You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-13 22:12:50 +02:00
Desktop: Fix undo issue when loading new note
This commit is contained in:
@@ -385,7 +385,7 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
|
||||
click: async () => {
|
||||
editorCutText();
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
@@ -395,7 +395,7 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
|
||||
click: async () => {
|
||||
editorCopyText();
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
@@ -410,7 +410,7 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
|
||||
onEditorPaste();
|
||||
}
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
menu.popup(bridge().window());
|
||||
@@ -517,6 +517,17 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
|
||||
};
|
||||
}, [props.content, props.contentMarkupLanguage, props.visiblePanes, props.resourceInfos, props.markupToHtml]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editor) return;
|
||||
|
||||
if (contentKeyHasChangedRef.current) {
|
||||
// editor.getSession().setMode(new CustomMdMode());
|
||||
const undoManager = editor.getSession().getUndoManager();
|
||||
undoManager.reset();
|
||||
editor.getSession().setUndoManager(undoManager);
|
||||
}
|
||||
}, [props.content, editor]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!webviewReady) return;
|
||||
|
||||
|
Reference in New Issue
Block a user