@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
@@ -5,7 +5,7 @@ export const createAddFileButton = (
5
5
  block: BlockFromConfig<FileBlockConfig, any, any>,
6
6
  editor: BlockNoteEditor<any, any, any>,
7
7
  buttonText?: string,
8
- buttonIcon?: HTMLElement
8
+ buttonIcon?: HTMLElement,
9
9
  ) => {
10
10
  const addFileButton = document.createElement("div");
11
11
  addFileButton.className = "bn-add-file-button";
@@ -35,13 +35,13 @@ export const createAddFileButton = (
35
35
  editor.transact((tr) =>
36
36
  tr.setMeta(editor.filePanel!.plugin, {
37
37
  block: block,
38
- })
38
+ }),
39
39
  );
40
40
  };
41
41
  addFileButton.addEventListener(
42
42
  "mousedown",
43
43
  addFileButtonMouseDownHandler,
44
- true
44
+ true,
45
45
  );
46
46
  addFileButton.addEventListener("click", addFileButtonClickHandler, true);
47
47
 
@@ -51,12 +51,12 @@ export const createAddFileButton = (
51
51
  addFileButton.removeEventListener(
52
52
  "mousedown",
53
53
  addFileButtonMouseDownHandler,
54
- true
54
+ true,
55
55
  );
56
56
  addFileButton.removeEventListener(
57
57
  "click",
58
58
  addFileButtonClickHandler,
59
- true
59
+ true,
60
60
  );
61
61
  },
62
62
  };
@@ -16,7 +16,7 @@ export const createFileBlockWrapper = (
16
16
  >,
17
17
  element?: { dom: HTMLElement; destroy?: () => void },
18
18
  buttonText?: string,
19
- buttonIcon?: HTMLElement
19
+ buttonIcon?: HTMLElement,
20
20
  ) => {
21
21
  const wrapper = document.createElement("div");
22
22
  wrapper.className = "bn-file-block-content-wrapper";
@@ -28,7 +28,7 @@ export const createFileBlockWrapper = (
28
28
  block,
29
29
  editor,
30
30
  buttonText,
31
- buttonIcon
31
+ buttonIcon,
32
32
  );
33
33
  wrapper.appendChild(addFileButton.dom);
34
34
 
@@ -3,7 +3,7 @@ import { BlockFromConfig, FileBlockConfig } from "../../../../schema/index.js";
3
3
  export const FILE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>`;
4
4
 
5
5
  export const createFileNameWithIcon = (
6
- block: BlockFromConfig<FileBlockConfig, any, any>
6
+ block: BlockFromConfig<FileBlockConfig, any, any>,
7
7
  ): { dom: HTMLElement; destroy?: () => void } => {
8
8
  const file = document.createElement("div");
9
9
  file.className = "bn-file-name-with-icon";
@@ -8,14 +8,14 @@ export const createResizableFileBlockWrapper = (
8
8
  element: { dom: HTMLElement; destroy?: () => void },
9
9
  resizeHandlesContainerElement: HTMLElement,
10
10
  buttonText: string,
11
- buttonIcon: HTMLElement
11
+ buttonIcon: HTMLElement,
12
12
  ): { dom: HTMLElement; destroy: () => void } => {
13
13
  const { dom, destroy } = createFileBlockWrapper(
14
14
  block,
15
15
  editor,
16
16
  element,
17
17
  buttonText,
18
- buttonIcon
18
+ buttonIcon,
19
19
  );
20
20
  const wrapper = dom;
21
21
  if (block.props.url && block.props.showPreview) {
@@ -93,7 +93,7 @@ export const createResizableFileBlockWrapper = (
93
93
  // predetermined minimum width.
94
94
  width = Math.min(
95
95
  Math.max(newWidth, minWidth),
96
- editor.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE
96
+ editor.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE,
97
97
  );
98
98
  wrapper.style.width = `${width}px`;
99
99
  };
@@ -183,11 +183,11 @@ export const createResizableFileBlockWrapper = (
183
183
  wrapper.addEventListener("mouseleave", wrapperMouseLeaveHandler);
184
184
  leftResizeHandle.addEventListener(
185
185
  "mousedown",
186
- leftResizeHandleMouseDownHandler
186
+ leftResizeHandleMouseDownHandler,
187
187
  );
188
188
  rightResizeHandle.addEventListener(
189
189
  "mousedown",
190
- rightResizeHandleMouseDownHandler
190
+ rightResizeHandleMouseDownHandler,
191
191
  );
192
192
 
193
193
  return {
@@ -200,11 +200,11 @@ export const createResizableFileBlockWrapper = (
200
200
  wrapper.removeEventListener("mouseleave", wrapperMouseLeaveHandler);
201
201
  leftResizeHandle.removeEventListener(
202
202
  "mousedown",
203
- leftResizeHandleMouseDownHandler
203
+ leftResizeHandleMouseDownHandler,
204
204
  );
205
205
  rightResizeHandle.removeEventListener(
206
206
  "mousedown",
207
- rightResizeHandleMouseDownHandler
207
+ rightResizeHandleMouseDownHandler,
208
208
  );
209
209
  },
210
210
  };
@@ -1,6 +1,6 @@
1
1
  export const createFigureWithCaption = (
2
2
  element: HTMLElement,
3
- caption: string
3
+ caption: string,
4
4
  ) => {
5
5
  const figure = document.createElement("figure");
6
6
  const captionElement = document.createElement("figcaption");
@@ -1,6 +1,6 @@
1
1
  export const createLinkWithCaption = (
2
2
  element: HTMLElement,
3
- caption: string
3
+ caption: string,
4
4
  ) => {
5
5
  const wrapper = document.createElement("div");
6
6
  const fileCaption = document.createElement("p");
@@ -4,7 +4,7 @@
4
4
  * @warning This function should only be used for development purposes, replace with your own backend!
5
5
  */
6
6
  export const uploadToTmpFilesDotOrg_DEV_ONLY = async (
7
- file: File
7
+ file: File,
8
8
  ): Promise<string> => {
9
9
  const body = new FormData();
10
10
  body.append("file", file);
@@ -15,6 +15,6 @@ export const uploadToTmpFilesDotOrg_DEV_ONLY = async (
15
15
  });
16
16
  return (await ret.json()).data.url.replace(
17
17
  "tmpfiles.org/",
18
- "tmpfiles.org/dl/"
18
+ "tmpfiles.org/dl/",
19
19
  );
20
20
  };
@@ -46,7 +46,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
46
46
  props: {
47
47
  level: level as any,
48
48
  },
49
- })
49
+ }),
50
50
  )
51
51
  // Removes the "#" character(s) used to set the heading.
52
52
  .deleteRange({ from: range.from, to: range.to })
@@ -75,7 +75,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
75
75
  props: {
76
76
  level: 1 as any,
77
77
  },
78
- })
78
+ }),
79
79
  );
80
80
  },
81
81
  "Mod-Alt-2": () => {
@@ -93,7 +93,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
93
93
  props: {
94
94
  level: 2 as any,
95
95
  },
96
- })
96
+ }),
97
97
  );
98
98
  },
99
99
  "Mod-Alt-3": () => {
@@ -111,7 +111,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
111
111
  props: {
112
112
  level: 3 as any,
113
113
  },
114
- })
114
+ }),
115
115
  );
116
116
  },
117
117
  };
@@ -150,12 +150,12 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
150
150
  ...(this.options.domAttributes?.blockContent || {}),
151
151
  ...HTMLAttributes,
152
152
  },
153
- this.options.domAttributes?.inlineContent || {}
153
+ this.options.domAttributes?.inlineContent || {},
154
154
  );
155
155
  },
156
156
  });
157
157
 
158
158
  export const Heading = createBlockSpecFromStronglyTypedTiptapNode(
159
159
  HeadingBlockContent,
160
- headingPropSchema
160
+ headingPropSchema,
161
161
  );
@@ -52,7 +52,7 @@ export const imageBlockConfig = {
52
52
 
53
53
  export const imageRender = (
54
54
  block: BlockFromConfig<typeof imageBlockConfig, any, any>,
55
- editor: BlockNoteEditor<any, any, any>
55
+ editor: BlockNoteEditor<any, any, any>,
56
56
  ) => {
57
57
  const icon = document.createElement("div");
58
58
  icon.innerHTML = FILE_IMAGE_ICON_SVG;
@@ -81,12 +81,12 @@ export const imageRender = (
81
81
  { dom: imageWrapper },
82
82
  imageWrapper,
83
83
  editor.dictionary.file_blocks.image.add_button_text,
84
- icon.firstElementChild as HTMLElement
84
+ icon.firstElementChild as HTMLElement,
85
85
  );
86
86
  };
87
87
 
88
88
  export const imageParse = (
89
- element: HTMLElement
89
+ element: HTMLElement,
90
90
  ): Partial<Props<typeof imageBlockConfig.propSchema>> | undefined => {
91
91
  if (element.tagName === "IMG") {
92
92
  // Ignore if parent figure has already been parsed.
@@ -115,7 +115,7 @@ export const imageParse = (
115
115
  };
116
116
 
117
117
  export const imageToExternalHTML = (
118
- block: BlockFromConfig<typeof imageBlockConfig, any, any>
118
+ block: BlockFromConfig<typeof imageBlockConfig, any, any>,
119
119
  ) => {
120
120
  if (!block.props.url) {
121
121
  const div = document.createElement("p");
@@ -41,7 +41,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
41
41
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
42
42
  type: "bulletListItem",
43
43
  props: {},
44
- })
44
+ }),
45
45
  )
46
46
  // Removes the "-", "+", or "*" character used to set the list.
47
47
  .deleteRange({ from: range.from, to: range.to });
@@ -66,7 +66,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
66
66
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
67
67
  type: "bulletListItem",
68
68
  props: {},
69
- })
69
+ }),
70
70
  );
71
71
  },
72
72
  };
@@ -122,12 +122,12 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
122
122
  ...(this.options.domAttributes?.blockContent || {}),
123
123
  ...HTMLAttributes,
124
124
  },
125
- this.options.domAttributes?.inlineContent || {}
125
+ this.options.domAttributes?.inlineContent || {},
126
126
  );
127
127
  },
128
128
  });
129
129
 
130
130
  export const BulletListItem = createBlockSpecFromStronglyTypedTiptapNode(
131
131
  BulletListItemBlockContent,
132
- bulletListItemPropSchema
132
+ bulletListItemPropSchema,
133
133
  );
@@ -52,7 +52,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
52
52
  props: {
53
53
  checked: false as any,
54
54
  },
55
- })
55
+ }),
56
56
  )
57
57
  // Removes the characters used to set the list.
58
58
  .deleteRange({ from: range.from, to: range.to });
@@ -77,7 +77,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
77
77
  props: {
78
78
  checked: true as any,
79
79
  },
80
- })
80
+ }),
81
81
  )
82
82
  // Removes the characters used to set the list.
83
83
  .deleteRange({ from: range.from, to: range.to });
@@ -102,7 +102,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
102
102
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
103
103
  type: "checkListItem",
104
104
  props: {},
105
- })
105
+ }),
106
106
  );
107
107
  },
108
108
  };
@@ -155,7 +155,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
155
155
  ) {
156
156
  const checkbox =
157
157
  (element.querySelector(
158
- "input[type=checkbox]"
158
+ "input[type=checkbox]",
159
159
  ) as HTMLInputElement) || null;
160
160
 
161
161
  if (checkbox === null) {
@@ -196,7 +196,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
196
196
  ...(this.options.domAttributes?.blockContent || {}),
197
197
  ...HTMLAttributes,
198
198
  },
199
- this.options.domAttributes?.inlineContent || {}
199
+ this.options.domAttributes?.inlineContent || {},
200
200
  );
201
201
 
202
202
  dom.insertBefore(checkbox, contentDOM);
@@ -234,12 +234,12 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
234
234
  if (typeof getPos !== "boolean") {
235
235
  const beforeBlockContainerPos = getNearestBlockPos(
236
236
  editor.state.doc,
237
- getPos()
237
+ getPos(),
238
238
  );
239
239
 
240
240
  if (beforeBlockContainerPos.node.type.name !== "blockContainer") {
241
241
  throw new Error(
242
- `Expected blockContainer node, got ${beforeBlockContainerPos.node.type.name}`
242
+ `Expected blockContainer node, got ${beforeBlockContainerPos.node.type.name}`,
243
243
  );
244
244
  }
245
245
 
@@ -249,7 +249,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
249
249
  props: {
250
250
  checked: checkbox.checked as any,
251
251
  },
252
- })
252
+ }),
253
253
  );
254
254
  }
255
255
  };
@@ -262,7 +262,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
262
262
  ...(this.options.domAttributes?.blockContent || {}),
263
263
  ...HTMLAttributes,
264
264
  },
265
- this.options.domAttributes?.inlineContent || {}
265
+ this.options.domAttributes?.inlineContent || {},
266
266
  );
267
267
 
268
268
  if (typeof getPos !== "boolean") {
@@ -295,5 +295,5 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
295
295
 
296
296
  export const CheckListItem = createBlockSpecFromStronglyTypedTiptapNode(
297
297
  checkListItemBlockContent,
298
- checkListItemPropSchema
298
+ checkListItemPropSchema,
299
299
  );
@@ -36,7 +36,7 @@ export const handleEnter = (editor: BlockNoteEditor<any, any, any>) => {
36
36
  updateBlockCommand(blockContainer.beforePos, {
37
37
  type: "paragraph",
38
38
  props: {},
39
- })
39
+ }),
40
40
  );
41
41
  }
42
42
 
@@ -35,7 +35,7 @@ export const NumberedListIndexingPlugin = () => {
35
35
  // first block in its nesting level, or the previous block is not an ordered list item.
36
36
 
37
37
  const prevBlock = tr.doc.resolve(
38
- blockInfo.bnBlock.beforePos
38
+ blockInfo.bnBlock.beforePos,
39
39
  ).nodeBefore;
40
40
 
41
41
  if (prevBlock) {
@@ -65,7 +65,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
65
65
  ({
66
66
  start: startIndex,
67
67
  } as any),
68
- })
68
+ }),
69
69
  )
70
70
  // Removes the "1." characters used to set the list.
71
71
  .deleteRange({ from: range.from, to: range.to });
@@ -90,7 +90,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
90
90
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
91
91
  type: "numberedListItem",
92
92
  props: {},
93
- })
93
+ }),
94
94
  );
95
95
  },
96
96
  };
@@ -160,12 +160,12 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
160
160
  ...(this.options.domAttributes?.blockContent || {}),
161
161
  ...HTMLAttributes,
162
162
  },
163
- this.options.domAttributes?.inlineContent || {}
163
+ this.options.domAttributes?.inlineContent || {},
164
164
  );
165
165
  },
166
166
  });
167
167
 
168
168
  export const NumberedListItem = createBlockSpecFromStronglyTypedTiptapNode(
169
169
  NumberedListItemBlockContent,
170
- numberedListItemPropSchema
170
+ numberedListItemPropSchema,
171
171
  );
@@ -26,7 +26,7 @@ export function getListItemContent(
26
26
  /**
27
27
  * The name of the list item node.
28
28
  */
29
- name: string
29
+ name: string,
30
30
  ): Fragment {
31
31
  /**
32
32
  * To actually implement this algorithm, we need to leverage ProseMirror's "fitting" algorithm.
@@ -70,8 +70,8 @@ export function getListItemContent(
70
70
  // and continuing with the rest of the algorithm.
71
71
  blockGroupNode = blockGroupNode.copy(
72
72
  blockGroupNode.content.cut(
73
- blockGroupNode.firstChild.firstChild.nodeSize + 2
74
- )
73
+ blockGroupNode.firstChild.firstChild.nodeSize + 2,
74
+ ),
75
75
  );
76
76
  }
77
77
 
@@ -90,14 +90,14 @@ export function getListItemContent(
90
90
  // The remaining nodes in the `blockGroup` stay in-place.
91
91
  const listItemNode = schema.nodes[name].create(
92
92
  {},
93
- listItemsFirstChild.content
93
+ listItemsFirstChild.content,
94
94
  );
95
95
 
96
96
  // We have `blockGroup<listItemsFirstChild, ...blockContainer<any>[]>`
97
97
  // We want to extract out the rest of the nodes as `<...blockContainer<any>[]>`
98
98
  const remainingListItemChildren = blockGroupNode.content.cut(
99
99
  // +2 for the `blockGroup` node's start and end markers
100
- listItemsFirstChild.nodeSize + 2
100
+ listItemsFirstChild.nodeSize + 2,
101
101
  );
102
102
  const hasRemainingListItemChildren = remainingListItemChildren.size > 0;
103
103
 
@@ -22,7 +22,7 @@ export const pageBreakRender = () => {
22
22
  };
23
23
  };
24
24
  export const pageBreakParse = (
25
- element: HTMLElement
25
+ element: HTMLElement,
26
26
  ): Partial<Props<typeof pageBreakConfig.propSchema>> | undefined => {
27
27
  if (element.tagName === "DIV" && element.hasAttribute("data-page-break")) {
28
28
  return {
@@ -10,9 +10,9 @@ import { pageBreakSchema } from "./schema.js";
10
10
 
11
11
  export function checkPageBreakBlocksInSchema<
12
12
  I extends InlineContentSchema,
13
- S extends StyleSchema
13
+ S extends StyleSchema,
14
14
  >(
15
- editor: BlockNoteEditor<any, I, S>
15
+ editor: BlockNoteEditor<any, I, S>,
16
16
  ): editor is BlockNoteEditor<typeof pageBreakSchema.blockSchema, I, S> {
17
17
  return (
18
18
  "pageBreak" in editor.schema.blockSchema &&
@@ -24,7 +24,7 @@ export function checkPageBreakBlocksInSchema<
24
24
  export function getPageBreakSlashMenuItems<
25
25
  BSchema extends BlockSchema,
26
26
  I extends InlineContentSchema,
27
- S extends StyleSchema
27
+ S extends StyleSchema,
28
28
  >(editor: BlockNoteEditor<BSchema, I, S>) {
29
29
  const items: (Omit<DefaultSuggestionItem, "key"> & { key: "page_break" })[] =
30
30
  [];
@@ -18,9 +18,9 @@ export const pageBreakSchema = BlockNoteSchema.create({
18
18
  export const withPageBreak = <
19
19
  B extends BlockSchema,
20
20
  I extends InlineContentSchema,
21
- S extends StyleSchema
21
+ S extends StyleSchema,
22
22
  >(
23
- schema: BlockNoteSchema<B, I, S>
23
+ schema: BlockNoteSchema<B, I, S>,
24
24
  ) => {
25
25
  return BlockNoteSchema.create({
26
26
  blockSpecs: {
@@ -31,7 +31,7 @@ export const ParagraphBlockContent = createStronglyTypedTiptapNode({
31
31
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
32
32
  type: "paragraph",
33
33
  props: {},
34
- })
34
+ }),
35
35
  );
36
36
  },
37
37
  };
@@ -67,12 +67,12 @@ export const ParagraphBlockContent = createStronglyTypedTiptapNode({
67
67
  ...(this.options.domAttributes?.blockContent || {}),
68
68
  ...HTMLAttributes,
69
69
  },
70
- this.options.domAttributes?.inlineContent || {}
70
+ this.options.domAttributes?.inlineContent || {},
71
71
  );
72
72
  },
73
73
  });
74
74
 
75
75
  export const Paragraph = createBlockSpecFromStronglyTypedTiptapNode(
76
76
  ParagraphBlockContent,
77
- paragraphPropSchema
77
+ paragraphPropSchema,
78
78
  );
@@ -36,7 +36,7 @@ export const QuoteBlockContent = createStronglyTypedTiptapNode({
36
36
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
37
37
  type: "quote",
38
38
  props: {},
39
- })
39
+ }),
40
40
  )
41
41
  // Removes the ">" character used to set the list.
42
42
  .deleteRange({ from: range.from, to: range.to });
@@ -59,7 +59,7 @@ export const QuoteBlockContent = createStronglyTypedTiptapNode({
59
59
  return this.editor.commands.command(
60
60
  updateBlockCommand(blockInfo.bnBlock.beforePos, {
61
61
  type: "quote",
62
- })
62
+ }),
63
63
  );
64
64
  },
65
65
  };
@@ -88,12 +88,12 @@ export const QuoteBlockContent = createStronglyTypedTiptapNode({
88
88
  ...(this.options.domAttributes?.blockContent || {}),
89
89
  ...HTMLAttributes,
90
90
  },
91
- this.options.domAttributes?.inlineContent || {}
91
+ this.options.domAttributes?.inlineContent || {},
92
92
  );
93
93
  },
94
94
  });
95
95
 
96
96
  export const Quote = createBlockSpecFromStronglyTypedTiptapNode(
97
97
  QuoteBlockContent,
98
- quotePropSchema
98
+ quotePropSchema,
99
99
  );
@@ -1,3 +1,3 @@
1
1
  ### @blocknote/core/src/blocks
2
2
 
3
- The default built-in blocks that ship with BlockNote
3
+ The default built-in blocks that ship with BlockNote
@@ -42,7 +42,7 @@ export const TableBlockContent = createStronglyTypedTiptapNode({
42
42
  ...(this.options.domAttributes?.blockContent || {}),
43
43
  ...HTMLAttributes,
44
44
  },
45
- this.options.domAttributes?.inlineContent || {}
45
+ this.options.domAttributes?.inlineContent || {},
46
46
  );
47
47
  },
48
48
 
@@ -59,18 +59,18 @@ export const TableBlockContent = createStronglyTypedTiptapNode({
59
59
  constructor(
60
60
  public node: PMNode,
61
61
  public cellMinWidth: number,
62
- public blockContentHTMLAttributes: Record<string, string>
62
+ public blockContentHTMLAttributes: Record<string, string>,
63
63
  ) {
64
64
  super(node, cellMinWidth);
65
65
 
66
66
  const blockContent = document.createElement("div");
67
67
  blockContent.className = mergeCSSClasses(
68
68
  "bn-block-content",
69
- blockContentHTMLAttributes.class
69
+ blockContentHTMLAttributes.class,
70
70
  );
71
71
  blockContent.setAttribute("data-content-type", "table");
72
72
  for (const [attribute, value] of Object.entries(
73
- blockContentHTMLAttributes
73
+ blockContentHTMLAttributes,
74
74
  )) {
75
75
  if (attribute !== "class") {
76
76
  blockContent.setAttribute(attribute, value);
@@ -229,5 +229,5 @@ export const Table = createBlockSpecFromStronglyTypedTiptapNode(
229
229
  },
230
230
  }),
231
231
  TableRow,
232
- ]
232
+ ],
233
233
  );
@@ -56,12 +56,12 @@ export const TableExtension = Extension.create({
56
56
  // Enables navigating cells using the tab key.
57
57
  Tab: () => {
58
58
  return this.editor.commands.command(({ state, dispatch, view }) =>
59
- goToNextCell(1)(state, dispatch, view)
59
+ goToNextCell(1)(state, dispatch, view),
60
60
  );
61
61
  },
62
62
  "Shift-Tab": () => {
63
63
  return this.editor.commands.command(({ state, dispatch, view }) =>
64
- goToNextCell(-1)(state, dispatch, view)
64
+ goToNextCell(-1)(state, dispatch, view),
65
65
  );
66
66
  },
67
67
  };
@@ -76,7 +76,7 @@ export const TableExtension = Extension.create({
76
76
 
77
77
  return {
78
78
  tableRole: callOrReturn(
79
- getExtensionField(extension, "tableRole", context)
79
+ getExtensionField(extension, "tableRole", context),
80
80
  ),
81
81
  };
82
82
  },
@@ -52,7 +52,7 @@ export const videoBlockConfig = {
52
52
 
53
53
  export const videoRender = (
54
54
  block: BlockFromConfig<typeof videoBlockConfig, any, any>,
55
- editor: BlockNoteEditor<any, any, any>
55
+ editor: BlockNoteEditor<any, any, any>,
56
56
  ) => {
57
57
  const icon = document.createElement("div");
58
58
  icon.innerHTML = FILE_VIDEO_ICON_SVG;
@@ -81,12 +81,12 @@ export const videoRender = (
81
81
  { dom: videoWrapper },
82
82
  videoWrapper,
83
83
  editor.dictionary.file_blocks.video.add_button_text,
84
- icon.firstElementChild as HTMLElement
84
+ icon.firstElementChild as HTMLElement,
85
85
  );
86
86
  };
87
87
 
88
88
  export const videoParse = (
89
- element: HTMLElement
89
+ element: HTMLElement,
90
90
  ): Partial<Props<typeof videoBlockConfig.propSchema>> | undefined => {
91
91
  if (element.tagName === "VIDEO") {
92
92
  // Ignore if parent figure has already been parsed.
@@ -115,7 +115,7 @@ export const videoParse = (
115
115
  };
116
116
 
117
117
  export const videoToExternalHTML = (
118
- block: BlockFromConfig<typeof videoBlockConfig, any, any>
118
+ block: BlockFromConfig<typeof videoBlockConfig, any, any>,
119
119
  ) => {
120
120
  if (!block.props.url) {
121
121
  const div = document.createElement("p");