File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 4
4
FormattingToolbar ,
5
5
FormattingToolbarController ,
6
6
getFormattingToolbarItems ,
7
+ useBlockNoteContext ,
7
8
} from "@blocknote/react" ;
8
9
import { forwardRef } from "react" ;
9
10
import { BlockNoteView } from "../BlockNoteView.js" ;
@@ -17,6 +18,8 @@ export const Editor = forwardRef<
17
18
18
19
assertEmpty ( rest , false ) ;
19
20
21
+ const blockNoteContext = useBlockNoteContext ( ) ;
22
+
20
23
return (
21
24
< BlockNoteView
22
25
autoFocus = { autoFocus }
@@ -28,6 +31,7 @@ export const Editor = forwardRef<
28
31
filePanel = { false }
29
32
formattingToolbar = { false }
30
33
editable = { editable }
34
+ theme = { blockNoteContext ?. colorSchemePreference }
31
35
ref = { ref }
32
36
onFocus = { onFocus }
33
37
onBlur = { onBlur }
Original file line number Diff line number Diff line change 4
4
FormattingToolbar ,
5
5
FormattingToolbarController ,
6
6
getFormattingToolbarItems ,
7
+ useBlockNoteContext ,
7
8
} from "@blocknote/react" ;
8
9
import { forwardRef } from "react" ;
9
10
import { BlockNoteView } from "../BlockNoteView.js" ;
@@ -17,6 +18,8 @@ export const Editor = forwardRef<
17
18
18
19
assertEmpty ( rest , false ) ;
19
20
21
+ const blockNoteContext = useBlockNoteContext ( ) ;
22
+
20
23
return (
21
24
< BlockNoteView
22
25
autoFocus = { autoFocus }
@@ -28,6 +31,7 @@ export const Editor = forwardRef<
28
31
filePanel = { false }
29
32
formattingToolbar = { false }
30
33
editable = { editable }
34
+ theme = { blockNoteContext ?. colorSchemePreference }
31
35
ref = { ref }
32
36
onFocus = { onFocus }
33
37
onBlur = { onBlur }
Original file line number Diff line number Diff line change @@ -159,8 +159,9 @@ function BlockNoteViewComponent<
159
159
...existingContext ,
160
160
editor,
161
161
setContentEditableProps,
162
+ colorSchemePreference : editorColorScheme ,
162
163
} ;
163
- } , [ existingContext , editor ] ) ;
164
+ } , [ existingContext , editor , editorColorScheme ] ) ;
164
165
165
166
// We set defaultUIProps and editorProps on a different context, the BlockNoteViewContext.
166
167
// This BlockNoteViewContext is used to render the editor and the default UI.
Original file line number Diff line number Diff line change 4
4
FormattingToolbar ,
5
5
FormattingToolbarController ,
6
6
getFormattingToolbarItems ,
7
+ useBlockNoteContext ,
7
8
} from "@blocknote/react" ;
8
9
import { forwardRef } from "react" ;
9
10
@@ -19,10 +20,13 @@ export const Editor = forwardRef<
19
20
20
21
assertEmpty ( rest ) ;
21
22
23
+ const blockNoteContext = useBlockNoteContext ( ) ;
24
+
22
25
return (
23
26
< BlockNoteView
24
27
autoFocus = { autoFocus }
25
28
className = { cn ( className , "" ) }
29
+ theme = { blockNoteContext ?. colorSchemePreference }
26
30
editor = { props . editor }
27
31
sideMenu = { false }
28
32
slashMenu = { false }
You can’t perform that action at this time.
0 commit comments