Add GetEditorStateAsString in events

This commit is contained in:
Eric NGUYEN 2022-10-10 10:44:12 +02:00 committed by Eric Nguyen
parent 1f2809193f
commit 710cbd0312
2 changed files with 22 additions and 2 deletions

View file

@ -204,6 +204,17 @@
component.dispatchEvent(new CustomEvent(eventType));
}
/**
* Return in a callback the current history of the editor as string
* @param callback
*/
public GetEditorStateAsString(callback: (state: string) => void) {
const eventType = 'getEditorStateAsString';
this.app.AddEventListener(eventType, callback);
const component = this.GetEditorComponent();
component.dispatchEvent(new CustomEvent(eventType));
}
/**
* Set the current history of the editor
* @param history Whole history of the editor