Skip to content

Commit 18bd907

Browse files
fix: Editors in comments not inheriting theme (#1890)
1 parent 2d9586b commit 18bd907

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

packages/ariakit/src/comments/Editor.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
FormattingToolbar,
55
FormattingToolbarController,
66
getFormattingToolbarItems,
7+
useBlockNoteContext,
78
} from "@blocknote/react";
89
import { forwardRef } from "react";
910
import { BlockNoteView } from "../BlockNoteView.js";
@@ -17,6 +18,8 @@ export const Editor = forwardRef<
1718

1819
assertEmpty(rest, false);
1920

21+
const blockNoteContext = useBlockNoteContext();
22+
2023
return (
2124
<BlockNoteView
2225
autoFocus={autoFocus}
@@ -28,6 +31,7 @@ export const Editor = forwardRef<
2831
filePanel={false}
2932
formattingToolbar={false}
3033
editable={editable}
34+
theme={blockNoteContext?.colorSchemePreference}
3135
ref={ref}
3236
onFocus={onFocus}
3337
onBlur={onBlur}

packages/mantine/src/comments/Editor.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
FormattingToolbar,
55
FormattingToolbarController,
66
getFormattingToolbarItems,
7+
useBlockNoteContext,
78
} from "@blocknote/react";
89
import { forwardRef } from "react";
910
import { BlockNoteView } from "../BlockNoteView.js";
@@ -17,6 +18,8 @@ export const Editor = forwardRef<
1718

1819
assertEmpty(rest, false);
1920

21+
const blockNoteContext = useBlockNoteContext();
22+
2023
return (
2124
<BlockNoteView
2225
autoFocus={autoFocus}
@@ -28,6 +31,7 @@ export const Editor = forwardRef<
2831
filePanel={false}
2932
formattingToolbar={false}
3033
editable={editable}
34+
theme={blockNoteContext?.colorSchemePreference}
3135
ref={ref}
3236
onFocus={onFocus}
3337
onBlur={onBlur}

packages/react/src/editor/BlockNoteView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ function BlockNoteViewComponent<
159159
...existingContext,
160160
editor,
161161
setContentEditableProps,
162+
colorSchemePreference: editorColorScheme,
162163
};
163-
}, [existingContext, editor]);
164+
}, [existingContext, editor, editorColorScheme]);
164165

165166
// We set defaultUIProps and editorProps on a different context, the BlockNoteViewContext.
166167
// This BlockNoteViewContext is used to render the editor and the default UI.

packages/shadcn/src/comments/Editor.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
FormattingToolbar,
55
FormattingToolbarController,
66
getFormattingToolbarItems,
7+
useBlockNoteContext,
78
} from "@blocknote/react";
89
import { forwardRef } from "react";
910

@@ -19,10 +20,13 @@ export const Editor = forwardRef<
1920

2021
assertEmpty(rest);
2122

23+
const blockNoteContext = useBlockNoteContext();
24+
2225
return (
2326
<BlockNoteView
2427
autoFocus={autoFocus}
2528
className={cn(className, "")}
29+
theme={blockNoteContext?.colorSchemePreference}
2630
editor={props.editor}
2731
sideMenu={false}
2832
slashMenu={false}

0 commit comments

Comments
 (0)