mirror of
https://github.com/heyman/heynote.git
synced 2024-12-23 15:18:48 +01:00
Don't emit event if we did not get an active block (can happen with extremely large blocks, most likely because of slow syntax tree parsing)
This commit is contained in:
parent
aa628a4f08
commit
6c1e89c5b0
@ -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,
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user