# HG changeset patch # User Ludovic Chabant # Date 1646115189 28800 # Node ID 7da0dec2dc8d8f00109c872bf79db76a1302b242 # Parent 42396b88c64d6e46739b872bc17ad9ceab80b3d1 Simple bail out when legacy editors are enabled diff -r 42396b88c64d -r 7da0dec2dc8d src/main.ts --- a/src/main.ts Mon Feb 28 22:11:17 2022 -0800 +++ b/src/main.ts Mon Feb 28 22:13:09 2022 -0800 @@ -183,7 +183,12 @@ private readonly rememberFileState = async (file: TFile, view: View): Promise => { const scrollInfo = view.editor.getScrollInfo(); - const stateSelectionJSON = view.editor.cm.state.selection.toJSON(); + const stateSelection = view.editor.cm.state.selection; + if (stateSelection == undefined) { + // Legacy editor is in use, let's ignore + return; + } + const stateSelectionJSON = stateSelection.toJSON(); const stateData = {'scrollInfo': scrollInfo, 'selection': stateSelectionJSON}; var existingFile = this.data.rememberedFiles[file.path];