@blocknote/core 0.21.0 → 0.23.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 (444) hide show
  1. package/dist/blocknote.js +2320 -1692
  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/basicBlocks.html +1 -0
  16. package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -0
  17. package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
  18. package/src/api/clipboard/clipboardExternal.test.ts +161 -0
  19. package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +186 -38
  20. package/src/api/clipboard/testUtil.ts +27 -0
  21. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -0
  22. package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +1 -0
  23. package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +1 -0
  24. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  25. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
  26. package/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md +0 -0
  27. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +16 -0
  28. package/src/api/nodeConversions/nodeToBlock.ts +4 -1
  29. package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +62 -0
  30. package/src/api/parsers/html/parseHTML.test.ts +9 -0
  31. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
  32. package/src/api/testUtil/cases/defaultSchema.ts +15 -1
  33. package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
  34. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +32 -11
  35. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -28
  36. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
  37. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +4 -16
  38. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
  39. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +26 -6
  40. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +49 -0
  41. package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +45 -0
  42. package/src/blocks/PageBreakBlockContent/schema.ts +40 -0
  43. package/src/editor/Block.css +18 -4
  44. package/src/editor/BlockNoteEditor.test.ts +21 -1
  45. package/src/editor/BlockNoteEditor.ts +17 -0
  46. package/src/editor/BlockNoteExtensions.ts +111 -16
  47. package/src/editor/editor.css +28 -13
  48. package/src/editor/transformPasted.ts +57 -4
  49. package/src/extensions/SideMenu/SideMenuPlugin.ts +115 -23
  50. package/src/extensions/SideMenu/dragging.ts +0 -1
  51. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +1 -1
  52. package/src/i18n/locales/ar.ts +6 -0
  53. package/src/i18n/locales/de.ts +6 -0
  54. package/src/i18n/locales/en.ts +6 -0
  55. package/src/i18n/locales/es.ts +6 -0
  56. package/src/i18n/locales/fr.ts +47 -17
  57. package/src/i18n/locales/hr.ts +72 -54
  58. package/src/i18n/locales/index.ts +1 -0
  59. package/src/i18n/locales/is.ts +6 -0
  60. package/src/i18n/locales/it.ts +315 -0
  61. package/src/i18n/locales/ja.ts +6 -0
  62. package/src/i18n/locales/ko.ts +6 -0
  63. package/src/i18n/locales/nl.ts +6 -0
  64. package/src/i18n/locales/pl.ts +6 -0
  65. package/src/i18n/locales/pt.ts +6 -0
  66. package/src/i18n/locales/ru.ts +6 -0
  67. package/src/i18n/locales/vi.ts +6 -0
  68. package/src/i18n/locales/zh.ts +6 -0
  69. package/src/index.ts +3 -0
  70. package/src/schema/blocks/createSpec.ts +1 -1
  71. package/src/schema/blocks/internal.ts +16 -6
  72. package/src/schema/inlineContent/internal.ts +4 -1
  73. package/src/schema/propTypes.ts +41 -18
  74. package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
  75. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  76. package/types/src/api/clipboard/testUtil.d.ts +509 -0
  77. package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
  78. package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
  79. package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
  80. package/types/src/api/testUtil/cases/defaultSchema.d.ts +2 -1
  81. package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +2 -0
  82. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
  83. package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +31 -0
  84. package/types/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.d.ts +8 -0
  85. package/types/src/blocks/PageBreakBlockContent/schema.d.ts +86 -0
  86. package/types/src/blocks/defaultBlocks.d.ts +16 -0
  87. package/types/src/editor/BlockNoteEditor.d.ts +15 -0
  88. package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
  89. package/types/src/editor/transformPasted.d.ts +8 -4
  90. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +25 -5
  91. package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +1 -1
  92. package/types/src/i18n/locales/de.d.ts +6 -0
  93. package/types/src/i18n/locales/en.d.ts +6 -0
  94. package/types/src/i18n/locales/es.d.ts +6 -0
  95. package/types/src/i18n/locales/hr.d.ts +6 -0
  96. package/types/src/i18n/locales/index.d.ts +1 -0
  97. package/types/src/i18n/locales/it.d.ts +245 -0
  98. package/types/src/index.d.ts +3 -0
  99. package/types/src/schema/propTypes.d.ts +20 -2
  100. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
  101. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
  102. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
  103. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
  104. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
  105. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
  106. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
  107. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
  108. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
  109. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
  110. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
  111. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
  112. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
  113. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
  114. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
  115. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
  116. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
  117. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
  118. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
  119. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
  120. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
  121. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
  122. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
  123. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
  124. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
  125. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
  126. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
  127. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
  128. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
  129. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
  130. package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
  131. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
  132. package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
  133. package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
  134. package/dist/src/api/blockManipulation/selections/selection.js +0 -149
  135. package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
  136. package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
  137. package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
  138. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
  139. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
  140. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
  141. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
  142. package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
  143. package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
  144. package/dist/src/api/clipboard/clipboard.test.js +0 -249
  145. package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
  146. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
  147. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
  148. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
  149. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
  150. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
  151. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
  152. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -25
  153. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
  154. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
  155. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
  156. package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -134
  157. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
  158. package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
  159. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
  160. package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
  161. package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
  162. package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
  163. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
  164. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
  165. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
  166. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
  167. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
  168. package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
  169. package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
  170. package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
  171. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
  172. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
  173. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
  174. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
  175. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
  176. package/dist/src/api/getBlockInfoFromPos.js +0 -165
  177. package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
  178. package/dist/src/api/nodeConversions/blockToNode.js +0 -197
  179. package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
  180. package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
  181. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
  182. package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
  183. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
  184. package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
  185. package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
  186. package/dist/src/api/nodeUtil.js +0 -28
  187. package/dist/src/api/nodeUtil.js.map +0 -1
  188. package/dist/src/api/parsers/html/parseHTML.js +0 -19
  189. package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
  190. package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
  191. package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
  192. package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
  193. package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
  194. package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
  195. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
  196. package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
  197. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
  198. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -112
  199. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
  200. package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
  201. package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
  202. package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
  203. package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
  204. package/dist/src/api/testUtil/cases/customStyles.js +0 -83
  205. package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
  206. package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
  207. package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
  208. package/dist/src/api/testUtil/index.js +0 -2
  209. package/dist/src/api/testUtil/index.js.map +0 -1
  210. package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
  211. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
  212. package/dist/src/api/testUtil/paste.js +0 -29
  213. package/dist/src/api/testUtil/paste.js.map +0 -1
  214. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -104
  215. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
  216. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js +0 -5
  217. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js.map +0 -1
  218. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
  219. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
  220. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
  221. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
  222. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -71
  223. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
  224. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +0 -5
  225. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +0 -1
  226. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +0 -10
  227. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +0 -1
  228. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +0 -39
  229. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +0 -1
  230. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +0 -51
  231. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +0 -1
  232. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +0 -17
  233. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +0 -1
  234. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +0 -147
  235. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +0 -1
  236. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +0 -9
  237. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +0 -1
  238. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +0 -11
  239. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js.map +0 -1
  240. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
  241. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
  242. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
  243. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
  244. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -114
  245. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
  246. package/dist/src/blocks/ImageBlockContent/parseImageElement.js +0 -6
  247. package/dist/src/blocks/ImageBlockContent/parseImageElement.js.map +0 -1
  248. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
  249. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
  250. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
  251. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
  252. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
  253. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
  254. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
  255. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
  256. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
  257. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
  258. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
  259. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
  260. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
  261. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
  262. package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
  263. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
  264. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -114
  265. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
  266. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js +0 -6
  267. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js.map +0 -1
  268. package/dist/src/blocks/defaultBlockHelpers.js +0 -50
  269. package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
  270. package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
  271. package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
  272. package/dist/src/blocks/defaultBlocks.js +0 -50
  273. package/dist/src/blocks/defaultBlocks.js.map +0 -1
  274. package/dist/src/blocks/defaultProps.js +0 -19
  275. package/dist/src/blocks/defaultProps.js.map +0 -1
  276. package/dist/src/editor/BlockNoteEditor.js +0 -751
  277. package/dist/src/editor/BlockNoteEditor.js.map +0 -1
  278. package/dist/src/editor/BlockNoteEditor.test.js +0 -65
  279. package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
  280. package/dist/src/editor/BlockNoteExtensions.js +0 -192
  281. package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
  282. package/dist/src/editor/BlockNoteSchema.js +0 -38
  283. package/dist/src/editor/BlockNoteSchema.js.map +0 -1
  284. package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
  285. package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
  286. package/dist/src/editor/cursorPositionTypes.js +0 -2
  287. package/dist/src/editor/cursorPositionTypes.js.map +0 -1
  288. package/dist/src/editor/defaultColors.js +0 -77
  289. package/dist/src/editor/defaultColors.js.map +0 -1
  290. package/dist/src/editor/selectionTypes.js +0 -2
  291. package/dist/src/editor/selectionTypes.js.map +0 -1
  292. package/dist/src/editor/transformPasted.js +0 -79
  293. package/dist/src/editor/transformPasted.js.map +0 -1
  294. package/dist/src/exporter/Exporter.js +0 -36
  295. package/dist/src/exporter/Exporter.js.map +0 -1
  296. package/dist/src/exporter/index.js +0 -3
  297. package/dist/src/exporter/index.js.map +0 -1
  298. package/dist/src/exporter/mapping.js +0 -12
  299. package/dist/src/exporter/mapping.js.map +0 -1
  300. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
  301. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
  302. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
  303. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
  304. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
  305. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
  306. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
  307. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
  308. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
  309. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
  310. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
  311. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
  312. package/dist/src/extensions/LinkToolbar/protocols.js +0 -14
  313. package/dist/src/extensions/LinkToolbar/protocols.js.map +0 -1
  314. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
  315. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
  316. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
  317. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
  318. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
  319. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
  320. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
  321. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
  322. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -347
  323. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
  324. package/dist/src/extensions/SideMenu/dragging.js +0 -135
  325. package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
  326. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
  327. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
  328. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
  329. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
  330. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
  331. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
  332. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
  333. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
  334. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
  335. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
  336. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -579
  337. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
  338. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
  339. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
  340. package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
  341. package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
  342. package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
  343. package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
  344. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
  345. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
  346. package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
  347. package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
  348. package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
  349. package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
  350. package/dist/src/extensions-shared/UiElementPosition.js +0 -2
  351. package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
  352. package/dist/src/i18n/dictionary.js +0 -4
  353. package/dist/src/i18n/dictionary.js.map +0 -1
  354. package/dist/src/i18n/locales/ar.js +0 -298
  355. package/dist/src/i18n/locales/ar.js.map +0 -1
  356. package/dist/src/i18n/locales/de.js +0 -313
  357. package/dist/src/i18n/locales/de.js.map +0 -1
  358. package/dist/src/i18n/locales/en.js +0 -314
  359. package/dist/src/i18n/locales/en.js.map +0 -1
  360. package/dist/src/i18n/locales/es.js +0 -312
  361. package/dist/src/i18n/locales/es.js.map +0 -1
  362. package/dist/src/i18n/locales/fr.js +0 -313
  363. package/dist/src/i18n/locales/fr.js.map +0 -1
  364. package/dist/src/i18n/locales/hr.js +0 -308
  365. package/dist/src/i18n/locales/hr.js.map +0 -1
  366. package/dist/src/i18n/locales/index.js +0 -16
  367. package/dist/src/i18n/locales/index.js.map +0 -1
  368. package/dist/src/i18n/locales/is.js +0 -305
  369. package/dist/src/i18n/locales/is.js.map +0 -1
  370. package/dist/src/i18n/locales/ja.js +0 -333
  371. package/dist/src/i18n/locales/ja.js.map +0 -1
  372. package/dist/src/i18n/locales/ko.js +0 -326
  373. package/dist/src/i18n/locales/ko.js.map +0 -1
  374. package/dist/src/i18n/locales/nl.js +0 -313
  375. package/dist/src/i18n/locales/nl.js.map +0 -1
  376. package/dist/src/i18n/locales/pl.js +0 -297
  377. package/dist/src/i18n/locales/pl.js.map +0 -1
  378. package/dist/src/i18n/locales/pt.js +0 -305
  379. package/dist/src/i18n/locales/pt.js.map +0 -1
  380. package/dist/src/i18n/locales/ru.js +0 -340
  381. package/dist/src/i18n/locales/ru.js.map +0 -1
  382. package/dist/src/i18n/locales/vi.js +0 -312
  383. package/dist/src/i18n/locales/vi.js.map +0 -1
  384. package/dist/src/i18n/locales/zh.js +0 -346
  385. package/dist/src/i18n/locales/zh.js.map +0 -1
  386. package/dist/src/index.js +0 -63
  387. package/dist/src/index.js.map +0 -1
  388. package/dist/src/pm-nodes/BlockContainer.js +0 -72
  389. package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
  390. package/dist/src/pm-nodes/BlockGroup.js +0 -43
  391. package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
  392. package/dist/src/pm-nodes/Doc.js +0 -7
  393. package/dist/src/pm-nodes/Doc.js.map +0 -1
  394. package/dist/src/pm-nodes/index.js +0 -4
  395. package/dist/src/pm-nodes/index.js.map +0 -1
  396. package/dist/src/schema/blocks/createSpec.js +0 -126
  397. package/dist/src/schema/blocks/createSpec.js.map +0 -1
  398. package/dist/src/schema/blocks/internal.js +0 -147
  399. package/dist/src/schema/blocks/internal.js.map +0 -1
  400. package/dist/src/schema/blocks/types.js +0 -2
  401. package/dist/src/schema/blocks/types.js.map +0 -1
  402. package/dist/src/schema/index.js +0 -11
  403. package/dist/src/schema/index.js.map +0 -1
  404. package/dist/src/schema/inlineContent/createSpec.js +0 -64
  405. package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
  406. package/dist/src/schema/inlineContent/internal.js +0 -52
  407. package/dist/src/schema/inlineContent/internal.js.map +0 -1
  408. package/dist/src/schema/inlineContent/types.js +0 -10
  409. package/dist/src/schema/inlineContent/types.js.map +0 -1
  410. package/dist/src/schema/propTypes.js +0 -2
  411. package/dist/src/schema/propTypes.js.map +0 -1
  412. package/dist/src/schema/styles/createSpec.js +0 -48
  413. package/dist/src/schema/styles/createSpec.js.map +0 -1
  414. package/dist/src/schema/styles/internal.js +0 -53
  415. package/dist/src/schema/styles/internal.js.map +0 -1
  416. package/dist/src/schema/styles/types.js +0 -2
  417. package/dist/src/schema/styles/types.js.map +0 -1
  418. package/dist/src/util/EventEmitter.js +0 -33
  419. package/dist/src/util/EventEmitter.js.map +0 -1
  420. package/dist/src/util/browser.js +0 -17
  421. package/dist/src/util/browser.js.map +0 -1
  422. package/dist/src/util/combineByGroup.js +0 -20
  423. package/dist/src/util/combineByGroup.js.map +0 -1
  424. package/dist/src/util/esmDependencies.js +0 -35
  425. package/dist/src/util/esmDependencies.js.map +0 -1
  426. package/dist/src/util/string.js +0 -14
  427. package/dist/src/util/string.js.map +0 -1
  428. package/dist/src/util/typescript.js +0 -12
  429. package/dist/src/util/typescript.js.map +0 -1
  430. /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
  431. /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
  432. /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
  433. /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
  434. /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
  435. /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
  436. /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
  437. /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
  438. /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
  439. /package/src/api/clipboard/__snapshots__/{tableAllCells.html → internal/tableAllCells.html} +0 -0
  440. /package/src/api/clipboard/__snapshots__/{tableCell.html → internal/tableCell.html} +0 -0
  441. /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
  442. /package/src/api/clipboard/__snapshots__/{tableRow.html → internal/tableRow.html} +0 -0
  443. /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
  444. /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
- import { PluginView } from "@tiptap/pm/state";
2
- import { EditorState, Plugin, PluginKey } from "prosemirror-state";
3
- import { EditorView } from "prosemirror-view";
1
+ import { DOMParser, Slice } from "@tiptap/pm/model";
2
+ import { EditorState, Plugin, PluginKey, PluginView } from "@tiptap/pm/state";
3
+ import { EditorView } from "@tiptap/pm/view";
4
4
 
5
5
  import { Block } from "../../blocks/defaultBlocks.js";
6
6
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
@@ -14,6 +14,7 @@ import { EventEmitter } from "../../util/EventEmitter.js";
14
14
  import { initializeESMDependencies } from "../../util/esmDependencies.js";
15
15
  import { getDraggableBlockFromElement } from "../getDraggableBlockFromElement.js";
16
16
  import { dragStart, unsetDragImage } from "./dragging.js";
17
+
17
18
  export type SideMenuState<
18
19
  BSchema extends BlockSchema,
19
20
  I extends InlineContentSchema,
@@ -28,9 +29,14 @@ const PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP = 0.1;
28
29
  function getBlockFromCoords(
29
30
  view: EditorView,
30
31
  coords: { left: number; top: number },
32
+ sideMenuDetection: "viewport" | "editor",
31
33
  adjustForColumns = true
32
34
  ) {
33
- const elements = view.root.elementsFromPoint(coords.left, coords.top);
35
+ const elements = view.root.elementsFromPoint(
36
+ // bit hacky - offset x position to right to account for the width of sidemenu itself
37
+ coords.left + (sideMenuDetection === "editor" ? 50 : 0),
38
+ coords.top
39
+ );
34
40
 
35
41
  for (const element of elements) {
36
42
  if (!view.dom.contains(element)) {
@@ -46,6 +52,7 @@ function getBlockFromCoords(
46
52
  left: coords.left + 50, // bit hacky, but if we're inside a column, offset x position to right to account for the width of sidemenu itself
47
53
  top: coords.top,
48
54
  },
55
+ sideMenuDetection,
49
56
  false
50
57
  );
51
58
  }
@@ -60,7 +67,8 @@ function getBlockFromMousePos(
60
67
  x: number;
61
68
  y: number;
62
69
  },
63
- view: EditorView
70
+ view: EditorView,
71
+ sideMenuDetection: "viewport" | "editor"
64
72
  ): { node: HTMLElement; id: string } | undefined {
65
73
  // Editor itself may have padding or other styling which affects
66
74
  // size/position, so we get the boundingRect of the first child (i.e. the
@@ -76,7 +84,7 @@ function getBlockFromMousePos(
76
84
 
77
85
  // this.horizontalPosAnchor = editorBoundingBox.x;
78
86
 
79
- // Gets block at mouse cursor's vertical position.
87
+ // Gets block at mouse cursor's position.
80
88
  const coords = {
81
89
  left: mousePos.x,
82
90
  top: mousePos.y,
@@ -85,15 +93,18 @@ function getBlockFromMousePos(
85
93
  const mouseLeftOfEditor = coords.left < editorBoundingBox.left;
86
94
  const mouseRightOfEditor = coords.left > editorBoundingBox.right;
87
95
 
88
- if (mouseLeftOfEditor) {
89
- coords.left = editorBoundingBox.left + 10;
90
- }
96
+ // Clamps the x position to the editor's bounding box.
97
+ if (sideMenuDetection === "viewport") {
98
+ if (mouseLeftOfEditor) {
99
+ coords.left = editorBoundingBox.left + 10;
100
+ }
91
101
 
92
- if (mouseRightOfEditor) {
93
- coords.left = editorBoundingBox.right - 10;
102
+ if (mouseRightOfEditor) {
103
+ coords.left = editorBoundingBox.right - 10;
104
+ }
94
105
  }
95
106
 
96
- let block = getBlockFromCoords(view, coords);
107
+ let block = getBlockFromCoords(view, coords, sideMenuDetection);
97
108
 
98
109
  if (!mouseRightOfEditor && block) {
99
110
  // note: this case is not necessary when we're on the right side of the editor
@@ -101,14 +112,14 @@ function getBlockFromMousePos(
101
112
  /* Now, because blocks can be nested
102
113
  | BlockA |
103
114
  x | BlockB y|
104
-
115
+
105
116
  hovering over position x (the "margin of block B") will return block A instead of block B.
106
117
  to fix this, we get the block from the right side of block A (position y, which will fall in BlockB correctly)
107
118
  */
108
119
 
109
120
  const rect = block.node.getBoundingClientRect();
110
121
  coords.left = rect.right - 10;
111
- block = getBlockFromCoords(view, coords, false);
122
+ block = getBlockFromCoords(view, coords, "viewport", false);
112
123
  }
113
124
 
114
125
  return block;
@@ -132,8 +143,11 @@ export class SideMenuView<
132
143
 
133
144
  public menuFrozen = false;
134
145
 
146
+ public isDragOrigin = false;
147
+
135
148
  constructor(
136
149
  private readonly editor: BlockNoteEditor<BSchema, I, S>,
150
+ private readonly sideMenuDetection: "viewport" | "editor",
137
151
  private readonly pmView: EditorView,
138
152
  emitUpdate: (state: SideMenuState<BSchema, I, S>) => void
139
153
  ) {
@@ -146,14 +160,18 @@ export class SideMenuView<
146
160
  };
147
161
 
148
162
  this.pmView.root.addEventListener(
149
- "drop",
150
- this.onDrop as EventListener,
151
- true
163
+ "dragstart",
164
+ this.onDragStart as EventListener
152
165
  );
153
166
  this.pmView.root.addEventListener(
154
167
  "dragover",
155
168
  this.onDragOver as EventListener
156
169
  );
170
+ this.pmView.root.addEventListener(
171
+ "drop",
172
+ this.onDrop as EventListener,
173
+ true
174
+ );
157
175
  initializeESMDependencies();
158
176
 
159
177
  // Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.
@@ -181,7 +199,11 @@ export class SideMenuView<
181
199
  return;
182
200
  }
183
201
 
184
- const block = getBlockFromMousePos(this.mousePos, this.pmView);
202
+ const block = getBlockFromMousePos(
203
+ this.mousePos,
204
+ this.pmView,
205
+ this.sideMenuDetection
206
+ );
185
207
 
186
208
  // Closes the menu if the mouse cursor is beyond the editor vertically.
187
209
  if (!block || !this.editor.isEditable) {
@@ -249,7 +271,16 @@ export class SideMenuView<
249
271
  onDrop = (event: DragEvent) => {
250
272
  this.editor._tiptapEditor.commands.blur();
251
273
 
274
+ // ProseMirror doesn't remove the dragged content if it's dropped outside
275
+ // the editor (e.g. to other editors), so we need to do it manually. Since
276
+ // the dragged content is the same as the selected content, we can just
277
+ // delete the selection.
278
+ if (this.isDragOrigin && !this.pmView.dom.contains(event.target as Node)) {
279
+ this.pmView.dispatch(this.pmView.state.tr.deleteSelection());
280
+ }
281
+
252
282
  if (
283
+ this.sideMenuDetection === "editor" ||
253
284
  (event as any).synthetic ||
254
285
  !event.dataTransfer?.types.includes("blocknote/html")
255
286
  ) {
@@ -268,6 +299,46 @@ export class SideMenuView<
268
299
  }
269
300
  };
270
301
 
302
+ /**
303
+ * If a block is being dragged, ProseMirror usually gets the context of what's
304
+ * being dragged from `view.dragging`, which is automatically set when a
305
+ * `dragstart` event fires in the editor. However, if the user tries to drag
306
+ * and drop blocks between multiple editors, only the one in which the drag
307
+ * began has that context, so we need to set it on the others manually. This
308
+ * ensures that PM always drops the blocks in between other blocks, and not
309
+ * inside them.
310
+ *
311
+ * After the `dragstart` event fires on the drag handle, it sets
312
+ * `blocknote/html` data on the clipboard. This handler fires right after,
313
+ * parsing the `blocknote/html` data into nodes and setting them on
314
+ * `view.dragging`.
315
+ *
316
+ * Note: Setting `view.dragging` on `dragover` would be better as the user
317
+ * could then drag between editors in different windows, but you can only
318
+ * access `dataTransfer` contents on `dragstart` and `drop` events.
319
+ */
320
+ onDragStart = (event: DragEvent) => {
321
+ if (!this.pmView.dragging) {
322
+ const html = event.dataTransfer?.getData("blocknote/html");
323
+ if (!html) {
324
+ return;
325
+ }
326
+
327
+ const element = document.createElement("div");
328
+ element.innerHTML = html;
329
+
330
+ const parser = DOMParser.fromSchema(this.pmView.state.schema);
331
+ const node = parser.parse(element, {
332
+ topNode: this.pmView.state.schema.nodes["blockGroup"].create(),
333
+ });
334
+
335
+ this.pmView.dragging = {
336
+ slice: new Slice(node.content, 0, 0),
337
+ move: true,
338
+ };
339
+ }
340
+ };
341
+
271
342
  /**
272
343
  * If the event is outside the editor contents,
273
344
  * we dispatch a fake event, so that we can still drop the content
@@ -275,11 +346,13 @@ export class SideMenuView<
275
346
  */
276
347
  onDragOver = (event: DragEvent) => {
277
348
  if (
349
+ this.sideMenuDetection === "editor" ||
278
350
  (event as any).synthetic ||
279
351
  !event.dataTransfer?.types.includes("blocknote/html")
280
352
  ) {
281
353
  return;
282
354
  }
355
+
283
356
  const pos = this.pmView.posAtCoords({
284
357
  left: event.clientX,
285
358
  top: event.clientY,
@@ -424,11 +497,14 @@ export class SideMenuView<
424
497
  this.onMouseMove as EventListener,
425
498
  true
426
499
  );
500
+ this.pmView.root.removeEventListener(
501
+ "dragstart",
502
+ this.onDragStart as EventListener
503
+ );
427
504
  this.pmView.root.removeEventListener(
428
505
  "dragover",
429
506
  this.onDragOver as EventListener
430
507
  );
431
-
432
508
  this.pmView.root.removeEventListener(
433
509
  "drop",
434
510
  this.onDrop as EventListener,
@@ -452,14 +528,22 @@ export class SideMenuProsemirrorPlugin<
452
528
  public view: SideMenuView<BSchema, I, S> | undefined;
453
529
  public readonly plugin: Plugin;
454
530
 
455
- constructor(private readonly editor: BlockNoteEditor<BSchema, I, S>) {
531
+ constructor(
532
+ private readonly editor: BlockNoteEditor<BSchema, I, S>,
533
+ sideMenuDetection: "viewport" | "editor"
534
+ ) {
456
535
  super();
457
536
  this.plugin = new Plugin({
458
537
  key: sideMenuPluginKey,
459
538
  view: (editorView) => {
460
- this.view = new SideMenuView(editor, editorView, (state) => {
461
- this.emit("update", state);
462
- });
539
+ this.view = new SideMenuView(
540
+ editor,
541
+ sideMenuDetection,
542
+ editorView,
543
+ (state) => {
544
+ this.emit("update", state);
545
+ }
546
+ );
463
547
  return this.view;
464
548
  },
465
549
  });
@@ -479,6 +563,10 @@ export class SideMenuProsemirrorPlugin<
479
563
  },
480
564
  block: Block<BSchema, I, S>
481
565
  ) => {
566
+ if (this.view) {
567
+ this.view.isDragOrigin = true;
568
+ }
569
+
482
570
  dragStart(event, block, this.editor);
483
571
  };
484
572
 
@@ -489,6 +577,10 @@ export class SideMenuProsemirrorPlugin<
489
577
  if (this.editor.prosemirrorView) {
490
578
  unsetDragImage(this.editor.prosemirrorView.root);
491
579
  }
580
+
581
+ if (this.view) {
582
+ this.view.isDragOrigin = false;
583
+ }
492
584
  };
493
585
  /**
494
586
  * Freezes the side menu. When frozen, the side menu will stay
@@ -202,6 +202,5 @@ export function dragStart<
202
202
  e.dataTransfer.setData("text/plain", plainText);
203
203
  e.dataTransfer.effectAllowed = "move";
204
204
  e.dataTransfer.setDragImage(dragImageElement!, 0, 0);
205
- view.dragging = { slice: selectedSlice, move: true };
206
205
  }
207
206
  }
@@ -1,7 +1,7 @@
1
1
  import type { Dictionary } from "../../i18n/dictionary.js";
2
2
 
3
3
  export type DefaultSuggestionItem = {
4
- key: keyof Dictionary["slash_menu"];
4
+ key: keyof Omit<Dictionary["slash_menu"], "page_break">;
5
5
  title: string;
6
6
  onItemClick: () => void;
7
7
  subtext?: string;
@@ -58,6 +58,12 @@ export const ar: Dictionary = {
58
58
  aliases: ["كود", "مسبق"],
59
59
  group: "الكتل الأساسية",
60
60
  },
61
+ page_break: {
62
+ title: "فاصل الصفحة",
63
+ subtext: "فاصل الصفحة",
64
+ aliases: ["page", "break", "separator", "فاصل", "الصفحة"],
65
+ group: "الكتل الأساسية",
66
+ },
61
67
  table: {
62
68
  title: "جدول",
63
69
  subtext: "يستخدم للجداول",
@@ -56,6 +56,12 @@ export const de = {
56
56
  aliases: ["code", "pre"],
57
57
  group: "Grundlegende blöcke",
58
58
  },
59
+ page_break: {
60
+ title: "Seitenumbruch",
61
+ subtext: "Seitentrenner",
62
+ aliases: ["page", "break", "separator", "seitenumbruch", "trenner"],
63
+ group: "Grundlegende Blöcke",
64
+ },
59
65
  table: {
60
66
  title: "Tabelle",
61
67
  subtext: "Tabelle mit editierbaren Zellen",
@@ -56,6 +56,12 @@ export const en = {
56
56
  aliases: ["code", "pre"],
57
57
  group: "Basic blocks",
58
58
  },
59
+ page_break: {
60
+ title: "Page Break",
61
+ subtext: "Page separator",
62
+ aliases: ["page", "break", "separator"],
63
+ group: "Basic blocks",
64
+ },
59
65
  table: {
60
66
  title: "Table",
61
67
  subtext: "Table with editable cells",
@@ -55,6 +55,12 @@ export const es = {
55
55
  aliases: ["code", "pre"],
56
56
  group: "Bloques básicos",
57
57
  },
58
+ page_break: {
59
+ title: "Salto de página",
60
+ subtext: "Separador de página",
61
+ aliases: ["page", "break", "separator", "salto", "separador"],
62
+ group: "Bloques básicos",
63
+ },
58
64
  table: {
59
65
  title: "Tabla",
60
66
  subtext: "Tabla con celdas editables",
@@ -10,13 +10,14 @@ export const fr: Dictionary = {
10
10
  },
11
11
  heading_2: {
12
12
  title: "Titre 2",
13
- subtext: "Utilisé pour les sections clés",
13
+ subtext: "Titre de deuxième niveau Utilisé pour les sections clés",
14
14
  aliases: ["h2", "titre2", "sous-titre"],
15
15
  group: "Titres",
16
16
  },
17
17
  heading_3: {
18
18
  title: "Titre 3",
19
- subtext: "Utilisé pour les sous-sections et les titres de groupe",
19
+ subtext:
20
+ "Titre de troisième niveau utilisé pour les sous-sections et les titres de groupe",
20
21
  aliases: ["h3", "titre3", "sous-titre"],
21
22
  group: "Titres",
22
23
  },
@@ -27,13 +28,21 @@ export const fr: Dictionary = {
27
28
  group: "Blocs de base",
28
29
  },
29
30
  bullet_list: {
30
- title: "Liste à Puces",
31
- subtext: "Utilisé pour afficher une liste non ordonnée",
32
- aliases: ["ul", "li", "liste", "listeàpuces", "liste à puces"],
31
+ title: "Liste à puces",
32
+ subtext: "Utilisé pour afficher une liste à puce non numérotée",
33
+ aliases: [
34
+ "ul",
35
+ "li",
36
+ "liste",
37
+ "listeàpuces",
38
+ "liste à puces",
39
+ "bullet points",
40
+ "bulletpoints",
41
+ ],
33
42
  group: "Blocs de base",
34
43
  },
35
44
  check_list: {
36
- title: "Liste de vérification",
45
+ title: "Liste de tâches",
37
46
  subtext: "Utilisé pour afficher une liste avec des cases à cocher",
38
47
  aliases: [
39
48
  "ul",
@@ -42,13 +51,18 @@ export const fr: Dictionary = {
42
51
  "liste de vérification",
43
52
  "liste cochée",
44
53
  "case à cocher",
54
+ "checklist",
55
+ "checkbox",
56
+ "check box",
57
+ "to do",
58
+ "todo",
45
59
  ],
46
60
  group: "Blocs de base",
47
61
  },
48
62
  paragraph: {
49
63
  title: "Paragraphe",
50
64
  subtext: "Utilisé pour le corps de votre document",
51
- aliases: ["p", "paragraphe"],
65
+ aliases: ["p", "paragraphe", "texte"],
52
66
  group: "Blocs de base",
53
67
  },
54
68
  code_block: {
@@ -57,10 +71,16 @@ export const fr: Dictionary = {
57
71
  aliases: ["code", "pre"],
58
72
  group: "Blocs de base",
59
73
  },
74
+ page_break: {
75
+ title: "Saut de page",
76
+ subtext: "Séparateur de page",
77
+ aliases: ["page", "break", "separator", "saut", "séparateur"],
78
+ group: "Blocs de base",
79
+ },
60
80
  table: {
61
81
  title: "Tableau",
62
82
  subtext: "Utilisé pour les tableaux",
63
- aliases: ["tableau"],
83
+ aliases: ["tableau", "grille"],
64
84
  group: "Avancé",
65
85
  },
66
86
  image: {
@@ -69,7 +89,9 @@ export const fr: Dictionary = {
69
89
  aliases: [
70
90
  "image",
71
91
  "uploadImage",
72
- "télécharger",
92
+ "télécharger image",
93
+ "téléverser image",
94
+ "uploader image",
73
95
  "img",
74
96
  "photo",
75
97
  "média",
@@ -82,8 +104,8 @@ export const fr: Dictionary = {
82
104
  subtext: "Insérer une vidéo",
83
105
  aliases: [
84
106
  "vidéo",
85
- "téléchargerVidéo",
86
- "téléverser",
107
+ "télécharger vidéo",
108
+ "téléverser vidéo",
87
109
  "mp4",
88
110
  "film",
89
111
  "média",
@@ -96,8 +118,8 @@ export const fr: Dictionary = {
96
118
  subtext: "Insérer un audio",
97
119
  aliases: [
98
120
  "audio",
99
- "téléchargerAudio",
100
- "téléverser",
121
+ "télécharger audio",
122
+ "téléverser audio",
101
123
  "mp3",
102
124
  "son",
103
125
  "média",
@@ -108,18 +130,26 @@ export const fr: Dictionary = {
108
130
  file: {
109
131
  title: "Fichier",
110
132
  subtext: "Insérer un fichier",
111
- aliases: ["fichier", "téléverser", "intégrer", "média", "url"],
133
+ aliases: [
134
+ "fichier",
135
+ "téléverser fichier",
136
+ "intégrer fichier",
137
+ "insérer fichier",
138
+ "média",
139
+ "url",
140
+ ],
112
141
  group: "Média",
113
142
  },
114
143
  emoji: {
115
144
  title: "Emoji",
116
145
  subtext: "Utilisé pour insérer un emoji",
117
- aliases: ["emoji", "émoticône", "émotion", "visage"],
146
+ aliases: ["emoji", "émoticône", "émotion", "visage", "smiley"],
118
147
  group: "Autres",
119
148
  },
120
149
  },
121
150
  placeholders: {
122
- default: "Entrez du texte ou tapez '/' pour les commandes",
151
+ default:
152
+ "Entrez du texte ou tapez '/' pour faire apparaître les options de mise en page",
123
153
  heading: "Titre",
124
154
  bulletListItem: "Liste",
125
155
  numberedListItem: "Liste",
@@ -280,7 +310,7 @@ export const fr: Dictionary = {
280
310
  audio: "Télécharger un fichier audio",
281
311
  file: "Télécharger un fichier",
282
312
  },
283
- upload_error: "Erreur : Échec du téléchargement",
313
+ upload_error: "Erreur : échec du téléchargement",
284
314
  },
285
315
  embed: {
286
316
  title: "Intégrer",