diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/editor.mjs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index d13be58..e2d3d6d 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
@@ -497,9 +497,12 @@ updateDumbyMap(() => { | |||
497 | 497 | ||
498 | // Re-render HTML by editor content | 498 | // Re-render HTML by editor content |
499 | cm.on('change', (_, change) => { | 499 | cm.on('change', (_, change) => { |
500 | updateDumbyMap(() => { | 500 | if (change.origin?.match(/\+input|\+delete|paste/)) { |
501 | updateCMScrollLine(cm) | 501 | textArea.dataset.scrollLine = cm.getCursor().line |
502 | }) | 502 | updateDumbyMap(() => { |
503 | updateCMScrollLine(cm) | ||
504 | }) | ||
505 | } | ||
503 | addClassToCodeLines() | 506 | addClassToCodeLines() |
504 | completeForCodeBlock(change) | 507 | completeForCodeBlock(change) |
505 | }) | 508 | }) |
@@ -511,8 +514,6 @@ cm.on('focus', () => { | |||
511 | }) | 514 | }) |
512 | 515 | ||
513 | cm.on('beforeChange', (_, change) => { | 516 | cm.on('beforeChange', (_, change) => { |
514 | textArea.dataset.scrollLine = cm.getCursor().line | ||
515 | |||
516 | // Don't allow more content after YAML doc separator | 517 | // Don't allow more content after YAML doc separator |
517 | if (change.origin && change.origin.match(/^(\+input|paste)$/)) { | 518 | if (change.origin && change.origin.match(/^(\+input|paste)$/)) { |
518 | const line = change.to.line | 519 | const line = change.to.line |