@blocknote/core 0.21.0 → 0.22.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 (391) hide show
  1. package/dist/blocknote.js +1023 -999
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +7 -7
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/webpack-stats.json +1 -1
  8. package/package.json +3 -3
  9. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
  10. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
  11. package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
  12. package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
  13. package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
  14. package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
  15. package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
  16. package/src/api/clipboard/clipboardExternal.test.ts +161 -0
  17. package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +60 -38
  18. package/src/api/clipboard/testUtil.ts +27 -0
  19. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -0
  20. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  21. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
  22. package/src/api/nodeConversions/nodeToBlock.ts +4 -1
  23. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
  24. package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
  25. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -19
  26. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +3 -15
  27. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
  28. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +25 -5
  29. package/src/editor/Block.css +3 -3
  30. package/src/editor/BlockNoteEditor.test.ts +21 -1
  31. package/src/editor/editor.css +6 -6
  32. package/src/editor/transformPasted.ts +57 -4
  33. package/src/schema/blocks/createSpec.ts +1 -1
  34. package/src/schema/blocks/internal.ts +16 -6
  35. package/src/schema/inlineContent/internal.ts +4 -1
  36. package/src/schema/propTypes.ts +41 -18
  37. package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
  38. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  39. package/types/src/api/clipboard/testUtil.d.ts +509 -0
  40. package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
  41. package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
  42. package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
  43. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
  44. package/types/src/blocks/defaultBlocks.d.ts +16 -0
  45. package/types/src/editor/transformPasted.d.ts +8 -4
  46. package/types/src/schema/propTypes.d.ts +20 -2
  47. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
  48. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
  49. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
  50. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
  51. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
  52. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
  53. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
  54. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
  55. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
  56. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
  57. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
  58. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
  59. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
  60. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
  61. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
  62. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
  63. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
  64. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
  65. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
  66. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
  67. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
  68. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
  69. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
  70. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
  71. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
  72. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
  73. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
  74. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
  75. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
  76. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
  77. package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
  78. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
  79. package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
  80. package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
  81. package/dist/src/api/blockManipulation/selections/selection.js +0 -149
  82. package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
  83. package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
  84. package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
  85. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
  86. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
  87. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
  88. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
  89. package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
  90. package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
  91. package/dist/src/api/clipboard/clipboard.test.js +0 -249
  92. package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
  93. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
  94. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
  95. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
  96. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
  97. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
  98. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
  99. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -25
  100. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
  101. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
  102. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
  103. package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -134
  104. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
  105. package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
  106. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
  107. package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
  108. package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
  109. package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
  110. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
  111. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
  112. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
  113. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
  114. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
  115. package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
  116. package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
  117. package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
  118. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
  119. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
  120. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
  121. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
  122. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
  123. package/dist/src/api/getBlockInfoFromPos.js +0 -165
  124. package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
  125. package/dist/src/api/nodeConversions/blockToNode.js +0 -197
  126. package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
  127. package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
  128. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
  129. package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
  130. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
  131. package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
  132. package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
  133. package/dist/src/api/nodeUtil.js +0 -28
  134. package/dist/src/api/nodeUtil.js.map +0 -1
  135. package/dist/src/api/parsers/html/parseHTML.js +0 -19
  136. package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
  137. package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
  138. package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
  139. package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
  140. package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
  141. package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
  142. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
  143. package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
  144. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
  145. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -112
  146. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
  147. package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
  148. package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
  149. package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
  150. package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
  151. package/dist/src/api/testUtil/cases/customStyles.js +0 -83
  152. package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
  153. package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
  154. package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
  155. package/dist/src/api/testUtil/index.js +0 -2
  156. package/dist/src/api/testUtil/index.js.map +0 -1
  157. package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
  158. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
  159. package/dist/src/api/testUtil/paste.js +0 -29
  160. package/dist/src/api/testUtil/paste.js.map +0 -1
  161. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -104
  162. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
  163. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js +0 -5
  164. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js.map +0 -1
  165. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
  166. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
  167. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
  168. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
  169. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -71
  170. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
  171. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +0 -5
  172. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +0 -1
  173. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +0 -10
  174. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +0 -1
  175. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +0 -39
  176. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +0 -1
  177. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +0 -51
  178. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +0 -1
  179. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +0 -17
  180. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +0 -1
  181. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +0 -147
  182. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +0 -1
  183. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +0 -9
  184. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +0 -1
  185. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +0 -11
  186. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js.map +0 -1
  187. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
  188. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
  189. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
  190. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
  191. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -114
  192. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
  193. package/dist/src/blocks/ImageBlockContent/parseImageElement.js +0 -6
  194. package/dist/src/blocks/ImageBlockContent/parseImageElement.js.map +0 -1
  195. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
  196. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
  197. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
  198. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
  199. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
  200. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
  201. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
  202. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
  203. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
  204. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
  205. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
  206. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
  207. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
  208. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
  209. package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
  210. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
  211. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -114
  212. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
  213. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js +0 -6
  214. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js.map +0 -1
  215. package/dist/src/blocks/defaultBlockHelpers.js +0 -50
  216. package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
  217. package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
  218. package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
  219. package/dist/src/blocks/defaultBlocks.js +0 -50
  220. package/dist/src/blocks/defaultBlocks.js.map +0 -1
  221. package/dist/src/blocks/defaultProps.js +0 -19
  222. package/dist/src/blocks/defaultProps.js.map +0 -1
  223. package/dist/src/editor/BlockNoteEditor.js +0 -751
  224. package/dist/src/editor/BlockNoteEditor.js.map +0 -1
  225. package/dist/src/editor/BlockNoteEditor.test.js +0 -65
  226. package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
  227. package/dist/src/editor/BlockNoteExtensions.js +0 -192
  228. package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
  229. package/dist/src/editor/BlockNoteSchema.js +0 -38
  230. package/dist/src/editor/BlockNoteSchema.js.map +0 -1
  231. package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
  232. package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
  233. package/dist/src/editor/cursorPositionTypes.js +0 -2
  234. package/dist/src/editor/cursorPositionTypes.js.map +0 -1
  235. package/dist/src/editor/defaultColors.js +0 -77
  236. package/dist/src/editor/defaultColors.js.map +0 -1
  237. package/dist/src/editor/selectionTypes.js +0 -2
  238. package/dist/src/editor/selectionTypes.js.map +0 -1
  239. package/dist/src/editor/transformPasted.js +0 -79
  240. package/dist/src/editor/transformPasted.js.map +0 -1
  241. package/dist/src/exporter/Exporter.js +0 -36
  242. package/dist/src/exporter/Exporter.js.map +0 -1
  243. package/dist/src/exporter/index.js +0 -3
  244. package/dist/src/exporter/index.js.map +0 -1
  245. package/dist/src/exporter/mapping.js +0 -12
  246. package/dist/src/exporter/mapping.js.map +0 -1
  247. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
  248. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
  249. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
  250. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
  251. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
  252. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
  253. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
  254. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
  255. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
  256. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
  257. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
  258. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
  259. package/dist/src/extensions/LinkToolbar/protocols.js +0 -14
  260. package/dist/src/extensions/LinkToolbar/protocols.js.map +0 -1
  261. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
  262. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
  263. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
  264. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
  265. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
  266. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
  267. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
  268. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
  269. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -347
  270. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
  271. package/dist/src/extensions/SideMenu/dragging.js +0 -135
  272. package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
  273. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
  274. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
  275. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
  276. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
  277. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
  278. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
  279. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
  280. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
  281. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
  282. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
  283. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -579
  284. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
  285. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
  286. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
  287. package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
  288. package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
  289. package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
  290. package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
  291. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
  292. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
  293. package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
  294. package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
  295. package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
  296. package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
  297. package/dist/src/extensions-shared/UiElementPosition.js +0 -2
  298. package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
  299. package/dist/src/i18n/dictionary.js +0 -4
  300. package/dist/src/i18n/dictionary.js.map +0 -1
  301. package/dist/src/i18n/locales/ar.js +0 -298
  302. package/dist/src/i18n/locales/ar.js.map +0 -1
  303. package/dist/src/i18n/locales/de.js +0 -313
  304. package/dist/src/i18n/locales/de.js.map +0 -1
  305. package/dist/src/i18n/locales/en.js +0 -314
  306. package/dist/src/i18n/locales/en.js.map +0 -1
  307. package/dist/src/i18n/locales/es.js +0 -312
  308. package/dist/src/i18n/locales/es.js.map +0 -1
  309. package/dist/src/i18n/locales/fr.js +0 -313
  310. package/dist/src/i18n/locales/fr.js.map +0 -1
  311. package/dist/src/i18n/locales/hr.js +0 -308
  312. package/dist/src/i18n/locales/hr.js.map +0 -1
  313. package/dist/src/i18n/locales/index.js +0 -16
  314. package/dist/src/i18n/locales/index.js.map +0 -1
  315. package/dist/src/i18n/locales/is.js +0 -305
  316. package/dist/src/i18n/locales/is.js.map +0 -1
  317. package/dist/src/i18n/locales/ja.js +0 -333
  318. package/dist/src/i18n/locales/ja.js.map +0 -1
  319. package/dist/src/i18n/locales/ko.js +0 -326
  320. package/dist/src/i18n/locales/ko.js.map +0 -1
  321. package/dist/src/i18n/locales/nl.js +0 -313
  322. package/dist/src/i18n/locales/nl.js.map +0 -1
  323. package/dist/src/i18n/locales/pl.js +0 -297
  324. package/dist/src/i18n/locales/pl.js.map +0 -1
  325. package/dist/src/i18n/locales/pt.js +0 -305
  326. package/dist/src/i18n/locales/pt.js.map +0 -1
  327. package/dist/src/i18n/locales/ru.js +0 -340
  328. package/dist/src/i18n/locales/ru.js.map +0 -1
  329. package/dist/src/i18n/locales/vi.js +0 -312
  330. package/dist/src/i18n/locales/vi.js.map +0 -1
  331. package/dist/src/i18n/locales/zh.js +0 -346
  332. package/dist/src/i18n/locales/zh.js.map +0 -1
  333. package/dist/src/index.js +0 -63
  334. package/dist/src/index.js.map +0 -1
  335. package/dist/src/pm-nodes/BlockContainer.js +0 -72
  336. package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
  337. package/dist/src/pm-nodes/BlockGroup.js +0 -43
  338. package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
  339. package/dist/src/pm-nodes/Doc.js +0 -7
  340. package/dist/src/pm-nodes/Doc.js.map +0 -1
  341. package/dist/src/pm-nodes/index.js +0 -4
  342. package/dist/src/pm-nodes/index.js.map +0 -1
  343. package/dist/src/schema/blocks/createSpec.js +0 -126
  344. package/dist/src/schema/blocks/createSpec.js.map +0 -1
  345. package/dist/src/schema/blocks/internal.js +0 -147
  346. package/dist/src/schema/blocks/internal.js.map +0 -1
  347. package/dist/src/schema/blocks/types.js +0 -2
  348. package/dist/src/schema/blocks/types.js.map +0 -1
  349. package/dist/src/schema/index.js +0 -11
  350. package/dist/src/schema/index.js.map +0 -1
  351. package/dist/src/schema/inlineContent/createSpec.js +0 -64
  352. package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
  353. package/dist/src/schema/inlineContent/internal.js +0 -52
  354. package/dist/src/schema/inlineContent/internal.js.map +0 -1
  355. package/dist/src/schema/inlineContent/types.js +0 -10
  356. package/dist/src/schema/inlineContent/types.js.map +0 -1
  357. package/dist/src/schema/propTypes.js +0 -2
  358. package/dist/src/schema/propTypes.js.map +0 -1
  359. package/dist/src/schema/styles/createSpec.js +0 -48
  360. package/dist/src/schema/styles/createSpec.js.map +0 -1
  361. package/dist/src/schema/styles/internal.js +0 -53
  362. package/dist/src/schema/styles/internal.js.map +0 -1
  363. package/dist/src/schema/styles/types.js +0 -2
  364. package/dist/src/schema/styles/types.js.map +0 -1
  365. package/dist/src/util/EventEmitter.js +0 -33
  366. package/dist/src/util/EventEmitter.js.map +0 -1
  367. package/dist/src/util/browser.js +0 -17
  368. package/dist/src/util/browser.js.map +0 -1
  369. package/dist/src/util/combineByGroup.js +0 -20
  370. package/dist/src/util/combineByGroup.js.map +0 -1
  371. package/dist/src/util/esmDependencies.js +0 -35
  372. package/dist/src/util/esmDependencies.js.map +0 -1
  373. package/dist/src/util/string.js +0 -14
  374. package/dist/src/util/string.js.map +0 -1
  375. package/dist/src/util/typescript.js +0 -12
  376. package/dist/src/util/typescript.js.map +0 -1
  377. /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
  378. /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
  379. /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
  380. /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
  381. /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
  382. /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
  383. /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
  384. /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
  385. /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
  386. /package/src/api/clipboard/__snapshots__/{tableAllCells.html → internal/tableAllCells.html} +0 -0
  387. /package/src/api/clipboard/__snapshots__/{tableCell.html → internal/tableCell.html} +0 -0
  388. /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
  389. /package/src/api/clipboard/__snapshots__/{tableRow.html → internal/tableRow.html} +0 -0
  390. /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
  391. /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
@@ -1,8 +1,26 @@
1
1
  export type PropSpec<PType extends boolean | number | string> = {
2
- values?: readonly PType[];
3
2
  default: PType;
3
+ values?: readonly PType[];
4
+ } | {
5
+ default: undefined;
6
+ type: "string" | "number" | "boolean";
7
+ values?: readonly PType[];
4
8
  };
5
9
  export type PropSchema = Record<string, PropSpec<boolean | number | string>>;
6
10
  export type Props<PSchema extends PropSchema> = {
7
- [PName in keyof PSchema]: PSchema[PName]["default"] extends boolean ? PSchema[PName]["values"] extends readonly boolean[] ? PSchema[PName]["values"][number] : boolean : PSchema[PName]["default"] extends number ? PSchema[PName]["values"] extends readonly number[] ? PSchema[PName]["values"][number] : number : PSchema[PName]["default"] extends string ? PSchema[PName]["values"] extends readonly string[] ? PSchema[PName]["values"][number] : string : never;
11
+ [PName in keyof PSchema]: (PSchema[PName] extends {
12
+ default: boolean;
13
+ } | {
14
+ type: "boolean";
15
+ } ? PSchema[PName]["values"] extends readonly boolean[] ? PSchema[PName]["values"][number] : boolean : PSchema[PName] extends {
16
+ default: number;
17
+ } | {
18
+ type: "number";
19
+ } ? PSchema[PName]["values"] extends readonly number[] ? PSchema[PName]["values"][number] : number : PSchema[PName] extends {
20
+ default: string;
21
+ } | {
22
+ type: "string";
23
+ } ? PSchema[PName]["values"] extends readonly string[] ? PSchema[PName]["values"][number] : string : never) extends infer T ? PSchema[PName] extends {
24
+ optional: true;
25
+ } ? T | undefined : T : never;
8
26
  };
@@ -1,30 +0,0 @@
1
- import { blockToNode } from "../../../nodeConversions/blockToNode.js";
2
- import { nodeToBlock } from "../../../nodeConversions/nodeToBlock.js";
3
- import { getNodeById } from "../../../nodeUtil.js";
4
- export function insertBlocks(editor, blocksToInsert, referenceBlock, placement = "before") {
5
- const id = typeof referenceBlock === "string" ? referenceBlock : referenceBlock.id;
6
- const nodesToInsert = [];
7
- for (const blockSpec of blocksToInsert) {
8
- nodesToInsert.push(blockToNode(blockSpec, editor.pmSchema, editor.schema.styleSchema));
9
- }
10
- const posInfo = getNodeById(id, editor._tiptapEditor.state.doc);
11
- if (!posInfo) {
12
- throw new Error(`Block with ID ${id} not found`);
13
- }
14
- // TODO: we might want to use the ReplaceStep directly here instead of insert,
15
- // because the fitting algorithm should not be necessary and might even cause unexpected behavior
16
- if (placement === "before") {
17
- editor.dispatch(editor._tiptapEditor.state.tr.insert(posInfo.posBeforeNode, nodesToInsert));
18
- }
19
- if (placement === "after") {
20
- editor.dispatch(editor._tiptapEditor.state.tr.insert(posInfo.posBeforeNode + posInfo.node.nodeSize, nodesToInsert));
21
- }
22
- // Now that the `PartialBlock`s have been converted to nodes, we can
23
- // re-convert them into full `Block`s.
24
- const insertedBlocks = [];
25
- for (const node of nodesToInsert) {
26
- insertedBlocks.push(nodeToBlock(node, editor.schema.blockSchema, editor.schema.inlineContentSchema, editor.schema.styleSchema, editor.blockCache));
27
- }
28
- return insertedBlocks;
29
- }
30
- //# sourceMappingURL=insertBlocks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insertBlocks.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,YAAY,CAK1B,MAAsC,EACtC,cAA6C,EAC7C,cAA+B,EAC/B,YAAgC,QAAQ;IAExC,MAAM,EAAE,GACN,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC;IAE1E,MAAM,aAAa,GAAW,EAAE,CAAC;IACjC,KAAK,MAAM,SAAS,IAAI,cAAc,EAA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from "../../setupTestEnv.js";
3
- import { insertBlocks } from "./insertBlocks.js";
4
- const getEditor = setupTestEnv();
5
- describe("Test insertBlocks", () => {
6
- it("Insert single basic block before", () => {
7
- insertBlocks(getEditor(), [{ type: "paragraph" }], "paragraph-0", "before");
8
- expect(getEditor().document).toMatchSnapshot();
9
- });
10
- it("Insert single basic block after", () => {
11
- insertBlocks(getEditor(), [{ type: "paragraph" }], "paragraph-0", "after");
12
- expect(getEditor().document).toMatchSnapshot();
13
- });
14
- it("Insert multiple blocks before", () => {
15
- insertBlocks(getEditor(), [
16
- { type: "paragraph", content: "Inserted paragraph 1" },
17
- { type: "paragraph", content: "Inserted paragraph 2" },
18
- { type: "paragraph", content: "Inserted paragraph 3" },
19
- ], "paragraph-0", "before");
20
- expect(getEditor().document).toMatchSnapshot();
21
- });
22
- it("Insert multiple blocks after", () => {
23
- insertBlocks(getEditor(), [
24
- { type: "paragraph", content: "Inserted paragraph 1" },
25
- { type: "paragraph", content: "Inserted paragraph 2" },
26
- { type: "paragraph", content: "Inserted paragraph 3" },
27
- ], "paragraph-0", "after");
28
- expect(getEditor().document).toMatchSnapshot();
29
- });
30
- it("Insert single complex block before", () => {
31
- insertBlocks(getEditor(), [
32
- {
33
- id: "inserted-heading-with-everything",
34
- type: "heading",
35
- props: {
36
- backgroundColor: "red",
37
- level: 2,
38
- textAlignment: "center",
39
- textColor: "red",
40
- },
41
- content: [
42
- { type: "text", text: "Heading", styles: { bold: true } },
43
- { type: "text", text: " with styled ", styles: {} },
44
- { type: "text", text: "content", styles: { italic: true } },
45
- ],
46
- children: [
47
- {
48
- id: "inserted-nested-paragraph-2",
49
- type: "paragraph",
50
- content: "Nested Paragraph 2",
51
- children: [
52
- {
53
- id: "inserted-double-nested-paragraph-2",
54
- type: "paragraph",
55
- content: "Double Nested Paragraph 2",
56
- },
57
- ],
58
- },
59
- ],
60
- },
61
- ], "paragraph-0", "before");
62
- expect(getEditor().document).toMatchSnapshot();
63
- });
64
- it("Insert single complex block after", () => {
65
- insertBlocks(getEditor(), [
66
- {
67
- id: "inserted-heading-with-everything",
68
- type: "heading",
69
- props: {
70
- backgroundColor: "red",
71
- level: 2,
72
- textAlignment: "center",
73
- textColor: "red",
74
- },
75
- content: [
76
- { type: "text", text: "Heading", styles: { bold: true } },
77
- { type: "text", text: " with styled ", styles: {} },
78
- { type: "text", text: "content", styles: { italic: true } },
79
- ],
80
- children: [
81
- {
82
- id: "inserted-nested-paragraph-2",
83
- type: "paragraph",
84
- content: "Nested Paragraph 2",
85
- children: [
86
- {
87
- id: "inserted-double-nested-paragraph-2",
88
- type: "paragraph",
89
- content: "Double Nested Paragraph 2",
90
- },
91
- ],
92
- },
93
- ],
94
- },
95
- ], "paragraph-0", "after");
96
- expect(getEditor().document).toMatchSnapshot();
97
- });
98
- });
99
- //# sourceMappingURL=insertBlocks.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insertBlocks.test.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;AAEjC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;QAE5E,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,YAA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I,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;iBAC5D;gBACD,QAAQ,EAAE;oBACR;wBACE,EAAE,EAAE,6BAA6B;wBACjC,IAAI,EAAE,WAAW;wBACjB,OAAO,EAAE,oBAAoB;wBAC7B,QAAQ,EAAE;4BACR;gCACE,EAAE,EAAE,oCAAoC;gCACxC,IAAI,EAAE,WAAW;gCACjB,OAAO,EAAE,2BAA2B;6BACrC;yBACF;qBACF;iBACF;aACF;SACF,EACD,aAAa,EACb,OAAO,CACR,CAAC;QAEF,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,97 +0,0 @@
1
- import { getBlockInfoFromResolvedPos, } from "../../../getBlockInfoFromPos.js";
2
- /**
3
- * Returns the block info from the parent block
4
- * or undefined if we're at the root
5
- */
6
- export const getParentBlockInfo = (doc, beforePos) => {
7
- const $pos = doc.resolve(beforePos);
8
- if ($pos.depth <= 1) {
9
- return undefined;
10
- }
11
- // get start pos of parent
12
- const parentBeforePos = $pos.posAtIndex($pos.index($pos.depth - 1), $pos.depth - 1);
13
- const parentBlockInfo = getBlockInfoFromResolvedPos(doc.resolve(parentBeforePos));
14
- return parentBlockInfo;
15
- };
16
- /**
17
- * Returns the block info from the sibling block before (above) the given block,
18
- * or undefined if the given block is the first sibling.
19
- */
20
- export const getPrevBlockInfo = (doc, beforePos) => {
21
- const $pos = doc.resolve(beforePos);
22
- const indexInParent = $pos.index();
23
- if (indexInParent === 0) {
24
- return undefined;
25
- }
26
- const prevBlockBeforePos = $pos.posAtIndex(indexInParent - 1);
27
- const prevBlockInfo = getBlockInfoFromResolvedPos(doc.resolve(prevBlockBeforePos));
28
- return prevBlockInfo;
29
- };
30
- /**
31
- * If a block has children like this:
32
- * A
33
- * - B
34
- * - C
35
- * -- D
36
- *
37
- * Then the bottom nested block returned is D.
38
- */
39
- export const getBottomNestedBlockInfo = (doc, blockInfo) => {
40
- while (blockInfo.childContainer) {
41
- const group = blockInfo.childContainer.node;
42
- const newPos = doc
43
- .resolve(blockInfo.childContainer.beforePos + 1)
44
- .posAtIndex(group.childCount - 1);
45
- blockInfo = getBlockInfoFromResolvedPos(doc.resolve(newPos));
46
- }
47
- return blockInfo;
48
- };
49
- const canMerge = (prevBlockInfo, nextBlockInfo) => {
50
- return (prevBlockInfo.isBlockContainer &&
51
- prevBlockInfo.blockContent.node.type.spec.content === "inline*" &&
52
- prevBlockInfo.blockContent.node.childCount > 0 &&
53
- nextBlockInfo.isBlockContainer &&
54
- nextBlockInfo.blockContent.node.type.spec.content === "inline*");
55
- };
56
- const mergeBlocks = (state, dispatch, prevBlockInfo, nextBlockInfo) => {
57
- // Un-nests all children of the next block.
58
- if (!nextBlockInfo.isBlockContainer) {
59
- throw new Error(`Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but next block is not a block container`);
60
- }
61
- // Removes a level of nesting all children of the next block by 1 level, if it contains both content and block
62
- // group nodes.
63
- if (nextBlockInfo.childContainer) {
64
- const childBlocksStart = state.doc.resolve(nextBlockInfo.childContainer.beforePos + 1);
65
- const childBlocksEnd = state.doc.resolve(nextBlockInfo.childContainer.afterPos - 1);
66
- const childBlocksRange = childBlocksStart.blockRange(childBlocksEnd);
67
- if (dispatch) {
68
- const pos = state.doc.resolve(nextBlockInfo.bnBlock.beforePos);
69
- state.tr.lift(childBlocksRange, pos.depth);
70
- }
71
- }
72
- // Deletes the boundary between the two blocks. Can be thought of as
73
- // removing the closing tags of the first block and the opening tags of the
74
- // second one to stitch them together.
75
- if (dispatch) {
76
- if (!prevBlockInfo.isBlockContainer) {
77
- throw new Error(`Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but previous block is not a block container`);
78
- }
79
- // TODO: test merging between a columnList and paragraph, between two columnLists, and v.v.
80
- dispatch(state.tr.delete(prevBlockInfo.blockContent.afterPos - 1, nextBlockInfo.blockContent.beforePos + 1));
81
- }
82
- return true;
83
- };
84
- export const mergeBlocksCommand = (posBetweenBlocks) => ({ state, dispatch, }) => {
85
- const $pos = state.doc.resolve(posBetweenBlocks);
86
- const nextBlockInfo = getBlockInfoFromResolvedPos($pos);
87
- const prevBlockInfo = getPrevBlockInfo(state.doc, nextBlockInfo.bnBlock.beforePos);
88
- if (!prevBlockInfo) {
89
- return false;
90
- }
91
- const bottomNestedBlockInfo = getBottomNestedBlockInfo(state.doc, prevBlockInfo);
92
- if (!canMerge(bottomNestedBlockInfo, nextBlockInfo)) {
93
- return false;
94
- }
95
- return mergeBlocks(state, dispatch, bottomNestedBlockInfo, nextBlockInfo);
96
- };
97
- //# sourceMappingURL=mergeBlocks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeBlocks.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAS,EAAE,SAAiB,EAAE,EAAE;IACjE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEpC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0BAA0B;IAC1B,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAC1B,IAAI,CAAC,KAAK,GAAG,CAAC,CACf,CAAC;IAEF,MAAM,eAAe,GAAG,2BAA2B,CACjD,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,C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CAAC;YACpC,MAAM,IAAI,KAAK,CACb,wCAAwC,aAAa,CAAC,OAAO,CAAC,SAAS,oCAAoC,aAAa,CAAC,OAAO,CAAC,SAAS,+CAA+C,CAC1L,CAAC;QACJ,CAAC;QAED,2FAA2F;QAC3F,QAAQ,CACN,KAAK,CAAC,EAAE,CAAC,MAAM,CACb,aAAa,CAAC,YAAY,CAAC,QAAQ,GAAG,CAAC,EACvC,aAAa,CAAC,YAAY,CAAC,SAAS,GAAG,CAAC,CACzC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAC7B,CAAC,gBAAwB,EAAE,EAAE,CAC7B,CAAC,EACC,KAAK,EACL,QAAQ,GAIT,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,gBAAgB,CACpC,KAAK,CAAC,GAAG,EACT,aAAa,CAAC,OAAO,CAAC,SAAS,CAChC,CAAC;IAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,qBAAqB,GAAG,wBAAwB,CACpD,KAAK,CAAC,GAAG,EACT,aAAa,CACd,CAAC;IAEF,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,aAAa,CAAC,CAAC;AAC5E,CAAC,CAAC"}
@@ -1,88 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { getBlockInfoFromSelection } from "../../../getBlockInfoFromPos.js";
3
- import { setupTestEnv } from "../../setupTestEnv.js";
4
- import { mergeBlocksCommand } from "./mergeBlocks.js";
5
- const getEditor = setupTestEnv();
6
- function mergeBlocks(posBetweenBlocks) {
7
- return getEditor()._tiptapEditor.commands.command(mergeBlocksCommand(posBetweenBlocks));
8
- }
9
- function getPosBeforeSelectedBlock() {
10
- return getBlockInfoFromSelection(getEditor()._tiptapEditor.state).bnBlock
11
- .beforePos;
12
- }
13
- describe("Test mergeBlocks", () => {
14
- it("Basic", () => {
15
- getEditor().setTextCursorPosition("paragraph-1");
16
- mergeBlocks(getPosBeforeSelectedBlock());
17
- expect(getEditor().document).toMatchSnapshot();
18
- });
19
- it("First block has children", () => {
20
- getEditor().setTextCursorPosition("paragraph-2");
21
- mergeBlocks(getPosBeforeSelectedBlock());
22
- expect(getEditor().document).toMatchSnapshot();
23
- });
24
- it("Second block has children", () => {
25
- getEditor().setTextCursorPosition("paragraph-with-children");
26
- mergeBlocks(getPosBeforeSelectedBlock());
27
- expect(getEditor().document).toMatchSnapshot();
28
- });
29
- it("Second block is empty", () => {
30
- getEditor().setTextCursorPosition("empty-paragraph");
31
- mergeBlocks(getPosBeforeSelectedBlock());
32
- expect(getEditor().document).toMatchSnapshot();
33
- });
34
- it("Blocks have different types", () => {
35
- getEditor().setTextCursorPosition("paragraph-5");
36
- mergeBlocks(getPosBeforeSelectedBlock());
37
- expect(getEditor().document).toMatchSnapshot();
38
- });
39
- it("Selection is updated", () => {
40
- getEditor().setTextCursorPosition("paragraph-0", "end");
41
- const firstBlockEndOffset = getEditor()._tiptapEditor.state.selection.$anchor.parentOffset;
42
- getEditor().setTextCursorPosition("paragraph-1");
43
- mergeBlocks(getPosBeforeSelectedBlock());
44
- const anchorIsAtOldFirstBlockEndPos = getEditor()._tiptapEditor.state.selection.$anchor.parentOffset ===
45
- firstBlockEndOffset;
46
- expect(anchorIsAtOldFirstBlockEndPos).toBeTruthy();
47
- });
48
- // We expect a no-op for each of the remaining tests as merging should only
49
- // happen for blocks which both have inline content. We also expect
50
- // `mergeBlocks` to return false as TipTap commands should do that instead of
51
- // throwing an error, when the command cannot be executed.
52
- it("First block is empty", () => {
53
- getEditor().setTextCursorPosition("paragraph-8");
54
- const originalDocument = getEditor().document;
55
- const ret = mergeBlocks(getPosBeforeSelectedBlock());
56
- expect(getEditor().document).toEqual(originalDocument);
57
- expect(ret).toBeFalsy();
58
- });
59
- it("Inline content & no content", () => {
60
- getEditor().setTextCursorPosition("image-0");
61
- const originalDocument = getEditor().document;
62
- const ret = mergeBlocks(getPosBeforeSelectedBlock());
63
- expect(getEditor().document).toEqual(originalDocument);
64
- expect(ret).toBeFalsy();
65
- });
66
- it("Inline content & table content", () => {
67
- getEditor().setTextCursorPosition("table-0");
68
- const originalDocument = getEditor().document;
69
- const ret = mergeBlocks(getPosBeforeSelectedBlock());
70
- expect(getEditor().document).toEqual(originalDocument);
71
- expect(ret).toBeFalsy();
72
- });
73
- it("No content & inline content", () => {
74
- getEditor().setTextCursorPosition("paragraph-6");
75
- const originalDocument = getEditor().document;
76
- const ret = mergeBlocks(getPosBeforeSelectedBlock());
77
- expect(getEditor().document).toEqual(originalDocument);
78
- expect(ret).toBeFalsy();
79
- });
80
- it("Table content & inline content", () => {
81
- getEditor().setTextCursorPosition("paragraph-7");
82
- const originalDocument = getEditor().document;
83
- const ret = mergeBlocks(getPosBeforeSelectedBlock());
84
- expect(getEditor().document).toEqual(originalDocument);
85
- expect(ret).toBeFalsy();
86
- });
87
- });
88
- //# sourceMappingURL=mergeBlocks.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeBlocks.test.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE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QACvD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,SAAS,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,SAAS,EAAE,CAAC,QAAQ,CAAC;QAC9C,MAAM,GAAG,GAAG,WAAW,CAAC,yBAAyB,EAAE,CAAC,CAAC;QAErD,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACvD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,219 +0,0 @@
1
- import { NodeSelection, TextSelection } from "prosemirror-state";
2
- import { CellSelection } from "prosemirror-tables";
3
- import { getNearestBlockPos } from "../../../getBlockInfoFromPos.js";
4
- import { getNodeById } from "../../../nodeUtil.js";
5
- /**
6
- * `getBlockSelectionData` and `updateBlockSelectionFromData` are used to save
7
- * and restore the selection within a block, when the block is moved. This is
8
- * done by first saving the offsets of the anchor and head from the before
9
- * positions of their surrounding blocks, as well as the IDs of those blocks. We
10
- * can then recreate the selection by finding the blocks with those IDs, getting
11
- * their before positions, and adding the offsets to those positions.
12
- * @param editor The BlockNote editor instance to get the selection data from.
13
- */
14
- function getBlockSelectionData(editor) {
15
- const state = editor._tiptapEditor.state;
16
- const selection = state.selection;
17
- const anchorBlockPosInfo = getNearestBlockPos(state.doc, selection.anchor);
18
- if (selection instanceof CellSelection) {
19
- return {
20
- type: "cell",
21
- anchorBlockId: anchorBlockPosInfo.node.attrs.id,
22
- anchorCellOffset: selection.$anchorCell.pos - anchorBlockPosInfo.posBeforeNode,
23
- headCellOffset: selection.$headCell.pos - anchorBlockPosInfo.posBeforeNode,
24
- };
25
- }
26
- else if (editor._tiptapEditor.state.selection instanceof NodeSelection) {
27
- return {
28
- type: "node",
29
- anchorBlockId: anchorBlockPosInfo.node.attrs.id,
30
- };
31
- }
32
- else {
33
- const headBlockPosInfo = getNearestBlockPos(state.doc, selection.head);
34
- return {
35
- type: "text",
36
- anchorBlockId: anchorBlockPosInfo.node.attrs.id,
37
- headBlockId: headBlockPosInfo.node.attrs.id,
38
- anchorOffset: selection.anchor - anchorBlockPosInfo.posBeforeNode,
39
- headOffset: selection.head - headBlockPosInfo.posBeforeNode,
40
- };
41
- }
42
- }
43
- /**
44
- * `getBlockSelectionData` and `updateBlockSelectionFromData` are used to save
45
- * and restore the selection within a block, when the block is moved. This is
46
- * done by first saving the offsets of the anchor and head from the before
47
- * positions of their surrounding blocks, as well as the IDs of those blocks. We
48
- * can then recreate the selection by finding the blocks with those IDs, getting
49
- * their before positions, and adding the offsets to those positions.
50
- * @param editor The BlockNote editor instance to update the selection in.
51
- * @param data The selection data to update the selection with (generated by
52
- * `getBlockSelectionData`).
53
- */
54
- function updateBlockSelectionFromData(editor, data) {
55
- const anchorBlockPos = getNodeById(data.anchorBlockId, editor._tiptapEditor.state.doc)?.posBeforeNode;
56
- if (anchorBlockPos === undefined) {
57
- throw new Error(`Could not find block with ID ${data.anchorBlockId} to update selection`);
58
- }
59
- let selection;
60
- if (data.type === "cell") {
61
- selection = CellSelection.create(editor._tiptapEditor.state.doc, anchorBlockPos + data.anchorCellOffset, anchorBlockPos + data.headCellOffset);
62
- }
63
- else if (data.type === "node") {
64
- selection = NodeSelection.create(editor._tiptapEditor.state.doc, anchorBlockPos + 1);
65
- }
66
- else {
67
- const headBlockPos = getNodeById(data.headBlockId, editor._tiptapEditor.state.doc)?.posBeforeNode;
68
- if (headBlockPos === undefined) {
69
- throw new Error(`Could not find block with ID ${data.headBlockId} to update selection`);
70
- }
71
- selection = TextSelection.create(editor._tiptapEditor.state.doc, anchorBlockPos + data.anchorOffset, headBlockPos + data.headOffset);
72
- }
73
- editor.dispatch(editor._tiptapEditor.state.tr.setSelection(selection));
74
- }
75
- /**
76
- * Replaces any `columnList` blocks with the children of their columns. This is
77
- * done here instead of in `getSelection` as we still need to remove the entire
78
- * `columnList` node but only insert the `blockContainer` nodes inside it.
79
- * @param blocks The blocks to flatten.
80
- */
81
- function flattenColumns(blocks) {
82
- return blocks
83
- .map((block) => {
84
- if (block.type === "columnList") {
85
- return block.children
86
- .map((column) => flattenColumns(column.children))
87
- .flat();
88
- }
89
- return {
90
- ...block,
91
- children: flattenColumns(block.children),
92
- };
93
- })
94
- .flat();
95
- }
96
- /**
97
- * Removes the selected blocks from the editor, then inserts them before/after a
98
- * reference block. Also updates the selection to match the original selection
99
- * using `getBlockSelectionData` and `updateBlockSelectionFromData`.
100
- * @param editor The BlockNote editor instance to move the blocks in.
101
- * @param referenceBlock The reference block to insert the selected blocks
102
- * before/after.
103
- * @param placement Whether to insert the selected blocks before or after the
104
- * reference block.
105
- */
106
- export function moveSelectedBlocksAndSelection(editor, referenceBlock, placement) {
107
- const blocks = editor.getSelection()?.blocks || [
108
- editor.getTextCursorPosition().block,
109
- ];
110
- const selectionData = getBlockSelectionData(editor);
111
- editor.removeBlocks(blocks);
112
- editor.insertBlocks(flattenColumns(blocks), referenceBlock, placement);
113
- updateBlockSelectionFromData(editor, selectionData);
114
- }
115
- // Checks if a block is in a valid place after being moved. This check is
116
- // primitive at the moment and only returns false if the block's parent is a
117
- // `columnList` block. This is because regular blocks cannot be direct children
118
- // of `columnList` blocks.
119
- function checkPlacementIsValid(parentBlock) {
120
- return !parentBlock || parentBlock.type !== "columnList";
121
- }
122
- // Gets the placement for moving a block up. This has 3 cases:
123
- // 1. If the block has a previous sibling without children, the placement is
124
- // before it.
125
- // 2. If the block has a previous sibling with children, the placement is after
126
- // the last child.
127
- // 3. If the block has no previous sibling, but is nested, the placement is
128
- // before its parent.
129
- // If the placement is invalid, the function is called recursively until a valid
130
- // placement is found. Returns undefined if no valid placement is found, meaning
131
- // the block is already at the top of the document.
132
- function getMoveUpPlacement(editor, prevBlock, parentBlock) {
133
- let referenceBlock;
134
- let placement;
135
- if (!prevBlock) {
136
- if (parentBlock) {
137
- referenceBlock = parentBlock;
138
- placement = "before";
139
- }
140
- }
141
- else if (prevBlock.children.length > 0) {
142
- referenceBlock = prevBlock.children[prevBlock.children.length - 1];
143
- placement = "after";
144
- }
145
- else {
146
- referenceBlock = prevBlock;
147
- placement = "before";
148
- }
149
- // Case when the block is already at the top of the document.
150
- if (!referenceBlock || !placement) {
151
- return undefined;
152
- }
153
- const referenceBlockParent = editor.getParentBlock(referenceBlock);
154
- if (!checkPlacementIsValid(referenceBlockParent)) {
155
- return getMoveUpPlacement(editor, placement === "after"
156
- ? referenceBlock
157
- : editor.getPrevBlock(referenceBlock), referenceBlockParent);
158
- }
159
- return { referenceBlock, placement };
160
- }
161
- // Gets the placement for moving a block down. This has 3 cases:
162
- // 1. If the block has a next sibling without children, the placement is after
163
- // it.
164
- // 2. If the block has a next sibling with children, the placement is before the
165
- // first child.
166
- // 3. If the block has no next sibling, but is nested, the placement is
167
- // after its parent.
168
- // If the placement is invalid, the function is called recursively until a valid
169
- // placement is found. Returns undefined if no valid placement is found, meaning
170
- // the block is already at the bottom of the document.
171
- function getMoveDownPlacement(editor, nextBlock, parentBlock) {
172
- let referenceBlock;
173
- let placement;
174
- if (!nextBlock) {
175
- if (parentBlock) {
176
- referenceBlock = parentBlock;
177
- placement = "after";
178
- }
179
- }
180
- else if (nextBlock.children.length > 0) {
181
- referenceBlock = nextBlock.children[0];
182
- placement = "before";
183
- }
184
- else {
185
- referenceBlock = nextBlock;
186
- placement = "after";
187
- }
188
- // Case when the block is already at the bottom of the document.
189
- if (!referenceBlock || !placement) {
190
- return undefined;
191
- }
192
- const referenceBlockParent = editor.getParentBlock(referenceBlock);
193
- if (!checkPlacementIsValid(referenceBlockParent)) {
194
- return getMoveDownPlacement(editor, placement === "before"
195
- ? referenceBlock
196
- : editor.getNextBlock(referenceBlock), referenceBlockParent);
197
- }
198
- return { referenceBlock, placement };
199
- }
200
- export function moveBlocksUp(editor) {
201
- const selection = editor.getSelection();
202
- const block = selection?.blocks[0] || editor.getTextCursorPosition().block;
203
- const moveUpPlacement = getMoveUpPlacement(editor, editor.getPrevBlock(block), editor.getParentBlock(block));
204
- if (!moveUpPlacement) {
205
- return;
206
- }
207
- moveSelectedBlocksAndSelection(editor, moveUpPlacement.referenceBlock, moveUpPlacement.placement);
208
- }
209
- export function moveBlocksDown(editor) {
210
- const selection = editor.getSelection();
211
- const block = selection?.blocks[selection?.blocks.length - 1] ||
212
- editor.getTextCursorPosition().block;
213
- const moveDownPlacement = getMoveDownPlacement(editor, editor.getNextBlock(block), editor.getParentBlock(block));
214
- if (!moveDownPlacement) {
215
- return;
216
- }
217
- moveSelectedBlocksAndSelection(editor, moveDownPlacement.referenceBlock, moveDownPlacement.placement);
218
- }
219
- //# sourceMappingURL=moveBlocks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveBlocks.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAqBnD;;;;;;;;GAQG;AACH,SAAS,qBAAqB,CAC5B,MAAsC;IAEtC,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAElC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAE3E,IAAI,SAAS,YAAY,aAAa,EAAE,CAAC;QACvC,OAAO;YACL,IAAI,EAAE,MAAe;YACrB,aAAa,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