Skip to content

Commit

Permalink
Store DOM mutation status in DOMChange objects
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed May 31, 2024
1 parent 411d10b commit 2cef54d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/domchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export class DOMChange {
} | null = null
text: string = ""
newSel: EditorSelection | null
domChanged: boolean

constructor(view: EditorView, start: number, end: number, readonly typeOver: boolean) {
this.domChanged = start > -1
let {impreciseHead: iHead, impreciseAnchor: iAnchor} = view.docView
if (view.state.readOnly && start > -1) {
// Ignore changes when the editor is read-only
Expand Down
2 changes: 1 addition & 1 deletion src/domobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export class DOMObserver {
let handled = applyDOMChange(this.view, domChange)
// The view wasn't updated but DOM/selection changes were seen. Reset the view.
if (this.view.state == startState &&
(domChange.bounds || domChange.newSel && !domChange.newSel.main.eq(this.view.state.selection.main)))
(domChange.domChanged || domChange.newSel && !domChange.newSel.main.eq(this.view.state.selection.main)))
this.view.update([])
return handled
}
Expand Down

0 comments on commit 2cef54d

Please sign in to comment.