1
0
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:
Laurent Cozic
2020-05-23 00:14:26 +01:00
parent 65a0e056c7
commit 0cfceab151

View File

@@ -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;