Skip to content

Commit feaee16

Browse files
authored
fix: export blocknoteviewprops (#774)
1 parent bea361e commit feaee16

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

packages/react/src/editor/BlockNoteView.tsx

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,44 @@ const emptyFn = () => {
3030
// noop
3131
};
3232

33+
export type BlockNoteViewProps<
34+
BSchema extends BlockSchema,
35+
ISchema extends InlineContentSchema,
36+
SSchema extends StyleSchema
37+
> = {
38+
editor: BlockNoteEditor<BSchema, ISchema, SSchema>;
39+
40+
theme?: "light" | "dark";
41+
42+
/**
43+
* Locks the editor from being editable by the user if set to `false`.
44+
*/
45+
editable?: boolean;
46+
/**
47+
* A callback function that runs whenever the text cursor position or selection changes.
48+
*/
49+
onSelectionChange?: () => void;
50+
51+
/**
52+
* A callback function that runs whenever the editor's contents change.
53+
*/
54+
onChange?: () => void;
55+
56+
children?: ReactNode;
57+
58+
ref?: Ref<HTMLDivElement> | undefined; // only here to get types working with the generics. Regular form doesn't work
59+
} & Omit<
60+
HTMLAttributes<HTMLDivElement>,
61+
"onChange" | "onSelectionChange" | "children"
62+
> &
63+
BlockNoteDefaultUIProps;
64+
3365
function BlockNoteViewComponent<
3466
BSchema extends BlockSchema,
3567
ISchema extends InlineContentSchema,
3668
SSchema extends StyleSchema
3769
>(
38-
props: {
39-
editor: BlockNoteEditor<BSchema, ISchema, SSchema>;
40-
41-
theme?: "light" | "dark";
42-
43-
/**
44-
* Locks the editor from being editable by the user if set to `false`.
45-
*/
46-
editable?: boolean;
47-
/**
48-
* A callback function that runs whenever the text cursor position or selection changes.
49-
*/
50-
onSelectionChange?: () => void;
51-
52-
/**
53-
* A callback function that runs whenever the editor's contents change.
54-
*/
55-
onChange?: () => void;
56-
57-
children?: ReactNode;
58-
59-
ref?: Ref<HTMLDivElement> | undefined; // only here to get types working with the generics. Regular form doesn't work
60-
} & Omit<
61-
HTMLAttributes<HTMLDivElement>,
62-
"onChange" | "onSelectionChange" | "children"
63-
> &
64-
BlockNoteDefaultUIProps,
70+
props: BlockNoteViewProps<BSchema, ISchema, SSchema>,
6571
ref: React.Ref<HTMLDivElement>
6672
) {
6773
const {

0 commit comments

Comments
 (0)