Skip to content

Commit

Permalink
Add an updateRoot method
Browse files Browse the repository at this point in the history
FEATURE: The new `EditorView.updateRoot` method can be used to make the editor
update its DOM root when it is moved to a new document or shadow tree.

Issue ProseMirror/prosemirror#476
  • Loading branch information
marijnh committed Sep 27, 2023
1 parent ac94468 commit 9a9a137
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ export class EditorView {
return cached || document
}

/// When an existing editor view is moved to a new document or
/// shadow tree, call this to make it recompute its root.
updateRoot() {
this._root = null
}

/// Given a pair of viewport coordinates, return the document
/// position that corresponds to them. May return null if the given
/// coordinates aren't inside of the editor. When an object is
Expand Down

0 comments on commit 9a9a137

Please sign in to comment.