diff --git a/src/editor/block/block.js b/src/editor/block/block.js index 7a67c2c..7998e79 100644 --- a/src/editor/block/block.js +++ b/src/editor/block/block.js @@ -285,11 +285,13 @@ const emitCursorChange = (editor) => ViewPlugin.fromClass( if (update.selectionSet || langChange) { const cursorLine = getBlockLineFromPos(update.state, update.state.selection.main.head) const block = getActiveNoteBlock(update.state) - editor.element.dispatchEvent(new SelectionChangeEvent({ - cursorLine, - language: block?.language.name, - languageAuto: block?.language.auto, - })) + if (block) { + editor.element.dispatchEvent(new SelectionChangeEvent({ + cursorLine, + language: block.language.name, + languageAuto: block.language.auto, + })) + } } } }