@liveblocks/react-blocknote 3.8.0-next3 → 3.8.0-tiptap1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,24 @@
1
1
  'use strict';
2
2
 
3
+ var core = require('@blocknote/core');
3
4
  var schema = require('./schema.cjs');
4
5
 
5
6
  const withLiveblocksEditorOptions = (liveblocksExtension, blocknoteOptions = {}, liveblocksOptions = {}) => {
6
7
  const {
7
8
  schema: blocknoteSchema,
8
- _extensions: blocknoteExtensions,
9
+ extensions: blocknoteExtensions,
9
10
  disableExtensions: blocknoteDisableExtensions,
10
11
  ...extraBlocknoteOptions
11
12
  } = blocknoteOptions;
12
13
  return {
13
14
  schema: schema.withLiveblocksSchema(blocknoteSchema, liveblocksOptions),
14
- _extensions: { liveblocksExtension, ...blocknoteExtensions },
15
+ extensions: [
16
+ core.createBlockNoteExtension({
17
+ key: "liveblocksExtension",
18
+ tiptapExtensions: [liveblocksExtension]
19
+ }),
20
+ ...blocknoteExtensions ?? []
21
+ ],
15
22
  disableExtensions: ["history", ...blocknoteDisableExtensions || []],
16
23
  ...extraBlocknoteOptions
17
24
  };
@@ -1 +1 @@
1
- {"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 mentions nodes 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;;;;"}
1
+ {"version":3,"file":"liveblocksEditorOptions.cjs","sources":["../../src/initialization/liveblocksEditorOptions.ts"],"sourcesContent":["import {\n type BlockNoteEditorOptions,\n type BlockSchema,\n createBlockNoteExtension,\n type DefaultBlockSchema,\n type DefaultInlineContentSchema,\n type DefaultStyleSchema,\n type InlineContentSchema,\n type 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<any, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 mentions nodes to the schema)\n schema: withLiveblocksSchema(blocknoteSchema, liveblocksOptions),\n\n // add the liveblocks extension\n extensions: [\n createBlockNoteExtension({\n key: \"liveblocksExtension\",\n tiptapExtensions: [liveblocksExtension],\n }),\n ...(blocknoteExtensions ?? []),\n ],\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","createBlockNoteExtension"],"mappings":";;;;;AAgBa,MAAA,2BAAA,GAA8B,CAKzC,mBAEA,EAAA,gBAAA,GAA6D,EAC7D,EAAA,iBAAA,GAAoD,EACP,KAAA;AAC7C,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA,eAAA;AAAA,IACR,UAAY,EAAA,mBAAA;AAAA,IACZ,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,UAAY,EAAA;AAAA,MACVC,6BAAyB,CAAA;AAAA,QACvB,GAAK,EAAA,qBAAA;AAAA,QACL,gBAAA,EAAkB,CAAC,mBAAmB,CAAA;AAAA,OACvC,CAAA;AAAA,MACD,GAAI,uBAAuB,EAAC;AAAA,KAC9B;AAAA,IAGA,mBAAmB,CAAC,SAAA,EAAW,GAAI,0BAAA,IAA8B,EAAG,CAAA;AAAA,IAGpE,GAAG,qBAAA;AAAA,GACL,CAAA;AACF;;;;"}
@@ -1,15 +1,22 @@
1
+ import { createBlockNoteExtension } from '@blocknote/core';
1
2
  import { withLiveblocksSchema } from './schema.js';
2
3
 
3
4
  const withLiveblocksEditorOptions = (liveblocksExtension, blocknoteOptions = {}, liveblocksOptions = {}) => {
4
5
  const {
5
6
  schema: blocknoteSchema,
6
- _extensions: blocknoteExtensions,
7
+ extensions: blocknoteExtensions,
7
8
  disableExtensions: blocknoteDisableExtensions,
8
9
  ...extraBlocknoteOptions
9
10
  } = blocknoteOptions;
10
11
  return {
11
12
  schema: withLiveblocksSchema(blocknoteSchema, liveblocksOptions),
12
- _extensions: { liveblocksExtension, ...blocknoteExtensions },
13
+ extensions: [
14
+ createBlockNoteExtension({
15
+ key: "liveblocksExtension",
16
+ tiptapExtensions: [liveblocksExtension]
17
+ }),
18
+ ...blocknoteExtensions ?? []
19
+ ],
13
20
  disableExtensions: ["history", ...blocknoteDisableExtensions || []],
14
21
  ...extraBlocknoteOptions
15
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"liveblocksEditorOptions.js","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 mentions nodes 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":[],"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,EAAQ,oBAAqB,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;;;;"}
1
+ {"version":3,"file":"liveblocksEditorOptions.js","sources":["../../src/initialization/liveblocksEditorOptions.ts"],"sourcesContent":["import {\n type BlockNoteEditorOptions,\n type BlockSchema,\n createBlockNoteExtension,\n type DefaultBlockSchema,\n type DefaultInlineContentSchema,\n type DefaultStyleSchema,\n type InlineContentSchema,\n type 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<any, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 mentions nodes to the schema)\n schema: withLiveblocksSchema(blocknoteSchema, liveblocksOptions),\n\n // add the liveblocks extension\n extensions: [\n createBlockNoteExtension({\n key: \"liveblocksExtension\",\n tiptapExtensions: [liveblocksExtension],\n }),\n ...(blocknoteExtensions ?? []),\n ],\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":[],"mappings":";;;AAgBa,MAAA,2BAAA,GAA8B,CAKzC,mBAEA,EAAA,gBAAA,GAA6D,EAC7D,EAAA,iBAAA,GAAoD,EACP,KAAA;AAC7C,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA,eAAA;AAAA,IACR,UAAY,EAAA,mBAAA;AAAA,IACZ,iBAAmB,EAAA,0BAAA;AAAA,IAChB,GAAA,qBAAA;AAAA,GACD,GAAA,gBAAA,CAAA;AAEJ,EAAO,OAAA;AAAA,IAEL,MAAA,EAAQ,oBAAqB,CAAA,eAAA,EAAiB,iBAAiB,CAAA;AAAA,IAG/D,UAAY,EAAA;AAAA,MACV,wBAAyB,CAAA;AAAA,QACvB,GAAK,EAAA,qBAAA;AAAA,QACL,gBAAA,EAAkB,CAAC,mBAAmB,CAAA;AAAA,OACvC,CAAA;AAAA,MACD,GAAI,uBAAuB,EAAC;AAAA,KAC9B;AAAA,IAGA,mBAAmB,CAAC,SAAA,EAAW,GAAI,0BAAA,IAA8B,EAAG,CAAA;AAAA,IAGpE,GAAG,qBAAA;AAAA,GACL,CAAA;AACF;;;;"}
@@ -3,14 +3,30 @@
3
3
  var core = require('@blocknote/core');
4
4
  var reactTiptap = require('@liveblocks/react-tiptap');
5
5
 
6
- const mentionSpec = core.createInlineContentSpecFromTipTapNode(reactTiptap.MentionNode, {
7
- id: {
8
- default: ""
6
+ const mentionSpec = core.createInlineContentSpecFromTipTapNode(
7
+ reactTiptap.MentionNode,
8
+ {
9
+ id: {
10
+ default: ""
11
+ },
12
+ notificationId: {
13
+ default: ""
14
+ }
9
15
  },
10
- notificationId: {
11
- default: ""
16
+ {
17
+ render(inlineContent) {
18
+ const el = document.createElement("liveblocks-mention");
19
+ el.setAttribute("data-id", inlineContent.props.id);
20
+ el.setAttribute(
21
+ "data-notification-id",
22
+ inlineContent.props.notificationId
23
+ );
24
+ return {
25
+ dom: el
26
+ };
27
+ }
12
28
  }
13
- });
29
+ );
14
30
  const groupMentionSpec = core.createInlineContentSpecFromTipTapNode(
15
31
  reactTiptap.GroupMentionNode,
16
32
  {
@@ -23,6 +39,20 @@ const groupMentionSpec = core.createInlineContentSpecFromTipTapNode(
23
39
  notificationId: {
24
40
  default: ""
25
41
  }
42
+ },
43
+ {
44
+ render(inlineContent) {
45
+ const el = document.createElement("liveblocks-group-mention");
46
+ el.setAttribute("data-id", inlineContent.props.id);
47
+ el.setAttribute("data-user-ids", inlineContent.props.userIds);
48
+ el.setAttribute(
49
+ "data-notification-id",
50
+ inlineContent.props.notificationId
51
+ );
52
+ return {
53
+ dom: el
54
+ };
55
+ }
26
56
  }
27
57
  );
28
58
  const withLiveblocksSchema = (schema, liveblocksOptions = {}) => {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.cjs","sources":["../../src/initialization/schema.ts"],"sourcesContent":["import type {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport {\n BlockNoteSchema,\n createInlineContentSpecFromTipTapNode,\n} from \"@blocknote/core\";\nimport { GroupMentionNode, MentionNode } from \"@liveblocks/react-tiptap\";\n\nconst mentionSpec = createInlineContentSpecFromTipTapNode(MentionNode, {\n id: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n});\n\nconst groupMentionSpec = createInlineContentSpecFromTipTapNode(\n GroupMentionNode,\n {\n id: {\n default: \"\",\n },\n userIds: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n }\n);\n\n/**\n * Adds the Liveblocks Mention and Group Mention nodes as inline content to the BlockNote schema\n *\n * This makes sure BlockNote knows about Liveblocks mentions and that you can read/write mentions via the BlockNote API\n */\nexport const withLiveblocksSchema = <\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n>(\n schema?: BlockNoteSchema<B, I, S>,\n liveblocksOptions: Partial<{ mentions: boolean }> = {}\n): BlockNoteSchema<B, I, S> => {\n const optionalSchema = schema || BlockNoteSchema.create();\n if (!liveblocksOptions.mentions) {\n return optionalSchema as BlockNoteSchema<B, I, S>;\n }\n return BlockNoteSchema.create({\n blockSpecs: optionalSchema.blockSpecs,\n inlineContentSpecs: {\n ...optionalSchema.inlineContentSpecs,\n liveblocksMention: mentionSpec,\n liveblocksGroupMention: groupMentionSpec,\n },\n styleSpecs: optionalSchema.styleSpecs,\n }) as any as BlockNoteSchema<\n // typescript needs some help here\n B,\n I & {\n liveblocksMention: typeof mentionSpec.config;\n liveblocksGroupMention: typeof groupMentionSpec.config;\n },\n S\n >;\n};\n"],"names":["createInlineContentSpecFromTipTapNode","MentionNode","GroupMentionNode","BlockNoteSchema"],"mappings":";;;;;AAWA,MAAM,WAAA,GAAcA,2CAAsCC,uBAAa,EAAA;AAAA,EACrE,EAAI,EAAA;AAAA,IACF,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,OAAS,EAAA,EAAA;AAAA,GACX;AACF,CAAC,CAAA,CAAA;AAED,MAAM,gBAAmB,GAAAD,0CAAA;AAAA,EACvBE,4BAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,oBAAuB,GAAA,CAKlC,MACA,EAAA,iBAAA,GAAoD,EACvB,KAAA;AAC7B,EAAM,MAAA,cAAA,GAAiB,MAAU,IAAAC,oBAAA,CAAgB,MAAO,EAAA,CAAA;AACxD,EAAI,IAAA,CAAC,kBAAkB,QAAU,EAAA;AAC/B,IAAO,OAAA,cAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAOA,qBAAgB,MAAO,CAAA;AAAA,IAC5B,YAAY,cAAe,CAAA,UAAA;AAAA,IAC3B,kBAAoB,EAAA;AAAA,MAClB,GAAG,cAAe,CAAA,kBAAA;AAAA,MAClB,iBAAmB,EAAA,WAAA;AAAA,MACnB,sBAAwB,EAAA,gBAAA;AAAA,KAC1B;AAAA,IACA,YAAY,cAAe,CAAA,UAAA;AAAA,GAC5B,CAAA,CAAA;AASH;;;;"}
1
+ {"version":3,"file":"schema.cjs","sources":["../../src/initialization/schema.ts"],"sourcesContent":["import type {\n BlockSchema,\n CustomInlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport {\n BlockNoteSchema,\n createInlineContentSpecFromTipTapNode,\n} from \"@blocknote/core\";\nimport { GroupMentionNode, MentionNode } from \"@liveblocks/react-tiptap\";\n\nconst mentionSpec = createInlineContentSpecFromTipTapNode(\n MentionNode,\n {\n id: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n },\n {\n render(\n inlineContent: CustomInlineContentFromConfig<\n {\n type: \"liveblocksMention\";\n content: \"styled\";\n propSchema: {\n id: {\n default: \"\";\n };\n notificationId: {\n default: \"\";\n };\n };\n },\n StyleSchema\n >\n ) {\n const el = document.createElement(\"liveblocks-mention\");\n el.setAttribute(\"data-id\", inlineContent.props.id);\n el.setAttribute(\n \"data-notification-id\",\n inlineContent.props.notificationId\n );\n return {\n dom: el,\n };\n },\n }\n);\n\nconst groupMentionSpec = createInlineContentSpecFromTipTapNode(\n GroupMentionNode,\n {\n id: {\n default: \"\",\n },\n userIds: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n },\n {\n render(\n inlineContent: CustomInlineContentFromConfig<\n {\n type: \"liveblocksGroupMention\";\n content: \"styled\";\n propSchema: {\n id: {\n default: \"\";\n };\n userIds: {\n default: \"\";\n };\n notificationId: {\n default: \"\";\n };\n };\n },\n StyleSchema\n >\n ) {\n const el = document.createElement(\"liveblocks-group-mention\");\n el.setAttribute(\"data-id\", inlineContent.props.id);\n el.setAttribute(\"data-user-ids\", inlineContent.props.userIds);\n el.setAttribute(\n \"data-notification-id\",\n inlineContent.props.notificationId\n );\n return {\n dom: el,\n };\n },\n }\n);\n\n/**\n * Adds the Liveblocks Mention and Group Mention nodes as inline content to the BlockNote schema\n *\n * This makes sure BlockNote knows about Liveblocks mentions and that you can read/write mentions via the BlockNote API\n */\nexport const withLiveblocksSchema = <\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n>(\n schema?: BlockNoteSchema<B, I, S>,\n liveblocksOptions: Partial<{ mentions: boolean }> = {}\n): BlockNoteSchema<B, I, S> => {\n const optionalSchema = schema || BlockNoteSchema.create();\n if (!liveblocksOptions.mentions) {\n return optionalSchema as BlockNoteSchema<B, I, S>;\n }\n return BlockNoteSchema.create({\n blockSpecs: optionalSchema.blockSpecs,\n inlineContentSpecs: {\n ...optionalSchema.inlineContentSpecs,\n liveblocksMention: mentionSpec,\n liveblocksGroupMention: groupMentionSpec,\n },\n styleSpecs: optionalSchema.styleSpecs,\n }) as any as BlockNoteSchema<\n // typescript needs some help here\n B,\n I,\n S\n >;\n};\n"],"names":["createInlineContentSpecFromTipTapNode","MentionNode","GroupMentionNode","BlockNoteSchema"],"mappings":";;;;;AAYA,MAAM,WAAc,GAAAA,0CAAA;AAAA,EAClBC,uBAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA;AAAA,IACE,OACE,aAeA,EAAA;AACA,MAAM,MAAA,EAAA,GAAK,QAAS,CAAA,aAAA,CAAc,oBAAoB,CAAA,CAAA;AACtD,MAAA,EAAA,CAAG,YAAa,CAAA,SAAA,EAAW,aAAc,CAAA,KAAA,CAAM,EAAE,CAAA,CAAA;AACjD,MAAG,EAAA,CAAA,YAAA;AAAA,QACD,sBAAA;AAAA,QACA,cAAc,KAAM,CAAA,cAAA;AAAA,OACtB,CAAA;AACA,MAAO,OAAA;AAAA,QACL,GAAK,EAAA,EAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAA,CAAA;AAEA,MAAM,gBAAmB,GAAAD,0CAAA;AAAA,EACvBE,4BAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA;AAAA,IACE,OACE,aAkBA,EAAA;AACA,MAAM,MAAA,EAAA,GAAK,QAAS,CAAA,aAAA,CAAc,0BAA0B,CAAA,CAAA;AAC5D,MAAA,EAAA,CAAG,YAAa,CAAA,SAAA,EAAW,aAAc,CAAA,KAAA,CAAM,EAAE,CAAA,CAAA;AACjD,MAAA,EAAA,CAAG,YAAa,CAAA,eAAA,EAAiB,aAAc,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAC5D,MAAG,EAAA,CAAA,YAAA;AAAA,QACD,sBAAA;AAAA,QACA,cAAc,KAAM,CAAA,cAAA;AAAA,OACtB,CAAA;AACA,MAAO,OAAA;AAAA,QACL,GAAK,EAAA,EAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,oBAAuB,GAAA,CAKlC,MACA,EAAA,iBAAA,GAAoD,EACvB,KAAA;AAC7B,EAAM,MAAA,cAAA,GAAiB,MAAU,IAAAC,oBAAA,CAAgB,MAAO,EAAA,CAAA;AACxD,EAAI,IAAA,CAAC,kBAAkB,QAAU,EAAA;AAC/B,IAAO,OAAA,cAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAOA,qBAAgB,MAAO,CAAA;AAAA,IAC5B,YAAY,cAAe,CAAA,UAAA;AAAA,IAC3B,kBAAoB,EAAA;AAAA,MAClB,GAAG,cAAe,CAAA,kBAAA;AAAA,MAClB,iBAAmB,EAAA,WAAA;AAAA,MACnB,sBAAwB,EAAA,gBAAA;AAAA,KAC1B;AAAA,IACA,YAAY,cAAe,CAAA,UAAA;AAAA,GAC5B,CAAA,CAAA;AAMH;;;;"}
@@ -1,14 +1,30 @@
1
1
  import { createInlineContentSpecFromTipTapNode, BlockNoteSchema } from '@blocknote/core';
2
2
  import { MentionNode, GroupMentionNode } from '@liveblocks/react-tiptap';
3
3
 
4
- const mentionSpec = createInlineContentSpecFromTipTapNode(MentionNode, {
5
- id: {
6
- default: ""
4
+ const mentionSpec = createInlineContentSpecFromTipTapNode(
5
+ MentionNode,
6
+ {
7
+ id: {
8
+ default: ""
9
+ },
10
+ notificationId: {
11
+ default: ""
12
+ }
7
13
  },
8
- notificationId: {
9
- default: ""
14
+ {
15
+ render(inlineContent) {
16
+ const el = document.createElement("liveblocks-mention");
17
+ el.setAttribute("data-id", inlineContent.props.id);
18
+ el.setAttribute(
19
+ "data-notification-id",
20
+ inlineContent.props.notificationId
21
+ );
22
+ return {
23
+ dom: el
24
+ };
25
+ }
10
26
  }
11
- });
27
+ );
12
28
  const groupMentionSpec = createInlineContentSpecFromTipTapNode(
13
29
  GroupMentionNode,
14
30
  {
@@ -21,6 +37,20 @@ const groupMentionSpec = createInlineContentSpecFromTipTapNode(
21
37
  notificationId: {
22
38
  default: ""
23
39
  }
40
+ },
41
+ {
42
+ render(inlineContent) {
43
+ const el = document.createElement("liveblocks-group-mention");
44
+ el.setAttribute("data-id", inlineContent.props.id);
45
+ el.setAttribute("data-user-ids", inlineContent.props.userIds);
46
+ el.setAttribute(
47
+ "data-notification-id",
48
+ inlineContent.props.notificationId
49
+ );
50
+ return {
51
+ dom: el
52
+ };
53
+ }
24
54
  }
25
55
  );
26
56
  const withLiveblocksSchema = (schema, liveblocksOptions = {}) => {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sources":["../../src/initialization/schema.ts"],"sourcesContent":["import type {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport {\n BlockNoteSchema,\n createInlineContentSpecFromTipTapNode,\n} from \"@blocknote/core\";\nimport { GroupMentionNode, MentionNode } from \"@liveblocks/react-tiptap\";\n\nconst mentionSpec = createInlineContentSpecFromTipTapNode(MentionNode, {\n id: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n});\n\nconst groupMentionSpec = createInlineContentSpecFromTipTapNode(\n GroupMentionNode,\n {\n id: {\n default: \"\",\n },\n userIds: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n }\n);\n\n/**\n * Adds the Liveblocks Mention and Group Mention nodes as inline content to the BlockNote schema\n *\n * This makes sure BlockNote knows about Liveblocks mentions and that you can read/write mentions via the BlockNote API\n */\nexport const withLiveblocksSchema = <\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n>(\n schema?: BlockNoteSchema<B, I, S>,\n liveblocksOptions: Partial<{ mentions: boolean }> = {}\n): BlockNoteSchema<B, I, S> => {\n const optionalSchema = schema || BlockNoteSchema.create();\n if (!liveblocksOptions.mentions) {\n return optionalSchema as BlockNoteSchema<B, I, S>;\n }\n return BlockNoteSchema.create({\n blockSpecs: optionalSchema.blockSpecs,\n inlineContentSpecs: {\n ...optionalSchema.inlineContentSpecs,\n liveblocksMention: mentionSpec,\n liveblocksGroupMention: groupMentionSpec,\n },\n styleSpecs: optionalSchema.styleSpecs,\n }) as any as BlockNoteSchema<\n // typescript needs some help here\n B,\n I & {\n liveblocksMention: typeof mentionSpec.config;\n liveblocksGroupMention: typeof groupMentionSpec.config;\n },\n S\n >;\n};\n"],"names":[],"mappings":";;;AAWA,MAAM,WAAA,GAAc,sCAAsC,WAAa,EAAA;AAAA,EACrE,EAAI,EAAA;AAAA,IACF,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,OAAS,EAAA,EAAA;AAAA,GACX;AACF,CAAC,CAAA,CAAA;AAED,MAAM,gBAAmB,GAAA,qCAAA;AAAA,EACvB,gBAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,oBAAuB,GAAA,CAKlC,MACA,EAAA,iBAAA,GAAoD,EACvB,KAAA;AAC7B,EAAM,MAAA,cAAA,GAAiB,MAAU,IAAA,eAAA,CAAgB,MAAO,EAAA,CAAA;AACxD,EAAI,IAAA,CAAC,kBAAkB,QAAU,EAAA;AAC/B,IAAO,OAAA,cAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAO,gBAAgB,MAAO,CAAA;AAAA,IAC5B,YAAY,cAAe,CAAA,UAAA;AAAA,IAC3B,kBAAoB,EAAA;AAAA,MAClB,GAAG,cAAe,CAAA,kBAAA;AAAA,MAClB,iBAAmB,EAAA,WAAA;AAAA,MACnB,sBAAwB,EAAA,gBAAA;AAAA,KAC1B;AAAA,IACA,YAAY,cAAe,CAAA,UAAA;AAAA,GAC5B,CAAA,CAAA;AASH;;;;"}
1
+ {"version":3,"file":"schema.js","sources":["../../src/initialization/schema.ts"],"sourcesContent":["import type {\n BlockSchema,\n CustomInlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"@blocknote/core\";\nimport {\n BlockNoteSchema,\n createInlineContentSpecFromTipTapNode,\n} from \"@blocknote/core\";\nimport { GroupMentionNode, MentionNode } from \"@liveblocks/react-tiptap\";\n\nconst mentionSpec = createInlineContentSpecFromTipTapNode(\n MentionNode,\n {\n id: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n },\n {\n render(\n inlineContent: CustomInlineContentFromConfig<\n {\n type: \"liveblocksMention\";\n content: \"styled\";\n propSchema: {\n id: {\n default: \"\";\n };\n notificationId: {\n default: \"\";\n };\n };\n },\n StyleSchema\n >\n ) {\n const el = document.createElement(\"liveblocks-mention\");\n el.setAttribute(\"data-id\", inlineContent.props.id);\n el.setAttribute(\n \"data-notification-id\",\n inlineContent.props.notificationId\n );\n return {\n dom: el,\n };\n },\n }\n);\n\nconst groupMentionSpec = createInlineContentSpecFromTipTapNode(\n GroupMentionNode,\n {\n id: {\n default: \"\",\n },\n userIds: {\n default: \"\",\n },\n notificationId: {\n default: \"\",\n },\n },\n {\n render(\n inlineContent: CustomInlineContentFromConfig<\n {\n type: \"liveblocksGroupMention\";\n content: \"styled\";\n propSchema: {\n id: {\n default: \"\";\n };\n userIds: {\n default: \"\";\n };\n notificationId: {\n default: \"\";\n };\n };\n },\n StyleSchema\n >\n ) {\n const el = document.createElement(\"liveblocks-group-mention\");\n el.setAttribute(\"data-id\", inlineContent.props.id);\n el.setAttribute(\"data-user-ids\", inlineContent.props.userIds);\n el.setAttribute(\n \"data-notification-id\",\n inlineContent.props.notificationId\n );\n return {\n dom: el,\n };\n },\n }\n);\n\n/**\n * Adds the Liveblocks Mention and Group Mention nodes as inline content to the BlockNote schema\n *\n * This makes sure BlockNote knows about Liveblocks mentions and that you can read/write mentions via the BlockNote API\n */\nexport const withLiveblocksSchema = <\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n>(\n schema?: BlockNoteSchema<B, I, S>,\n liveblocksOptions: Partial<{ mentions: boolean }> = {}\n): BlockNoteSchema<B, I, S> => {\n const optionalSchema = schema || BlockNoteSchema.create();\n if (!liveblocksOptions.mentions) {\n return optionalSchema as BlockNoteSchema<B, I, S>;\n }\n return BlockNoteSchema.create({\n blockSpecs: optionalSchema.blockSpecs,\n inlineContentSpecs: {\n ...optionalSchema.inlineContentSpecs,\n liveblocksMention: mentionSpec,\n liveblocksGroupMention: groupMentionSpec,\n },\n styleSpecs: optionalSchema.styleSpecs,\n }) as any as BlockNoteSchema<\n // typescript needs some help here\n B,\n I,\n S\n >;\n};\n"],"names":[],"mappings":";;;AAYA,MAAM,WAAc,GAAA,qCAAA;AAAA,EAClB,WAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA;AAAA,IACE,OACE,aAeA,EAAA;AACA,MAAM,MAAA,EAAA,GAAK,QAAS,CAAA,aAAA,CAAc,oBAAoB,CAAA,CAAA;AACtD,MAAA,EAAA,CAAG,YAAa,CAAA,SAAA,EAAW,aAAc,CAAA,KAAA,CAAM,EAAE,CAAA,CAAA;AACjD,MAAG,EAAA,CAAA,YAAA;AAAA,QACD,sBAAA;AAAA,QACA,cAAc,KAAM,CAAA,cAAA;AAAA,OACtB,CAAA;AACA,MAAO,OAAA;AAAA,QACL,GAAK,EAAA,EAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAA,CAAA;AAEA,MAAM,gBAAmB,GAAA,qCAAA;AAAA,EACvB,gBAAA;AAAA,EACA;AAAA,IACE,EAAI,EAAA;AAAA,MACF,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,EAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA;AAAA,IACE,OACE,aAkBA,EAAA;AACA,MAAM,MAAA,EAAA,GAAK,QAAS,CAAA,aAAA,CAAc,0BAA0B,CAAA,CAAA;AAC5D,MAAA,EAAA,CAAG,YAAa,CAAA,SAAA,EAAW,aAAc,CAAA,KAAA,CAAM,EAAE,CAAA,CAAA;AACjD,MAAA,EAAA,CAAG,YAAa,CAAA,eAAA,EAAiB,aAAc,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAC5D,MAAG,EAAA,CAAA,YAAA;AAAA,QACD,sBAAA;AAAA,QACA,cAAc,KAAM,CAAA,cAAA;AAAA,OACtB,CAAA;AACA,MAAO,OAAA;AAAA,QACL,GAAK,EAAA,EAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,oBAAuB,GAAA,CAKlC,MACA,EAAA,iBAAA,GAAoD,EACvB,KAAA;AAC7B,EAAM,MAAA,cAAA,GAAiB,MAAU,IAAA,eAAA,CAAgB,MAAO,EAAA,CAAA;AACxD,EAAI,IAAA,CAAC,kBAAkB,QAAU,EAAA;AAC/B,IAAO,OAAA,cAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAO,gBAAgB,MAAO,CAAA;AAAA,IAC5B,YAAY,cAAe,CAAA,UAAA;AAAA,IAC3B,kBAAoB,EAAA;AAAA,MAClB,GAAG,cAAe,CAAA,kBAAA;AAAA,MAClB,iBAAmB,EAAA,WAAA;AAAA,MACnB,sBAAwB,EAAA,gBAAA;AAAA,KAC1B;AAAA,IACA,YAAY,cAAe,CAAA,UAAA;AAAA,GAC5B,CAAA,CAAA;AAMH;;;;"}
package/dist/version.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const PKG_NAME = "@liveblocks/react-blocknote";
4
- const PKG_VERSION = typeof "3.8.0-next3" === "string" && "3.8.0-next3";
4
+ const PKG_VERSION = typeof "3.8.0-tiptap1" === "string" && "3.8.0-tiptap1";
5
5
  const PKG_FORMAT = typeof "cjs" === "string" && "cjs";
6
6
 
7
7
  exports.PKG_FORMAT = PKG_FORMAT;
@@ -1 +1 @@
1
- {"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-blocknote\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,8BAAA;AACX,MAAA,WAAA,GAAc,OAAO,aAAA,KAAgB,QAAY,IAAA,cAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
1
+ {"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-blocknote\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,8BAAA;AACX,MAAA,WAAA,GAAc,OAAO,eAAA,KAAgB,QAAY,IAAA,gBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const PKG_NAME = "@liveblocks/react-blocknote";
2
- const PKG_VERSION = typeof "3.8.0-next3" === "string" && "3.8.0-next3";
2
+ const PKG_VERSION = typeof "3.8.0-tiptap1" === "string" && "3.8.0-tiptap1";
3
3
  const PKG_FORMAT = typeof "esm" === "string" && "esm";
4
4
 
5
5
  export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-blocknote\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,8BAAA;AACX,MAAA,WAAA,GAAc,OAAO,aAAA,KAAgB,QAAY,IAAA,cAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-blocknote\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,8BAAA;AACX,MAAA,WAAA,GAAc,OAAO,eAAA,KAAgB,QAAY,IAAA,gBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react-blocknote",
3
- "version": "3.8.0-next3",
3
+ "version": "3.8.0-tiptap1",
4
4
  "description": "An integration of BlockNote + React to enable collaboration, comments, live cursors, and more with Liveblocks.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -42,19 +42,19 @@
42
42
  "test:watch": "NODE_OPTIONS=\"--no-deprecation\" vitest"
43
43
  },
44
44
  "dependencies": {
45
- "@liveblocks/client": "3.8.0-next3",
46
- "@liveblocks/core": "3.8.0-next3",
47
- "@liveblocks/react": "3.8.0-next3",
48
- "@liveblocks/react-tiptap": "3.8.0-next3",
49
- "@liveblocks/react-ui": "3.8.0-next3",
50
- "@liveblocks/yjs": "3.8.0-next3",
51
- "@tiptap/core": "^2.7.2",
45
+ "@liveblocks/client": "3.8.0-tiptap1",
46
+ "@liveblocks/core": "3.8.0-tiptap1",
47
+ "@liveblocks/react": "3.8.0-tiptap1",
48
+ "@liveblocks/react-tiptap": "3.8.0-tiptap1",
49
+ "@liveblocks/react-ui": "3.8.0-tiptap1",
50
+ "@liveblocks/yjs": "3.8.0-tiptap1",
51
+ "@tiptap/core": "^3.4.2",
52
52
  "vitest-tsconfig-paths": "^3.4.1"
53
53
  },
54
54
  "peerDependencies": {
55
- "@blocknote/core": "0.25.1 - 1.0.0",
56
- "@blocknote/react": "0.25.1 - 1.0.0",
57
- "@tiptap/core": "^2.7.2",
55
+ "@blocknote/core": "0.39.1 - 1.0.0",
56
+ "@blocknote/react": "0.39.1 - 1.0.0",
57
+ "@tiptap/core": "^3.4.2",
58
58
  "@types/react": "*",
59
59
  "@types/react-dom": "*",
60
60
  "react": "^18 || ^19 || ^19.0.0-rc",