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

Add support for native ProseMirror widget decorations #115

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

smoores-dev
Copy link
Collaborator

Adds a new component type, NativeWidgetView, that renders toDOM-style ProseMirror widget decorations within a wrapper span. Added the gapcursor and tables plugins to the demo for testing (both rely on widgets). This ended up being pleasantly simple, I think!

In testing with the tables plugin, I found and resolved two more issues:

  • Fixed a tiny bug where we weren't passing the correct this context to NodeView.update/destroy, which breaks custom node views that are implemented as classes/rely on this context
  • Went back to using flushSync rather than batch in dispatchTransaction. I don't remember why we initially switched to batch here, but we need to flush state updates all of the way through to the render function of the useEditor hook on each view.dispatch, so that view.state gets updated in time for the next call to view.dispatch.

@smoores-dev smoores-dev requested a review from a team as a code owner March 4, 2024 21:24
@smoores-dev smoores-dev merged commit c6d606e into react-editor-view Mar 7, 2024
1 of 2 checks passed
@smoores-dev smoores-dev deleted the native-widgets branch March 7, 2024 20:13
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