-
-
Notifications
You must be signed in to change notification settings - Fork 618
feat: Render Mantine BlockNoteView
without MantineProvider
#2029
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
@nperez0111 any suggestions for how to name the component? I think |
@matthewlipski, I prefer naming things as what they are, instead of naming them as what they are not 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just thought of something @matthewlipski, I think that may be able to use the provider if it exists by calling:
import { MantineContext } from "@mantine/core";
const hasContextSet = useContext(MantineContext)
if (hasContextSet) {
return // simple render
} else {
return // wrap with a provider
}
Because Mantine has a default value of null
(https://github.com/mantinedev/mantine/blob/81e38bc8e3894c433f065557df60db5691aaf131/packages/%40mantine/core/src/core/MantineProvider/Mantine.context.ts#L25) we can easily tell whether the project already has a Mantine context set or not, and branch based on that. So maybe it can "just work" for the dev without having to use a separate component.
Maybe this is worth exploring?
…y within a `MantineContext`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EASY!
* Updated mantine * Updated submenu code * Small fixes * Small fixes * Small fix * Updated Mantine 8.3.2 * feat: Render Mantine `BlockNoteView` without `MantineProvider` (#2029) * Added `withMantineProvider` prop * Ran `pnpm gen` * Made separate component instead of boolean flag * Updated naming * Made `BlockNoteView` render `MantineProvider` only if it's not already within a `MantineContext`
This PR changes the Mantine
BlockNoteView
to check if it's being rendered within an existingMantineContext
. If it isn't, it wraps the editor in aMantineProvider
. Otherwise, it just renders the editor.I've changed how the Mantine active styles are reset too (using CSS instead of Mantine theme) so that in case a
MantineContext
is found, the theme set on it doesn't affect BlockNote's styles.Closes #1555