You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-13 22:12:50 +02:00
Electron: Fixes #479: Currently loaded note was cleared when creating new note
This commit is contained in:
@@ -216,7 +216,16 @@ class NoteTextComponent extends React.Component {
|
||||
// would clear it.
|
||||
// 2. It resets the undo manager - fixes https://github.com/laurent22/joplin/issues/355
|
||||
// Note: calling undoManager.reset() doesn't work
|
||||
this.editor_.editor.session.setValue(note ? note.body : '');
|
||||
try {
|
||||
this.editor_.editor.getSession().setValue(note ? note.body : '');
|
||||
} catch (error) {
|
||||
if (error.message === "Cannot read property 'match' of undefined") {
|
||||
// The internals of Ace Editor throws an exception when creating a new note,
|
||||
// but that can be ignored.
|
||||
} else {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
this.editor_.editor.clearSelection();
|
||||
this.editor_.editor.moveCursorTo(0,0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user