@blocknote/core 0.19.2 → 0.21.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 (220) hide show
  1. package/dist/blocknote.js +2035 -1758
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +6 -6
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +6 -3
  6. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +1 -1
  7. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +219 -0
  8. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +1 -0
  9. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +175 -0
  10. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +1 -0
  11. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +4 -1
  12. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +1 -1
  13. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +6 -3
  14. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +1 -1
  15. package/dist/src/api/blockManipulation/getBlock/getBlock.js +56 -0
  16. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +1 -0
  17. package/dist/src/api/blockManipulation/selections/selection.js +149 -0
  18. package/dist/src/api/blockManipulation/selections/selection.js.map +1 -0
  19. package/dist/src/api/blockManipulation/selections/selection.test.js +39 -0
  20. package/dist/src/api/blockManipulation/selections/selection.test.js.map +1 -0
  21. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +3 -0
  22. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +1 -1
  23. package/dist/src/api/clipboard/clipboard.test.js +6 -3
  24. package/dist/src/api/clipboard/clipboard.test.js.map +1 -1
  25. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +1 -1
  26. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -1
  27. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +2 -3
  28. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +1 -1
  29. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +5 -5
  30. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +1 -1
  31. package/dist/src/api/clipboard/toClipboard/copyExtension.js +4 -2
  32. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +1 -1
  33. package/dist/src/api/nodeUtil.js +1 -1
  34. package/dist/src/api/nodeUtil.js.map +1 -1
  35. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +4 -1
  36. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +1 -1
  37. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +14 -7
  38. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +1 -1
  39. package/dist/src/blocks/AudioBlockContent/{audioBlockHelpers.js → parseAudioElement.js} +1 -1
  40. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js.map +1 -0
  41. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +5 -4
  42. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +1 -1
  43. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +5 -0
  44. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +1 -0
  45. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +10 -0
  46. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +1 -0
  47. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +39 -0
  48. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +1 -0
  49. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +51 -0
  50. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +1 -0
  51. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +17 -0
  52. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +1 -0
  53. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +147 -0
  54. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +1 -0
  55. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +9 -0
  56. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +1 -0
  57. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +11 -0
  58. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js.map +1 -0
  59. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +17 -9
  60. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +1 -1
  61. package/dist/src/blocks/ImageBlockContent/{imageBlockHelpers.js → parseImageElement.js} +1 -1
  62. package/dist/src/blocks/ImageBlockContent/parseImageElement.js.map +1 -0
  63. package/dist/src/blocks/TableBlockContent/TableExtension.js +8 -1
  64. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +1 -1
  65. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +18 -7
  66. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +1 -1
  67. package/dist/src/blocks/VideoBlockContent/{videoBlockHelpers.js → parseVideoElement.js} +1 -1
  68. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js.map +1 -0
  69. package/dist/src/editor/BlockNoteEditor.js +64 -62
  70. package/dist/src/editor/BlockNoteEditor.js.map +1 -1
  71. package/dist/src/editor/BlockNoteExtensions.js +5 -8
  72. package/dist/src/editor/BlockNoteExtensions.js.map +1 -1
  73. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +4 -2
  74. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +1 -1
  75. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +10 -8
  76. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -1
  77. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +7 -3
  78. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +1 -1
  79. package/dist/src/extensions/LinkToolbar/protocols.js +14 -0
  80. package/dist/src/extensions/LinkToolbar/protocols.js.map +1 -0
  81. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +19 -13
  82. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -1
  83. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +5 -1
  84. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +1 -1
  85. package/dist/src/extensions/SideMenu/dragging.js +8 -1
  86. package/dist/src/extensions/SideMenu/dragging.js.map +1 -1
  87. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +3 -3
  88. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +1 -1
  89. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +37 -11
  90. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +1 -1
  91. package/dist/src/i18n/locales/ru.js +1 -1
  92. package/dist/src/index.js +9 -2
  93. package/dist/src/index.js.map +1 -1
  94. package/dist/src/schema/inlineContent/createSpec.js +1 -1
  95. package/dist/src/schema/inlineContent/createSpec.js.map +1 -1
  96. package/dist/style.css +1 -1
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/dist/webpack-stats.json +1 -1
  99. package/package.json +3 -3
  100. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +6 -6
  101. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +9506 -0
  102. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +295 -0
  103. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +336 -0
  104. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +5 -1
  105. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +11 -3
  106. package/src/api/blockManipulation/getBlock/getBlock.ts +141 -0
  107. package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +660 -0
  108. package/src/api/blockManipulation/selections/selection.test.ts +56 -0
  109. package/src/api/blockManipulation/selections/selection.ts +244 -0
  110. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +4 -0
  111. package/src/api/clipboard/__snapshots__/tableAllCells.html +1 -1
  112. package/src/api/clipboard/__snapshots__/tableCell.html +1 -1
  113. package/src/api/clipboard/__snapshots__/tableRow.html +1 -1
  114. package/src/api/clipboard/clipboard.test.ts +7 -3
  115. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
  116. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +7 -14
  117. package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -6
  118. package/src/api/clipboard/toClipboard/copyExtension.ts +7 -2
  119. package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -1
  120. package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -1
  121. package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -1
  122. package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -1
  123. package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
  124. package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
  125. package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -1
  126. package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
  127. package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
  128. package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
  129. package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
  130. package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
  131. package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
  132. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
  133. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -1
  134. package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
  135. package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
  136. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
  137. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -1
  138. package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -1
  139. package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +2 -2
  140. package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -1
  141. package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +1 -1
  142. package/src/api/nodeUtil.ts +2 -2
  143. package/src/api/parsers/markdown/parseMarkdown.test.ts +5 -7
  144. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +13 -14
  145. package/src/blocks/FileBlockContent/FileBlockContent.ts +5 -12
  146. package/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts +5 -0
  147. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +16 -0
  148. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +63 -0
  149. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +80 -0
  150. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +24 -0
  151. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +204 -0
  152. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +13 -0
  153. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +15 -0
  154. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +20 -28
  155. package/src/blocks/TableBlockContent/TableExtension.ts +12 -1
  156. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +20 -27
  157. package/src/editor/Block.css +35 -51
  158. package/src/editor/BlockNoteEditor.ts +101 -92
  159. package/src/editor/BlockNoteExtensions.ts +9 -8
  160. package/src/editor/editor.css +1 -0
  161. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +4 -2
  162. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +11 -8
  163. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -4
  164. package/src/extensions/LinkToolbar/protocols.ts +13 -0
  165. package/src/extensions/Placeholder/PlaceholderPlugin.ts +29 -21
  166. package/src/extensions/SideMenu/SideMenuPlugin.ts +5 -1
  167. package/src/extensions/SideMenu/dragging.ts +8 -1
  168. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +3 -6
  169. package/src/extensions/TableHandles/TableHandlesPlugin.ts +49 -12
  170. package/src/i18n/locales/ru.ts +1 -1
  171. package/src/index.ts +9 -2
  172. package/src/schema/inlineContent/createSpec.ts +2 -2
  173. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +15 -0
  174. package/types/src/api/blockManipulation/getBlock/getBlock.d.ts +7 -0
  175. package/types/src/api/blockManipulation/selections/selection.d.ts +5 -0
  176. package/types/src/api/blockManipulation/selections/selection.test.d.ts +1 -0
  177. package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +2 -3
  178. package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +1 -3
  179. package/types/src/api/nodeUtil.d.ts +1 -1
  180. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +2 -5
  181. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -5
  182. package/types/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.d.ts +3 -0
  183. package/types/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.d.ts +4 -0
  184. package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +6 -0
  185. package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +9 -0
  186. package/types/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.d.ts +6 -0
  187. package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +9 -0
  188. package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.d.ts +3 -0
  189. package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.d.ts +3 -0
  190. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -5
  191. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -5
  192. package/types/src/editor/BlockNoteEditor.d.ts +60 -14
  193. package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
  194. package/types/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.d.ts +1 -0
  195. package/types/src/extensions/LinkToolbar/protocols.d.ts +2 -0
  196. package/types/src/index.d.ts +9 -2
  197. package/types/src/pm-nodes/BlockContainer.d.ts +2 -2
  198. package/types/src/pm-nodes/BlockGroup.d.ts +2 -2
  199. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js +0 -116
  200. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js.map +0 -1
  201. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +0 -110
  202. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +0 -1
  203. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +0 -1
  204. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +0 -317
  205. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +0 -1
  206. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +0 -1
  207. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +0 -1
  208. package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +0 -3799
  209. package/src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts +0 -196
  210. package/src/api/blockManipulation/commands/moveBlock/moveBlock.ts +0 -176
  211. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +0 -456
  212. package/types/src/api/blockManipulation/commands/moveBlock/moveBlock.d.ts +0 -5
  213. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +0 -41
  214. /package/src/blocks/AudioBlockContent/{audioBlockHelpers.ts → parseAudioElement.ts} +0 -0
  215. /package/src/blocks/ImageBlockContent/{imageBlockHelpers.ts → parseImageElement.ts} +0 -0
  216. /package/src/blocks/VideoBlockContent/{videoBlockHelpers.ts → parseVideoElement.ts} +0 -0
  217. /package/types/src/api/blockManipulation/commands/{moveBlock/moveBlock.test.d.ts → moveBlocks/moveBlocks.test.d.ts} +0 -0
  218. /package/types/src/blocks/AudioBlockContent/{audioBlockHelpers.d.ts → parseAudioElement.d.ts} +0 -0
  219. /package/types/src/blocks/ImageBlockContent/{imageBlockHelpers.d.ts → parseImageElement.d.ts} +0 -0
  220. /package/types/src/blocks/VideoBlockContent/{videoBlockHelpers.d.ts → parseVideoElement.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ export const VALID_LINK_PROTOCOLS = [
2
+ "http",
3
+ "https",
4
+ "ftp",
5
+ "ftps",
6
+ "mailto",
7
+ "tel",
8
+ "callto",
9
+ "sms",
10
+ "cid",
11
+ "xmpp",
12
+ ];
13
+ export const DEFAULT_LINK_PROTOCOL = "https";
@@ -18,10 +18,10 @@ export class PlaceholderPlugin {
18
18
  if (nonce) {
19
19
  styleEl.setAttribute("nonce", nonce);
20
20
  }
21
- if (editor._tiptapEditor.view.root instanceof ShadowRoot) {
22
- editor._tiptapEditor.view.root.append(styleEl);
21
+ if (editor.prosemirrorView?.root instanceof ShadowRoot) {
22
+ editor.prosemirrorView.root.append(styleEl);
23
23
  } else {
24
- editor._tiptapEditor.view.root.head.appendChild(styleEl);
24
+ editor.prosemirrorView?.root.head.appendChild(styleEl);
25
25
  }
26
26
 
27
27
  const styleSheet = styleEl.sheet!;
@@ -48,32 +48,40 @@ export class PlaceholderPlugin {
48
48
  for (const [blockType, placeholder] of Object.entries(placeholders)) {
49
49
  const mustBeFocused = blockType === "default";
50
50
 
51
- styleSheet.insertRule(
52
- `${getSelector(
53
- blockType,
54
- mustBeFocused
55
- )}{ content: ${JSON.stringify(placeholder)}; }`
56
- );
57
-
58
- // For some reason, the placeholders which show when the block is focused
59
- // take priority over ones which show depending on block type, so we need
60
- // to make sure the block specific ones are also used when the block is
61
- // focused.
62
- if (!mustBeFocused) {
51
+ try {
63
52
  styleSheet.insertRule(
64
- `${getSelector(blockType, true)}{ content: ${JSON.stringify(
65
- placeholder
66
- )}; }`
53
+ `${getSelector(
54
+ blockType,
55
+ mustBeFocused
56
+ )} { content: ${JSON.stringify(placeholder)}; }`
57
+ );
58
+
59
+ // For some reason, the placeholders which show when the block is focused
60
+ // take priority over ones which show depending on block type, so we need
61
+ // to make sure the block specific ones are also used when the block is
62
+ // focused.
63
+ if (!mustBeFocused) {
64
+ styleSheet.insertRule(
65
+ `${getSelector(blockType, true)} { content: ${JSON.stringify(
66
+ placeholder
67
+ )}; }`
68
+ );
69
+ }
70
+ } catch (e) {
71
+ // eslint-disable-next-line no-console
72
+ console.warn(
73
+ `Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)`,
74
+ e
67
75
  );
68
76
  }
69
77
  }
70
78
 
71
79
  return {
72
80
  destroy: () => {
73
- if (editor._tiptapEditor.view.root instanceof ShadowRoot) {
74
- editor._tiptapEditor.view.root.removeChild(styleEl);
81
+ if (editor.prosemirrorView?.root instanceof ShadowRoot) {
82
+ editor.prosemirrorView.root.removeChild(styleEl);
75
83
  } else {
76
- editor._tiptapEditor.view.root.head.removeChild(styleEl);
84
+ editor.prosemirrorView?.root.head.removeChild(styleEl);
77
85
  }
78
86
  },
79
87
  };
@@ -485,7 +485,11 @@ export class SideMenuProsemirrorPlugin<
485
485
  /**
486
486
  * Handles drag & drop events for blocks.
487
487
  */
488
- blockDragEnd = () => unsetDragImage(this.editor.prosemirrorView.root);
488
+ blockDragEnd = () => {
489
+ if (this.editor.prosemirrorView) {
490
+ unsetDragImage(this.editor.prosemirrorView.root);
491
+ }
492
+ };
489
493
  /**
490
494
  * Freezes the side menu. When frozen, the side menu will stay
491
495
  * attached to the same block regardless of which block is hovered by the
@@ -148,8 +148,15 @@ export function dragStart<
148
148
  }
149
149
 
150
150
  const view = editor.prosemirrorView;
151
+ if (!view) {
152
+ return;
153
+ }
151
154
 
152
- const pos = getNodeById(block.id, view.state.doc).posBeforeNode;
155
+ const posInfo = getNodeById(block.id, view.state.doc);
156
+ if (!posInfo) {
157
+ throw new Error(`Block with ID ${block.id} not found`);
158
+ }
159
+ const pos = posInfo.posBeforeNode;
153
160
 
154
161
  if (pos != null) {
155
162
  const selection = view.state.selection;
@@ -45,12 +45,12 @@ class SuggestionMenuView<
45
45
  });
46
46
  };
47
47
 
48
- this.rootEl = this.editor._tiptapEditor.view.root;
48
+ this.rootEl = this.editor.prosemirrorView?.root;
49
49
 
50
50
  // Setting capture=true ensures that any parent container of the editor that
51
51
  // gets scrolled will trigger the scroll event. Scroll events do not bubble
52
52
  // and so won't propagate to the document by default.
53
- this.rootEl.addEventListener("scroll", this.handleScroll, true);
53
+ this.rootEl?.addEventListener("scroll", this.handleScroll, true);
54
54
  }
55
55
 
56
56
  handleScroll = () => {
@@ -113,10 +113,7 @@ class SuggestionMenuView<
113
113
 
114
114
  closeMenu = () => {
115
115
  this.editor.dispatch(
116
- this.editor._tiptapEditor.view.state.tr.setMeta(
117
- suggestionMenuPluginKey,
118
- null
119
- )
116
+ this.editor._tiptapEditor.state.tr.setMeta(suggestionMenuPluginKey, null)
120
117
  );
121
118
  };
122
119
 
@@ -236,6 +236,9 @@ export class TableHandlesView<
236
236
  blockEl.id,
237
237
  this.editor._tiptapEditor.state.doc
238
238
  );
239
+ if (!pmNodeInfo) {
240
+ throw new Error(`Block with ID ${blockEl.id} not found`);
241
+ }
239
242
 
240
243
  const block = nodeToBlock(
241
244
  pmNodeInfo.node,
@@ -468,17 +471,26 @@ export class TableHandlesView<
468
471
  // the existing selection out of the block.
469
472
  this.editor.setTextCursorPosition(this.state.block.id);
470
473
  };
471
- // Updates drag handle positions on table content updates.
474
+ // Updates drag handles when the table is modified or removed.
472
475
  update() {
473
476
  if (!this.state || !this.state.show) {
474
477
  return;
475
478
  }
476
479
 
477
- const tableBody = this.tableElement!.querySelector("tbody");
478
- if (!tableBody) {
480
+ // Hide handles if the table block has been removed.
481
+ this.state.block = this.editor.getBlock(this.state.block.id)!;
482
+ if (!this.state.block) {
483
+ this.state.show = false;
484
+ this.state.showAddOrRemoveRowsButton = false;
485
+ this.state.showAddOrRemoveColumnsButton = false;
486
+ this.emitUpdate();
487
+
479
488
  return;
480
489
  }
481
490
 
491
+ const rowCount = this.state.block.content.rows.length;
492
+ const colCount = this.state.block.content.rows[0].cells.length;
493
+
482
494
  if (
483
495
  this.state.rowIndex !== undefined &&
484
496
  this.state.colIndex !== undefined
@@ -486,20 +498,33 @@ export class TableHandlesView<
486
498
  // If rows or columns are deleted in the update, the hovered indices for
487
499
  // those may now be out of bounds. If this is the case, they are moved to
488
500
  // the new last row or column.
489
- if (this.state.rowIndex >= tableBody.children.length) {
490
- this.state.rowIndex = tableBody.children.length - 1;
501
+ if (this.state.rowIndex >= rowCount) {
502
+ this.state.rowIndex = rowCount - 1;
491
503
  }
492
- if (this.state.colIndex >= tableBody.children[0].children.length) {
493
- this.state.colIndex = tableBody.children[0].children.length - 1;
504
+ if (this.state.colIndex >= colCount) {
505
+ this.state.colIndex = colCount - 1;
494
506
  }
507
+ }
508
+
509
+ // Update bounding boxes.
510
+ const tableBody = this.tableElement!.querySelector("tbody");
511
+ if (!tableBody) {
512
+ throw new Error(
513
+ "Table block does not contain a 'tbody' HTML element. This should never happen."
514
+ );
515
+ }
495
516
 
517
+ if (
518
+ this.state.rowIndex !== undefined &&
519
+ this.state.colIndex !== undefined
520
+ ) {
496
521
  const row = tableBody.children[this.state.rowIndex];
497
522
  const cell = row.children[this.state.colIndex];
523
+
498
524
  this.state.referencePosCell = cell.getBoundingClientRect();
499
525
  }
500
-
501
- this.state.block = this.editor.getBlock(this.state.block.id)!;
502
526
  this.state.referencePosTable = tableBody.getBoundingClientRect();
527
+
503
528
  this.emitUpdate();
504
529
  }
505
530
 
@@ -717,7 +742,11 @@ export class TableHandlesProsemirrorPlugin<
717
742
  })
718
743
  );
719
744
 
720
- setHiddenDragImage(this.editor._tiptapEditor.view.root);
745
+ if (!this.editor.prosemirrorView) {
746
+ throw new Error("Editor view not initialized.");
747
+ }
748
+
749
+ setHiddenDragImage(this.editor.prosemirrorView.root);
721
750
  event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);
722
751
  event.dataTransfer!.effectAllowed = "move";
723
752
  };
@@ -756,7 +785,11 @@ export class TableHandlesProsemirrorPlugin<
756
785
  })
757
786
  );
758
787
 
759
- setHiddenDragImage(this.editor._tiptapEditor.view.root);
788
+ if (!this.editor.prosemirrorView) {
789
+ throw new Error("Editor view not initialized.");
790
+ }
791
+
792
+ setHiddenDragImage(this.editor.prosemirrorView.root);
760
793
  event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);
761
794
  event.dataTransfer!.effectAllowed = "copyMove";
762
795
  };
@@ -779,7 +812,11 @@ export class TableHandlesProsemirrorPlugin<
779
812
  this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, null)
780
813
  );
781
814
 
782
- unsetHiddenDragImage(this.editor._tiptapEditor.view.root);
815
+ if (!this.editor.prosemirrorView) {
816
+ throw new Error("Editor view not initialized.");
817
+ }
818
+
819
+ unsetHiddenDragImage(this.editor.prosemirrorView.root);
783
820
  };
784
821
 
785
822
  /**
@@ -271,7 +271,7 @@ export const ru: Dictionary = {
271
271
  image: "Удалить картинку",
272
272
  video: "Удалить видео",
273
273
  audio: "Удалить аудио",
274
- file: "Скачать файл",
274
+ file: "Удалить файл",
275
275
  },
276
276
  },
277
277
  file_preview_toggle: {
package/src/index.ts CHANGED
@@ -7,10 +7,16 @@ export * from "./api/testUtil/index.js";
7
7
  export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
8
8
  export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
9
9
  export * from "./blocks/FileBlockContent/FileBlockContent.js";
10
- export * from "./blocks/FileBlockContent/fileBlockHelpers.js";
10
+ export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
11
+ export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
12
+ export * from "./blocks/FileBlockContent/helpers/render/createAddFileButton.js";
13
+ export * from "./blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js";
14
+ export * from "./blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js";
15
+ export * from "./blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js";
16
+ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js";
17
+ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js";
11
18
  export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
12
19
  export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
13
- export { parseImageElement } from "./blocks/ImageBlockContent/imageBlockHelpers.js";
14
20
  export {
15
21
  EMPTY_CELL_HEIGHT,
16
22
  EMPTY_CELL_WIDTH,
@@ -30,6 +36,7 @@ export * from "./extensions-shared/UiElementPosition.js";
30
36
  export * from "./extensions/FilePanel/FilePanelPlugin.js";
31
37
  export * from "./extensions/FormattingToolbar/FormattingToolbarPlugin.js";
32
38
  export * from "./extensions/LinkToolbar/LinkToolbarPlugin.js";
39
+ export * from "./extensions/LinkToolbar/protocols.js";
33
40
  export * from "./extensions/SideMenu/SideMenuPlugin.js";
34
41
  export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem.js";
35
42
  export * from "./extensions/SuggestionMenu/DefaultSuggestionItem.js";
@@ -142,8 +142,8 @@ export function createInlineContentSpec<
142
142
  editor.schema.styleSchema
143
143
  );
144
144
 
145
- editor._tiptapEditor.view.dispatch(
146
- editor._tiptapEditor.view.state.tr.replaceWith(
145
+ editor.dispatch(
146
+ editor.prosemirrorView.state.tr.replaceWith(
147
147
  getPos(),
148
148
  getPos() + node.nodeSize,
149
149
  content
@@ -0,0 +1,15 @@
1
+ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor";
2
+ import { BlockIdentifier } from "../../../../schema/index.js";
3
+ /**
4
+ * Removes the selected blocks from the editor, then inserts them before/after a
5
+ * reference block. Also updates the selection to match the original selection
6
+ * using `getBlockSelectionData` and `updateBlockSelectionFromData`.
7
+ * @param editor The BlockNote editor instance to move the blocks in.
8
+ * @param referenceBlock The reference block to insert the selected blocks
9
+ * before/after.
10
+ * @param placement Whether to insert the selected blocks before or after the
11
+ * reference block.
12
+ */
13
+ export declare function moveSelectedBlocksAndSelection(editor: BlockNoteEditor<any, any, any>, referenceBlock: BlockIdentifier, placement: "before" | "after"): void;
14
+ export declare function moveBlocksUp(editor: BlockNoteEditor<any, any, any>): void;
15
+ export declare function moveBlocksDown(editor: BlockNoteEditor<any, any, any>): void;
@@ -0,0 +1,7 @@
1
+ import { Block } from "../../../blocks/defaultBlocks.js";
2
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
3
+ import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
4
+ export declare function getBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
5
+ export declare function getPrevBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
6
+ export declare function getNextBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
7
+ export declare function getParentBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
@@ -0,0 +1,5 @@
1
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
2
+ import { Selection } from "../../../editor/selectionTypes.js";
3
+ import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
4
+ export declare function getSelection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>): Selection<BSchema, I, S> | undefined;
5
+ export declare function setSelection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, startBlock: BlockIdentifier, endBlock: BlockIdentifier): void;
@@ -1,3 +1,2 @@
1
- import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
2
- import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
3
- export declare function handleVSCodePaste<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(event: ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>): Promise<boolean>;
1
+ import { EditorView } from "prosemirror-view";
2
+ export declare function handleVSCodePaste(event: ClipboardEvent, view: EditorView): Promise<boolean>;
@@ -1,6 +1,4 @@
1
1
  import { Extension } from "@tiptap/core";
2
2
  import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
3
3
  import { InlineContentSchema, StyleSchema } from "../../../schema/index.js";
4
- export declare const createPasteFromClipboardExtension: <BSchema extends Record<string, import("../../../schema/index.js").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>) => Extension<{
5
- editor: BlockNoteEditor<BSchema, I, S>;
6
- }, undefined>;
4
+ export declare const createPasteFromClipboardExtension: <BSchema extends Record<string, import("../../../schema/index.js").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>) => Extension<any, any>;
@@ -5,4 +5,4 @@ import { Node } from "prosemirror-model";
5
5
  export declare function getNodeById(id: string, doc: Node): {
6
6
  node: Node;
7
7
  posBeforeNode: number;
8
- };
8
+ } | undefined;
@@ -42,11 +42,8 @@ export declare const audioBlockConfig: {
42
42
  fileBlockAccept: string[];
43
43
  };
44
44
  export declare const audioRender: (block: BlockFromConfig<typeof audioBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
45
- dom: HTMLDivElement;
46
- destroy?: undefined;
47
- } | {
48
- dom: HTMLDivElement;
49
- destroy: (() => void) | undefined;
45
+ dom: HTMLElement;
46
+ destroy?: (() => void) | undefined;
50
47
  };
51
48
  export declare const audioParse: (element: HTMLElement) => Partial<Props<typeof audioBlockConfig.propSchema>> | undefined;
52
49
  export declare const audioToExternalHTML: (block: BlockFromConfig<typeof audioBlockConfig, any, any>) => {
@@ -34,11 +34,8 @@ export declare const fileBlockConfig: {
34
34
  isFileBlock: true;
35
35
  };
36
36
  export declare const fileRender: (block: BlockFromConfig<typeof fileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
37
- dom: HTMLDivElement;
38
- destroy?: undefined;
39
- } | {
40
- dom: HTMLDivElement;
41
- destroy: (() => void) | undefined;
37
+ dom: HTMLElement;
38
+ destroy?: (() => void) | undefined;
42
39
  };
43
40
  export declare const fileParse: (element: HTMLElement) => {
44
41
  url: string | undefined;
@@ -0,0 +1,3 @@
1
+ export declare const parseEmbedElement: (embedElement: HTMLEmbedElement) => {
2
+ url: string | undefined;
3
+ };
@@ -0,0 +1,4 @@
1
+ export declare const parseFigureElement: (figureElement: HTMLElement, targetTag: string) => {
2
+ targetElement: HTMLElement;
3
+ caption: string | undefined;
4
+ } | undefined;
@@ -0,0 +1,6 @@
1
+ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js";
2
+ import { BlockFromConfig, FileBlockConfig } from "../../../../schema/index.js";
3
+ export declare const createAddFileButton: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>, buttonText?: string, buttonIcon?: HTMLElement) => {
4
+ dom: HTMLDivElement;
5
+ destroy: () => void;
6
+ };
@@ -0,0 +1,9 @@
1
+ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js";
2
+ import { BlockFromConfig, BlockSchemaWithBlock, FileBlockConfig } from "../../../../schema/index.js";
3
+ export declare const createFileBlockWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<BlockSchemaWithBlock<FileBlockConfig["type"], FileBlockConfig>, any, any>, element?: {
4
+ dom: HTMLElement;
5
+ destroy?: () => void;
6
+ }, buttonText?: string, buttonIcon?: HTMLElement) => {
7
+ dom: HTMLElement;
8
+ destroy?: (() => void) | undefined;
9
+ };
@@ -0,0 +1,6 @@
1
+ import { BlockFromConfig, FileBlockConfig } from "../../../../schema/index.js";
2
+ export declare 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>";
3
+ export declare const createFileNameWithIcon: (block: BlockFromConfig<FileBlockConfig, any, any>) => {
4
+ dom: HTMLElement;
5
+ destroy?: () => void;
6
+ };
@@ -0,0 +1,9 @@
1
+ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js";
2
+ import { BlockFromConfig, FileBlockConfig } from "../../../../schema/index.js";
3
+ export declare const createResizableFileBlockWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>, element: {
4
+ dom: HTMLElement;
5
+ destroy?: () => void;
6
+ }, resizeHandlesContainerElement: HTMLElement, buttonText: string, buttonIcon: HTMLElement) => {
7
+ dom: HTMLElement;
8
+ destroy: () => void;
9
+ };
@@ -0,0 +1,3 @@
1
+ export declare const createFigureWithCaption: (element: HTMLElement, caption: string) => {
2
+ dom: HTMLElement;
3
+ };
@@ -0,0 +1,3 @@
1
+ export declare const createLinkWithCaption: (element: HTMLElement, caption: string) => {
2
+ dom: HTMLDivElement;
3
+ };
@@ -56,11 +56,8 @@ export declare const imageBlockConfig: {
56
56
  fileBlockAccept: string[];
57
57
  };
58
58
  export declare const imageRender: (block: BlockFromConfig<typeof imageBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
59
- dom: HTMLDivElement;
60
- destroy?: undefined;
61
- } | {
62
- dom: HTMLDivElement;
63
- destroy: (() => void) | undefined;
59
+ dom: HTMLElement;
60
+ destroy: () => void;
64
61
  };
65
62
  export declare const imageParse: (element: HTMLElement) => Partial<Props<typeof imageBlockConfig.propSchema>> | undefined;
66
63
  export declare const imageToExternalHTML: (block: BlockFromConfig<typeof imageBlockConfig, any, any>) => {
@@ -56,11 +56,8 @@ export declare const videoBlockConfig: {
56
56
  fileBlockAccept: string[];
57
57
  };
58
58
  export declare const videoRender: (block: BlockFromConfig<typeof videoBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
59
- dom: HTMLDivElement;
60
- destroy?: undefined;
61
- } | {
62
- dom: HTMLDivElement;
63
- destroy: (() => void) | undefined;
59
+ dom: HTMLElement;
60
+ destroy: () => void;
64
61
  };
65
62
  export declare const videoParse: (element: HTMLElement) => Partial<Props<typeof videoBlockConfig.propSchema>> | undefined;
66
63
  export declare const videoToExternalHTML: (block: BlockFromConfig<typeof videoBlockConfig, any, any>) => {
@@ -17,6 +17,7 @@ import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor.js";
17
17
  import { Dictionary } from "../i18n/dictionary.js";
18
18
  import { Plugin, Transaction } from "@tiptap/pm/state";
19
19
  import "../style.css";
20
+ import { EditorView } from "prosemirror-view";
20
21
  export type BlockNoteExtension = AnyExtension | {
21
22
  plugin: Plugin;
22
23
  };
@@ -123,6 +124,20 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
123
124
  */
124
125
  setIdAttribute?: boolean;
125
126
  dropCursor?: (opts: any) => Plugin;
127
+ /**
128
+ Select desired behavior when pressing `Tab` (or `Shift-Tab`). Specifically,
129
+ what should happen when a user has selected multiple blocks while a toolbar
130
+ is open:
131
+ - `"prefer-navigate-ui"`: Change focus to the toolbar. The user needs to
132
+ first press `Escape` to close the toolbar, and can then indent multiple
133
+ blocks. Better for keyboard accessibility.
134
+ - `"prefer-indent"`: Regardless of whether toolbars are open, indent the
135
+ selection of blocks. In this case, it's not possible to navigate toolbars
136
+ with the keyboard.
137
+
138
+ @default "prefer-navigate-ui"
139
+ */
140
+ tabBehavior: "prefer-navigate-ui" | "prefer-indent";
126
141
  };
127
142
  export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
128
143
  protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
@@ -139,7 +154,8 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
139
154
  * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
140
155
  */
141
156
  readonly headless: boolean;
142
- readonly _tiptapEditor: BlockNoteTipTapEditor & {
157
+ readonly _tiptapEditor: Omit<BlockNoteTipTapEditor, "view"> & {
158
+ view: EditorView | undefined;
143
159
  contentComponent: any;
144
160
  };
145
161
  /**
@@ -182,7 +198,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
182
198
  readonly uploadFile: ((file: File, blockId?: string) => Promise<string | Record<string, any>>) | undefined;
183
199
  private onUploadStartCallbacks;
184
200
  private onUploadEndCallbacks;
185
- readonly resolveFileUrl: (url: string) => Promise<string>;
201
+ readonly resolveFileUrl?: (url: string) => Promise<string>;
186
202
  get pmSchema(): Schema<any, any>;
187
203
  static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
188
204
  protected constructor(options: Partial<BlockNoteEditorOptions<any, any, any>>);
@@ -193,8 +209,8 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
193
209
  * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
194
210
  */
195
211
  mount: (parentElement?: HTMLElement | null) => void;
196
- get prosemirrorView(): import("prosemirror-view").EditorView;
197
- get domElement(): HTMLDivElement;
212
+ get prosemirrorView(): EditorView | undefined;
213
+ get domElement(): HTMLDivElement | undefined;
198
214
  isFocused(): boolean;
199
215
  focus(): void;
200
216
  onUploadStart(callback: (blockId?: string) => void): () => void;
@@ -210,10 +226,39 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
210
226
  get document(): Block<BSchema, ISchema, SSchema>[];
211
227
  /**
212
228
  * Gets a snapshot of an existing block from the editor.
213
- * @param blockIdentifier The identifier of an existing block that should be retrieved.
214
- * @returns The block that matches the identifier, or `undefined` if no matching block was found.
229
+ * @param blockIdentifier The identifier of an existing block that should be
230
+ * retrieved.
231
+ * @returns The block that matches the identifier, or `undefined` if no
232
+ * matching block was found.
215
233
  */
216
234
  getBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
235
+ /**
236
+ * Gets a snapshot of the previous sibling of an existing block from the
237
+ * editor.
238
+ * @param blockIdentifier The identifier of an existing block for which the
239
+ * previous sibling should be retrieved.
240
+ * @returns The previous sibling of the block that matches the identifier.
241
+ * `undefined` if no matching block was found, or it's the first child/block
242
+ * in the document.
243
+ */
244
+ getPrevBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
245
+ /**
246
+ * Gets a snapshot of the next sibling of an existing block from the editor.
247
+ * @param blockIdentifier The identifier of an existing block for which the
248
+ * next sibling should be retrieved.
249
+ * @returns The next sibling of the block that matches the identifier.
250
+ * `undefined` if no matching block was found, or it's the last child/block in
251
+ * the document.
252
+ */
253
+ getNextBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
254
+ /**
255
+ * Gets a snapshot of the parent of an existing block from the editor.
256
+ * @param blockIdentifier The identifier of an existing block for which the
257
+ * parent should be retrieved.
258
+ * @returns The parent of the block that matches the identifier. `undefined`
259
+ * if no matching block was found, or the block isn't nested.
260
+ */
261
+ getParentBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
217
262
  /**
218
263
  * Traverses all blocks in the editor depth-first, and executes a callback for each.
219
264
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
@@ -246,6 +291,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
246
291
  * Gets a snapshot of the current selection.
247
292
  */
248
293
  getSelection(): Selection<BSchema, ISchema, SSchema> | undefined;
294
+ setSelection(startBlock: BlockIdentifier, endBlock: BlockIdentifier): void;
249
295
  /**
250
296
  * Checks if the editor is currently editable, or if it's locked.
251
297
  * @returns True if the editor is editable, false otherwise.
@@ -345,17 +391,17 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
345
391
  */
346
392
  unnestBlock(): void;
347
393
  /**
348
- * Moves the block containing the text cursor up. If the previous block has
349
- * children, moves it to the end of its children. If there is no previous
350
- * block, but the current block is nested, moves it out of & before its parent.
394
+ * Moves the selected blocks up. If the previous block has children, moves
395
+ * them to the end of its children. If there is no previous block, but the
396
+ * current blocks share a common parent, moves them out of & before it.
351
397
  */
352
- moveBlockUp(): void;
398
+ moveBlocksUp(): void;
353
399
  /**
354
- * Moves the block containing the text cursor down. If the next block has
355
- * children, moves it to the start of its children. If there is no next block,
356
- * but the current block is nested, moves it out of & after its parent.
400
+ * Moves the selected blocks down. If the next block has children, moves
401
+ * them to the start of its children. If there is no next block, but the
402
+ * current blocks share a common parent, moves them out of & after it.
357
403
  */
358
- moveBlockDown(): void;
404
+ moveBlocksDown(): void;
359
405
  /**
360
406
  * Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list
361
407
  * items are un-nested in the output HTML.
@@ -25,6 +25,7 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
25
25
  tableHandles: boolean;
26
26
  dropCursor: (opts: any) => Plugin;
27
27
  placeholders: Record<string | "default", string>;
28
+ tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
28
29
  };
29
30
  /**
30
31
  * Get all the Tiptap extensions BlockNote is configured with by default