@liveblocks/react-blocknote
Version:
An integration of BlockNote + React to enable collaboration, comments, live cursors, and more with Liveblocks.
1 lines • 2.12 kB
Source Map (JSON)
{"version":3,"file":"liveblocksEditorOptions.cjs","sources":["../../src/initialization/liveblocksEditorOptions.ts"],"sourcesContent":["import type {\n BlockNoteEditorOptions,\n BlockSchema,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n DefaultStyleSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport type { Extension } from \"@tiptap/core\";\n\nimport { withLiveblocksSchema } from \"./schema\";\n/**\n * Helper function to add Liveblocks support to BlockNoteEditorOptions\n */\nexport const withLiveblocksEditorOptions = <\n B extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema,\n>(\n liveblocksExtension: Extension,\n blocknoteOptions: Partial<BlockNoteEditorOptions<B, I, S>> = {},\n liveblocksOptions: Partial<{ mentions: boolean }> = {}\n): Partial<BlockNoteEditorOptions<B, I, S>> => {\n const {\n schema: blocknoteSchema,\n _extensions: blocknoteExtensions,\n disableExtensions: blocknoteDisableExtensions,\n ...extraBlocknoteOptions\n } = blocknoteOptions;\n\n return {\n // add the liveblocks schema (i.e.: add the mention node to the schema)\n schema: withLiveblocksSchema(blocknoteSchema, liveblocksOptions),\n\n // add the liveblocks extension\n _extensions: { liveblocksExtension, ...blocknoteExtensions },\n\n // disable the history extension\n disableExtensions: [\"history\", ...(blocknoteDisableExtensions || [])],\n\n // pass the rest of the options through\n ...extraBlocknoteOptions,\n };\n};\n"],"names":["withLiveblocksSchema"],"mappings":";;;;AAea,MAAA,2BAAA,GAA8B,CAKzC,mBACA,EAAA,gBAAA,GAA6D,EAC7D,EAAA,iBAAA,GAAoD,EACP,KAAA;AAC7C,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA,eAAA;AAAA,IACR,WAAa,EAAA,mBAAA;AAAA,IACb,iBAAmB,EAAA,0BAAA;AAAA,IAChB,GAAA,qBAAA;AAAA,GACD,GAAA,gBAAA,CAAA;AAEJ,EAAO,OAAA;AAAA,IAEL,MAAA,EAAQA,2BAAqB,CAAA,eAAA,EAAiB,iBAAiB,CAAA;AAAA,IAG/D,WAAa,EAAA,EAAE,mBAAqB,EAAA,GAAG,mBAAoB,EAAA;AAAA,IAG3D,mBAAmB,CAAC,SAAA,EAAW,GAAI,0BAAA,IAA8B,EAAG,CAAA;AAAA,IAGpE,GAAG,qBAAA;AAAA,GACL,CAAA;AACF;;;;"}