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 = <
7474 [ defaultColorScheme , theme ]
7575 ) ;
7676
77+ const finalTheme =
78+ typeof theme === "string"
79+ ? theme
80+ : defaultColorScheme !== "no-preference"
81+ ? defaultColorScheme
82+ : "light" ;
83+
7784 return (
7885 < 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 */ }
8186 < MantineProvider
8287 theme = { mantineTheme }
88+ // Scopes Mantine CSS variables to only the editor, as proposed here:
89+ // https://github.com/orgs/mantinedev/discussions/5685
8390 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`.
8795 getRootElement = { ( ) => undefined } >
8896 < BlockNoteViewRaw
97+ data-mantine-color-scheme = { finalTheme }
8998 className = { mergeCSSClasses ( "bn-mantine" , className || "" ) }
9099 theme = { typeof theme === "object" ? undefined : theme }
91100 { ...rest }
You can’t perform that action at this time.
0 commit comments