1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Plugins: Make sure "replaceSelection" command can be undone in Rich Text editor

This commit is contained in:
Laurent Cozic 2020-11-15 15:59:47 +00:00
parent ce59d29bb3
commit b480aae59b

View File

@ -275,6 +275,12 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
editor.selection.setContent(value);
editor.fire('joplinChange');
dispatchDidUpdate(editor);
// It doesn't make sense but it seems calling setContent
// doesn't create an undo step so we need to call it
// manually.
// https://github.com/tinymce/tinymce/issues/3745
window.requestAnimationFrame(() => editor.undoManager.add());
},
};