@blocknote/core 0.30.0 → 0.30.1

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.
Files changed (148) hide show
  1. package/dist/blocknote.cjs +2 -2
  2. package/dist/blocknote.cjs.map +1 -1
  3. package/dist/blocknote.js +22 -20
  4. package/dist/blocknote.js.map +1 -1
  5. package/dist/comments.cjs.map +1 -1
  6. package/dist/comments.js.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/dist/webpack-stats.json +1 -1
  10. package/package.json +5 -3
  11. package/src/api/README.md +1 -1
  12. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
  13. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -5
  14. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
  15. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
  16. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
  17. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
  18. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
  19. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
  20. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +7 -7
  21. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
  22. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
  23. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -42
  24. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +18 -18
  25. package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
  26. package/src/api/blockManipulation/insertContentAt.ts +1 -1
  27. package/src/api/blockManipulation/selections/selection.ts +11 -11
  28. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +7 -7
  29. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +6 -6
  30. package/src/api/blockManipulation/tables/tables.test.ts +106 -106
  31. package/src/api/blockManipulation/tables/tables.ts +35 -35
  32. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
  33. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
  34. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
  35. package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
  36. package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
  37. package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
  38. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
  39. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
  40. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
  41. package/src/api/exporters/markdown/markdownExporter.ts +3 -3
  42. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
  43. package/src/api/getBlockInfoFromPos.ts +6 -6
  44. package/src/api/nodeConversions/blockToNode.ts +26 -26
  45. package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
  46. package/src/api/nodeConversions/nodeToBlock.ts +37 -33
  47. package/src/api/nodeUtil.test.ts +16 -16
  48. package/src/api/nodeUtil.ts +10 -10
  49. package/src/api/parsers/html/parseHTML.ts +1 -1
  50. package/src/api/parsers/html/util/nestedLists.ts +2 -2
  51. package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
  52. package/src/api/pmUtil.ts +4 -4
  53. package/src/api/positionMapping.test.ts +3 -3
  54. package/src/api/positionMapping.ts +5 -5
  55. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
  56. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +12 -12
  57. package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
  58. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
  59. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +5 -5
  60. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
  61. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
  62. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
  63. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
  64. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
  65. package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
  66. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
  67. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
  68. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
  69. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
  70. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
  71. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
  72. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
  73. package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
  74. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
  75. package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
  76. package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
  77. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
  78. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
  79. package/src/blocks/README.md +1 -1
  80. package/src/blocks/TableBlockContent/TableBlockContent.ts +5 -5
  81. package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
  82. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
  83. package/src/blocks/defaultBlockHelpers.ts +8 -8
  84. package/src/blocks/defaultBlockTypeGuards.ts +16 -16
  85. package/src/blocks/defaultBlocks.ts +3 -3
  86. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
  87. package/src/comments/threadstore/ThreadStore.ts +1 -1
  88. package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
  89. package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
  90. package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
  91. package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
  92. package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
  93. package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
  94. package/src/editor/Block.css +8 -0
  95. package/src/editor/BlockNoteEditor.test.ts +3 -3
  96. package/src/editor/BlockNoteEditor.ts +7 -1
  97. package/src/editor/BlockNoteExtensions.ts +10 -10
  98. package/src/editor/BlockNoteSchema.ts +4 -4
  99. package/src/editor/BlockNoteTipTapEditor.ts +10 -10
  100. package/src/editor/README.md +1 -1
  101. package/src/editor/cursorPositionTypes.ts +1 -1
  102. package/src/editor/editor.css +15 -3
  103. package/src/editor/selectionTypes.ts +1 -1
  104. package/src/editor/transformPasted.ts +2 -2
  105. package/src/exporter/Exporter.ts +5 -5
  106. package/src/exporter/mapping.ts +7 -7
  107. package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
  108. package/src/extensions/Collaboration/CursorPlugin.ts +2 -2
  109. package/src/extensions/Comments/CommentsPlugin.ts +9 -9
  110. package/src/extensions/Comments/userstore/UserStore.ts +2 -2
  111. package/src/extensions/FilePanel/FilePanelPlugin.ts +7 -7
  112. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +4 -4
  113. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
  114. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -11
  115. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +4 -4
  116. package/src/extensions/Placeholder/PlaceholderPlugin.ts +10 -10
  117. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +2 -2
  118. package/src/extensions/README.md +1 -1
  119. package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
  120. package/src/extensions/SideMenu/SideMenuPlugin.ts +31 -31
  121. package/src/extensions/SideMenu/dragging.ts +8 -8
  122. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +17 -17
  123. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
  124. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +12 -12
  125. package/src/extensions/TableHandles/TableHandlesPlugin.ts +54 -53
  126. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  127. package/src/extensions/UniqueID/UniqueID.ts +6 -6
  128. package/src/extensions/getDraggableBlockFromElement.ts +1 -1
  129. package/src/fonts/inter.css +18 -9
  130. package/src/locales.ts +1 -1
  131. package/src/pm-nodes/BlockGroup.ts +1 -1
  132. package/src/pm-nodes/Doc.ts +4 -4
  133. package/src/schema/README.md +1 -1
  134. package/src/schema/blocks/createSpec.ts +14 -14
  135. package/src/schema/blocks/internal.ts +17 -17
  136. package/src/schema/blocks/types.ts +25 -25
  137. package/src/schema/inlineContent/createSpec.ts +16 -20
  138. package/src/schema/inlineContent/internal.ts +9 -9
  139. package/src/schema/inlineContent/types.ts +26 -26
  140. package/src/schema/propTypes.ts +8 -8
  141. package/src/schema/styles/createSpec.ts +2 -2
  142. package/src/schema/styles/internal.ts +7 -7
  143. package/src/schema/styles/types.ts +2 -2
  144. package/src/util/EventEmitter.ts +4 -4
  145. package/src/util/README.md +1 -1
  146. package/src/util/combineByGroup.ts +1 -1
  147. package/src/util/table.ts +33 -30
  148. package/types/src/editor/BlockNoteEditor.d.ts +3 -1
@@ -35,7 +35,7 @@ function removeDuplicates(array: any, by = JSON.stringify) {
35
35
  */
36
36
  function findDuplicates(items: any) {
37
37
  const filtered = items.filter(
38
- (el: any, index: number) => items.indexOf(el) !== index
38
+ (el: any, index: number) => items.indexOf(el) !== index,
39
39
  );
40
40
  const duplicates = removeDuplicates(filtered);
41
41
  return duplicates;
@@ -154,7 +154,7 @@ const UniqueID = Extension.create({
154
154
  const { types, attributeName, generateID } = this.options;
155
155
  const transform = combineTransactionSteps(
156
156
  oldState.doc,
157
- transactions as any
157
+ transactions as any,
158
158
  );
159
159
  const { mapping } = transform;
160
160
  // get changed ranges based on the old state
@@ -166,7 +166,7 @@ const UniqueID = Extension.create({
166
166
  newRange,
167
167
  (node) => {
168
168
  return types.includes(node.type.name);
169
- }
169
+ },
170
170
  );
171
171
  const newIds = newNodes
172
172
  .map(({ node }) => node.attrs[attributeName])
@@ -193,7 +193,7 @@ const UniqueID = Extension.create({
193
193
  if (wasInitial) {
194
194
  // the old state was the "initial content"
195
195
  const jsonNode = JSON.parse(
196
- JSON.stringify(newState.doc.toJSON())
196
+ JSON.stringify(newState.doc.toJSON()),
197
197
  );
198
198
  jsonNode.content[0].content[0].attrs.id = "initialBlockId";
199
199
  // would the new state with the fix also be the "initial content"?
@@ -308,7 +308,7 @@ const UniqueID = Extension.create({
308
308
  [attributeName]: null,
309
309
  },
310
310
  removeId(node.content),
311
- node.marks
311
+ node.marks,
312
312
  );
313
313
  list.push(nodeWithoutId);
314
314
  });
@@ -319,7 +319,7 @@ const UniqueID = Extension.create({
319
319
  return new Slice(
320
320
  removeId(slice.content),
321
321
  slice.openStart,
322
- slice.openEnd
322
+ slice.openEnd,
323
323
  );
324
324
  },
325
325
  },
@@ -2,7 +2,7 @@ import { EditorView } from "prosemirror-view";
2
2
 
3
3
  export function getDraggableBlockFromElement(
4
4
  element: Element,
5
- view: EditorView
5
+ view: EditorView,
6
6
  ) {
7
7
  while (
8
8
  element &&
@@ -5,7 +5,8 @@
5
5
  font-family: "Inter";
6
6
  font-style: normal;
7
7
  font-weight: 100;
8
- src: local(""),
8
+ src:
9
+ local(""),
9
10
  url("./inter-v12-latin/inter-v12-latin-100.woff2") format("woff2"),
10
11
  /* Chrome 26+, Opera 23+, Firefox 39+ */
11
12
  url("./inter-v12-latin/inter-v12-latin-100.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -15,7 +16,8 @@
15
16
  font-family: "Inter";
16
17
  font-style: normal;
17
18
  font-weight: 200;
18
- src: local(""),
19
+ src:
20
+ local(""),
19
21
  url("./inter-v12-latin/inter-v12-latin-200.woff2") format("woff2"),
20
22
  /* Chrome 26+, Opera 23+, Firefox 39+ */
21
23
  url("./inter-v12-latin/inter-v12-latin-200.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -25,7 +27,8 @@
25
27
  font-family: "Inter";
26
28
  font-style: normal;
27
29
  font-weight: 300;
28
- src: local(""),
30
+ src:
31
+ local(""),
29
32
  url("./inter-v12-latin/inter-v12-latin-300.woff2") format("woff2"),
30
33
  /* Chrome 26+, Opera 23+, Firefox 39+ */
31
34
  url("./inter-v12-latin/inter-v12-latin-300.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -35,7 +38,8 @@
35
38
  font-family: "Inter";
36
39
  font-style: normal;
37
40
  font-weight: 400;
38
- src: local(""),
41
+ src:
42
+ local(""),
39
43
  url("./inter-v12-latin/inter-v12-latin-regular.woff2") format("woff2"),
40
44
  /* Chrome 26+, Opera 23+, Firefox 39+ */
41
45
  url("./inter-v12-latin/inter-v12-latin-regular.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -45,7 +49,8 @@
45
49
  font-family: "Inter";
46
50
  font-style: normal;
47
51
  font-weight: 500;
48
- src: local(""),
52
+ src:
53
+ local(""),
49
54
  url("./inter-v12-latin/inter-v12-latin-500.woff2") format("woff2"),
50
55
  /* Chrome 26+, Opera 23+, Firefox 39+ */
51
56
  url("./inter-v12-latin/inter-v12-latin-500.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -55,7 +60,8 @@
55
60
  font-family: "Inter";
56
61
  font-style: normal;
57
62
  font-weight: 600;
58
- src: local(""),
63
+ src:
64
+ local(""),
59
65
  url("./inter-v12-latin/inter-v12-latin-600.woff2") format("woff2"),
60
66
  /* Chrome 26+, Opera 23+, Firefox 39+ */
61
67
  url("./inter-v12-latin/inter-v12-latin-600.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -65,7 +71,8 @@
65
71
  font-family: "Inter";
66
72
  font-style: normal;
67
73
  font-weight: 700;
68
- src: local(""),
74
+ src:
75
+ local(""),
69
76
  url("./inter-v12-latin/inter-v12-latin-700.woff2") format("woff2"),
70
77
  /* Chrome 26+, Opera 23+, Firefox 39+ */
71
78
  url("./inter-v12-latin/inter-v12-latin-700.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -75,7 +82,8 @@
75
82
  font-family: "Inter";
76
83
  font-style: normal;
77
84
  font-weight: 800;
78
- src: local(""),
85
+ src:
86
+ local(""),
79
87
  url("./inter-v12-latin/inter-v12-latin-800.woff2") format("woff2"),
80
88
  /* Chrome 26+, Opera 23+, Firefox 39+ */
81
89
  url("./inter-v12-latin/inter-v12-latin-800.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
@@ -85,7 +93,8 @@
85
93
  font-family: "Inter";
86
94
  font-style: normal;
87
95
  font-weight: 900;
88
- src: local(""),
96
+ src:
97
+ local(""),
89
98
  url("./inter-v12-latin/inter-v12-latin-900.woff2") format("woff2"),
90
99
  /* Chrome 26+, Opera 23+, Firefox 39+ */
91
100
  url("./inter-v12-latin/inter-v12-latin-900.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
package/src/locales.ts CHANGED
@@ -1 +1 @@
1
- export * from "./i18n/index.js";
1
+ export * from "./i18n/index.js";
@@ -37,7 +37,7 @@ export const BlockGroup = Node.create<{
37
37
  const blockGroup = document.createElement("div");
38
38
  blockGroup.className = mergeCSSClasses(
39
39
  "bn-block-group",
40
- blockGroupHTMLAttributes.class
40
+ blockGroupHTMLAttributes.class,
41
41
  );
42
42
  blockGroup.setAttribute("data-node-type", "blockGroup");
43
43
  for (const [attribute, value] of Object.entries(blockGroupHTMLAttributes)) {
@@ -1,7 +1,7 @@
1
- import {Node} from "@tiptap/core";
1
+ import { Node } from "@tiptap/core";
2
2
 
3
3
  export const Doc = Node.create({
4
- name: "doc",
5
- topNode: true,
6
- content: "blockGroup",
4
+ name: "doc",
5
+ topNode: true,
6
+ content: "blockGroup",
7
7
  });
@@ -1,3 +1,3 @@
1
1
  ### @blocknote/core/src/schema
2
2
 
3
- The BlockNote Schema consists of Blocks, InlineContent and Styles.
3
+ The BlockNote Schema consists of Blocks, InlineContent and Styles.
@@ -26,7 +26,7 @@ export type CustomBlockConfig = BlockConfig & {
26
26
  export type CustomBlockImplementation<
27
27
  T extends CustomBlockConfig,
28
28
  I extends InlineContentSchema,
29
- S extends StyleSchema
29
+ S extends StyleSchema,
30
30
  > = {
31
31
  render: (
32
32
  /**
@@ -38,7 +38,7 @@ export type CustomBlockImplementation<
38
38
  * This is typed generically. If you want an editor with your custom schema, you need to
39
39
  * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
40
40
  */
41
- editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>
41
+ editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>,
42
42
  // (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations
43
43
  // or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics
44
44
  ) => {
@@ -52,14 +52,14 @@ export type CustomBlockImplementation<
52
52
  // TODO: Maybe can return undefined to ignore when serializing?
53
53
  toExternalHTML?: (
54
54
  block: BlockFromConfig<T, I, S>,
55
- editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>
55
+ editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>,
56
56
  ) => {
57
57
  dom: HTMLElement;
58
58
  contentDOM?: HTMLElement;
59
59
  };
60
60
 
61
61
  parse?: (
62
- el: HTMLElement
62
+ el: HTMLElement,
63
63
  ) => PartialBlockFromConfig<T, I, S>["props"] | undefined;
64
64
  };
65
65
 
@@ -85,7 +85,7 @@ export function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor) {
85
85
  // from the clipboard.
86
86
  export function getParseRules(
87
87
  config: BlockConfig,
88
- customParseFunction: CustomBlockImplementation<any, any, any>["parse"]
88
+ customParseFunction: CustomBlockImplementation<any, any, any>["parse"],
89
89
  ) {
90
90
  const rules: TagParseRule[] = [
91
91
  {
@@ -136,10 +136,10 @@ export function getParseRules(
136
136
  export function createBlockSpec<
137
137
  T extends CustomBlockConfig,
138
138
  I extends InlineContentSchema,
139
- S extends StyleSchema
139
+ S extends StyleSchema,
140
140
  >(
141
141
  blockConfig: T,
142
- blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S>
142
+ blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S>,
143
143
  ) {
144
144
  const node = createStronglyTypedTiptapNode({
145
145
  name: blockConfig.type as T["type"],
@@ -173,7 +173,7 @@ export function createBlockSpec<
173
173
  {},
174
174
  blockConfig.propSchema,
175
175
  blockConfig.isFileBlock,
176
- HTMLAttributes
176
+ HTMLAttributes,
177
177
  );
178
178
  },
179
179
 
@@ -186,7 +186,7 @@ export function createBlockSpec<
186
186
  getPos,
187
187
  editor,
188
188
  this.editor,
189
- blockConfig.type
189
+ blockConfig.type,
190
190
  );
191
191
  // Gets the custom HTML attributes for `blockContent` nodes
192
192
  const blockContentDOMAttributes =
@@ -199,7 +199,7 @@ export function createBlockSpec<
199
199
  block.type,
200
200
  block.props,
201
201
  blockConfig.propSchema,
202
- blockContentDOMAttributes
202
+ blockContentDOMAttributes,
203
203
  );
204
204
 
205
205
  if (blockConfig.isSelectable === false) {
@@ -213,7 +213,7 @@ export function createBlockSpec<
213
213
 
214
214
  if (node.name !== blockConfig.type) {
215
215
  throw new Error(
216
- "Node name does not match block type. This is a bug in BlockNote."
216
+ "Node name does not match block type. This is a bug in BlockNote.",
217
217
  );
218
218
  }
219
219
 
@@ -231,7 +231,7 @@ export function createBlockSpec<
231
231
  block.props,
232
232
  blockConfig.propSchema,
233
233
  blockConfig.isFileBlock,
234
- blockContentDOMAttributes
234
+ blockContentDOMAttributes,
235
235
  );
236
236
  },
237
237
  // TODO: this should not have wrapInBlockStructure and generally be a lot simpler
@@ -242,7 +242,7 @@ export function createBlockSpec<
242
242
 
243
243
  let output = blockImplementation.toExternalHTML?.(
244
244
  block as any,
245
- editor as any
245
+ editor as any,
246
246
  );
247
247
  if (output === undefined) {
248
248
  output = blockImplementation.render(block as any, editor as any);
@@ -252,7 +252,7 @@ export function createBlockSpec<
252
252
  block.type,
253
253
  block.props,
254
254
  blockConfig.propSchema,
255
- blockContentDOMAttributes
255
+ blockContentDOMAttributes,
256
256
  );
257
257
  },
258
258
  });
@@ -99,17 +99,17 @@ export function getBlockFromPos<
99
99
  Config extends BlockConfig,
100
100
  BSchema extends BlockSchemaWithBlock<BType, Config>,
101
101
  I extends InlineContentSchema,
102
- S extends StyleSchema
102
+ S extends StyleSchema,
103
103
  >(
104
104
  getPos: (() => number) | boolean,
105
105
  editor: BlockNoteEditor<BSchema, I, S>,
106
106
  tipTapEditor: Editor,
107
- type: BType
107
+ type: BType,
108
108
  ) {
109
109
  // Gets position of the node
110
110
  if (typeof getPos === "boolean") {
111
111
  throw new Error(
112
- "Cannot find node position as getPos is a boolean, not a function."
112
+ "Cannot find node position as getPos is a boolean, not a function.",
113
113
  );
114
114
  }
115
115
  const pos = getPos();
@@ -142,7 +142,7 @@ export function getBlockFromPos<
142
142
  // an `inlineContent` class to it.
143
143
  export function wrapInBlockStructure<
144
144
  BType extends string,
145
- PSchema extends PropSchema
145
+ PSchema extends PropSchema,
146
146
  >(
147
147
  element: {
148
148
  dom: HTMLElement;
@@ -153,7 +153,7 @@ export function wrapInBlockStructure<
153
153
  blockProps: Props<PSchema>,
154
154
  propSchema: PSchema,
155
155
  isFileBlock = false,
156
- domAttributes?: Record<string, string>
156
+ domAttributes?: Record<string, string>,
157
157
  ): {
158
158
  dom: HTMLElement;
159
159
  contentDOM?: HTMLElement;
@@ -173,7 +173,7 @@ export function wrapInBlockStructure<
173
173
  // Sets blockContent class
174
174
  blockContent.className = mergeCSSClasses(
175
175
  "bn-block-content",
176
- domAttributes?.class || ""
176
+ domAttributes?.class || "",
177
177
  );
178
178
  // Sets content type attribute
179
179
  blockContent.setAttribute("data-content-type", blockType);
@@ -197,7 +197,7 @@ export function wrapInBlockStructure<
197
197
  if (element.contentDOM !== undefined) {
198
198
  element.contentDOM.className = mergeCSSClasses(
199
199
  "bn-inline-content",
200
- element.contentDOM.className
200
+ element.contentDOM.className,
201
201
  );
202
202
  }
203
203
 
@@ -215,7 +215,7 @@ type StronglyTypedTipTapNode<
215
215
  | "tableRow+"
216
216
  | "blockContainer+"
217
217
  | "column column+"
218
- | ""
218
+ | "",
219
219
  > = Node & { name: Name; config: { content: Content } };
220
220
 
221
221
  export function createStronglyTypedTiptapNode<
@@ -225,7 +225,7 @@ export function createStronglyTypedTiptapNode<
225
225
  | "tableRow+"
226
226
  | "blockContainer+"
227
227
  | "column column+"
228
- | ""
228
+ | "",
229
229
  >(config: NodeConfig & { name: Name; content: Content }) {
230
230
  return Node.create(config) as StronglyTypedTipTapNode<Name, Content>; // force re-typing (should be safe as it's type-checked from the config)
231
231
  }
@@ -239,7 +239,7 @@ export function createInternalBlockSpec<T extends BlockConfig>(
239
239
  any,
240
240
  InlineContentSchema,
241
241
  StyleSchema
242
- >
242
+ >,
243
243
  ) {
244
244
  return {
245
245
  config,
@@ -249,7 +249,7 @@ export function createInternalBlockSpec<T extends BlockConfig>(
249
249
 
250
250
  export function createBlockSpecFromStronglyTypedTiptapNode<
251
251
  T extends Node,
252
- P extends PropSchema
252
+ P extends PropSchema,
253
253
  >(node: T, propSchema: P, requiredExtensions?: Array<Extension | Node>) {
254
254
  return createInternalBlockSpec(
255
255
  {
@@ -257,12 +257,12 @@ export function createBlockSpecFromStronglyTypedTiptapNode<
257
257
  content: (node.config.content === "inline*"
258
258
  ? "inline"
259
259
  : node.config.content === "tableRow+"
260
- ? "table"
261
- : "none") as T["config"]["content"] extends "inline*"
260
+ ? "table"
261
+ : "none") as T["config"]["content"] extends "inline*"
262
262
  ? "inline"
263
263
  : T["config"]["content"] extends "tableRow+"
264
- ? "table"
265
- : "none",
264
+ ? "table"
265
+ : "none",
266
266
  propSchema,
267
267
  },
268
268
  {
@@ -271,12 +271,12 @@ export function createBlockSpecFromStronglyTypedTiptapNode<
271
271
  toInternalHTML: defaultBlockToHTML,
272
272
  toExternalHTML: defaultBlockToHTML,
273
273
  // parse: () => undefined, // parse rules are in node already
274
- }
274
+ },
275
275
  );
276
276
  }
277
277
 
278
278
  export function getBlockSchemaFromSpecs<T extends BlockSpecs>(specs: T) {
279
279
  return Object.fromEntries(
280
- Object.entries(specs).map(([key, value]) => [key, value.config])
280
+ Object.entries(specs).map(([key, value]) => [key, value.config]),
281
281
  ) as BlockSchemaFromSpecs<T>;
282
282
  }
@@ -74,7 +74,7 @@ export type TiptapBlockImplementation<
74
74
  T extends BlockConfig,
75
75
  B extends BlockSchema,
76
76
  I extends InlineContentSchema,
77
- S extends StyleSchema
77
+ S extends StyleSchema,
78
78
  > = {
79
79
  requiredExtensions?: Array<Extension | Node>;
80
80
  node: Node;
@@ -82,7 +82,7 @@ export type TiptapBlockImplementation<
82
82
  block: BlockFromConfigNoChildren<T, I, S> & {
83
83
  children: BlockNoDefaults<B, I, S>[];
84
84
  },
85
- editor: BlockNoteEditor<B, I, S>
85
+ editor: BlockNoteEditor<B, I, S>,
86
86
  ) => {
87
87
  dom: HTMLElement;
88
88
  contentDOM?: HTMLElement;
@@ -91,7 +91,7 @@ export type TiptapBlockImplementation<
91
91
  block: BlockFromConfigNoChildren<T, I, S> & {
92
92
  children: BlockNoDefaults<B, I, S>[];
93
93
  },
94
- editor: BlockNoteEditor<B, I, S>
94
+ editor: BlockNoteEditor<B, I, S>,
95
95
  ) => {
96
96
  dom: HTMLElement;
97
97
  contentDOM?: HTMLElement;
@@ -103,7 +103,7 @@ export type BlockSpec<
103
103
  T extends BlockConfig,
104
104
  B extends BlockSchema,
105
105
  I extends InlineContentSchema,
106
- S extends StyleSchema
106
+ S extends StyleSchema,
107
107
  > = {
108
108
  config: T;
109
109
  implementation: TiptapBlockImplementation<NoInfer<T>, B, I, S>;
@@ -141,7 +141,7 @@ export type BlockSchemaFromSpecs<T extends BlockSpecs> = {
141
141
 
142
142
  export type BlockSchemaWithBlock<
143
143
  BType extends string,
144
- C extends BlockConfig
144
+ C extends BlockConfig,
145
145
  > = {
146
146
  [k in BType]: C;
147
147
  };
@@ -156,7 +156,7 @@ export type TableCellProps = {
156
156
 
157
157
  export type TableCell<
158
158
  I extends InlineContentSchema,
159
- S extends StyleSchema = StyleSchema
159
+ S extends StyleSchema = StyleSchema,
160
160
  > = {
161
161
  type: "tableCell";
162
162
  props: TableCellProps;
@@ -165,7 +165,7 @@ export type TableCell<
165
165
 
166
166
  export type TableContent<
167
167
  I extends InlineContentSchema,
168
- S extends StyleSchema = StyleSchema
168
+ S extends StyleSchema = StyleSchema,
169
169
  > = {
170
170
  type: "tableContent";
171
171
  columnWidths: (number | undefined)[];
@@ -182,7 +182,7 @@ export type TableContent<
182
182
  export type BlockFromConfigNoChildren<
183
183
  B extends BlockConfig,
184
184
  I extends InlineContentSchema,
185
- S extends StyleSchema
185
+ S extends StyleSchema,
186
186
  > = {
187
187
  id: string;
188
188
  type: B["type"];
@@ -190,16 +190,16 @@ export type BlockFromConfigNoChildren<
190
190
  content: B["content"] extends "inline"
191
191
  ? InlineContent<I, S>[]
192
192
  : B["content"] extends "table"
193
- ? TableContent<I, S>
194
- : B["content"] extends "none"
195
- ? undefined
196
- : never;
193
+ ? TableContent<I, S>
194
+ : B["content"] extends "none"
195
+ ? undefined
196
+ : never;
197
197
  };
198
198
 
199
199
  export type BlockFromConfig<
200
200
  B extends BlockConfig,
201
201
  I extends InlineContentSchema,
202
- S extends StyleSchema
202
+ S extends StyleSchema,
203
203
  > = BlockFromConfigNoChildren<B, I, S> & {
204
204
  children: BlockNoDefaults<BlockSchema, I, S>[];
205
205
  };
@@ -210,7 +210,7 @@ export type BlockFromConfig<
210
210
  type BlocksWithoutChildren<
211
211
  BSchema extends BlockSchema,
212
212
  I extends InlineContentSchema,
213
- S extends StyleSchema
213
+ S extends StyleSchema,
214
214
  > = {
215
215
  [BType in keyof BSchema]: BlockFromConfigNoChildren<BSchema[BType], I, S>;
216
216
  };
@@ -220,7 +220,7 @@ type BlocksWithoutChildren<
220
220
  export type BlockNoDefaults<
221
221
  BSchema extends BlockSchema,
222
222
  I extends InlineContentSchema,
223
- S extends StyleSchema
223
+ S extends StyleSchema,
224
224
  > = BlocksWithoutChildren<BSchema, I, S>[keyof BSchema] & {
225
225
  children: BlockNoDefaults<BSchema, I, S>[];
226
226
  };
@@ -229,7 +229,7 @@ export type SpecificBlock<
229
229
  BSchema extends BlockSchema,
230
230
  BType extends keyof BSchema,
231
231
  I extends InlineContentSchema,
232
- S extends StyleSchema
232
+ S extends StyleSchema,
233
233
  > = BlocksWithoutChildren<BSchema, I, S>[BType] & {
234
234
  children: BlockNoDefaults<BSchema, I, S>[];
235
235
  };
@@ -243,7 +243,7 @@ export type SpecificBlock<
243
243
 
244
244
  export type PartialTableCell<
245
245
  I extends InlineContentSchema,
246
- S extends StyleSchema = StyleSchema
246
+ S extends StyleSchema = StyleSchema,
247
247
  > = {
248
248
  type: "tableCell";
249
249
  props?: Partial<TableCellProps>;
@@ -252,7 +252,7 @@ export type PartialTableCell<
252
252
 
253
253
  export type PartialTableContent<
254
254
  I extends InlineContentSchema,
255
- S extends StyleSchema = StyleSchema
255
+ S extends StyleSchema = StyleSchema,
256
256
  > = {
257
257
  type: "tableContent";
258
258
  columnWidths?: (number | undefined)[];
@@ -266,7 +266,7 @@ export type PartialTableContent<
266
266
  type PartialBlockFromConfigNoChildren<
267
267
  B extends BlockConfig,
268
268
  I extends InlineContentSchema,
269
- S extends StyleSchema
269
+ S extends StyleSchema,
270
270
  > = {
271
271
  id?: string;
272
272
  type?: B["type"];
@@ -274,14 +274,14 @@ type PartialBlockFromConfigNoChildren<
274
274
  content?: B["content"] extends "inline"
275
275
  ? PartialInlineContent<I, S>
276
276
  : B["content"] extends "table"
277
- ? PartialTableContent<I, S>
278
- : undefined;
277
+ ? PartialTableContent<I, S>
278
+ : undefined;
279
279
  };
280
280
 
281
281
  type PartialBlocksWithoutChildren<
282
282
  BSchema extends BlockSchema,
283
283
  I extends InlineContentSchema,
284
- S extends StyleSchema
284
+ S extends StyleSchema,
285
285
  > = {
286
286
  [BType in keyof BSchema]: PartialBlockFromConfigNoChildren<
287
287
  BSchema[BType],
@@ -293,7 +293,7 @@ type PartialBlocksWithoutChildren<
293
293
  export type PartialBlockNoDefaults<
294
294
  BSchema extends BlockSchema,
295
295
  I extends InlineContentSchema,
296
- S extends StyleSchema
296
+ S extends StyleSchema,
297
297
  > = PartialBlocksWithoutChildren<
298
298
  BSchema,
299
299
  I,
@@ -307,7 +307,7 @@ export type SpecificPartialBlock<
307
307
  BSchema extends BlockSchema,
308
308
  I extends InlineContentSchema,
309
309
  BType extends keyof BSchema,
310
- S extends StyleSchema
310
+ S extends StyleSchema,
311
311
  > = PartialBlocksWithoutChildren<BSchema, I, S>[BType] & {
312
312
  children?: BlockNoDefaults<BSchema, I, S>[];
313
313
  };
@@ -315,7 +315,7 @@ export type SpecificPartialBlock<
315
315
  export type PartialBlockFromConfig<
316
316
  B extends BlockConfig,
317
317
  I extends InlineContentSchema,
318
- S extends StyleSchema
318
+ S extends StyleSchema,
319
319
  > = PartialBlockFromConfigNoChildren<B, I, S> & {
320
320
  children?: BlockNoDefaults<BlockSchema, I, S>[];
321
321
  };