Skip to content

Conversation

matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Jul 10, 2023

There are a number of issues with the current rendering implementation in React:

  • Each menu/toolbar is rendered under a separate root.
  • The editor is not immediately initialized upon calling useBlocknote, causing issues.
  • Each menu is attached to document.body instead of being a sibling to the editor.
  • The way in which factories are designed makes sense for a vanilla implementation, but using them for React is unintuitive.
  • Plugins have too much responsibility - they should only provide information for UI elements to render, but instead they also render the UI elements themselves.
  • Supplying custom menu/formatting components is done using the uiFactories option, which is kind of clunky.

This PR is a major rethink of how we create, render, and pass elements to the editor in React (also changes the vanilla implementation a bit).

@vercel
Copy link

vercel bot commented Jul 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote-website ✅ Ready (Inspect) Visit Preview Aug 1, 2023 7:47pm
@matthewlipski matthewlipski changed the title React re-architecture feat: React re-architecture Jul 10, 2023
Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added number of comments. Will also create a separate PR with some fixes / changes.

About the overall architecture, I have following questions:

  • does it make sense that "static" things like "freezeMenu" are part of "state"? (sorry for opening up this discussion again, seems we're going a bit back and forth)
  • Plugin views are recreated indeed when other plugins are changed / added. This is by design in prosemirror, probably so that plugins can react to changes to the view that other plugins make. Although it works (see my separate PR that fixes the issues you ran into with this), I think it will be nicer (and faster) to register all plugins on editor instantation

After the comments have been addressed, lets discussed this including your bullets above that haven't been addressed yet

* fix initialcontent and uniqueid * fix * Removed ready check in `BlockNoteView` --------- Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants