Skip to content

Commit 675bb98

Browse files
staredclaude
andcommitted
Fix cursor position reset in editor after typing
The parsedContent watcher was calling highlight() which replaces innerHTML, resetting cursor position. Changed to only call markErrors() directly since we only need to update error markings when content changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e208ca4 commit 675bb98

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/MarkdownEditor.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,11 @@ watch(colorArray, () => {
283283
}
284284
}, { deep: true })
285285
286-
// Re-highlight when parsed content changes (for error marking)
286+
// Update error markings when parsed content changes (without re-highlighting to preserve cursor)
287287
watch(parsedContent, () => {
288-
if (codeRef.value) {
289-
highlight(codeRef.value)
288+
if (codeRef.value && parsedContent.value) {
289+
const code = codeRef.value.textContent || ''
290+
markErrors(codeRef.value, code, parsedContent.value.errors)
290291
}
291292
})
292293

0 commit comments

Comments
 (0)