@ -185,7 +185,7 @@ export async function showRefuseToOverwrite() {
}
export async function askForImportChapters() {
const { value } = await Swal . fire ( {
const { isConfirmed } = await Swal . fire ( {
icon : 'question' ,
text : i18n.t ( 'This file has embedded chapters. Do you want to import the chapters as cut-segments?' ) ,
showCancelButton : true ,
@ -193,7 +193,7 @@ export async function askForImportChapters() {
confirmButtonText : i18n.t ( 'Import chapters' ) ,
} ) ;
return value ;
return isConfirmed ;
}
const maxSegments = 300 ;
@ -233,10 +233,10 @@ export async function createNumSegments(fileDuration: number) {
return edl ;
}
const exampleDuration = '00:00:05.123' ;
export async function askForSegmentDuration ( { fileDuration , inputPlaceholder , parseTimecode } : {
fileDuration : number , inputPlaceholder : string , parseTimecode : ParseTimecode ,
fileDuration : number ,
inputPlaceholder : string ,
parseTimecode : ParseTimecode ,
} ) {
const { value } = await Swal . fire ( {
input : 'text' ,
@ -310,7 +310,10 @@ async function askForSegmentsStartOrEnd(text: string) {
return value === 'both' ? [ 'start' , 'end' ] as const : [ value as 'start' | 'end' ] as const ;
}
export async function askForShiftSegments ( { inputPlaceholder , parseTimecode } : { inputPlaceholder : string , parseTimecode : ParseTimecode } ) {
export async function askForShiftSegments ( { inputPlaceholder , parseTimecode } : {
inputPlaceholder : string ,
parseTimecode : ParseTimecode ,
} ) {
function parseValue ( value : string ) {
let parseableValue = value ;
let sign = 1 ;
@ -332,7 +335,7 @@ export async function askForShiftSegments({ inputPlaceholder, parseTimecode }: {
text : i18n.t ( 'Shift all segments on the timeline by this amount. Negative values will be shifted back, while positive value will be shifted forward in time.' ) ,
inputValidator : ( v ) = > {
const parsed = parseValue ( v ) ;
if ( parsed == null ) return i18n . t ( 'Please input a valid duration. Example: {{example}}' , { example : exampleDuration } ) ;
if ( parsed == null ) return i18n . t ( 'Please input a valid duration. Example: {{example}}' , { example : inputPlaceholder } ) ;
return null ;
} ,
} ) ;