From c5280cd056c0f45498278158954f8667ed1b7f8a Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 4 Feb 2022 09:40:50 +0100 Subject: [PATCH] Fix CodeMirror retaining history of unrelated notes (#1640) --- ts/editor/NoteEditor.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ts/editor/NoteEditor.svelte b/ts/editor/NoteEditor.svelte index 0b5abf23e..f84af9c29 100644 --- a/ts/editor/NoteEditor.svelte +++ b/ts/editor/NoteEditor.svelte @@ -147,6 +147,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let noteId: number | null = null; export function setNoteId(ntid: number): void { + // TODO this is a hack, because it requires the NoteEditor to know implementation details of the PlainTextInput. + // It should be refactored once we work on our own Undo stack + for (const pi of plainTextInputs) { + pi.api.getEditor().clearHistory(); + } noteId = ntid; }