aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-09 15:06:11 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-09 15:06:11 +0800
commit2d5f7ad47019b54fa1c2ef08cafb9b25f82a4ecc (patch)
tree9d94e9813ab4d95e68bebb49aaecb4cc87892ebb
parent9e62f0371f66cc4f2aa275f958f16a9443b108b7 (diff)
fix: proper timing to adjust scroll of HTML contents
-rw-r--r--src/editor.mjs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/editor.mjs b/src/editor.mjs
index 55c6267..e39d97c 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -487,6 +487,8 @@ cm.on('focus', () => {
487}) 487})
488 488
489cm.on('beforeChange', (_, change) => { 489cm.on('beforeChange', (_, change) => {
490 textArea.dataset.scrollLine = cm.getCursor().line
491
490 // Don't allow more content after YAML doc separator 492 // Don't allow more content after YAML doc separator
491 if (change.origin && change.origin.match(/^(\+input|paste)$/)) { 493 if (change.origin && change.origin.match(/^(\+input|paste)$/)) {
492 const line = change.to.line 494 const line = change.to.line
@@ -830,7 +832,6 @@ const addSuggestions = (anchor, suggestions) => {
830cm.on('cursorActivity', _ => { 832cm.on('cursorActivity', _ => {
831 menu.style.display = 'none' 833 menu.style.display = 'none'
832 const anchor = cm.getCursor() 834 const anchor = cm.getCursor()
833 textArea.dataset.scrollLine = anchor.line
834 835
835 if (insideCodeblockForMap(anchor)) { 836 if (insideCodeblockForMap(anchor)) {
836 handleTypingInCodeBlock(anchor) 837 handleTypingInCodeBlock(anchor)