Fix CodeMirror retaining history of unrelated notes (#1640)

This commit is contained in:
Henrik Giesel 2022-02-04 09:40:50 +01:00 committed by GitHub
parent 30bbbaf00b
commit c5280cd056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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