Skip to content
Discussion options

You must be logged in to vote

I would suggest using the same pattern we usually use for toolbars. Toolbars are very similar to a ToC, since they, too, depend on the state of the editor to show which formatting options are enabled for the current selection.

The recommended solution for toolbars is to wrap both the Plate editor and the toolbar in a PlateProvider. From anywhere inside the PlateProvider, you can call usePlateEditorState to get an editor value that will update on every change.

The performance issue isn't really an issue unless your ToC component takes a particularly long time to render. If that's the case, you could throttle the computation so it runs at most once every 100ms and cache the output (the list…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@12joan
Comment options

@zbeyens
Comment options

Comment options

You must be logged in to vote
2 replies
@12joan
Comment options

@nabanita-sarkar
Comment options

Answer selected by nabanita-sarkar
Comment options

You must be logged in to vote
1 reply
@12joan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants