@blocknote/core 0.30.0 → 0.31.0

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 (245) hide show
  1. package/dist/blocknote.cjs +9 -9
  2. package/dist/blocknote.cjs.map +1 -1
  3. package/dist/blocknote.js +2771 -2245
  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/{en-D4taoCs4.cjs → en-BXVKCwYt.cjs} +2 -2
  8. package/dist/en-BXVKCwYt.cjs.map +1 -0
  9. package/dist/{en-B7ycW7c8.js → en-qGo6sk9V.js} +2 -3
  10. package/dist/en-qGo6sk9V.js.map +1 -0
  11. package/dist/locales.cjs +1 -1
  12. package/dist/locales.cjs.map +1 -1
  13. package/dist/locales.js +20 -39
  14. package/dist/locales.js.map +1 -1
  15. package/dist/style.css +1 -1
  16. package/dist/webpack-stats.json +1 -1
  17. package/package.json +8 -7
  18. package/src/api/README.md +1 -1
  19. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
  20. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +7 -8
  21. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
  22. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
  23. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
  24. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
  25. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
  26. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
  27. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +8 -8
  28. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
  29. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
  30. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2816 -0
  31. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +200 -42
  32. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +104 -34
  33. package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
  34. package/src/api/blockManipulation/insertContentAt.ts +1 -1
  35. package/src/api/blockManipulation/selections/selection.ts +59 -12
  36. package/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.ts → textCursorPosition.ts} +13 -13
  37. package/src/api/blockManipulation/tables/tables.test.ts +106 -106
  38. package/src/api/blockManipulation/tables/tables.ts +35 -35
  39. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
  40. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
  41. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
  42. package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
  43. package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
  44. package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
  45. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
  46. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
  47. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
  48. package/src/api/exporters/markdown/markdownExporter.ts +3 -3
  49. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
  50. package/src/api/getBlockInfoFromPos.ts +6 -6
  51. package/src/api/nodeConversions/blockToNode.ts +31 -28
  52. package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
  53. package/src/api/nodeConversions/nodeToBlock.ts +240 -41
  54. package/src/api/nodeUtil.test.ts +16 -16
  55. package/src/api/nodeUtil.ts +10 -10
  56. package/src/api/parsers/html/parseHTML.ts +1 -1
  57. package/src/api/parsers/html/util/nestedLists.ts +2 -2
  58. package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
  59. package/src/api/pmUtil.ts +7 -7
  60. package/src/api/positionMapping.test.ts +3 -3
  61. package/src/api/positionMapping.ts +5 -5
  62. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
  63. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +18 -18
  64. package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
  65. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
  66. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +6 -6
  67. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
  68. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
  69. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
  70. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
  71. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
  72. package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
  73. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
  74. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
  75. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
  76. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
  77. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
  78. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
  79. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
  80. package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
  81. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
  82. package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
  83. package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
  84. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
  85. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
  86. package/src/blocks/README.md +1 -1
  87. package/src/blocks/TableBlockContent/TableBlockContent.ts +37 -7
  88. package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
  89. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
  90. package/src/blocks/defaultBlockHelpers.ts +8 -8
  91. package/src/blocks/defaultBlockTypeGuards.ts +16 -16
  92. package/src/blocks/defaultBlocks.ts +3 -3
  93. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
  94. package/src/comments/threadstore/ThreadStore.ts +1 -1
  95. package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
  96. package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
  97. package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
  98. package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
  99. package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
  100. package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
  101. package/src/editor/Block.css +35 -1
  102. package/src/editor/BlockNoteEditor.test.ts +10 -3
  103. package/src/editor/BlockNoteEditor.ts +95 -38
  104. package/src/editor/BlockNoteExtension.ts +26 -0
  105. package/src/editor/BlockNoteExtensions.ts +38 -22
  106. package/src/editor/BlockNoteSchema.ts +4 -4
  107. package/src/editor/BlockNoteTipTapEditor.ts +33 -12
  108. package/src/editor/README.md +1 -1
  109. package/src/editor/cursorPositionTypes.ts +1 -1
  110. package/src/editor/editor.css +15 -3
  111. package/src/editor/selectionTypes.ts +1 -1
  112. package/src/editor/transformPasted.ts +2 -2
  113. package/src/exporter/Exporter.ts +5 -5
  114. package/src/exporter/mapping.ts +7 -7
  115. package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
  116. package/src/extensions/Collaboration/CursorPlugin.ts +15 -9
  117. package/src/extensions/Collaboration/ForkYDocPlugin.test.ts +166 -0
  118. package/src/extensions/Collaboration/ForkYDocPlugin.ts +174 -0
  119. package/src/extensions/Collaboration/SyncPlugin.ts +7 -4
  120. package/src/extensions/Collaboration/UndoPlugin.ts +7 -4
  121. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +30 -0
  122. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +30 -0
  123. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -0
  124. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -0
  125. package/src/extensions/Comments/CommentsPlugin.ts +80 -75
  126. package/src/extensions/Comments/userstore/UserStore.ts +2 -2
  127. package/src/extensions/FilePanel/FilePanelPlugin.ts +56 -55
  128. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +60 -30
  129. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
  130. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +33 -32
  131. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
  132. package/src/extensions/Placeholder/PlaceholderPlugin.ts +113 -110
  133. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +179 -170
  134. package/src/extensions/README.md +1 -1
  135. package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +22 -19
  136. package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
  137. package/src/extensions/SideMenu/SideMenuPlugin.ts +49 -48
  138. package/src/extensions/SideMenu/dragging.ts +8 -8
  139. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +176 -176
  140. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
  141. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +16 -16
  142. package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
  143. package/src/extensions/TableHandles/TableHandlesPlugin.ts +199 -195
  144. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  145. package/src/extensions/UniqueID/UniqueID.ts +6 -6
  146. package/src/extensions/getDraggableBlockFromElement.ts +1 -1
  147. package/src/fonts/inter.css +18 -9
  148. package/src/i18n/locales/ar.ts +0 -1
  149. package/src/i18n/locales/de.ts +0 -1
  150. package/src/i18n/locales/en.ts +0 -1
  151. package/src/i18n/locales/es.ts +0 -1
  152. package/src/i18n/locales/fr.ts +0 -1
  153. package/src/i18n/locales/hr.ts +0 -1
  154. package/src/i18n/locales/is.ts +0 -1
  155. package/src/i18n/locales/it.ts +0 -1
  156. package/src/i18n/locales/ja.ts +0 -1
  157. package/src/i18n/locales/ko.ts +0 -1
  158. package/src/i18n/locales/nl.ts +0 -1
  159. package/src/i18n/locales/no.ts +0 -1
  160. package/src/i18n/locales/pl.ts +0 -1
  161. package/src/i18n/locales/pt.ts +0 -1
  162. package/src/i18n/locales/ru.ts +0 -1
  163. package/src/i18n/locales/sk.ts +0 -1
  164. package/src/i18n/locales/uk.ts +0 -1
  165. package/src/i18n/locales/vi.ts +0 -1
  166. package/src/i18n/locales/zh-tw.ts +0 -1
  167. package/src/i18n/locales/zh.ts +0 -1
  168. package/src/index.ts +18 -8
  169. package/src/locales.ts +1 -1
  170. package/src/pm-nodes/BlockContainer.ts +1 -1
  171. package/src/pm-nodes/BlockGroup.ts +2 -2
  172. package/src/pm-nodes/Doc.ts +5 -4
  173. package/src/schema/README.md +1 -1
  174. package/src/schema/blocks/createSpec.ts +14 -14
  175. package/src/schema/blocks/internal.ts +17 -17
  176. package/src/schema/blocks/types.ts +25 -25
  177. package/src/schema/inlineContent/createSpec.ts +16 -20
  178. package/src/schema/inlineContent/internal.ts +9 -9
  179. package/src/schema/inlineContent/types.ts +26 -26
  180. package/src/schema/propTypes.ts +8 -8
  181. package/src/schema/styles/createSpec.ts +2 -2
  182. package/src/schema/styles/internal.ts +7 -7
  183. package/src/schema/styles/types.ts +2 -2
  184. package/src/util/EventEmitter.ts +4 -4
  185. package/src/util/README.md +1 -1
  186. package/src/util/combineByGroup.ts +1 -1
  187. package/src/util/table.ts +33 -30
  188. package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +1 -1
  189. package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +4 -0
  190. package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.d.ts +1 -0
  191. package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +3 -1
  192. package/types/src/api/blockManipulation/selections/selection.d.ts +10 -0
  193. package/types/src/api/blockManipulation/selections/textCursorPosition.d.ts +5 -0
  194. package/types/src/api/blockManipulation/transactions.test.d.ts +0 -0
  195. package/types/src/api/clipboard/clipboardExternal.test.d.ts +1 -0
  196. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  197. package/types/src/api/clipboard/testUtil.d.ts +541 -0
  198. package/types/src/api/exporters/html/htmlConversion.test.d.ts +1 -0
  199. package/types/src/api/exporters/markdown/markdownExporter.test.d.ts +1 -0
  200. package/types/src/api/nodeConversions/nodeConversions.test.d.ts +1 -0
  201. package/types/src/api/nodeConversions/nodeToBlock.d.ts +39 -2
  202. package/types/src/api/parsers/html/parseHTML.test.d.ts +1 -0
  203. package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +1 -0
  204. package/types/src/api/pmUtil.d.ts +3 -3
  205. package/types/src/api/testUtil/cases/customBlocks.d.ts +670 -0
  206. package/types/src/api/testUtil/cases/customInlineContent.d.ts +558 -0
  207. package/types/src/api/testUtil/cases/customStyles.d.ts +552 -0
  208. package/types/src/api/testUtil/cases/defaultSchema.d.ts +4 -0
  209. package/types/src/api/testUtil/index.d.ts +14 -0
  210. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +9 -0
  211. package/types/src/api/testUtil/paste.d.ts +2 -0
  212. package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
  213. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +9 -1
  214. package/types/src/editor/BlockNoteEditor.d.ts +58 -10
  215. package/types/src/editor/BlockNoteExtension.d.ts +9 -0
  216. package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
  217. package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -2
  218. package/types/src/extensions/Collaboration/CursorPlugin.d.ts +3 -3
  219. package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +41 -0
  220. package/types/src/extensions/Collaboration/ForkYDocPlugin.test.d.ts +1 -0
  221. package/types/src/extensions/Collaboration/SyncPlugin.d.ts +3 -3
  222. package/types/src/extensions/Collaboration/UndoPlugin.d.ts +3 -3
  223. package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +17 -0
  224. package/types/src/extensions/Comments/CommentsPlugin.d.ts +2 -4
  225. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +3 -4
  226. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -5
  227. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -4
  228. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +2 -3
  229. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +2 -3
  230. package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +2 -3
  231. package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +2 -3
  232. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +3 -4
  233. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -4
  234. package/types/src/extensions/Suggestions/SuggestionMarks.d.ts +4 -0
  235. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +5 -6
  236. package/types/src/i18n/locales/en.d.ts +0 -1
  237. package/types/src/i18n/locales/sk.d.ts +0 -1
  238. package/types/src/index.d.ts +15 -8
  239. package/dist/en-B7ycW7c8.js.map +0 -1
  240. package/dist/en-D4taoCs4.cjs.map +0 -1
  241. package/dist/tsconfig.tsbuildinfo +0 -1
  242. package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +0 -844
  243. package/src/api/blockManipulation/selections/selection.test.ts +0 -72
  244. package/src/api/blockManipulation/selections/textCursorPosition/__snapshots__/textCursorPosition.test.ts.snap +0 -316
  245. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +0 -74
@@ -40,7 +40,7 @@ export const TrailingNode = Extension.create<TrailingNodeOptions>({
40
40
 
41
41
  return tr.insert(
42
42
  endPosition,
43
- type.create(undefined, contentType.create())
43
+ type.create(undefined, contentType.create()),
44
44
  );
45
45
  },
46
46
  state: {
@@ -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+ */
@@ -163,7 +163,6 @@ export const ar: Dictionary = {
163
163
  },
164
164
  suggestion_menu: {
165
165
  no_items_title: "لم يتم العثور على عناصر",
166
- loading: "جارٍ التحميل…",
167
166
  },
168
167
  color_picker: {
169
168
  text_title: "نص",
@@ -178,7 +178,6 @@ export const de: Dictionary = {
178
178
  },
179
179
  suggestion_menu: {
180
180
  no_items_title: "Keine Elemente gefunden",
181
- loading: "Laden …",
182
181
  },
183
182
  color_picker: {
184
183
  text_title: "Text",
@@ -178,7 +178,6 @@ export const en = {
178
178
  },
179
179
  suggestion_menu: {
180
180
  no_items_title: "No items found",
181
- loading: "Loading…",
182
181
  },
183
182
  color_picker: {
184
183
  text_title: "Text",
@@ -177,7 +177,6 @@ export const es: Dictionary = {
177
177
  },
178
178
  suggestion_menu: {
179
179
  no_items_title: "No se encontraron elementos",
180
- loading: "Cargando…",
181
180
  },
182
181
  color_picker: {
183
182
  text_title: "Texto",
@@ -202,7 +202,6 @@ export const fr: Dictionary = {
202
202
  },
203
203
  suggestion_menu: {
204
204
  no_items_title: "Aucun élément trouvé",
205
- loading: "Chargement…",
206
205
  },
207
206
  color_picker: {
208
207
  text_title: "Texte",
@@ -191,7 +191,6 @@ export const hr: Dictionary = {
191
191
  },
192
192
  suggestion_menu: {
193
193
  no_items_title: "Stavke nisu pronađene",
194
- loading: "Učitavanje…",
195
194
  },
196
195
  color_picker: {
197
196
  text_title: "Tekst",
@@ -170,7 +170,6 @@ export const is: Dictionary = {
170
170
  },
171
171
  suggestion_menu: {
172
172
  no_items_title: "Engir hlutir fundust",
173
- loading: "Hleður…",
174
173
  },
175
174
  color_picker: {
176
175
  text_title: "Texti",
@@ -179,7 +179,6 @@ export const it: Dictionary = {
179
179
  },
180
180
  suggestion_menu: {
181
181
  no_items_title: "Nessun elemento trovato",
182
- loading: "Caricamento…",
183
182
  },
184
183
  color_picker: {
185
184
  text_title: "Testo",
@@ -198,7 +198,6 @@ export const ja: Dictionary = {
198
198
  },
199
199
  suggestion_menu: {
200
200
  no_items_title: "アイテムが見つかりません",
201
- loading: "読込中…",
202
201
  },
203
202
  color_picker: {
204
203
  text_title: "文字色",
@@ -191,7 +191,6 @@ export const ko: Dictionary = {
191
191
  },
192
192
  suggestion_menu: {
193
193
  no_items_title: "항목을 찾을 수 없음",
194
- loading: "로딩 중…",
195
194
  },
196
195
  color_picker: {
197
196
  text_title: "텍스트",
@@ -178,7 +178,6 @@ export const nl: Dictionary = {
178
178
  },
179
179
  suggestion_menu: {
180
180
  no_items_title: "Geen items gevonden",
181
- loading: "Laden…",
182
181
  },
183
182
  color_picker: {
184
183
  text_title: "Tekst",
@@ -178,7 +178,6 @@ export const no: Dictionary = {
178
178
  },
179
179
  suggestion_menu: {
180
180
  no_items_title: "Ingen elementer funnet",
181
- loading: "Laster…",
182
181
  },
183
182
  color_picker: {
184
183
  text_title: "Tekst",
@@ -162,7 +162,6 @@ export const pl: Dictionary = {
162
162
  },
163
163
  suggestion_menu: {
164
164
  no_items_title: "Nie znaleziono elementów",
165
- loading: "Ładowanie…",
166
165
  },
167
166
  color_picker: {
168
167
  text_title: "Tekst",
@@ -170,7 +170,6 @@ export const pt: Dictionary = {
170
170
  },
171
171
  suggestion_menu: {
172
172
  no_items_title: "Nenhum item encontrado",
173
- loading: "Carregando…",
174
173
  },
175
174
  color_picker: {
176
175
  text_title: "Texto",
@@ -205,7 +205,6 @@ export const ru: Dictionary = {
205
205
  },
206
206
  suggestion_menu: {
207
207
  no_items_title: "ничего не найдено",
208
- loading: "Загрузка…",
209
208
  },
210
209
  color_picker: {
211
210
  text_title: "Текст",
@@ -177,7 +177,6 @@ export const sk = {
177
177
  },
178
178
  suggestion_menu: {
179
179
  no_items_title: "Nenašli sa žiadne položky",
180
- loading: "Načítava sa…",
181
180
  },
182
181
  color_picker: {
183
182
  text_title: "Text",
@@ -203,7 +203,6 @@ export const uk: Dictionary = {
203
203
  },
204
204
  suggestion_menu: {
205
205
  no_items_title: "Нічого не знайдено",
206
- loading: "Завантаження…",
207
206
  },
208
207
  color_picker: {
209
208
  text_title: "Текст",
@@ -177,7 +177,6 @@ export const vi: Dictionary = {
177
177
  },
178
178
  suggestion_menu: {
179
179
  no_items_title: "Không tìm thấy mục nào",
180
- loading: "Đang tải...",
181
180
  },
182
181
  color_picker: {
183
182
  text_title: "Văn bản",
@@ -211,7 +211,6 @@ export const zhTW: Dictionary = {
211
211
  },
212
212
  suggestion_menu: {
213
213
  no_items_title: "無相符項目",
214
- loading: "載入中…",
215
214
  },
216
215
  color_picker: {
217
216
  text_title: "文字",
@@ -211,7 +211,6 @@ export const zh: Dictionary = {
211
211
  },
212
212
  suggestion_menu: {
213
213
  no_items_title: "无匹配项",
214
- loading: "加载中…",
215
214
  },
216
215
  color_picker: {
217
216
  text_title: "文本",
package/src/index.ts CHANGED
@@ -1,10 +1,17 @@
1
+ export * from "./api/blockManipulation/commands/insertBlocks/insertBlocks.js";
2
+ export * from "./api/blockManipulation/commands/replaceBlocks/replaceBlocks.js";
1
3
  export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
2
4
  export * from "./api/exporters/html/externalHTMLExporter.js";
3
5
  export * from "./api/exporters/html/internalHTMLSerializer.js";
4
6
  export * from "./api/getBlockInfoFromPos.js";
5
7
  export * from "./api/nodeUtil.js";
8
+ export * from "./api/pmUtil.js";
6
9
  export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
7
10
  export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
11
+ export * from "./blocks/defaultBlockHelpers.js";
12
+ export * from "./blocks/defaultBlocks.js";
13
+ export * from "./blocks/defaultBlockTypeGuards.js";
14
+ export * from "./blocks/defaultProps.js";
8
15
  export * from "./blocks/FileBlockContent/FileBlockContent.js";
9
16
  export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
10
17
  export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
@@ -16,19 +23,16 @@ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createFigureWith
16
23
  export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js";
17
24
  export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
18
25
  export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
19
- export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
20
26
  export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
27
+ export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
21
28
  export * from "./blocks/PageBreakBlockContent/schema.js";
22
29
  export {
23
30
  EMPTY_CELL_HEIGHT,
24
31
  EMPTY_CELL_WIDTH,
25
32
  } from "./blocks/TableBlockContent/TableExtension.js";
26
33
  export * from "./blocks/VideoBlockContent/VideoBlockContent.js";
27
- export * from "./blocks/defaultBlockHelpers.js";
28
- export * from "./blocks/defaultBlockTypeGuards.js";
29
- export * from "./blocks/defaultBlocks.js";
30
- export * from "./blocks/defaultProps.js";
31
34
  export * from "./editor/BlockNoteEditor.js";
35
+ export * from "./editor/BlockNoteExtension.js";
32
36
  export * from "./editor/BlockNoteExtensions.js";
33
37
  export * from "./editor/BlockNoteSchema.js";
34
38
  export * from "./editor/defaultColors.js";
@@ -42,22 +46,24 @@ export * from "./extensions/LinkToolbar/protocols.js";
42
46
  export * from "./extensions/SideMenu/SideMenuPlugin.js";
43
47
  export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem.js";
44
48
  export * from "./extensions/SuggestionMenu/DefaultSuggestionItem.js";
45
- export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
46
49
  export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems.js";
47
50
  export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems.js";
51
+ export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
48
52
  export * from "./extensions/TableHandles/TableHandlesPlugin.js";
49
53
  export * from "./i18n/dictionary.js";
50
54
  export * from "./schema/index.js";
51
55
  export * from "./util/browser.js";
52
56
  export * from "./util/combineByGroup.js";
53
57
  export * from "./util/esmDependencies.js";
54
- export * from "./util/table.js";
55
58
  export * from "./util/string.js";
59
+ export * from "./util/table.js";
56
60
  export * from "./util/typescript.js";
57
61
 
58
62
  export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockContent.js";
59
- export { UnreachableCaseError, assertEmpty } from "./util/typescript.js";
63
+ export { assertEmpty, UnreachableCaseError } from "./util/typescript.js";
60
64
 
65
+ export * from "./util/EventEmitter.js";
66
+ // for testing from react (TODO: move):
61
67
  // Unit testing
62
68
  export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js";
63
69
 
@@ -70,3 +76,7 @@ export * from "./extensions/UniqueID/UniqueID.js";
70
76
  export * from "./api/exporters/markdown/markdownExporter.js";
71
77
  export * from "./api/parsers/html/parseHTML.js";
72
78
  export * from "./api/parsers/markdown/parseMarkdown.js";
79
+
80
+ // TODO: for ai, remove?
81
+ export * from "./api/blockManipulation/getBlock/getBlock.js";
82
+ export * from "./api/positionMapping.js";
package/src/locales.ts CHANGED
@@ -1 +1 @@
1
- export * from "./i18n/index.js";
1
+ export * from "./i18n/index.js";
@@ -27,7 +27,7 @@ export const BlockContainer = Node.create<{
27
27
  // Ensures content-specific keyboard handlers trigger first.
28
28
  priority: 50,
29
29
  defining: true,
30
-
30
+ marks: "insertion modification deletion",
31
31
  parseHTML() {
32
32
  return [
33
33
  {
@@ -8,7 +8,7 @@ export const BlockGroup = Node.create<{
8
8
  name: "blockGroup",
9
9
  group: "childContainer",
10
10
  content: "blockGroupChild+",
11
-
11
+ marks: "deletion insertion modification",
12
12
  parseHTML() {
13
13
  return [
14
14
  {
@@ -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,8 @@
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
+ marks: "insertion modification deletion",
7
8
  });
@@ -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
  });