@blocknote/core 0.20.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 (456) hide show
  1. package/dist/blocknote.js +1602 -1569
  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/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/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +3 -3
  10. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +1 -3
  11. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +1 -1
  12. package/src/api/blockManipulation/selections/selection.ts +5 -5
  13. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
  14. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
  15. package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
  16. package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
  17. package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
  18. package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
  19. package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
  20. package/src/api/clipboard/__snapshots__/internal/tableAllCells.html +1 -0
  21. package/src/api/clipboard/__snapshots__/internal/tableCell.html +1 -0
  22. package/src/api/clipboard/__snapshots__/internal/tableRow.html +1 -0
  23. package/src/api/clipboard/clipboardExternal.test.ts +161 -0
  24. package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +66 -40
  25. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
  26. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +7 -14
  27. package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -6
  28. package/src/api/clipboard/testUtil.ts +27 -0
  29. package/src/api/clipboard/toClipboard/copyExtension.ts +8 -2
  30. package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -1
  31. package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -1
  32. package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -1
  33. package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -1
  34. package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
  35. package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
  36. package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -1
  37. package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
  38. package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
  39. package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
  40. package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
  41. package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
  42. package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
  43. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
  44. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -1
  45. package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
  46. package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
  47. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
  48. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -1
  49. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  50. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
  51. package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -1
  52. package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +2 -2
  53. package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -1
  54. package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +1 -1
  55. package/src/api/nodeConversions/nodeToBlock.ts +4 -1
  56. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
  57. package/src/api/parsers/markdown/parseMarkdown.test.ts +5 -7
  58. package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
  59. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +13 -14
  60. package/src/blocks/FileBlockContent/FileBlockContent.ts +5 -12
  61. package/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts +5 -0
  62. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +16 -0
  63. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +63 -0
  64. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +80 -0
  65. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +24 -0
  66. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +204 -0
  67. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +13 -0
  68. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +15 -0
  69. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -19
  70. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +20 -28
  71. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +3 -15
  72. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
  73. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +25 -5
  74. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +20 -27
  75. package/src/editor/Block.css +38 -54
  76. package/src/editor/BlockNoteEditor.test.ts +21 -1
  77. package/src/editor/BlockNoteEditor.ts +14 -7
  78. package/src/editor/BlockNoteExtensions.ts +7 -8
  79. package/src/editor/editor.css +7 -6
  80. package/src/editor/transformPasted.ts +57 -4
  81. package/src/extensions/LinkToolbar/protocols.ts +13 -0
  82. package/src/extensions/Placeholder/PlaceholderPlugin.ts +6 -6
  83. package/src/extensions/SideMenu/SideMenuPlugin.ts +5 -1
  84. package/src/extensions/SideMenu/dragging.ts +3 -0
  85. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +3 -6
  86. package/src/extensions/TableHandles/TableHandlesPlugin.ts +15 -3
  87. package/src/index.ts +9 -2
  88. package/src/schema/blocks/createSpec.ts +1 -1
  89. package/src/schema/blocks/internal.ts +16 -6
  90. package/src/schema/inlineContent/createSpec.ts +2 -2
  91. package/src/schema/inlineContent/internal.ts +4 -1
  92. package/src/schema/propTypes.ts +41 -18
  93. package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
  94. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  95. package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +2 -3
  96. package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +1 -3
  97. package/types/src/api/clipboard/testUtil.d.ts +509 -0
  98. package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
  99. package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
  100. package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
  101. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +2 -5
  102. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -5
  103. package/types/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.d.ts +3 -0
  104. package/types/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.d.ts +4 -0
  105. package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +6 -0
  106. package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +9 -0
  107. package/types/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.d.ts +6 -0
  108. package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +9 -0
  109. package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.d.ts +3 -0
  110. package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.d.ts +3 -0
  111. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -5
  112. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
  113. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -5
  114. package/types/src/blocks/defaultBlocks.d.ts +16 -0
  115. package/types/src/editor/BlockNoteEditor.d.ts +6 -4
  116. package/types/src/editor/transformPasted.d.ts +8 -4
  117. package/types/src/extensions/LinkToolbar/protocols.d.ts +2 -0
  118. package/types/src/index.d.ts +9 -2
  119. package/types/src/schema/propTypes.d.ts +20 -2
  120. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
  121. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
  122. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
  123. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
  124. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
  125. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
  126. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
  127. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
  128. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
  129. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
  130. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
  131. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
  132. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
  133. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
  134. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
  135. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
  136. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
  137. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
  138. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
  139. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
  140. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
  141. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
  142. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
  143. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
  144. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
  145. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
  146. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
  147. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
  148. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
  149. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
  150. package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
  151. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
  152. package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
  153. package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
  154. package/dist/src/api/blockManipulation/selections/selection.js +0 -149
  155. package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
  156. package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
  157. package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
  158. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
  159. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
  160. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
  161. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
  162. package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
  163. package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
  164. package/dist/src/api/clipboard/clipboard.test.js +0 -246
  165. package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
  166. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
  167. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
  168. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
  169. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
  170. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
  171. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
  172. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -26
  173. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
  174. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
  175. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
  176. package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -132
  177. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
  178. package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
  179. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
  180. package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
  181. package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
  182. package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
  183. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
  184. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
  185. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
  186. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
  187. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
  188. package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
  189. package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
  190. package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
  191. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
  192. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
  193. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
  194. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
  195. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
  196. package/dist/src/api/getBlockInfoFromPos.js +0 -165
  197. package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
  198. package/dist/src/api/nodeConversions/blockToNode.js +0 -197
  199. package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
  200. package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
  201. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
  202. package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
  203. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
  204. package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
  205. package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
  206. package/dist/src/api/nodeUtil.js +0 -28
  207. package/dist/src/api/nodeUtil.js.map +0 -1
  208. package/dist/src/api/parsers/html/parseHTML.js +0 -19
  209. package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
  210. package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
  211. package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
  212. package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
  213. package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
  214. package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
  215. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
  216. package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
  217. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
  218. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -109
  219. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
  220. package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
  221. package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
  222. package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
  223. package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
  224. package/dist/src/api/testUtil/cases/customStyles.js +0 -83
  225. package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
  226. package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
  227. package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
  228. package/dist/src/api/testUtil/index.js +0 -2
  229. package/dist/src/api/testUtil/index.js.map +0 -1
  230. package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
  231. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
  232. package/dist/src/api/testUtil/paste.js +0 -29
  233. package/dist/src/api/testUtil/paste.js.map +0 -1
  234. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -97
  235. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
  236. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +0 -5
  237. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +0 -1
  238. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
  239. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
  240. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
  241. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
  242. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -70
  243. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
  244. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +0 -317
  245. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +0 -1
  246. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
  247. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
  248. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
  249. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
  250. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -106
  251. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
  252. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +0 -6
  253. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +0 -1
  254. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
  255. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
  256. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
  257. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
  258. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
  259. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
  260. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
  261. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
  262. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
  263. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
  264. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
  265. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
  266. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
  267. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
  268. package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
  269. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
  270. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -103
  271. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
  272. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +0 -6
  273. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +0 -1
  274. package/dist/src/blocks/defaultBlockHelpers.js +0 -50
  275. package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
  276. package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
  277. package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
  278. package/dist/src/blocks/defaultBlocks.js +0 -50
  279. package/dist/src/blocks/defaultBlocks.js.map +0 -1
  280. package/dist/src/blocks/defaultProps.js +0 -19
  281. package/dist/src/blocks/defaultProps.js.map +0 -1
  282. package/dist/src/editor/BlockNoteEditor.js +0 -748
  283. package/dist/src/editor/BlockNoteEditor.js.map +0 -1
  284. package/dist/src/editor/BlockNoteEditor.test.js +0 -65
  285. package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
  286. package/dist/src/editor/BlockNoteExtensions.js +0 -196
  287. package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
  288. package/dist/src/editor/BlockNoteSchema.js +0 -38
  289. package/dist/src/editor/BlockNoteSchema.js.map +0 -1
  290. package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
  291. package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
  292. package/dist/src/editor/cursorPositionTypes.js +0 -2
  293. package/dist/src/editor/cursorPositionTypes.js.map +0 -1
  294. package/dist/src/editor/defaultColors.js +0 -77
  295. package/dist/src/editor/defaultColors.js.map +0 -1
  296. package/dist/src/editor/selectionTypes.js +0 -2
  297. package/dist/src/editor/selectionTypes.js.map +0 -1
  298. package/dist/src/editor/transformPasted.js +0 -79
  299. package/dist/src/editor/transformPasted.js.map +0 -1
  300. package/dist/src/exporter/Exporter.js +0 -36
  301. package/dist/src/exporter/Exporter.js.map +0 -1
  302. package/dist/src/exporter/index.js +0 -3
  303. package/dist/src/exporter/index.js.map +0 -1
  304. package/dist/src/exporter/mapping.js +0 -12
  305. package/dist/src/exporter/mapping.js.map +0 -1
  306. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
  307. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
  308. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
  309. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
  310. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
  311. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
  312. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
  313. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
  314. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
  315. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
  316. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
  317. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
  318. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
  319. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
  320. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
  321. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
  322. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
  323. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
  324. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
  325. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
  326. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -343
  327. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
  328. package/dist/src/extensions/SideMenu/dragging.js +0 -132
  329. package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
  330. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
  331. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
  332. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
  333. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
  334. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
  335. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
  336. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
  337. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
  338. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
  339. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
  340. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -570
  341. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
  342. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
  343. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
  344. package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
  345. package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
  346. package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
  347. package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
  348. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
  349. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
  350. package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
  351. package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
  352. package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
  353. package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
  354. package/dist/src/extensions-shared/UiElementPosition.js +0 -2
  355. package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
  356. package/dist/src/i18n/dictionary.js +0 -4
  357. package/dist/src/i18n/dictionary.js.map +0 -1
  358. package/dist/src/i18n/locales/ar.js +0 -298
  359. package/dist/src/i18n/locales/ar.js.map +0 -1
  360. package/dist/src/i18n/locales/de.js +0 -313
  361. package/dist/src/i18n/locales/de.js.map +0 -1
  362. package/dist/src/i18n/locales/en.js +0 -314
  363. package/dist/src/i18n/locales/en.js.map +0 -1
  364. package/dist/src/i18n/locales/es.js +0 -312
  365. package/dist/src/i18n/locales/es.js.map +0 -1
  366. package/dist/src/i18n/locales/fr.js +0 -313
  367. package/dist/src/i18n/locales/fr.js.map +0 -1
  368. package/dist/src/i18n/locales/hr.js +0 -308
  369. package/dist/src/i18n/locales/hr.js.map +0 -1
  370. package/dist/src/i18n/locales/index.js +0 -16
  371. package/dist/src/i18n/locales/index.js.map +0 -1
  372. package/dist/src/i18n/locales/is.js +0 -305
  373. package/dist/src/i18n/locales/is.js.map +0 -1
  374. package/dist/src/i18n/locales/ja.js +0 -333
  375. package/dist/src/i18n/locales/ja.js.map +0 -1
  376. package/dist/src/i18n/locales/ko.js +0 -326
  377. package/dist/src/i18n/locales/ko.js.map +0 -1
  378. package/dist/src/i18n/locales/nl.js +0 -313
  379. package/dist/src/i18n/locales/nl.js.map +0 -1
  380. package/dist/src/i18n/locales/pl.js +0 -297
  381. package/dist/src/i18n/locales/pl.js.map +0 -1
  382. package/dist/src/i18n/locales/pt.js +0 -305
  383. package/dist/src/i18n/locales/pt.js.map +0 -1
  384. package/dist/src/i18n/locales/ru.js +0 -340
  385. package/dist/src/i18n/locales/ru.js.map +0 -1
  386. package/dist/src/i18n/locales/vi.js +0 -312
  387. package/dist/src/i18n/locales/vi.js.map +0 -1
  388. package/dist/src/i18n/locales/zh.js +0 -346
  389. package/dist/src/i18n/locales/zh.js.map +0 -1
  390. package/dist/src/index.js +0 -56
  391. package/dist/src/index.js.map +0 -1
  392. package/dist/src/pm-nodes/BlockContainer.js +0 -72
  393. package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
  394. package/dist/src/pm-nodes/BlockGroup.js +0 -43
  395. package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
  396. package/dist/src/pm-nodes/Doc.js +0 -7
  397. package/dist/src/pm-nodes/Doc.js.map +0 -1
  398. package/dist/src/pm-nodes/index.js +0 -4
  399. package/dist/src/pm-nodes/index.js.map +0 -1
  400. package/dist/src/schema/blocks/createSpec.js +0 -126
  401. package/dist/src/schema/blocks/createSpec.js.map +0 -1
  402. package/dist/src/schema/blocks/internal.js +0 -147
  403. package/dist/src/schema/blocks/internal.js.map +0 -1
  404. package/dist/src/schema/blocks/types.js +0 -2
  405. package/dist/src/schema/blocks/types.js.map +0 -1
  406. package/dist/src/schema/index.js +0 -11
  407. package/dist/src/schema/index.js.map +0 -1
  408. package/dist/src/schema/inlineContent/createSpec.js +0 -64
  409. package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
  410. package/dist/src/schema/inlineContent/internal.js +0 -52
  411. package/dist/src/schema/inlineContent/internal.js.map +0 -1
  412. package/dist/src/schema/inlineContent/types.js +0 -10
  413. package/dist/src/schema/inlineContent/types.js.map +0 -1
  414. package/dist/src/schema/propTypes.js +0 -2
  415. package/dist/src/schema/propTypes.js.map +0 -1
  416. package/dist/src/schema/styles/createSpec.js +0 -48
  417. package/dist/src/schema/styles/createSpec.js.map +0 -1
  418. package/dist/src/schema/styles/internal.js +0 -53
  419. package/dist/src/schema/styles/internal.js.map +0 -1
  420. package/dist/src/schema/styles/types.js +0 -2
  421. package/dist/src/schema/styles/types.js.map +0 -1
  422. package/dist/src/util/EventEmitter.js +0 -33
  423. package/dist/src/util/EventEmitter.js.map +0 -1
  424. package/dist/src/util/browser.js +0 -17
  425. package/dist/src/util/browser.js.map +0 -1
  426. package/dist/src/util/combineByGroup.js +0 -20
  427. package/dist/src/util/combineByGroup.js.map +0 -1
  428. package/dist/src/util/esmDependencies.js +0 -35
  429. package/dist/src/util/esmDependencies.js.map +0 -1
  430. package/dist/src/util/string.js +0 -14
  431. package/dist/src/util/string.js.map +0 -1
  432. package/dist/src/util/typescript.js +0 -12
  433. package/dist/src/util/typescript.js.map +0 -1
  434. package/src/api/clipboard/__snapshots__/tableAllCells.html +0 -1
  435. package/src/api/clipboard/__snapshots__/tableCell.html +0 -1
  436. package/src/api/clipboard/__snapshots__/tableRow.html +0 -1
  437. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +0 -456
  438. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +0 -41
  439. /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
  440. /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
  441. /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
  442. /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
  443. /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
  444. /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
  445. /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
  446. /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
  447. /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
  448. /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
  449. /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
  450. /package/src/blocks/AudioBlockContent/{audioBlockHelpers.ts → parseAudioElement.ts} +0 -0
  451. /package/src/blocks/ImageBlockContent/{imageBlockHelpers.ts → parseImageElement.ts} +0 -0
  452. /package/src/blocks/VideoBlockContent/{videoBlockHelpers.ts → parseVideoElement.ts} +0 -0
  453. /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
  454. /package/types/src/blocks/AudioBlockContent/{audioBlockHelpers.d.ts → parseAudioElement.d.ts} +0 -0
  455. /package/types/src/blocks/ImageBlockContent/{imageBlockHelpers.d.ts → parseImageElement.d.ts} +0 -0
  456. /package/types/src/blocks/VideoBlockContent/{videoBlockHelpers.d.ts → parseVideoElement.d.ts} +0 -0
@@ -1,17 +0,0 @@
1
- export const isAppleOS = () => typeof navigator !== "undefined" &&
2
- (/Mac/.test(navigator.platform) ||
3
- (/AppleWebKit/.test(navigator.userAgent) &&
4
- /Mobile\/\w+/.test(navigator.userAgent)));
5
- export function formatKeyboardShortcut(shortcut, ctrlText = "Ctrl") {
6
- if (isAppleOS()) {
7
- return shortcut.replace("Mod", "⌘");
8
- }
9
- else {
10
- return shortcut.replace("Mod", ctrlText);
11
- }
12
- }
13
- export function mergeCSSClasses(...classes) {
14
- return classes.filter((c) => c).join(" ");
15
- }
16
- export const isSafari = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
17
- //# sourceMappingURL=browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/util/browser.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAC5B,OAAO,SAAS,KAAK,WAAW;IAChC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC7B,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;YACtC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAEhD,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,QAAQ,GAAG,MAAM;IACxE,IAAI,SAAS,EAAE,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAG,OAAiB;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAC3B,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Combines items by group. This can be used to combine multiple slash menu item arrays,
3
- * while making sure that items from the same group are adjacent to each other.
4
- */
5
- export function combineByGroup(items, ...additionalItemsArray) {
6
- const combinedItems = [...items];
7
- for (const additionalItems of additionalItemsArray) {
8
- for (const additionalItem of additionalItems) {
9
- const lastItemWithSameGroup = combinedItems.findLastIndex((item) => item.group === additionalItem.group);
10
- if (lastItemWithSameGroup === -1) {
11
- combinedItems.push(additionalItem);
12
- }
13
- else {
14
- combinedItems.splice(lastItemWithSameGroup + 1, 0, additionalItem);
15
- }
16
- }
17
- }
18
- return combinedItems;
19
- }
20
- //# sourceMappingURL=combineByGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"combineByGroup.js","sourceRoot":"","sources":["../../../src/util/combineByGroup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAU,EACV,GAAG,oBAEE;IAEL,MAAM,aAAa,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACjC,KAAK,MAAM,eAAe,IAAI,oBAAoB,EAAE,CAAC;QACnD,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC7C,MAAM,qBAAqB,GAAG,aAAa,CAAC,aAAa,CACvD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,cAAc,CAAC,KAAK,CAC9C,CAAC;YACF,IAAI,qBAAqB,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjC,aAAa,CAAC,IAAI,CAAC,cAAmB,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,MAAM,CAAC,qBAAqB,GAAG,CAAC,EAAE,CAAC,EAAE,cAAmB,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -1,35 +0,0 @@
1
- // some dependencies only export as ESM modules. This makes them incompatible with Node CJS.
2
- // To work around this, we load these dependencies as dynamic imports in a function that initializes them.
3
- // (to reproduce this issue, run ts-node on a file that users server-util)
4
- export let esmDependencies;
5
- export async function initializeESMDependencies() {
6
- if (esmDependencies) {
7
- return esmDependencies;
8
- }
9
- const vals = await Promise.all([
10
- import("rehype-parse"),
11
- import("rehype-stringify"),
12
- import("unified"),
13
- import("hast-util-from-dom"),
14
- import("rehype-remark"),
15
- import("remark-gfm"),
16
- import("remark-stringify"),
17
- import("remark-parse"),
18
- import("remark-rehype"),
19
- import("rehype-format"),
20
- ]);
21
- esmDependencies = {
22
- rehypeParse: vals[0],
23
- rehypeStringify: vals[1],
24
- unified: vals[2],
25
- hastUtilFromDom: vals[3],
26
- rehypeRemark: vals[4],
27
- remarkGfm: vals[5],
28
- remarkStringify: vals[6],
29
- remarkParse: vals[7],
30
- remarkRehype: vals[8],
31
- rehypeFormat: vals[9],
32
- };
33
- return esmDependencies;
34
- }
35
- //# sourceMappingURL=esmDependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esmDependencies.js","sourceRoot":"","sources":["../../../src/util/esmDependencies.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,0GAA0G;AAE1G,0EAA0E;AAC1E,MAAM,CAAC,IAAI,eAaN,CAAC;AAEN,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC;QACtB,MAAM,CAAC,kBAAkB,CAAC;QAC1B,MAAM,CAAC,SAAS,CAAC;QACjB,MAAM,CAAC,oBAAoB,CAAC;QAC5B,MAAM,CAAC,eAAe,CAAC;QACvB,MAAM,CAAC,YAAY,CAAC;QACpB,MAAM,CAAC,kBAAkB,CAAC;QAC1B,MAAM,CAAC,cAAc,CAAC;QACtB,MAAM,CAAC,eAAe,CAAC;QACvB,MAAM,CAAC,eAAe,CAAC;KACxB,CAAC,CAAC;IAEH,eAAe,GAAG;QAChB,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACpB,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;QACxB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAChB,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;QACxB,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QACrB,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QAClB,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;QACxB,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACpB,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QACrB,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;KACtB,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,14 +0,0 @@
1
- export function camelToDataKebab(str) {
2
- return "data-" + str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
3
- }
4
- export function filenameFromURL(url) {
5
- const parts = url.split("/");
6
- if (!parts.length || // invalid?
7
- parts[parts.length - 1] === "" // for example, URL ends in a directory-like trailing slash
8
- ) {
9
- // in this case just return the original url
10
- return url;
11
- }
12
- return parts[parts.length - 1];
13
- }
14
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/util/string.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IACE,CAAC,KAAK,CAAC,MAAM,IAAI,WAAW;QAC5B,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,2DAA2D;MAC1F,CAAC;QACD,4CAA4C;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC"}
@@ -1,12 +0,0 @@
1
- export class UnreachableCaseError extends Error {
2
- constructor(val) {
3
- super(`Unreachable case: ${val}`);
4
- }
5
- }
6
- export function assertEmpty(obj, throwError = true) {
7
- const { "data-test": dataTest, ...rest } = obj; // exclude data-test
8
- if (Object.keys(rest).length > 0 && throwError) {
9
- throw new Error("Object must be empty " + JSON.stringify(obj));
10
- }
11
- }
12
- //# sourceMappingURL=typescript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/util/typescript.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,GAAU;QACpB,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,GAA0B,EAAE,UAAU,GAAG,IAAI;IACvE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,oBAAoB;IAEpE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
@@ -1 +0,0 @@
1
- <tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr><tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr>
@@ -1 +0,0 @@
1
- <tr><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr>
@@ -1 +0,0 @@
1
- <tr><td colspan="1" rowspan="1"><p>Table Cell</p></td><td colspan="1" rowspan="1"><p>Table Cell</p></td></tr>
@@ -1,456 +0,0 @@
1
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import {
3
- BlockFromConfig,
4
- BlockSchemaWithBlock,
5
- FileBlockConfig,
6
- } from "../../schema/index.js";
7
-
8
- export const FILE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>`;
9
- export const createFileBlockWrapper = (
10
- block: BlockFromConfig<FileBlockConfig, any, any>,
11
- editor: BlockNoteEditor<
12
- BlockSchemaWithBlock<FileBlockConfig["type"], FileBlockConfig>,
13
- any,
14
- any
15
- >,
16
- // TODO: Maybe make optional for default preview
17
- element: { dom: HTMLElement; destroy?: () => void },
18
- buttonText?: string,
19
- buttonIcon?: HTMLElement
20
- ) => {
21
- const wrapper = document.createElement("div");
22
- wrapper.className = "bn-file-block-content-wrapper";
23
-
24
- if (block.props.url === "") {
25
- const addFileButton = createAddFileButton(
26
- block,
27
- editor,
28
- buttonText,
29
- buttonIcon
30
- );
31
- wrapper.appendChild(addFileButton.dom);
32
-
33
- const loading = document.createElement("div");
34
- loading.className = "bn-file-loading-preview";
35
- loading.textContent = "Loading...";
36
-
37
- const destroyUploadStartHandler = editor.onUploadStart((blockId) => {
38
- if (blockId === block.id) {
39
- wrapper.removeChild(addFileButton.dom);
40
- wrapper.appendChild(loading);
41
- }
42
- });
43
- const destroyUploadEndHandler = editor.onUploadEnd((blockId) => {
44
- if (blockId === block.id) {
45
- wrapper.removeChild(loading);
46
- wrapper.appendChild(addFileButton.dom);
47
- }
48
- });
49
-
50
- return {
51
- dom: wrapper,
52
- destroy: () => {
53
- addFileButton.destroy?.();
54
- destroyUploadStartHandler();
55
- destroyUploadEndHandler();
56
- },
57
- };
58
- } else if (block.props.showPreview === false) {
59
- // TODO: Not using the wrapper element here?
60
- const file = createDefaultFilePreview(block).dom;
61
- const element = createFileAndCaptionWrapper(block, file);
62
-
63
- return {
64
- dom: element.dom,
65
- };
66
- } else {
67
- wrapper.appendChild(element.dom);
68
-
69
- return {
70
- dom: wrapper,
71
- destroy: element.destroy,
72
- };
73
- }
74
- };
75
-
76
- // Default file preview, displaying a file icon and file name.
77
- export const createDefaultFilePreview = (
78
- block: BlockFromConfig<FileBlockConfig, any, any>
79
- ): { dom: HTMLElement; destroy?: () => void } => {
80
- const file = document.createElement("div");
81
- file.className = "bn-file-default-preview";
82
-
83
- const icon = document.createElement("div");
84
- icon.className = "bn-file-default-preview-icon";
85
- icon.innerHTML = FILE_ICON_SVG;
86
-
87
- const fileName = document.createElement("p");
88
- fileName.className = "bn-file-default-preview-name";
89
- fileName.textContent = block.props.name || "";
90
-
91
- file.appendChild(icon);
92
- file.appendChild(fileName);
93
-
94
- return {
95
- dom: file,
96
- };
97
- };
98
-
99
- // Wrapper element containing file preview and caption.
100
- export const createFileAndCaptionWrapper = (
101
- block: BlockFromConfig<FileBlockConfig, any, any>,
102
- file: HTMLElement
103
- ) => {
104
- const fileAndCaptionWrapper = document.createElement("div");
105
- fileAndCaptionWrapper.className = "bn-file-and-caption-wrapper";
106
-
107
- const caption = document.createElement("p");
108
- caption.className = "bn-file-caption";
109
- caption.textContent = block.props.caption;
110
-
111
- if (
112
- typeof block.props.previewWidth === "number" &&
113
- block.props.previewWidth > 0 &&
114
- block.props.caption !== undefined
115
- ) {
116
- caption.style.width = `${block.props.previewWidth}px`;
117
- }
118
-
119
- fileAndCaptionWrapper.appendChild(file);
120
- fileAndCaptionWrapper.appendChild(caption);
121
-
122
- return {
123
- dom: fileAndCaptionWrapper,
124
- };
125
- };
126
-
127
- // Button element that acts as a placeholder for files with no src.
128
- export const createAddFileButton = (
129
- block: BlockFromConfig<FileBlockConfig, any, any>,
130
- editor: BlockNoteEditor<any, any, any>,
131
- buttonText?: string,
132
- buttonIcon?: HTMLElement
133
- ) => {
134
- const addFileButton = document.createElement("div");
135
- addFileButton.className = "bn-add-file-button";
136
-
137
- const addFileButtonIcon = document.createElement("div");
138
- addFileButtonIcon.className = "bn-add-file-button-icon";
139
- if (buttonIcon) {
140
- addFileButtonIcon.appendChild(buttonIcon);
141
- } else {
142
- addFileButtonIcon.innerHTML =
143
- '<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>';
144
- }
145
-
146
- const addFileButtonText = document.createElement("p");
147
- addFileButtonText.className = "bn-add-file-button-text";
148
- addFileButtonText.innerHTML =
149
- buttonText || editor.dictionary.file_blocks.file.add_button_text;
150
-
151
- // Prevents focus from moving to the button.
152
- const addFileButtonMouseDownHandler = (event: MouseEvent) => {
153
- event.preventDefault();
154
- };
155
- // Opens the file toolbar.
156
- const addFileButtonClickHandler = () => {
157
- editor.dispatch(
158
- editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {
159
- block: block,
160
- })
161
- );
162
- };
163
-
164
- addFileButton.appendChild(addFileButtonIcon);
165
- addFileButton.appendChild(addFileButtonText);
166
-
167
- addFileButton.addEventListener(
168
- "mousedown",
169
- addFileButtonMouseDownHandler,
170
- true
171
- );
172
- addFileButton.addEventListener("click", addFileButtonClickHandler, true);
173
-
174
- return {
175
- dom: addFileButton,
176
- destroy: () => {
177
- addFileButton.removeEventListener(
178
- "mousedown",
179
- addFileButtonMouseDownHandler,
180
- true
181
- );
182
- addFileButton.removeEventListener(
183
- "click",
184
- addFileButtonClickHandler,
185
- true
186
- );
187
- },
188
- };
189
- };
190
-
191
- export const parseEmbedElement = (embedElement: HTMLEmbedElement) => {
192
- const url = embedElement.src || undefined;
193
-
194
- return { url };
195
- };
196
-
197
- export const parseFigureElement = (
198
- figureElement: HTMLElement,
199
- targetTag: string
200
- ) => {
201
- const targetElement = figureElement.querySelector(
202
- targetTag
203
- ) as HTMLElement | null;
204
- if (!targetElement) {
205
- return undefined;
206
- }
207
-
208
- const captionElement = figureElement.querySelector("figcaption");
209
- const caption = captionElement?.textContent ?? undefined;
210
-
211
- return { targetElement, caption };
212
- };
213
-
214
- // Wrapper figure element to display file link with caption. Used for external
215
- // HTML
216
- export const createLinkWithCaption = (
217
- element: HTMLElement,
218
- caption: string
219
- ) => {
220
- const wrapper = document.createElement("div");
221
- const fileCaption = document.createElement("p");
222
- fileCaption.textContent = caption;
223
-
224
- wrapper.appendChild(element);
225
- wrapper.appendChild(fileCaption);
226
-
227
- return {
228
- dom: wrapper,
229
- };
230
- };
231
-
232
- // Wrapper figure element to display file preview with caption. Used for
233
- // external HTML.
234
- export const createFigureWithCaption = (
235
- element: HTMLElement,
236
- caption: string
237
- ) => {
238
- const figure = document.createElement("figure");
239
- const captionElement = document.createElement("figcaption");
240
- captionElement.textContent = caption;
241
-
242
- figure.appendChild(element);
243
- figure.appendChild(captionElement);
244
-
245
- return { dom: figure };
246
- };
247
-
248
- // Wrapper element which adds resize handles & logic for visual media file
249
- // previews.
250
- export const createResizeHandlesWrapper = (
251
- block: BlockFromConfig<FileBlockConfig, any, any>,
252
- editor: BlockNoteEditor<any, any, any>,
253
- element: HTMLElement,
254
- getWidth: () => number,
255
- setWidth: (width: number) => void
256
- ): { dom: HTMLElement; destroy: () => void } => {
257
- if (!block.props.previewWidth) {
258
- throw new Error("Block must have a `previewWidth` prop.");
259
- }
260
-
261
- // Wrapper element for rendered element and resize handles.
262
- const wrapper = document.createElement("div");
263
- wrapper.className = "bn-visual-media-wrapper";
264
-
265
- // Resize handle elements.
266
- const leftResizeHandle = document.createElement("div");
267
- leftResizeHandle.className = "bn-visual-media-resize-handle";
268
- leftResizeHandle.style.left = "4px";
269
- const rightResizeHandle = document.createElement("div");
270
- rightResizeHandle.className = "bn-visual-media-resize-handle";
271
- rightResizeHandle.style.right = "4px";
272
-
273
- // Temporary parameters set when the user begins resizing the element, used to
274
- // calculate the new width of the element.
275
- let resizeParams:
276
- | {
277
- handleUsed: "left" | "right";
278
- initialWidth: number;
279
- initialClientX: number;
280
- }
281
- | undefined;
282
-
283
- // Updates the element width with an updated width depending on the cursor X
284
- // offset from when the resize began, and which resize handle is being used.
285
- const windowMouseMoveHandler = (event: MouseEvent) => {
286
- if (!resizeParams) {
287
- if (
288
- !editor.isEditable &&
289
- wrapper.contains(leftResizeHandle) &&
290
- wrapper.contains(rightResizeHandle)
291
- ) {
292
- wrapper.removeChild(leftResizeHandle);
293
- wrapper.removeChild(rightResizeHandle);
294
- }
295
-
296
- return;
297
- }
298
-
299
- let newWidth: number;
300
-
301
- if (block.props.textAlignment === "center") {
302
- if (resizeParams.handleUsed === "left") {
303
- newWidth =
304
- resizeParams.initialWidth +
305
- (resizeParams.initialClientX - event.clientX) * 2;
306
- } else {
307
- newWidth =
308
- resizeParams.initialWidth +
309
- (event.clientX - resizeParams.initialClientX) * 2;
310
- }
311
- } else {
312
- if (resizeParams.handleUsed === "left") {
313
- newWidth =
314
- resizeParams.initialWidth +
315
- resizeParams.initialClientX -
316
- event.clientX;
317
- } else {
318
- newWidth =
319
- resizeParams.initialWidth +
320
- event.clientX -
321
- resizeParams.initialClientX;
322
- }
323
- }
324
-
325
- // Min element width in px.
326
- const minWidth = 64;
327
-
328
- // Ensures the element is not wider than the editor and not smaller than a
329
- // predetermined minimum width.
330
- if (newWidth < minWidth) {
331
- setWidth(minWidth);
332
- } else if (newWidth > editor.domElement.firstElementChild!.clientWidth) {
333
- setWidth(editor.domElement.firstElementChild!.clientWidth);
334
- } else {
335
- setWidth(newWidth);
336
- }
337
- };
338
- // Stops mouse movements from resizing the element and updates the block's
339
- // `width` prop to the new value.
340
- const windowMouseUpHandler = (event: MouseEvent) => {
341
- // Hides the drag handles if the cursor is no longer over the element.
342
- if (
343
- (!event.target ||
344
- !wrapper.contains(event.target as Node) ||
345
- !editor.isEditable) &&
346
- wrapper.contains(leftResizeHandle) &&
347
- wrapper.contains(rightResizeHandle)
348
- ) {
349
- wrapper.removeChild(leftResizeHandle);
350
- wrapper.removeChild(rightResizeHandle);
351
- }
352
-
353
- if (!resizeParams) {
354
- return;
355
- }
356
-
357
- resizeParams = undefined;
358
-
359
- editor.updateBlock(block, {
360
- props: {
361
- previewWidth: getWidth(),
362
- },
363
- });
364
- };
365
-
366
- // Shows the resize handles when hovering over the element with the cursor.
367
- const elementMouseEnterHandler = () => {
368
- if (editor.isEditable) {
369
- wrapper.appendChild(leftResizeHandle);
370
- wrapper.appendChild(rightResizeHandle);
371
- }
372
- };
373
- // Hides the resize handles when the cursor leaves the element, unless the
374
- // cursor moves to one of the resize handles.
375
- const elementMouseLeaveHandler = (event: MouseEvent) => {
376
- if (
377
- event.relatedTarget === leftResizeHandle ||
378
- event.relatedTarget === rightResizeHandle
379
- ) {
380
- return;
381
- }
382
-
383
- if (resizeParams) {
384
- return;
385
- }
386
-
387
- if (
388
- editor.isEditable &&
389
- wrapper.contains(leftResizeHandle) &&
390
- wrapper.contains(rightResizeHandle)
391
- ) {
392
- wrapper.removeChild(leftResizeHandle);
393
- wrapper.removeChild(rightResizeHandle);
394
- }
395
- };
396
-
397
- // Sets the resize params, allowing the user to begin resizing the element by
398
- // moving the cursor left or right.
399
- const leftResizeHandleMouseDownHandler = (event: MouseEvent) => {
400
- event.preventDefault();
401
-
402
- wrapper.appendChild(leftResizeHandle);
403
- wrapper.appendChild(rightResizeHandle);
404
-
405
- resizeParams = {
406
- handleUsed: "left",
407
- initialWidth: block.props.previewWidth!,
408
- initialClientX: event.clientX,
409
- };
410
- };
411
- const rightResizeHandleMouseDownHandler = (event: MouseEvent) => {
412
- event.preventDefault();
413
-
414
- wrapper.appendChild(leftResizeHandle);
415
- wrapper.appendChild(rightResizeHandle);
416
-
417
- resizeParams = {
418
- handleUsed: "right",
419
- initialWidth: block.props.previewWidth!,
420
- initialClientX: event.clientX,
421
- };
422
- };
423
-
424
- wrapper.appendChild(element);
425
-
426
- window.addEventListener("mousemove", windowMouseMoveHandler);
427
- window.addEventListener("mouseup", windowMouseUpHandler);
428
- element.addEventListener("mouseenter", elementMouseEnterHandler);
429
- element.addEventListener("mouseleave", elementMouseLeaveHandler);
430
- leftResizeHandle.addEventListener(
431
- "mousedown",
432
- leftResizeHandleMouseDownHandler
433
- );
434
- rightResizeHandle.addEventListener(
435
- "mousedown",
436
- rightResizeHandleMouseDownHandler
437
- );
438
-
439
- return {
440
- dom: wrapper,
441
- destroy: () => {
442
- window.removeEventListener("mousemove", windowMouseMoveHandler);
443
- window.removeEventListener("mouseup", windowMouseUpHandler);
444
- element.removeEventListener("mouseenter", elementMouseEnterHandler);
445
- element.removeEventListener("mouseleave", elementMouseLeaveHandler);
446
- leftResizeHandle.removeEventListener(
447
- "mousedown",
448
- leftResizeHandleMouseDownHandler
449
- );
450
- rightResizeHandle.removeEventListener(
451
- "mousedown",
452
- rightResizeHandleMouseDownHandler
453
- );
454
- },
455
- };
456
- };
@@ -1,41 +0,0 @@
1
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
- import { BlockFromConfig, BlockSchemaWithBlock, FileBlockConfig } from "../../schema/index.js";
3
- 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>";
4
- export declare const createFileBlockWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<BlockSchemaWithBlock<FileBlockConfig["type"], FileBlockConfig>, any, any>, element: {
5
- dom: HTMLElement;
6
- destroy?: () => void;
7
- }, buttonText?: string, buttonIcon?: HTMLElement) => {
8
- dom: HTMLDivElement;
9
- destroy?: undefined;
10
- } | {
11
- dom: HTMLDivElement;
12
- destroy: (() => void) | undefined;
13
- };
14
- export declare const createDefaultFilePreview: (block: BlockFromConfig<FileBlockConfig, any, any>) => {
15
- dom: HTMLElement;
16
- destroy?: () => void;
17
- };
18
- export declare const createFileAndCaptionWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, file: HTMLElement) => {
19
- dom: HTMLDivElement;
20
- };
21
- export declare const createAddFileButton: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>, buttonText?: string, buttonIcon?: HTMLElement) => {
22
- dom: HTMLDivElement;
23
- destroy: () => void;
24
- };
25
- export declare const parseEmbedElement: (embedElement: HTMLEmbedElement) => {
26
- url: string | undefined;
27
- };
28
- export declare const parseFigureElement: (figureElement: HTMLElement, targetTag: string) => {
29
- targetElement: HTMLElement;
30
- caption: string | undefined;
31
- } | undefined;
32
- export declare const createLinkWithCaption: (element: HTMLElement, caption: string) => {
33
- dom: HTMLDivElement;
34
- };
35
- export declare const createFigureWithCaption: (element: HTMLElement, caption: string) => {
36
- dom: HTMLElement;
37
- };
38
- export declare const createResizeHandlesWrapper: (block: BlockFromConfig<FileBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>, element: HTMLElement, getWidth: () => number, setWidth: (width: number) => void) => {
39
- dom: HTMLElement;
40
- destroy: () => void;
41
- };