Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 9a9a137

Browse files
committed
Add an updateRoot method
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
1 parent ac94468 commit 9a9a137

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ export class EditorView {
339339
return cached || document
340340
}
341341

342+
/// When an existing editor view is moved to a new document or
343+
/// shadow tree, call this to make it recompute its root.
344+
updateRoot() {
345+
this._root = null
346+
}
347+
342348
/// Given a pair of viewport coordinates, return the document
343349
/// position that corresponds to them. May return null if the given
344350
/// coordinates aren't inside of the editor. When an object is

0 commit comments

Comments
 (0)