File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -74,18 +74,27 @@ export const BlockNoteView = <
74
74
[ defaultColorScheme , theme ]
75
75
) ;
76
76
77
+ const finalTheme =
78
+ typeof theme === "string"
79
+ ? theme
80
+ : defaultColorScheme !== "no-preference"
81
+ ? defaultColorScheme
82
+ : "light" ;
83
+
77
84
return (
78
85
< ComponentsContext . Provider value = { components } >
79
- { /* `cssVariablesSelector` scopes Mantine CSS variables to only the editor, */ }
80
- { /* as proposed here: https://github.com/orgs/mantinedev/discussions/5685 */ }
81
86
< MantineProvider
82
87
theme = { mantineTheme }
88
+ // Scopes Mantine CSS variables to only the editor, as proposed here:
89
+ // https://github.com/orgs/mantinedev/discussions/5685
83
90
cssVariablesSelector = ".bn-mantine"
84
- // This gets the element to set `data-mantine-color-scheme` on. Since we
85
- // don't need this attribute (we use our own theming API), we return
86
- // undefined here.
91
+ // This gets the element to set `data-mantine-color-scheme` on. This
92
+ // element needs to already be rendered, so we can't set it to the
93
+ // editor container element. Instead, we set it to `undefined` and set it
94
+ // manually in `BlockNoteViewRaw`.
87
95
getRootElement = { ( ) => undefined } >
88
96
< BlockNoteViewRaw
97
+ data-mantine-color-scheme = { finalTheme }
89
98
className = { mergeCSSClasses ( "bn-mantine" , className || "" ) }
90
99
theme = { typeof theme === "object" ? undefined : theme }
91
100
{ ...rest }
You can’t perform that action at this time.
0 commit comments