Skip to content

Commit

Permalink
Always call setDOM for composition nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Sep 7, 2023
1 parent 7b68a9b commit 5b22236
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/contentview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export abstract class ContentView {
}

setDOM(dom: Node) {
if (this.dom == dom) return
if (this.dom) (this.dom as any).cmView = null
this.dom = dom
;(dom as any).cmView = this
Expand Down
6 changes: 2 additions & 4 deletions src/docview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,8 @@ export class DocView extends ContentView {
cView.flags |= ViewFlag.Composition | (cView.children.some(c => c.flags & ViewFlag.Dirty) ? ViewFlag.ChildDirty : 0)
this.markedForComposition.add(cView)
let prev = ContentView.get(dom)
if (prev != cView) {
if (prev) prev.dom = null
cView.setDOM(dom)
}
if (prev && prev != cView) prev.dom = null
cView.setDOM(dom)
}
let pos = this.childPos(composition.range.fromB, 1)
let cView: ContentView = this.children[pos.i]
Expand Down

0 comments on commit 5b22236

Please sign in to comment.