mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-14 18:27:44 +02:00
Desktop: WYSIWYG: Fix undo issue
This commit is contained in:
parent
44024371ff
commit
254735fcae
@ -779,17 +779,6 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
|
||||
|
||||
await loadDocumentAssets(editor, await props.allAssets(props.contentMarkupLanguage));
|
||||
|
||||
// Need to clear UndoManager to avoid this problem:
|
||||
// - Load note 1
|
||||
// - Make a change
|
||||
// - Load note 2
|
||||
// - Undo => content is that of note 1
|
||||
|
||||
// The doc is not very clear what's the different between
|
||||
// clear() and reset() but it seems reset() works best, in
|
||||
// particular for the onPaste bug.
|
||||
editor.undoManager.reset();
|
||||
|
||||
dispatchDidUpdate(editor);
|
||||
};
|
||||
|
||||
@ -800,6 +789,21 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
|
||||
};
|
||||
}, [editor, props.markupToHtml, props.allAssets, props.content, props.resourceInfos]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editor) return;
|
||||
|
||||
// Need to clear UndoManager to avoid this problem:
|
||||
// - Load note 1
|
||||
// - Make a change
|
||||
// - Load note 2
|
||||
// - Undo => content is that of note 1
|
||||
|
||||
// The doc is not very clear what's the different between
|
||||
// clear() and reset() but it seems reset() works best, in
|
||||
// particular for the onPaste bug.
|
||||
editor.undoManager.reset();
|
||||
}, [editor, props.contentKey]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editor) return () => {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user