@blocknote/core 0.29.1 → 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 (182) hide show
  1. package/README.md +125 -0
  2. package/dist/blocknote.cjs +9 -9
  3. package/dist/blocknote.cjs.map +1 -1
  4. package/dist/blocknote.js +1501 -1359
  5. package/dist/blocknote.js.map +1 -1
  6. package/dist/comments.cjs.map +1 -1
  7. package/dist/comments.js.map +1 -1
  8. package/dist/locales.cjs +1 -1
  9. package/dist/locales.cjs.map +1 -1
  10. package/dist/locales.js +751 -9
  11. package/dist/locales.js.map +1 -1
  12. package/dist/style.css +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/webpack-stats.json +1 -1
  15. package/package.json +7 -8
  16. package/src/api/README.md +1 -1
  17. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -7
  18. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
  19. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -5
  20. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -5
  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/__snapshots__/moveBlocks.test.ts.snap +0 -20
  24. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
  25. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
  26. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
  27. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -12
  28. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
  29. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +7 -7
  30. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -6
  31. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
  32. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
  33. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -17
  34. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -42
  35. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +18 -18
  36. package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
  37. package/src/api/blockManipulation/insertContentAt.ts +1 -1
  38. package/src/api/blockManipulation/selections/selection.ts +11 -11
  39. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +7 -7
  40. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +6 -6
  41. package/src/api/blockManipulation/tables/tables.test.ts +106 -106
  42. package/src/api/blockManipulation/tables/tables.ts +35 -35
  43. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
  44. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
  45. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
  46. package/src/api/clipboard/fromClipboard/pasteExtension.ts +21 -3
  47. package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
  48. package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
  49. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
  50. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
  51. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
  52. package/src/api/exporters/markdown/markdownExporter.ts +3 -3
  53. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
  54. package/src/api/getBlockInfoFromPos.ts +6 -6
  55. package/src/api/nodeConversions/blockToNode.ts +26 -26
  56. package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
  57. package/src/api/nodeConversions/nodeToBlock.ts +37 -33
  58. package/src/api/nodeUtil.test.ts +16 -16
  59. package/src/api/nodeUtil.ts +10 -10
  60. package/src/api/parsers/html/parseHTML.ts +1 -1
  61. package/src/api/parsers/html/util/nestedLists.ts +2 -2
  62. package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
  63. package/src/api/pmUtil.ts +4 -4
  64. package/src/api/positionMapping.test.ts +3 -3
  65. package/src/api/positionMapping.ts +5 -5
  66. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +9 -4
  67. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +40 -26
  68. package/src/blocks/FileBlockContent/FileBlockContent.ts +7 -2
  69. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
  70. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +5 -5
  71. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
  72. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
  73. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +15 -8
  74. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
  75. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
  76. package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
  77. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +9 -6
  78. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +14 -6
  79. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +13 -29
  80. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +24 -13
  81. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
  82. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
  83. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +13 -30
  84. package/src/blocks/ListItemBlockContent/getListItemContent.ts +115 -0
  85. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
  86. package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
  87. package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
  88. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +9 -5
  89. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +10 -5
  90. package/src/blocks/README.md +1 -1
  91. package/src/blocks/TableBlockContent/TableBlockContent.ts +76 -19
  92. package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
  93. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +14 -6
  94. package/src/blocks/defaultBlockHelpers.ts +24 -8
  95. package/src/blocks/defaultBlockTypeGuards.ts +16 -16
  96. package/src/blocks/defaultBlocks.ts +3 -3
  97. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
  98. package/src/comments/threadstore/ThreadStore.ts +1 -1
  99. package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
  100. package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
  101. package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
  102. package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
  103. package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
  104. package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
  105. package/src/editor/Block.css +10 -1
  106. package/src/editor/BlockNoteEditor.test.ts +3 -3
  107. package/src/editor/BlockNoteEditor.ts +110 -61
  108. package/src/editor/BlockNoteExtensions.ts +24 -15
  109. package/src/editor/BlockNoteSchema.ts +4 -4
  110. package/src/editor/BlockNoteTipTapEditor.ts +10 -10
  111. package/src/editor/README.md +1 -1
  112. package/src/editor/cursorPositionTypes.ts +1 -1
  113. package/src/editor/editor.css +15 -3
  114. package/src/editor/selectionTypes.ts +1 -1
  115. package/src/editor/transformPasted.ts +2 -2
  116. package/src/exporter/Exporter.ts +5 -5
  117. package/src/exporter/mapping.ts +7 -7
  118. package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
  119. package/src/extensions/Collaboration/CursorPlugin.ts +152 -0
  120. package/src/extensions/Collaboration/SyncPlugin.ts +15 -0
  121. package/src/extensions/Collaboration/UndoPlugin.ts +14 -0
  122. package/src/extensions/Comments/CommentsPlugin.ts +9 -9
  123. package/src/extensions/Comments/userstore/UserStore.ts +2 -2
  124. package/src/extensions/FilePanel/FilePanelPlugin.ts +37 -28
  125. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +6 -8
  126. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +29 -26
  127. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -11
  128. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +4 -4
  129. package/src/extensions/Placeholder/PlaceholderPlugin.ts +10 -10
  130. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +2 -2
  131. package/src/extensions/README.md +1 -1
  132. package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
  133. package/src/extensions/SideMenu/SideMenuPlugin.ts +31 -31
  134. package/src/extensions/SideMenu/dragging.ts +8 -8
  135. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +17 -17
  136. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
  137. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +12 -12
  138. package/src/extensions/TableHandles/TableHandlesPlugin.ts +54 -53
  139. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  140. package/src/extensions/UniqueID/UniqueID.ts +6 -6
  141. package/src/extensions/getDraggableBlockFromElement.ts +1 -1
  142. package/src/fonts/inter.css +18 -9
  143. package/src/i18n/locales/index.ts +2 -0
  144. package/src/i18n/locales/ru.ts +2 -2
  145. package/src/i18n/locales/sk.ts +355 -0
  146. package/src/i18n/locales/zh-tw.ts +390 -0
  147. package/src/locales.ts +1 -1
  148. package/src/pm-nodes/BlockContainer.ts +7 -6
  149. package/src/pm-nodes/BlockGroup.ts +1 -1
  150. package/src/pm-nodes/Doc.ts +4 -4
  151. package/src/schema/README.md +1 -1
  152. package/src/schema/blocks/createSpec.ts +15 -15
  153. package/src/schema/blocks/internal.ts +17 -18
  154. package/src/schema/blocks/types.ts +27 -26
  155. package/src/schema/inlineContent/createSpec.ts +16 -20
  156. package/src/schema/inlineContent/internal.ts +9 -9
  157. package/src/schema/inlineContent/types.ts +26 -26
  158. package/src/schema/propTypes.ts +8 -8
  159. package/src/schema/styles/createSpec.ts +2 -2
  160. package/src/schema/styles/internal.ts +7 -7
  161. package/src/schema/styles/types.ts +2 -2
  162. package/src/util/EventEmitter.ts +4 -4
  163. package/src/util/README.md +1 -1
  164. package/src/util/combineByGroup.ts +1 -1
  165. package/src/util/table.ts +33 -30
  166. package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -4
  167. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +8 -4
  168. package/types/src/blocks/ListItemBlockContent/getListItemContent.d.ts +28 -0
  169. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +8 -4
  170. package/types/src/blocks/defaultBlockHelpers.d.ts +1 -0
  171. package/types/src/blocks/defaultBlocks.d.ts +16 -8
  172. package/types/src/editor/BlockNoteEditor.d.ts +21 -2
  173. package/types/src/extensions/Collaboration/CursorPlugin.d.ts +31 -0
  174. package/types/src/extensions/Collaboration/SyncPlugin.d.ts +7 -0
  175. package/types/src/extensions/Collaboration/UndoPlugin.d.ts +6 -0
  176. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +1 -1
  177. package/types/src/i18n/locales/index.d.ts +2 -0
  178. package/types/src/i18n/locales/sk.d.ts +313 -0
  179. package/types/src/i18n/locales/zh-tw.d.ts +2 -0
  180. package/types/src/schema/blocks/types.d.ts +2 -1
  181. package/src/extensions/Collaboration/createCollaborationExtensions.ts +0 -147
  182. package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +0 -17
package/src/util/table.ts CHANGED
@@ -13,47 +13,50 @@ import { PartialTableCell, TableCell } from "../schema/blocks/types.js";
13
13
  */
14
14
  export function mapTableCell<
15
15
  T extends InlineContentSchema,
16
- S extends StyleSchema
16
+ S extends StyleSchema,
17
17
  >(
18
- content: PartialInlineContent<T, S> | PartialTableCell<T, S> | TableCell<T, S>
18
+ content:
19
+ | PartialInlineContent<T, S>
20
+ | PartialTableCell<T, S>
21
+ | TableCell<T, S>,
19
22
  ): TableCell<T, S> {
20
23
  return isTableCell(content)
21
24
  ? { ...content }
22
25
  : isPartialTableCell(content)
23
- ? {
24
- type: "tableCell",
25
- content: ([] as InlineContent<T, S>[]).concat(content.content as any),
26
- props: {
27
- backgroundColor: content.props?.backgroundColor ?? "default",
28
- textColor: content.props?.textColor ?? "default",
29
- textAlignment: content.props?.textAlignment ?? "left",
30
- colspan: content.props?.colspan ?? 1,
31
- rowspan: content.props?.rowspan ?? 1,
32
- },
33
- }
34
- : {
35
- type: "tableCell",
36
- content: ([] as InlineContent<T, S>[]).concat(content as any),
37
- props: {
38
- backgroundColor: "default",
39
- textColor: "default",
40
- textAlignment: "left",
41
- colspan: 1,
42
- rowspan: 1,
43
- },
44
- };
26
+ ? {
27
+ type: "tableCell",
28
+ content: ([] as InlineContent<T, S>[]).concat(content.content as any),
29
+ props: {
30
+ backgroundColor: content.props?.backgroundColor ?? "default",
31
+ textColor: content.props?.textColor ?? "default",
32
+ textAlignment: content.props?.textAlignment ?? "left",
33
+ colspan: content.props?.colspan ?? 1,
34
+ rowspan: content.props?.rowspan ?? 1,
35
+ },
36
+ }
37
+ : {
38
+ type: "tableCell",
39
+ content: ([] as InlineContent<T, S>[]).concat(content as any),
40
+ props: {
41
+ backgroundColor: "default",
42
+ textColor: "default",
43
+ textAlignment: "left",
44
+ colspan: 1,
45
+ rowspan: 1,
46
+ },
47
+ };
45
48
  }
46
49
 
47
50
  export function isPartialTableCell<
48
51
  T extends InlineContentSchema,
49
- S extends StyleSchema
52
+ S extends StyleSchema,
50
53
  >(
51
54
  content:
52
55
  | TableCell<T, S>
53
56
  | PartialInlineContent<T, S>
54
57
  | PartialTableCell<T, S>
55
58
  | undefined
56
- | null
59
+ | null,
57
60
  ): content is PartialTableCell<T, S> {
58
61
  return (
59
62
  content !== undefined &&
@@ -66,14 +69,14 @@ export function isPartialTableCell<
66
69
 
67
70
  export function isTableCell<
68
71
  T extends InlineContentSchema,
69
- S extends StyleSchema
72
+ S extends StyleSchema,
70
73
  >(
71
74
  content:
72
75
  | TableCell<T, S>
73
76
  | PartialInlineContent<T, S>
74
77
  | PartialTableCell<T, S>
75
78
  | undefined
76
- | null
79
+ | null,
77
80
  ): content is TableCell<T, S> {
78
81
  return (
79
82
  isPartialTableCell(content) &&
@@ -86,7 +89,7 @@ export function getColspan(
86
89
  cell:
87
90
  | TableCell<any, any>
88
91
  | PartialTableCell<any, any>
89
- | PartialInlineContent<any, any>
92
+ | PartialInlineContent<any, any>,
90
93
  ): number {
91
94
  if (isTableCell(cell)) {
92
95
  return cell.props.colspan ?? 1;
@@ -98,7 +101,7 @@ export function getRowspan(
98
101
  cell:
99
102
  | TableCell<any, any>
100
103
  | PartialTableCell<any, any>
101
- | PartialInlineContent<any, any>
104
+ | PartialInlineContent<any, any>,
102
105
  ): number {
103
106
  if (isTableCell(cell)) {
104
107
  return cell.props.rowspan ?? 1;
@@ -330,7 +330,8 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
330
330
  default: true;
331
331
  };
332
332
  previewWidth: {
333
- default: number;
333
+ default: undefined;
334
+ type: "number";
334
335
  };
335
336
  };
336
337
  content: "none";
@@ -360,7 +361,8 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
360
361
  default: true;
361
362
  };
362
363
  previewWidth: {
363
- default: number;
364
+ default: undefined;
365
+ type: "number";
364
366
  };
365
367
  };
366
368
  content: "none";
@@ -392,7 +394,8 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
392
394
  default: true;
393
395
  };
394
396
  previewWidth: {
395
- default: number;
397
+ default: undefined;
398
+ type: "number";
396
399
  };
397
400
  };
398
401
  content: "none";
@@ -422,7 +425,8 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
422
425
  default: true;
423
426
  };
424
427
  previewWidth: {
425
- default: number;
428
+ default: undefined;
429
+ type: "number";
426
430
  };
427
431
  };
428
432
  content: "none";
@@ -22,7 +22,8 @@ export declare const imagePropSchema: {
22
22
  default: true;
23
23
  };
24
24
  previewWidth: {
25
- default: number;
25
+ default: undefined;
26
+ type: "number";
26
27
  };
27
28
  };
28
29
  export declare const imageBlockConfig: {
@@ -48,7 +49,8 @@ export declare const imageBlockConfig: {
48
49
  default: true;
49
50
  };
50
51
  previewWidth: {
51
- default: number;
52
+ default: undefined;
53
+ type: "number";
52
54
  };
53
55
  };
54
56
  content: "none";
@@ -87,7 +89,8 @@ export declare const ImageBlock: {
87
89
  default: true;
88
90
  };
89
91
  previewWidth: {
90
- default: number;
92
+ default: undefined;
93
+ type: "number";
91
94
  };
92
95
  };
93
96
  content: "none";
@@ -117,7 +120,8 @@ export declare const ImageBlock: {
117
120
  default: true;
118
121
  };
119
122
  previewWidth: {
120
- default: number;
123
+ default: undefined;
124
+ type: "number";
121
125
  };
122
126
  };
123
127
  content: "none";
@@ -0,0 +1,28 @@
1
+ import { Fragment, Schema } from "prosemirror-model";
2
+ /**
3
+ * This function is used to parse the content of a list item external HTML node.
4
+ *
5
+ * Due to a change in how prosemirror-model handles parsing elements, we have additional flexibility in how we can "fit" content into a list item.
6
+ *
7
+ * We've decided to take an approach that is similar to Notion. The core rules of the algorithm are:
8
+ *
9
+ * - If the first child of an `li` has ONLY text content, take the text content, and flatten it into the list item. Subsequent siblings are carried over as is, as children of the list item.
10
+ * - e.g. `<li><h1>Hello</h1><p>World</p></li> -> <li>Hello<blockGroup><blockContainer><p>World</p></blockContainer></blockGroup></li>`
11
+ * - Else, take the content and insert it as children instead.
12
+ * - e.g. `<li><img src="url" /></li> -> <li><p></p><blockGroup><blockContainer><img src="url" /></blockContainer></blockGroup></li>`
13
+ *
14
+ * This ensures that a list item's content is always valid ProseMirror content. Smoothing over differences between how external HTML may be rendered, and how ProseMirror expects content to be structured.
15
+ */
16
+ export declare function getListItemContent(
17
+ /**
18
+ * The `li` element to parse.
19
+ */
20
+ _node: Node,
21
+ /**
22
+ * The schema to use for parsing.
23
+ */
24
+ schema: Schema,
25
+ /**
26
+ * The name of the list item node.
27
+ */
28
+ name: string): Fragment;
@@ -22,7 +22,8 @@ export declare const videoPropSchema: {
22
22
  default: true;
23
23
  };
24
24
  previewWidth: {
25
- default: number;
25
+ default: undefined;
26
+ type: "number";
26
27
  };
27
28
  };
28
29
  export declare const videoBlockConfig: {
@@ -48,7 +49,8 @@ export declare const videoBlockConfig: {
48
49
  default: true;
49
50
  };
50
51
  previewWidth: {
51
- default: number;
52
+ default: undefined;
53
+ type: "number";
52
54
  };
53
55
  };
54
56
  content: "none";
@@ -87,7 +89,8 @@ export declare const VideoBlock: {
87
89
  default: true;
88
90
  };
89
91
  previewWidth: {
90
- default: number;
92
+ default: undefined;
93
+ type: "number";
91
94
  };
92
95
  };
93
96
  content: "none";
@@ -117,7 +120,8 @@ export declare const VideoBlock: {
117
120
  default: true;
118
121
  };
119
122
  previewWidth: {
120
- default: number;
123
+ default: undefined;
124
+ type: "number";
121
125
  };
122
126
  };
123
127
  content: "none";
@@ -8,3 +8,4 @@ export declare const defaultBlockToHTML: <BSchema extends BlockSchema, I extends
8
8
  dom: HTMLElement;
9
9
  contentDOM?: HTMLElement;
10
10
  };
11
+ export declare function mergeParagraphs(element: HTMLElement): void;
@@ -330,7 +330,8 @@ export declare const defaultBlockSpecs: {
330
330
  default: true;
331
331
  };
332
332
  previewWidth: {
333
- default: number;
333
+ default: undefined;
334
+ type: "number";
334
335
  };
335
336
  };
336
337
  content: "none";
@@ -360,7 +361,8 @@ export declare const defaultBlockSpecs: {
360
361
  default: true;
361
362
  };
362
363
  previewWidth: {
363
- default: number;
364
+ default: undefined;
365
+ type: "number";
364
366
  };
365
367
  };
366
368
  content: "none";
@@ -392,7 +394,8 @@ export declare const defaultBlockSpecs: {
392
394
  default: true;
393
395
  };
394
396
  previewWidth: {
395
- default: number;
397
+ default: undefined;
398
+ type: "number";
396
399
  };
397
400
  };
398
401
  content: "none";
@@ -422,7 +425,8 @@ export declare const defaultBlockSpecs: {
422
425
  default: true;
423
426
  };
424
427
  previewWidth: {
425
- default: number;
428
+ default: undefined;
429
+ type: "number";
426
430
  };
427
431
  };
428
432
  content: "none";
@@ -810,7 +814,8 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
810
814
  default: true;
811
815
  };
812
816
  previewWidth: {
813
- default: number;
817
+ default: undefined;
818
+ type: "number";
814
819
  };
815
820
  };
816
821
  content: "none";
@@ -840,7 +845,8 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
840
845
  default: true;
841
846
  };
842
847
  previewWidth: {
843
- default: number;
848
+ default: undefined;
849
+ type: "number";
844
850
  };
845
851
  };
846
852
  content: "none";
@@ -872,7 +878,8 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
872
878
  default: true;
873
879
  };
874
880
  previewWidth: {
875
- default: number;
881
+ default: undefined;
882
+ type: "number";
876
883
  };
877
884
  };
878
885
  content: "none";
@@ -902,7 +909,8 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
902
909
  default: true;
903
910
  };
904
911
  previewWidth: {
905
- default: number;
912
+ default: undefined;
913
+ type: "number";
906
914
  };
907
915
  };
908
916
  content: "none";
@@ -26,6 +26,7 @@ import { EventEmitter } from "../util/EventEmitter.js";
26
26
  export type BlockNoteExtensionFactory = (editor: BlockNoteEditor<any, any, any>) => BlockNoteExtension;
27
27
  export type BlockNoteExtension = AnyExtension | {
28
28
  plugin: Plugin;
29
+ priority?: number;
29
30
  };
30
31
  export type BlockCache<BSchema extends BlockSchema = any, ISchema extends InlineContentSchema = any, SSchema extends StyleSchema = any> = WeakMap<Node, Block<BSchema, ISchema, SSchema>>;
31
32
  export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
@@ -289,6 +290,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
289
290
  readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
290
291
  readonly comments?: CommentsPlugin;
291
292
  private readonly showSelectionPlugin;
293
+ private readonly cursorPlugin;
292
294
  /**
293
295
  * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
294
296
  * This method should set when creating the editor as this is application-specific.
@@ -378,8 +380,15 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
378
380
  * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
379
381
  */
380
382
  mount: (parentElement?: HTMLElement | null, contentComponent?: any) => void;
383
+ /**
384
+ * Get the underlying prosemirror state
385
+ * @note Prefer using `editor.transact` to read the current editor state, as that will ensure the state is up to date
386
+ * @see https://prosemirror.net/docs/ref/#state.EditorState
387
+ */
388
+ get prosemirrorState(): import("prosemirror-state").EditorState;
381
389
  /**
382
390
  * Get the underlying prosemirror view
391
+ * @see https://prosemirror.net/docs/ref/#view.EditorView
383
392
  */
384
393
  get prosemirrorView(): EditorView | undefined;
385
394
  get domElement(): HTMLDivElement | undefined;
@@ -441,7 +450,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
441
450
  * Executes a callback whenever the editor's contents change.
442
451
  * @param callback The callback to execute.
443
452
  *
444
- * @deprecated use `onChange` instead
453
+ * @deprecated use {@link BlockNoteEditor.onChange} instead
445
454
  */
446
455
  onEditorContentChange(callback: () => void): void;
447
456
  /**
@@ -516,12 +525,22 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
516
525
  insertedBlocks: Block<BSchema, ISchema, SSchema>[];
517
526
  removedBlocks: Block<BSchema, ISchema, SSchema>[];
518
527
  };
528
+ /**
529
+ * Undo the last action.
530
+ */
531
+ undo(): boolean;
532
+ /**
533
+ * Redo the last action.
534
+ */
535
+ redo(): boolean;
519
536
  /**
520
537
  * Insert a piece of content at the current cursor position.
521
538
  *
522
539
  * @param content can be a string, or array of partial inline content elements
523
540
  */
524
- insertInlineContent(content: PartialInlineContent<ISchema, SSchema>): void;
541
+ insertInlineContent(content: PartialInlineContent<ISchema, SSchema>, { updateSelection }?: {
542
+ updateSelection?: boolean;
543
+ }): void;
525
544
  /**
526
545
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
527
546
  */
@@ -0,0 +1,31 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ import { Awareness } from "y-protocols/awareness.js";
3
+ import * as Y from "yjs";
4
+ export type CollaborationUser = {
5
+ name: string;
6
+ color: string;
7
+ [key: string]: string;
8
+ };
9
+ export declare class CursorPlugin {
10
+ private collaboration;
11
+ plugin: Plugin;
12
+ private provider;
13
+ private recentlyUpdatedCursors;
14
+ constructor(collaboration: {
15
+ fragment: Y.XmlFragment;
16
+ user: CollaborationUser;
17
+ provider: {
18
+ awareness: Awareness;
19
+ };
20
+ renderCursor?: (user: CollaborationUser) => HTMLElement;
21
+ showCursorLabels?: "always" | "activity";
22
+ });
23
+ get priority(): number;
24
+ private renderCursor;
25
+ updateUser: (user: {
26
+ name: string;
27
+ color: string;
28
+ [key: string]: string;
29
+ }) => void;
30
+ static defaultCursorRender: (user: CollaborationUser) => HTMLSpanElement;
31
+ }
@@ -0,0 +1,7 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ import type * as Y from "yjs";
3
+ export declare class SyncPlugin {
4
+ plugin: Plugin;
5
+ constructor(fragment: Y.XmlFragment);
6
+ get priority(): number;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ export declare class UndoPlugin {
3
+ plugin: Plugin;
4
+ constructor();
5
+ get priority(): number;
6
+ }
@@ -13,7 +13,7 @@ export declare class FilePanelView<I extends InlineContentSchema, S extends Styl
13
13
  private readonly pmView;
14
14
  state?: FilePanelState<I, S>;
15
15
  emitUpdate: () => void;
16
- constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>, pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
16
+ constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>, pluginKey: PluginKey<FilePanelState<I, S>>, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
17
17
  mouseDownHandler: () => void;
18
18
  dragstartHandler: () => void;
19
19
  scrollHandler: () => void;
@@ -13,6 +13,8 @@ export * from "./no.js";
13
13
  export * from "./pl.js";
14
14
  export * from "./pt.js";
15
15
  export * from "./ru.js";
16
+ export * from "./sk.js";
16
17
  export * from "./uk.js";
17
18
  export * from "./vi.js";
18
19
  export * from "./zh.js";
20
+ export * from "./zh-tw.js";