UNPKG

@liveblocks/react-blocknote

Version:

An integration of BlockNote + React to enable collaboration, comments, live cursors, and more with Liveblocks.

1 lines 1.88 kB
{"version":3,"file":"useCreateBlockNoteWithLiveblocks.cjs","sources":["../../src/initialization/useCreateBlockNoteWithLiveblocks.ts"],"sourcesContent":["import type {\n BlockNoteEditorOptions,\n BlockSchema,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n DefaultStyleSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport { useCreateBlockNote } from \"@blocknote/react\";\nimport type { DependencyList } from \"react\";\n\nimport type { LiveblocksExtensionOptions } from \"../BlockNoteLiveblocksExtension\";\nimport { useLiveblocksExtension } from \"../BlockNoteLiveblocksExtension\";\nimport { withLiveblocksEditorOptions } from \"./liveblocksEditorOptions\";\n\n/**\n * Function that can be used instead of standard useCreateBlockNote to add Liveblocks support\n */\nexport const useCreateBlockNoteWithLiveblocks = <\n B extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema,\n>(\n blocknoteOptions: Partial<BlockNoteEditorOptions<B, I, S>> = {},\n liveblocksOptions: LiveblocksExtensionOptions = undefined,\n deps: DependencyList = []\n) => {\n const liveblocksExtension = useLiveblocksExtension(liveblocksOptions);\n return useCreateBlockNote(\n withLiveblocksEditorOptions(\n liveblocksExtension,\n blocknoteOptions,\n liveblocksOptions\n ),\n [liveblocksExtension, ...deps]\n );\n};\n"],"names":["useLiveblocksExtension","useCreateBlockNote","withLiveblocksEditorOptions"],"mappings":";;;;;;AAmBa,MAAA,gCAAA,GAAmC,CAK9C,gBAA6D,GAAA,IAC7D,iBAAgD,GAAA,KAAA,CAAA,EAChD,IAAuB,GAAA,EACpB,KAAA;AACH,EAAM,MAAA,mBAAA,GAAsBA,oDAAuB,iBAAiB,CAAA,CAAA;AACpE,EAAO,OAAAC,wBAAA;AAAA,IACLC,mDAAA;AAAA,MACE,mBAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,KACF;AAAA,IACA,CAAC,mBAAqB,EAAA,GAAG,IAAI,CAAA;AAAA,GAC/B,CAAA;AACF;;;;"}