@@ -130,7 +130,7 @@ export class Preview {
130
130
iframe . setAttribute ( 'height' , '100%' ) ;
131
131
iframe . setAttribute ( 'scrolling' , 'no' ) ;
132
132
iframe . setAttribute ( 'allow' , 'autoplay' ) ;
133
- iframe . setAttribute ( 'src' , `https://creatomate.com/embed?version=1.5 .0&token=${ publicToken } ` ) ;
133
+ iframe . setAttribute ( 'src' , `https://creatomate.com/embed?version=1.6 .0&token=${ publicToken } ` ) ;
134
134
iframe . style . border = 'none' ;
135
135
iframe . style . display = 'none' ;
136
136
@@ -187,9 +187,12 @@ export class Preview {
187
187
* Make sure the template is located in the project from which you are using the public token.
188
188
*
189
189
* @param templateId The ID of the template.
190
+ * @param createUndoPoint Set to 'true' if you wish to add an undo point to be used later with 'undo()' and 'redo()'.
191
+ * @see undo()
192
+ * @see redo()
190
193
*/
191
- async loadTemplate ( templateId : string ) : Promise < void > {
192
- await this . _sendCommand ( { message : 'setTemplate' , templateId } ) . catch ( ( error ) => {
194
+ async loadTemplate ( templateId : string , createUndoPoint = false ) : Promise < void > {
195
+ await this . _sendCommand ( { message : 'setTemplate' , templateId, createUndoPoint } ) . catch ( ( error ) => {
193
196
throw new Error ( `Failed to load template: ${ error . message } ` ) ;
194
197
} ) ;
195
198
@@ -326,7 +329,7 @@ export class Preview {
326
329
}
327
330
328
331
/**
329
- * Reverts the last changes made by 'setSource()', 'applyModifications()', or the user when in interactive mode.
332
+ * Reverts the last changes made by 'loadTemplate', ' setSource()', 'applyModifications()', or the user when in interactive mode.
330
333
*
331
334
* @see setSource()
332
335
* @see applyModifications()
@@ -348,6 +351,19 @@ export class Preview {
348
351
} ) ;
349
352
}
350
353
354
+ /**
355
+ * Clears the undo history stack, preventing undoing or redoing previous changes.
356
+ *
357
+ * @param stack Specify 'undo' or 'redo' to only clear their respective states, or omit this parameter to clear both.
358
+ * @see undo()
359
+ * @see redo()
360
+ */
361
+ async clearHistory ( stack ?: 'undo' | 'redo' ) : Promise < void > {
362
+ return this . _sendCommand ( { message : 'clearHistory' , stack } ) . catch ( ( error ) => {
363
+ throw new Error ( `Failed to clear the history: ${ error . message } ` ) ;
364
+ } ) ;
365
+ }
366
+
351
367
/**
352
368
* Starts playing the video.
353
369
*
0 commit comments