@blocknote/mantine 0.47.3 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote-mantine.cjs +2 -2
- package/dist/blocknote-mantine.cjs.map +1 -1
- package/dist/blocknote-mantine.js +901 -1220
- package/dist/blocknote-mantine.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +6 -6
- package/src/BlockNoteView.tsx +21 -13
- package/src/popover/Popover.tsx +3 -3
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1776092396118,"assets":[{"name":"blocknote-mantine.cjs","size":18327},{"name":"blocknote-mantine.cjs.map","size":71920}],"chunks":[{"id":"ec22802","entry":true,"initial":true,"files":["blocknote-mantine.cjs"],"names":["blocknote-mantine"]}],"modules":[{"name":"./rolldown/runtime.js","size":1008,"chunks":["ec22802"]},{"name":"./src/BlockNoteTheme.ts","size":1876,"chunks":["ec22802"]},{"name":"./src/toolbar/ToolbarButton.tsx","size":2388,"chunks":["ec22802"]},{"name":"./src/badge/Badge.tsx","size":1389,"chunks":["ec22802"]},{"name":"./src/comments/Card.tsx","size":1250,"chunks":["ec22802"]},{"name":"./src/comments/Comment.tsx","size":2184,"chunks":["ec22802"]},{"name":"./src/comments/Editor.tsx","size":1086,"chunks":["ec22802"]},{"name":"./src/form/TextInput.tsx","size":834,"chunks":["ec22802"]},{"name":"./src/menu/Menu.tsx","size":3204,"chunks":["ec22802"]},{"name":"./src/menu/Button.tsx","size":680,"chunks":["ec22802"]},{"name":"./src/panel/Panel.tsx","size":1072,"chunks":["ec22802"]},{"name":"./src/panel/PanelButton.tsx","size":387,"chunks":["ec22802"]},{"name":"./src/panel/PanelFileInput.tsx","size":408,"chunks":["ec22802"]},{"name":"./src/panel/PanelTab.tsx","size":291,"chunks":["ec22802"]},{"name":"./src/panel/PanelTextInput.tsx","size":433,"chunks":["ec22802"]},{"name":"./src/popover/Popover.tsx","size":972,"chunks":["ec22802"]},{"name":"./src/sideMenu/SideMenu.tsx","size":355,"chunks":["ec22802"]},{"name":"./src/sideMenu/SideMenuButton.tsx","size":700,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenu.tsx","size":365,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuEmptyItem.tsx","size":478,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuItem.tsx","size":1836,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuLabel.tsx","size":336,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuLoader.tsx","size":345,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx","size":435,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuEmptyItem.tsx","size":561,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuItem.tsx","size":818,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuLoader.tsx","size":426,"chunks":["ec22802"]},{"name":"./src/tableHandle/ExtendButton.tsx","size":386,"chunks":["ec22802"]},{"name":"./src/tableHandle/TableHandle.tsx","size":458,"chunks":["ec22802"]},{"name":"./src/toolbar/Toolbar.tsx","size":605,"chunks":["ec22802"]},{"name":"./src/toolbar/ToolbarSelect.tsx","size":1628,"chunks":["ec22802"]},{"name":"./src/components.tsx","size":1446,"chunks":["ec22802"]},{"name":"./src/BlockNoteView.tsx","size":1940,"chunks":["ec22802"]},{"name":"./src/defaultThemes.ts","size":1952,"chunks":["ec22802"]},{"name":"./src/index.tsx","size":0,"chunks":["ec22802"]}]}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/mantine"
|
|
12
12
|
},
|
|
13
13
|
"license": "MPL-2.0",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.48.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"types",
|
|
@@ -54,23 +54,23 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@blocknote/core": "0.
|
|
58
|
-
"@blocknote/react": "0.
|
|
57
|
+
"@blocknote/core": "0.48.0",
|
|
58
|
+
"@blocknote/react": "0.48.0",
|
|
59
59
|
"react-icons": "^5.5.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.2.3",
|
|
63
63
|
"@types/react-dom": "^19.2.3",
|
|
64
|
-
"@vitejs/plugin-react": "^
|
|
64
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
65
65
|
"eslint": "^8.57.1",
|
|
66
66
|
"react": "^19.2.3",
|
|
67
67
|
"react-dom": "^19.2.3",
|
|
68
68
|
"rimraf": "^5.0.10",
|
|
69
69
|
"rollup-plugin-webpack-stats": "^0.2.6",
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
|
-
"vite": "^
|
|
71
|
+
"vite": "^8.0.3",
|
|
72
72
|
"vite-plugin-eslint": "^1.8.1",
|
|
73
|
-
"vite-plugin-externalize-deps": "^0.
|
|
73
|
+
"vite-plugin-externalize-deps": "^0.10.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@mantine/core": "^8.3.11",
|
package/src/BlockNoteView.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
usePrefersColorScheme,
|
|
12
12
|
} from "@blocknote/react";
|
|
13
13
|
import { MantineContext, MantineProvider } from "@mantine/core";
|
|
14
|
-
import React, { useCallback, useContext } from "react";
|
|
14
|
+
import React, { useCallback, useContext, useEffect } from "react";
|
|
15
15
|
import {
|
|
16
16
|
applyBlockNoteCSSVariablesFromTheme,
|
|
17
17
|
removeBlockNoteCSSVariables,
|
|
@@ -38,17 +38,23 @@ export const BlockNoteView = <
|
|
|
38
38
|
};
|
|
39
39
|
},
|
|
40
40
|
) => {
|
|
41
|
-
const { className, theme, ...rest } = props;
|
|
41
|
+
const { className, theme, editor, ...rest } = props;
|
|
42
42
|
|
|
43
43
|
const existingContext = useBlockNoteContext();
|
|
44
44
|
const systemColorScheme = usePrefersColorScheme();
|
|
45
45
|
const defaultColorScheme =
|
|
46
46
|
existingContext?.colorSchemePreference || systemColorScheme;
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const finalTheme =
|
|
49
|
+
typeof theme === "string"
|
|
50
|
+
? theme
|
|
51
|
+
: defaultColorScheme !== "no-preference"
|
|
52
|
+
? defaultColorScheme
|
|
53
|
+
: "light";
|
|
54
|
+
|
|
55
|
+
const applyThemeVariables = useCallback(
|
|
56
|
+
(node: HTMLElement | null) => {
|
|
50
57
|
if (!node) {
|
|
51
|
-
// todo: clean variables?
|
|
52
58
|
return;
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -70,14 +76,15 @@ export const BlockNoteView = <
|
|
|
70
76
|
[defaultColorScheme, theme],
|
|
71
77
|
);
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!editor.portalElement) {
|
|
81
|
+
throw new Error("Portal element not found");
|
|
82
|
+
}
|
|
83
|
+
editor.portalElement.setAttribute("data-mantine-color-scheme", finalTheme);
|
|
84
|
+
applyThemeVariables(editor.portalElement);
|
|
85
|
+
}, [editor, applyThemeVariables, finalTheme]);
|
|
74
86
|
|
|
75
|
-
const
|
|
76
|
-
typeof theme === "string"
|
|
77
|
-
? theme
|
|
78
|
-
: defaultColorScheme !== "no-preference"
|
|
79
|
-
? defaultColorScheme
|
|
80
|
-
: "light";
|
|
87
|
+
const mantineContext = useContext(MantineContext);
|
|
81
88
|
|
|
82
89
|
const view = (
|
|
83
90
|
<ComponentsContext.Provider value={components}>
|
|
@@ -85,8 +92,9 @@ export const BlockNoteView = <
|
|
|
85
92
|
data-mantine-color-scheme={finalTheme}
|
|
86
93
|
className={mergeCSSClasses("bn-mantine", className || "")}
|
|
87
94
|
theme={typeof theme === "object" ? undefined : theme}
|
|
95
|
+
editor={editor}
|
|
88
96
|
{...rest}
|
|
89
|
-
ref={
|
|
97
|
+
ref={applyThemeVariables}
|
|
90
98
|
/>
|
|
91
99
|
</ComponentsContext.Provider>
|
|
92
100
|
);
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -11,18 +11,18 @@ import { forwardRef } from "react";
|
|
|
11
11
|
export const Popover = (
|
|
12
12
|
props: ComponentProps["Generic"]["Popover"]["Root"],
|
|
13
13
|
) => {
|
|
14
|
-
const { open, onOpenChange, position, children, ...rest } = props;
|
|
14
|
+
const { open, onOpenChange, position, portalRoot, children, ...rest } = props;
|
|
15
15
|
|
|
16
16
|
assertEmpty(rest);
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<MantinePopover
|
|
20
20
|
middlewares={{ size: { padding: 20 } }}
|
|
21
|
-
withinPortal={
|
|
21
|
+
withinPortal={!!portalRoot}
|
|
22
|
+
portalProps={portalRoot ? { target: portalRoot } : undefined}
|
|
22
23
|
opened={open}
|
|
23
24
|
onChange={onOpenChange}
|
|
24
25
|
position={position}
|
|
25
|
-
zIndex={10000}
|
|
26
26
|
>
|
|
27
27
|
{children}
|
|
28
28
|
</MantinePopover>
|