MCPcopy Index your code
hub / github.com/TypeCellOS/BlockNote / useCreateBlockNote

Function useCreateBlockNote

packages/react/src/hooks/useCreateBlockNote.tsx:14–36  ·  view source on GitHub ↗
(
  options: Options = {} as Options,
  deps: DependencyList = [],
)

Source from the content-addressed store, hash-verified

12 * Hook to instantiate a BlockNote Editor instance in React
13 */
14export const useCreateBlockNote = <
15 Options extends Partial<BlockNoteEditorOptions<any, any, any>> | undefined,
16>(
17 options: Options = {} as Options,
18 deps: DependencyList = [],
19): Options extends {
20 schema: CustomBlockNoteSchema<infer BSchema, infer ISchema, infer SSchema>;
21}
22 ? BlockNoteEditor<BSchema, ISchema, SSchema>
23 : BlockNoteEditor<
24 DefaultBlockSchema,
25 DefaultInlineContentSchema,
26 DefaultStyleSchema
27 > => {
28 return useMemo(() => {
29 const editor = BlockNoteEditor.create(options) as any;
30 if (window) {
31 // for testing / dev purposes
32 (window as any).ProseMirror = editor._tiptapEditor;
33 }
34 return editor;
35 }, deps); //eslint-disable-line react-hooks/exhaustive-deps
36};

Callers 15

EditorFunction · 0.90
EditorFunction · 0.90
DemoEditorInnerFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90

Calls 1

createMethod · 0.45

Tested by

no test coverage detected