You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Desktop: WYSIWYG: Fix undo issue
This commit is contained in:
@ -779,6 +779,19 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
|
|||||||
|
|
||||||
await loadDocumentAssets(editor, await props.allAssets(props.contentMarkupLanguage));
|
await loadDocumentAssets(editor, await props.allAssets(props.contentMarkupLanguage));
|
||||||
|
|
||||||
|
dispatchDidUpdate(editor);
|
||||||
|
};
|
||||||
|
|
||||||
|
loadContent();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [editor, props.markupToHtml, props.allAssets, props.content, props.resourceInfos]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!editor) return;
|
||||||
|
|
||||||
// Need to clear UndoManager to avoid this problem:
|
// Need to clear UndoManager to avoid this problem:
|
||||||
// - Load note 1
|
// - Load note 1
|
||||||
// - Make a change
|
// - Make a change
|
||||||
@ -789,16 +802,7 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
|
|||||||
// clear() and reset() but it seems reset() works best, in
|
// clear() and reset() but it seems reset() works best, in
|
||||||
// particular for the onPaste bug.
|
// particular for the onPaste bug.
|
||||||
editor.undoManager.reset();
|
editor.undoManager.reset();
|
||||||
|
}, [editor, props.contentKey]);
|
||||||
dispatchDidUpdate(editor);
|
|
||||||
};
|
|
||||||
|
|
||||||
loadContent();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
cancelled = true;
|
|
||||||
};
|
|
||||||
}, [editor, props.markupToHtml, props.allAssets, props.content, props.resourceInfos]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor) return () => {};
|
if (!editor) return () => {};
|
||||||
|
Reference in New Issue
Block a user