fix lost content data after CKEditor crash, closes #3584

This commit is contained in:
zadam 2023-02-15 15:08:59 +01:00
parent cbabaa6b0c
commit c95c5bb471

View file

@ -154,6 +154,19 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
}
});
await this.watchdog.setCreator(async (elementOrData, editorConfig) => {
const editor = await BalloonEditor.create(elementOrData, editorConfig);
editor.model.document.on('change:data', () => this.spacedUpdate.scheduleUpdate());
if (glob.isDev && ENABLE_INSPECTOR) {
await import(/* webpackIgnore: true */'../../../libraries/ckeditor/inspector.js');
CKEditorInspector.attach(editor);
}
return editor;
});
await this.watchdog.create(this.$editor[0], {
placeholder: "Type the content of your note here ...",
mention: mentionSetup,
@ -168,13 +181,6 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
enablePreview: true // Enable preview view
}
});
this.watchdog.editor.model.document.on('change:data', () => this.spacedUpdate.scheduleUpdate());
if (glob.isDev && ENABLE_INSPECTOR) {
await import(/* webpackIgnore: true */'../../../libraries/ckeditor/inspector.js');
CKEditorInspector.attach(this.watchdog.editor);
}
}
async doRefresh(note) {