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

Use ref to move contentDOM #1960

Merged
merged 1 commit into from
Sep 30, 2021
Merged

Conversation

philippkuehn
Copy link
Contributor

@philippkuehn philippkuehn commented Sep 29, 2021

Instead of calling maybeMoveContentDOM manually, we are using a ref.

fixes #1942, which was broken because of this patch (which was a fix for #1747). #1747 is still fixed with this PR.

@YousefED I had to remove forwardRef for NodeViewContent (which was a merged PR from you) for that so I would like to hear you thoughts about this change. I’m still not quite sure what you needed this ref for. Can you give me an example?

@YousefED
Copy link
Contributor

The ref was used in combination with https://github.com/ueberdosis/tiptap/pull/1470/files, which would refactor the React nodeviews to avoid usage of this.dom.querySelector('[data-node-view-content]').

If I understand this PR correctly, you've come to a similar approach (remove the hacky queryselector) as https://github.com/ueberdosis/tiptap/pull/1470/files, but use Context as a way to pass the ref, instead of forcing consumers to pass along the ref. Your approach has the advantage that it doesn't change the API, at the cost of a little less easy to grasp pattern using Context. I think that's a fair trade-off so if this has been tested well, I'd suggest to merge it!

@philippkuehn philippkuehn merged commit dead826 into main Sep 30, 2021
@philippkuehn philippkuehn deleted the feature/use-ref-to-move-contentdom branch September 30, 2021 19:14
@philippkuehn
Copy link
Contributor Author

@YousefED thanks! :)

andrewlu0 pushed a commit to trybaseplate/tiptap that referenced this pull request Oct 20, 2023
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.

Issue with ReactNodeViewRenderer and tippyjs-react caused by extension-collaboration
2 participants