diff options
-rw-r--r-- | src/editor.mjs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index 5c65af4..0b3f23e 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
@@ -344,9 +344,9 @@ new window.MutationObserver(() => { | |||
344 | if (line) { | 344 | if (line) { |
345 | const [lineNumber, offset] = line.split('/') | 345 | const [lineNumber, offset] = line.split('/') |
346 | 346 | ||
347 | if (!isNaN(lineNumber)) { | 347 | if (!lineNumber || isNaN(lineNumber)) return |
348 | cm.scrollIntoView({ line: lineNumber, ch: 0 }, offset) | 348 | |
349 | } | 349 | cm.scrollIntoView({ line: lineNumber, ch: 0 }, offset) |
350 | } | 350 | } |
351 | }).observe(dumbyContainer, { | 351 | }).observe(dumbyContainer, { |
352 | attributes: true, | 352 | attributes: true, |
@@ -379,7 +379,7 @@ new window.MutationObserver(() => { | |||
379 | const line = textArea.dataset.scrollLine | 379 | const line = textArea.dataset.scrollLine |
380 | let lineNumber = Number(line) | 380 | let lineNumber = Number(line) |
381 | let p | 381 | let p |
382 | if (isNaN(lineNumber)) return | 382 | if (!line || isNaN(lineNumber)) return |
383 | 383 | ||
384 | const paragraphs = Array.from(dumbymap.htmlHolder.querySelectorAll('p')) | 384 | const paragraphs = Array.from(dumbymap.htmlHolder.querySelectorAll('p')) |
385 | do { | 385 | do { |