Skip to content

Commit 1b2e86b

Browse files
Open feat: Update Mantine setup (#2033)
1 parent 7012308 commit 1b2e86b

File tree

10 files changed

+1366
-805
lines changed

10 files changed

+1366
-805
lines changed

docs/content/docs/getting-started/mantine.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,27 @@ imageTitle: Mantine rich text editor using BlockNote
99
[Mantine](https://mantine.dev/) is an open-source collection of React components.
1010

1111
```console tab="npm"
12+
npm install @mantine/core @mantine/hooks @mantine/util
1213
npm install @blocknote/core @blocknote/react @blocknote/mantine
1314
```
1415

1516
```console tab="pnpm"
17+
pnpm add @mantine/core @mantine/hooks @mantine/util
1618
pnpm add @blocknote/core @blocknote/react @blocknote/mantine
1719
```
1820

1921
```console tab="bun"
22+
bun add @mantine/core @mantine/hooks @mantine/util
2023
bun add @blocknote/core @blocknote/react @blocknote/mantine
2124
```
2225

2326
To use BlockNote with Mantine, you can import `BlockNoteView` from `@blocknote/mantine` and the stylesheet from `@blocknote/mantine/style.css`.
2427

28+
<Callout type={"info"}>
29+
If your application already uses Mantine UI, you should use the
30+
`@blocknote/mantine/blocknoteStyles.css` stylesheet instead. It only contains
31+
the styles added by BlockNote on top of the Mantine core styles, whereas
32+
`@blocknote/mantine/style.css` includes both.
33+
</Callout>
34+
2535
<Example name="basic/minimal" />

docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
"@liveblocks/react-tiptap": "3.7.1-tiptap3",
4242
"@liveblocks/react-ui": "3.7.1-tiptap3",
4343
"@mantine/core": "^8.3.2",
44+
"@mantine/hooks": "^8.3.2",
45+
"@mantine/utils": "^6.0.22",
4446
"@mui/icons-material": "^5.16.1",
4547
"@mui/material": "^5.16.1",
4648
"@polar-sh/better-auth": "^1.0.2",

packages/mantine/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@
4343
"require": "./dist/blocknote-mantine.cjs"
4444
},
4545
"./style.css": {
46-
"import": "./dist/style.css",
47-
"require": "./dist/style.css",
48-
"style": "./dist/style.css"
46+
"import": "./src/style.css",
47+
"require": "./src/style.css",
48+
"style": "./src/style.css"
49+
},
50+
"./blocknoteStyles.css": {
51+
"import": "./src/blocknoteStyles.css",
52+
"require": "./src/blocknoteStyles.css",
53+
"style": "./src/blocknoteStyles.css"
4954
}
5055
},
5156
"scripts": {
@@ -58,9 +63,6 @@
5863
"dependencies": {
5964
"@blocknote/core": "0.39.1",
6065
"@blocknote/react": "0.39.1",
61-
"@mantine/core": "^8.3.2",
62-
"@mantine/hooks": "^8.3.2",
63-
"@mantine/utils": "^6.0.22",
6466
"react-icons": "^5.2.1"
6567
},
6668
"devDependencies": {
@@ -78,6 +80,9 @@
7880
"vite-plugin-externalize-deps": "^0.8.0"
7981
},
8082
"peerDependencies": {
83+
"@mantine/core": "^8.3.2",
84+
"@mantine/hooks": "^8.3.2",
85+
"@mantine/utils": "^6.0.22",
8186
"react": "^18.0 || ^19.0 || >= 19.0.0-rc",
8287
"react-dom": "^18.0 || ^19.0 || >= 19.0.0-rc"
8388
},

packages/mantine/src/BlockNoteView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
Theme,
1919
} from "./BlockNoteTheme.js";
2020
import { components } from "./components.js";
21-
import "./style.css";
2221

2322
export const BlockNoteView = <
2423
BSchema extends BlockSchema,
@@ -98,9 +97,10 @@ export const BlockNoteView = <
9897

9998
return (
10099
<MantineProvider
101-
// Scopes Mantine CSS variables to only the editor, as proposed here:
102-
// https://github.com/orgs/mantinedev/discussions/5685
103-
cssVariablesSelector=".bn-mantine"
100+
// By default, Mantine adds its CSS variables to the root. This disables
101+
// that, as we instead set the variables on `.bn-mantine` in
102+
// `mantineStyles.css`.
103+
withCssVariables={false}
104104
// This gets the element to set `data-mantine-color-scheme` on. This
105105
// element needs to already be rendered, so we can't set it to the
106106
// editor container element. Instead, we set it to `undefined` and set it

0 commit comments

Comments
 (0)