Skip to content

refactor: reuse toolbar types and extract mantine context #1440

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

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

YousefED
Copy link
Collaborator

@YousefED YousefED commented Feb 17, 2025

  • split components and BlockNoteView file for mantine / ariakit / shadcn to cleanup a bit
  • extracted generic toolbar types (see packages/react/src/editor/ComponentsContext.tsx). This makes it clear that for example the formattingtoolbar and linktoolbar expect the same types. In the implementations (e.g. mantine/src/components.tsx) we actually pass the same Toolbar (and ToolbarButton) as the different components.

These changes were extracted from the Comments PR, so that it's easy for Nick to continue on this work when working on tables

To discuss

does it still make sense to have a separate FormattingToolbar and LinkToolbar?

Pro:

  • makes it easy to pass different components for these different cases (probably pretty niche case)

Con:

  • more (internal) code (defining the components)

We could also always use the generic component. And optionally, also pass in a parameter with the "location / usage" (not sure about right naming). e.g., instead of:

<Components.FormattingToolbar.Root>

we do:

<Components.Toolbar.Root usage="formatting-toolbar"

Copy link

vercel bot commented Feb 17, 2025

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Feb 17, 2025 1:10pm
blocknote-website ✅ Ready (Inspect) Visit Preview Feb 17, 2025 1:10pm

Copy link
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

This looks good to me

@YousefED YousefED merged commit 2839ede into main Feb 17, 2025
5 checks passed
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.

2 participants