Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap the DocNodeView in a ChildDescriptorContext. #116

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

smoores-dev
Copy link
Collaborator

When rendering nested ProseMirror editors, e.g. when taking control over an atom node's content, the nested DocNodeView would register itself as the child of the atom node in the view descriptor tree. This could cause subtle issues when, e.g., ProseMirror attempts to determine whether the content is ltr or rtl, because it would treat the nested editor as the contentDOM of the atom, even if it was rendered in a portal into a non-contiguous part of the page. Presumably other issues could also arise from the fact that ProseMirror thought this node had a contentDOM when it actually does not.

This PR resolves this by simply providing a top-level ChildDescriptorContext, so that nested editors never accidentally cross the boundary up into their parents' view descriptor tree.

@smoores-dev smoores-dev requested a review from a team as a code owner March 7, 2024 19:40
@smoores-dev smoores-dev force-pushed the block-selection-bugs branch 2 times, most recently from 1eb5b09 to 3945df7 Compare March 7, 2024 19:42
Base automatically changed from native-widgets to react-editor-view March 7, 2024 20:13
When rendering nested ProseMirror editors, e.g.
when taking control over an atom node's content,
the nested DocNodeView would register itself as
the child of the atom node in the view descriptor
tree. This could cause subtle issues when, e.g.,
ProseMirror attempts to determine whether the
content is ltr or rtl, because it would treat the
nested editor as the contentDOM of the atom, even
if it was rendered in a portal into a non-
contiguous part of the page. Presumably other
issues could also arise from the fact that
ProseMirror thought this node had a contentDOM
when it actually does not.

This PR resolves this by simply providing a top-
level ChildDescriptorContext, so that nested
editors never accidentally cross the boundary up
into their parents' view descriptor tree.
@smoores-dev smoores-dev merged commit 964fc45 into react-editor-view Mar 7, 2024
1 of 2 checks passed
@smoores-dev smoores-dev deleted the block-selection-bugs branch March 7, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant