Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/domobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class DOMObserver {
currentSelection = new SelectionState
onCharData: ((e: Event) => void) | null = null
suppressingSelectionUpdates = false
lockDOMSelectionSync = false

constructor(
readonly view: EditorView,
Expand Down Expand Up @@ -132,7 +133,9 @@ export class DOMObserver {
if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode!, sel.anchorOffset))
return this.flushSoon()
}
this.lockDOMSelectionSync = !!this.view.input.mouseDown
this.flush()
this.lockDOMSelectionSync = false
}

setCurSelection() {
Expand Down
2 changes: 1 addition & 1 deletion src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function selectionToDOM(view: EditorView, force = false) {

if (view.cursorWrapper) {
selectCursorWrapper(view)
} else {
} else if (!view.domObserver.lockDOMSelectionSync) {
let {anchor, head} = sel, resetEditableFrom, resetEditableTo
if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {
if (!sel.$from.parent.inlineContent)
Expand Down