Skip to content

fix: Mantine CSS variables element #1463

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 26, 2025
Merged

fix: Mantine CSS variables element #1463

merged 3 commits into from
Feb 26, 2025

Conversation

matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Feb 25, 2025

Mantine theme CSS variables aren't being set properly at the moment, which means that an editor using the Mantine BlockNoteView may not have the CSS variables it needs when not within an existing MantineProvider. This is because getRootElement returns no element, but we need it to set data-mantine-color-scheme on the .bn-mantine element. Since it's a child of the MantineProvider and can't be found on render, we have to set data-mantine-color-scheme manually through BlockNoteViewRaw.

We pretty much never use Mantine theme variables as we use the BlockNote theme variables instead, but the Badge components from the comments PR does use them. Maybe we also want to change this to use strictly BlockNote theme variables? (ofc in the comments PR, not this one)

Copy link

vercel bot commented Feb 25, 2025

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Feb 25, 2025 7:19pm
blocknote-website ✅ Ready (Inspect) Visit Preview Feb 25, 2025 7:19pm

@matthewlipski
Copy link
Collaborator Author

Ok so I was also getting confused and not exactly understanding what's going on - @nperez0111 you're right in your comments, I added data-mantine-color-scheme manually to BlockNoteViewRaw and that worked just fine, so now the theme variables get added to .bn-mantine correctly and no extra div is needed👍

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 now!

@matthewlipski matthewlipski merged commit b4b8d9a into main Feb 26, 2025
6 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