@blocknote/core 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/dist/blocknote.js +1023 -999
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +7 -7
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/webpack-stats.json +1 -1
  8. package/package.json +3 -3
  9. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
  10. package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
  11. package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
  12. package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
  13. package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
  14. package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
  15. package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
  16. package/src/api/clipboard/clipboardExternal.test.ts +161 -0
  17. package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +60 -38
  18. package/src/api/clipboard/testUtil.ts +27 -0
  19. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -0
  20. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  21. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
  22. package/src/api/nodeConversions/nodeToBlock.ts +4 -1
  23. package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
  24. package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
  25. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -19
  26. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +3 -15
  27. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
  28. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +25 -5
  29. package/src/editor/Block.css +3 -3
  30. package/src/editor/BlockNoteEditor.test.ts +21 -1
  31. package/src/editor/editor.css +6 -6
  32. package/src/editor/transformPasted.ts +57 -4
  33. package/src/schema/blocks/createSpec.ts +1 -1
  34. package/src/schema/blocks/internal.ts +16 -6
  35. package/src/schema/inlineContent/internal.ts +4 -1
  36. package/src/schema/propTypes.ts +41 -18
  37. package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
  38. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  39. package/types/src/api/clipboard/testUtil.d.ts +509 -0
  40. package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
  41. package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
  42. package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
  43. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
  44. package/types/src/blocks/defaultBlocks.d.ts +16 -0
  45. package/types/src/editor/transformPasted.d.ts +8 -4
  46. package/types/src/schema/propTypes.d.ts +20 -2
  47. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
  48. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
  49. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
  50. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
  51. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
  52. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
  53. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
  54. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
  55. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
  56. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
  57. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
  58. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
  59. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
  60. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
  61. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
  62. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
  63. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
  64. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
  65. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
  66. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
  67. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
  68. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
  69. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
  70. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
  71. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
  72. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
  73. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
  74. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
  75. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
  76. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
  77. package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
  78. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
  79. package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
  80. package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
  81. package/dist/src/api/blockManipulation/selections/selection.js +0 -149
  82. package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
  83. package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
  84. package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
  85. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
  86. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
  87. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
  88. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
  89. package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
  90. package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
  91. package/dist/src/api/clipboard/clipboard.test.js +0 -249
  92. package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
  93. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
  94. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
  95. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
  96. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
  97. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
  98. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
  99. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -25
  100. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
  101. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
  102. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
  103. package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -134
  104. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
  105. package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
  106. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
  107. package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
  108. package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
  109. package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
  110. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
  111. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
  112. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
  113. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
  114. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
  115. package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
  116. package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
  117. package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
  118. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
  119. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
  120. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
  121. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
  122. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
  123. package/dist/src/api/getBlockInfoFromPos.js +0 -165
  124. package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
  125. package/dist/src/api/nodeConversions/blockToNode.js +0 -197
  126. package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
  127. package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
  128. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
  129. package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
  130. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
  131. package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
  132. package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
  133. package/dist/src/api/nodeUtil.js +0 -28
  134. package/dist/src/api/nodeUtil.js.map +0 -1
  135. package/dist/src/api/parsers/html/parseHTML.js +0 -19
  136. package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
  137. package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
  138. package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
  139. package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
  140. package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
  141. package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
  142. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
  143. package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
  144. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
  145. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -112
  146. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
  147. package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
  148. package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
  149. package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
  150. package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
  151. package/dist/src/api/testUtil/cases/customStyles.js +0 -83
  152. package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
  153. package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
  154. package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
  155. package/dist/src/api/testUtil/index.js +0 -2
  156. package/dist/src/api/testUtil/index.js.map +0 -1
  157. package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
  158. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
  159. package/dist/src/api/testUtil/paste.js +0 -29
  160. package/dist/src/api/testUtil/paste.js.map +0 -1
  161. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -104
  162. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
  163. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js +0 -5
  164. package/dist/src/blocks/AudioBlockContent/parseAudioElement.js.map +0 -1
  165. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
  166. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
  167. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
  168. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
  169. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -71
  170. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
  171. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js +0 -5
  172. package/dist/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.js.map +0 -1
  173. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js +0 -10
  174. package/dist/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.js.map +0 -1
  175. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js +0 -39
  176. package/dist/src/blocks/FileBlockContent/helpers/render/createAddFileButton.js.map +0 -1
  177. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js +0 -51
  178. package/dist/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.js.map +0 -1
  179. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js +0 -17
  180. package/dist/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.js.map +0 -1
  181. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js +0 -147
  182. package/dist/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.js.map +0 -1
  183. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js +0 -9
  184. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.js.map +0 -1
  185. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js +0 -11
  186. package/dist/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js.map +0 -1
  187. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
  188. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
  189. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
  190. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
  191. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -114
  192. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
  193. package/dist/src/blocks/ImageBlockContent/parseImageElement.js +0 -6
  194. package/dist/src/blocks/ImageBlockContent/parseImageElement.js.map +0 -1
  195. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
  196. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
  197. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
  198. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
  199. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
  200. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
  201. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
  202. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
  203. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
  204. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
  205. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
  206. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
  207. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
  208. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
  209. package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
  210. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
  211. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -114
  212. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
  213. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js +0 -6
  214. package/dist/src/blocks/VideoBlockContent/parseVideoElement.js.map +0 -1
  215. package/dist/src/blocks/defaultBlockHelpers.js +0 -50
  216. package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
  217. package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
  218. package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
  219. package/dist/src/blocks/defaultBlocks.js +0 -50
  220. package/dist/src/blocks/defaultBlocks.js.map +0 -1
  221. package/dist/src/blocks/defaultProps.js +0 -19
  222. package/dist/src/blocks/defaultProps.js.map +0 -1
  223. package/dist/src/editor/BlockNoteEditor.js +0 -751
  224. package/dist/src/editor/BlockNoteEditor.js.map +0 -1
  225. package/dist/src/editor/BlockNoteEditor.test.js +0 -65
  226. package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
  227. package/dist/src/editor/BlockNoteExtensions.js +0 -192
  228. package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
  229. package/dist/src/editor/BlockNoteSchema.js +0 -38
  230. package/dist/src/editor/BlockNoteSchema.js.map +0 -1
  231. package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
  232. package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
  233. package/dist/src/editor/cursorPositionTypes.js +0 -2
  234. package/dist/src/editor/cursorPositionTypes.js.map +0 -1
  235. package/dist/src/editor/defaultColors.js +0 -77
  236. package/dist/src/editor/defaultColors.js.map +0 -1
  237. package/dist/src/editor/selectionTypes.js +0 -2
  238. package/dist/src/editor/selectionTypes.js.map +0 -1
  239. package/dist/src/editor/transformPasted.js +0 -79
  240. package/dist/src/editor/transformPasted.js.map +0 -1
  241. package/dist/src/exporter/Exporter.js +0 -36
  242. package/dist/src/exporter/Exporter.js.map +0 -1
  243. package/dist/src/exporter/index.js +0 -3
  244. package/dist/src/exporter/index.js.map +0 -1
  245. package/dist/src/exporter/mapping.js +0 -12
  246. package/dist/src/exporter/mapping.js.map +0 -1
  247. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
  248. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
  249. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
  250. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
  251. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
  252. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
  253. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
  254. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
  255. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
  256. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
  257. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
  258. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
  259. package/dist/src/extensions/LinkToolbar/protocols.js +0 -14
  260. package/dist/src/extensions/LinkToolbar/protocols.js.map +0 -1
  261. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
  262. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
  263. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
  264. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
  265. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
  266. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
  267. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
  268. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
  269. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -347
  270. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
  271. package/dist/src/extensions/SideMenu/dragging.js +0 -135
  272. package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
  273. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
  274. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
  275. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
  276. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
  277. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
  278. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
  279. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
  280. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
  281. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
  282. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
  283. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -579
  284. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
  285. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
  286. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
  287. package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
  288. package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
  289. package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
  290. package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
  291. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
  292. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
  293. package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
  294. package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
  295. package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
  296. package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
  297. package/dist/src/extensions-shared/UiElementPosition.js +0 -2
  298. package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
  299. package/dist/src/i18n/dictionary.js +0 -4
  300. package/dist/src/i18n/dictionary.js.map +0 -1
  301. package/dist/src/i18n/locales/ar.js +0 -298
  302. package/dist/src/i18n/locales/ar.js.map +0 -1
  303. package/dist/src/i18n/locales/de.js +0 -313
  304. package/dist/src/i18n/locales/de.js.map +0 -1
  305. package/dist/src/i18n/locales/en.js +0 -314
  306. package/dist/src/i18n/locales/en.js.map +0 -1
  307. package/dist/src/i18n/locales/es.js +0 -312
  308. package/dist/src/i18n/locales/es.js.map +0 -1
  309. package/dist/src/i18n/locales/fr.js +0 -313
  310. package/dist/src/i18n/locales/fr.js.map +0 -1
  311. package/dist/src/i18n/locales/hr.js +0 -308
  312. package/dist/src/i18n/locales/hr.js.map +0 -1
  313. package/dist/src/i18n/locales/index.js +0 -16
  314. package/dist/src/i18n/locales/index.js.map +0 -1
  315. package/dist/src/i18n/locales/is.js +0 -305
  316. package/dist/src/i18n/locales/is.js.map +0 -1
  317. package/dist/src/i18n/locales/ja.js +0 -333
  318. package/dist/src/i18n/locales/ja.js.map +0 -1
  319. package/dist/src/i18n/locales/ko.js +0 -326
  320. package/dist/src/i18n/locales/ko.js.map +0 -1
  321. package/dist/src/i18n/locales/nl.js +0 -313
  322. package/dist/src/i18n/locales/nl.js.map +0 -1
  323. package/dist/src/i18n/locales/pl.js +0 -297
  324. package/dist/src/i18n/locales/pl.js.map +0 -1
  325. package/dist/src/i18n/locales/pt.js +0 -305
  326. package/dist/src/i18n/locales/pt.js.map +0 -1
  327. package/dist/src/i18n/locales/ru.js +0 -340
  328. package/dist/src/i18n/locales/ru.js.map +0 -1
  329. package/dist/src/i18n/locales/vi.js +0 -312
  330. package/dist/src/i18n/locales/vi.js.map +0 -1
  331. package/dist/src/i18n/locales/zh.js +0 -346
  332. package/dist/src/i18n/locales/zh.js.map +0 -1
  333. package/dist/src/index.js +0 -63
  334. package/dist/src/index.js.map +0 -1
  335. package/dist/src/pm-nodes/BlockContainer.js +0 -72
  336. package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
  337. package/dist/src/pm-nodes/BlockGroup.js +0 -43
  338. package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
  339. package/dist/src/pm-nodes/Doc.js +0 -7
  340. package/dist/src/pm-nodes/Doc.js.map +0 -1
  341. package/dist/src/pm-nodes/index.js +0 -4
  342. package/dist/src/pm-nodes/index.js.map +0 -1
  343. package/dist/src/schema/blocks/createSpec.js +0 -126
  344. package/dist/src/schema/blocks/createSpec.js.map +0 -1
  345. package/dist/src/schema/blocks/internal.js +0 -147
  346. package/dist/src/schema/blocks/internal.js.map +0 -1
  347. package/dist/src/schema/blocks/types.js +0 -2
  348. package/dist/src/schema/blocks/types.js.map +0 -1
  349. package/dist/src/schema/index.js +0 -11
  350. package/dist/src/schema/index.js.map +0 -1
  351. package/dist/src/schema/inlineContent/createSpec.js +0 -64
  352. package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
  353. package/dist/src/schema/inlineContent/internal.js +0 -52
  354. package/dist/src/schema/inlineContent/internal.js.map +0 -1
  355. package/dist/src/schema/inlineContent/types.js +0 -10
  356. package/dist/src/schema/inlineContent/types.js.map +0 -1
  357. package/dist/src/schema/propTypes.js +0 -2
  358. package/dist/src/schema/propTypes.js.map +0 -1
  359. package/dist/src/schema/styles/createSpec.js +0 -48
  360. package/dist/src/schema/styles/createSpec.js.map +0 -1
  361. package/dist/src/schema/styles/internal.js +0 -53
  362. package/dist/src/schema/styles/internal.js.map +0 -1
  363. package/dist/src/schema/styles/types.js +0 -2
  364. package/dist/src/schema/styles/types.js.map +0 -1
  365. package/dist/src/util/EventEmitter.js +0 -33
  366. package/dist/src/util/EventEmitter.js.map +0 -1
  367. package/dist/src/util/browser.js +0 -17
  368. package/dist/src/util/browser.js.map +0 -1
  369. package/dist/src/util/combineByGroup.js +0 -20
  370. package/dist/src/util/combineByGroup.js.map +0 -1
  371. package/dist/src/util/esmDependencies.js +0 -35
  372. package/dist/src/util/esmDependencies.js.map +0 -1
  373. package/dist/src/util/string.js +0 -14
  374. package/dist/src/util/string.js.map +0 -1
  375. package/dist/src/util/typescript.js +0 -12
  376. package/dist/src/util/typescript.js.map +0 -1
  377. /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
  378. /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
  379. /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
  380. /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
  381. /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
  382. /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
  383. /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
  384. /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
  385. /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
  386. /package/src/api/clipboard/__snapshots__/{tableAllCells.html → internal/tableAllCells.html} +0 -0
  387. /package/src/api/clipboard/__snapshots__/{tableCell.html → internal/tableCell.html} +0 -0
  388. /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
  389. /package/src/api/clipboard/__snapshots__/{tableRow.html → internal/tableRow.html} +0 -0
  390. /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
  391. /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
@@ -1,54 +0,0 @@
1
- import { Plugin, PluginKey, TextSelection } from "prosemirror-state";
2
- const PLUGIN_KEY = new PluginKey("node-selection-keyboard");
3
- // By default, typing with a node selection active will cause ProseMirror to
4
- // replace the node with one that contains editable content. This plugin blocks
5
- // this behaviour without also blocking things like keyboard shortcuts:
6
- //
7
- // - Lets through key presses that do not include alphanumeric characters. This
8
- // includes things like backspace/delete/home/end/etc.
9
- // - Lets through any key presses that include ctrl/meta keys. These will be
10
- // shortcuts of some kind like ctrl+C/mod+C.
11
- // - Special case for Enter key which creates a new paragraph block below and
12
- // sets the selection to it. This is just to bring the UX closer to Notion
13
- //
14
- // While a more elegant solution would probably process transactions instead of
15
- // keystrokes, this brings us most of the way to Notion's UX without much added
16
- // complexity.
17
- export class NodeSelectionKeyboardPlugin {
18
- plugin;
19
- constructor() {
20
- this.plugin = new Plugin({
21
- key: PLUGIN_KEY,
22
- props: {
23
- handleKeyDown: (view, event) => {
24
- // Checks for node selection
25
- if ("node" in view.state.selection) {
26
- // Checks if key press uses ctrl/meta modifier
27
- if (event.ctrlKey || event.metaKey) {
28
- return false;
29
- }
30
- // Checks if key press is alphanumeric
31
- if (event.key.length === 1) {
32
- event.preventDefault();
33
- return true;
34
- }
35
- // Checks if key press is Enter
36
- if (event.key === "Enter" &&
37
- !event.shiftKey &&
38
- !event.altKey &&
39
- !event.ctrlKey &&
40
- !event.metaKey) {
41
- const tr = view.state.tr;
42
- view.dispatch(tr
43
- .insert(view.state.tr.selection.$to.after(), view.state.schema.nodes["paragraph"].createChecked())
44
- .setSelection(new TextSelection(tr.doc.resolve(view.state.tr.selection.$to.after() + 1))));
45
- return true;
46
- }
47
- }
48
- return false;
49
- },
50
- },
51
- });
52
- }
53
- }
54
- //# sourceMappingURL=NodeSelectionKeyboardPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeSelectionKeyboardPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAC5D,4EAA4E;AAC5E,+EAA+E;AAC/E,uEAAuE;AACvE,EAAE;AACF,+EAA+E;AAC/E,sDAAsD;AACtD,4EAA4E;AAC5E,4CAA4C;AAC5C,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,cAAc;AACd,MAAM,OAAO,2BAA2B;IACtB,MAAM,CAAS;IAC/B;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,GAAG,EAAE,UAAU;YACf,KAAK,EAAE;gBACL,aAAa,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oBAC7B,4BAA4B;oBAC5B,IAAI,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;wBACnC,8CAA8C;wBAC9C,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;4BACnC,OAAO,KAAK,CAAC;wBACf,CAAC;wBACD,sCAAsC;wBACtC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;4BAC3B,KAAK,CAAC,cAAc,EAAE,CAAC;4BAEvB,OAAO,IAAI,CAAC;wBACd,CAAC;wBACD,+BAA+B;wBAC/B,IACE,KAAK,CAAC,GAAG,KAAK,OAAO;4BACrB,CAAC,KAAK,CAAC,QAAQ;4BACf,CAAC,KAAK,CAAC,MAAM;4BACb,CAAC,KAAK,CAAC,OAAO;4BACd,CAAC,KAAK,CAAC,OAAO,EACd,CAAC;4BACD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;4BACzB,IAAI,CAAC,QAAQ,CACX,EAAE;iCACC,MAAM,CACL,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EACnC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,aAAa,EAAE,CACrD;iCACA,YAAY,CACX,IAAI,aAAa,CACf,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CACxD,CACF,CACJ,CAAC;4BAEF,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC;oBAED,OAAO,KAAK,CAAC;gBACf,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,90 +0,0 @@
1
- import { Plugin, PluginKey } from "prosemirror-state";
2
- import { Decoration, DecorationSet } from "prosemirror-view";
3
- const PLUGIN_KEY = new PluginKey(`blocknote-placeholder`);
4
- export class PlaceholderPlugin {
5
- plugin;
6
- constructor(editor, placeholders) {
7
- this.plugin = new Plugin({
8
- key: PLUGIN_KEY,
9
- view: () => {
10
- const styleEl = document.createElement("style");
11
- const nonce = editor._tiptapEditor.options.injectNonce;
12
- if (nonce) {
13
- styleEl.setAttribute("nonce", nonce);
14
- }
15
- if (editor.prosemirrorView?.root instanceof ShadowRoot) {
16
- editor.prosemirrorView.root.append(styleEl);
17
- }
18
- else {
19
- editor.prosemirrorView?.root.head.appendChild(styleEl);
20
- }
21
- const styleSheet = styleEl.sheet;
22
- const getBaseSelector = (additionalSelectors = "") => `.bn-block-content${additionalSelectors} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;
23
- const getSelector = (blockType, mustBeFocused = true) => {
24
- const mustBeFocusedSelector = mustBeFocused
25
- ? `[data-is-empty-and-focused]`
26
- : ``;
27
- if (blockType === "default") {
28
- return getBaseSelector(mustBeFocusedSelector);
29
- }
30
- const blockTypeSelector = `[data-content-type="${blockType}"]`;
31
- return getBaseSelector(mustBeFocusedSelector + blockTypeSelector);
32
- };
33
- for (const [blockType, placeholder] of Object.entries(placeholders)) {
34
- const mustBeFocused = blockType === "default";
35
- try {
36
- styleSheet.insertRule(`${getSelector(blockType, mustBeFocused)} { content: ${JSON.stringify(placeholder)}; }`);
37
- // For some reason, the placeholders which show when the block is focused
38
- // take priority over ones which show depending on block type, so we need
39
- // to make sure the block specific ones are also used when the block is
40
- // focused.
41
- if (!mustBeFocused) {
42
- styleSheet.insertRule(`${getSelector(blockType, true)} { content: ${JSON.stringify(placeholder)}; }`);
43
- }
44
- }
45
- catch (e) {
46
- // eslint-disable-next-line no-console
47
- console.warn(`Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)`, e);
48
- }
49
- }
50
- return {
51
- destroy: () => {
52
- if (editor.prosemirrorView?.root instanceof ShadowRoot) {
53
- editor.prosemirrorView.root.removeChild(styleEl);
54
- }
55
- else {
56
- editor.prosemirrorView?.root.head.removeChild(styleEl);
57
- }
58
- },
59
- };
60
- },
61
- props: {
62
- // TODO: maybe also add placeholder for empty document ("e.g.: start writing..")
63
- decorations: (state) => {
64
- const { doc, selection } = state;
65
- if (!editor.isEditable) {
66
- return;
67
- }
68
- if (!selection.empty) {
69
- return;
70
- }
71
- // Don't show placeholder when the cursor is inside a code block
72
- if (selection.$from.parent.type.spec.code) {
73
- return;
74
- }
75
- const $pos = selection.$anchor;
76
- const node = $pos.parent;
77
- if (node.content.size > 0) {
78
- return null;
79
- }
80
- const before = $pos.before();
81
- const dec = Decoration.node(before, before + node.nodeSize, {
82
- "data-is-empty-and-focused": "true",
83
- });
84
- return DecorationSet.create(doc, [dec]);
85
- },
86
- },
87
- });
88
- }
89
- }
90
- //# sourceMappingURL=PlaceholderPlugin.js.map
@@ -1 +0,0 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E,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;wBACzD,CAAC;oBACH,CAAC;iBACF,CAAC;YACJ,CAAC;YACD,KAAK,EAAE;gBACL,gFAAgF;gBAChF,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;oBACrB,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;oBAEjC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;wBACvB,OAAO;oBACT,CAAC;oBAED,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;wBACrB,OAAO;oBACT,CAAC;oBAED,gEAAgE;oBAChE,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAC1C,OAAO;oBACT,CAAC;oBAED,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC;oBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;oBAEzB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;wBAC1B,OAAO,IAAI,CAAC;oBACd,CAAC;oBAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;oBAE7B,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;wBAC1D,2BAA2B,EAAE,MAAM;qBACpC,CAAC,CAAC;oBAEH,OAAO,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC1C,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,187 +0,0 @@
1
- import { findChildren } from "@tiptap/core";
2
- import { Plugin, PluginKey } from "prosemirror-state";
3
- import { Decoration, DecorationSet } from "prosemirror-view";
4
- const PLUGIN_KEY = new PluginKey(`previous-blocks`);
5
- const nodeAttributes = {
6
- // Numbered List Items
7
- index: "index",
8
- // Headings
9
- level: "level",
10
- // All Blocks
11
- type: "type",
12
- depth: "depth",
13
- "depth-change": "depth-change",
14
- };
15
- /**
16
- * This plugin tracks transformation of Block node attributes, so we can support CSS transitions.
17
- *
18
- * Problem it solves: ProseMirror recreates the DOM when transactions happen. So when a transaction changes a Node attribute,
19
- * it results in a completely new DOM element. This means CSS transitions don't work.
20
- *
21
- * Solution: When attributes change on a node, this plugin sets a data-* attribute with the "previous" value. This way we can still use CSS transitions. (See block.module.css)
22
- */
23
- export class PreviousBlockTypePlugin {
24
- plugin;
25
- constructor() {
26
- let timeout;
27
- this.plugin = new Plugin({
28
- key: PLUGIN_KEY,
29
- view(_editorView) {
30
- return {
31
- update: async (view, _prevState) => {
32
- if (this.key?.getState(view.state).updatedBlocks.size > 0) {
33
- // use setTimeout 0 to clear the decorations so that at least
34
- // for one DOM-render the decorations have been applied
35
- timeout = setTimeout(() => {
36
- view.dispatch(view.state.tr.setMeta(PLUGIN_KEY, { clearUpdate: true }));
37
- }, 0);
38
- }
39
- },
40
- destroy: () => {
41
- if (timeout) {
42
- clearTimeout(timeout);
43
- }
44
- },
45
- };
46
- },
47
- state: {
48
- init() {
49
- return {
50
- // Block attributes, by block ID, from just before the previous transaction.
51
- prevTransactionOldBlockAttrs: {},
52
- // Block attributes, by block ID, from just before the current transaction.
53
- currentTransactionOldBlockAttrs: {},
54
- // Set of IDs of blocks whose attributes changed from the current transaction.
55
- updatedBlocks: new Set(),
56
- };
57
- },
58
- apply(transaction, prev, oldState, newState) {
59
- prev.currentTransactionOldBlockAttrs = {};
60
- prev.updatedBlocks.clear();
61
- if (!transaction.docChanged || oldState.doc.eq(newState.doc)) {
62
- return prev;
63
- }
64
- // TODO: Instead of iterating through the entire document, only check nodes affected by the transactions. Will
65
- // also probably require checking nodes affected by the previous transaction too.
66
- // We didn't get this to work yet:
67
- // const transform = combineTransactionSteps(oldState.doc, [transaction]);
68
- // // const { mapping } = transform;
69
- // const changes = getChangedRanges(transform);
70
- //
71
- // changes.forEach(({ oldRange, newRange }) => {
72
- // const oldNodes = findChildrenInRange(
73
- // oldState.doc,
74
- // oldRange,
75
- // (node) => node.attrs.id
76
- // );
77
- //
78
- // const newNodes = findChildrenInRange(
79
- // newState.doc,
80
- // newRange,
81
- // (node) => node.attrs.id
82
- // );
83
- const currentTransactionOriginalOldBlockAttrs = {};
84
- const oldNodes = findChildren(oldState.doc, (node) => node.attrs.id);
85
- const oldNodesById = new Map(oldNodes.map((node) => [node.node.attrs.id, node]));
86
- const newNodes = findChildren(newState.doc, (node) => node.attrs.id);
87
- // Traverses all block containers in the new editor state.
88
- for (const node of newNodes) {
89
- const oldNode = oldNodesById.get(node.node.attrs.id);
90
- const oldContentNode = oldNode?.node.firstChild;
91
- const newContentNode = node.node.firstChild;
92
- if (oldNode && oldContentNode && newContentNode) {
93
- const newAttrs = {
94
- index: newContentNode.attrs.index,
95
- level: newContentNode.attrs.level,
96
- type: newContentNode.type.name,
97
- depth: newState.doc.resolve(node.pos).depth,
98
- };
99
- let oldAttrs = {
100
- index: oldContentNode.attrs.index,
101
- level: oldContentNode.attrs.level,
102
- type: oldContentNode.type.name,
103
- depth: oldState.doc.resolve(oldNode.pos).depth,
104
- };
105
- currentTransactionOriginalOldBlockAttrs[node.node.attrs.id] =
106
- oldAttrs;
107
- // Whenever a transaction is appended by the OrderedListItemIndexPlugin, it's given the metadata:
108
- // { "orderedListIndexing": true }
109
- // These appended transactions happen immediately after any transaction which causes ordered list item
110
- // indices to require updating, including those which trigger animations. Therefore, these animations are
111
- // immediately overridden when the PreviousBlockTypePlugin processes the appended transaction, despite only
112
- // the listItemIndex attribute changing. To solve this, oldAttrs must be edited for transactions with the
113
- // "orderedListIndexing" metadata, so the correct animation can be re-triggered.
114
- if (transaction.getMeta("numberedListIndexing")) {
115
- // If the block existed before the transaction, gets the attributes from before the previous transaction
116
- // (i.e. the transaction that caused list item indices to need updating).
117
- if (node.node.attrs.id in prev.prevTransactionOldBlockAttrs) {
118
- oldAttrs =
119
- prev.prevTransactionOldBlockAttrs[node.node.attrs.id];
120
- }
121
- // Stops list item indices themselves being animated (looks smoother), unless the block's content type is
122
- // changing from a numbered list item to something else.
123
- if (newAttrs.type === "numberedListItem") {
124
- oldAttrs.index = newAttrs.index;
125
- }
126
- }
127
- prev.currentTransactionOldBlockAttrs[node.node.attrs.id] =
128
- oldAttrs;
129
- // TODO: faster deep equal?
130
- if (JSON.stringify(oldAttrs) !== JSON.stringify(newAttrs)) {
131
- oldAttrs["depth-change"] =
132
- oldAttrs.depth - newAttrs.depth;
133
- // for debugging:
134
- // console.log(
135
- // "id:",
136
- // node.node.attrs.id,
137
- // "previousBlockTypePlugin changes detected, oldAttrs",
138
- // oldAttrs,
139
- // "new",
140
- // newAttrs
141
- // );
142
- prev.updatedBlocks.add(node.node.attrs.id);
143
- }
144
- }
145
- }
146
- prev.prevTransactionOldBlockAttrs =
147
- currentTransactionOriginalOldBlockAttrs;
148
- return prev;
149
- },
150
- },
151
- props: {
152
- decorations(state) {
153
- const pluginState = this.getState(state);
154
- if (pluginState.updatedBlocks.size === 0) {
155
- return undefined;
156
- }
157
- const decorations = [];
158
- state.doc.descendants((node, pos) => {
159
- if (!node.attrs.id) {
160
- return;
161
- }
162
- if (!pluginState.updatedBlocks.has(node.attrs.id)) {
163
- return;
164
- }
165
- const prevAttrs = pluginState.currentTransactionOldBlockAttrs[node.attrs.id];
166
- const decorationAttrs = {};
167
- for (const [nodeAttr, val] of Object.entries(prevAttrs)) {
168
- decorationAttrs["data-prev-" + nodeAttributes[nodeAttr]] =
169
- val || "none";
170
- }
171
- // for debugging:
172
- // console.log(
173
- // "previousBlockTypePlugin committing decorations",
174
- // decorationAttrs
175
- // );
176
- const decoration = Decoration.node(pos, pos + node.nodeSize, {
177
- ...decorationAttrs,
178
- });
179
- decorations.push(decoration);
180
- });
181
- return DecorationSet.create(state.doc, decorations);
182
- },
183
- },
184
- });
185
- }
186
- }
187
- //# sourceMappingURL=PreviousBlockTypePlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreviousBlockTypePlugin.js","sourceRoot":"","sources":["../../../../src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAEpD,MAAM,cAAc,GAA2B;IAC7C,sBAAsB;IACtB,KAAK,EAAE,OAAO;IACd,WAAW;IACX,KAAK,EAAE,OAAO;IACd,aAAa;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,cAAc;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,uBAAuB;IAClB,MAAM,CAAS;IAC/B;QACE,IAAI,OAAsC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,GAAG,EAAE,UAAU;YACf,IAAI,CAAC,WAAW;gBACd,OAAO;oBACL,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;wBACjC,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;4BAC1D,6DAA6D;4BAC7D,uDAAuD;4BACvD,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gCACxB,IAAI,CAAC,QAAQ,CACX,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CACzD,CAAC;4BACJ,CAAC,EAAE,CAAC,CAAC,CAAC;wBACR,CAAC;o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AAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;gBACtD,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,68 +0,0 @@
1
- import { Fragment, Slice } from "prosemirror-model";
2
- import { Selection } from "prosemirror-state";
3
- /**
4
- * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users
5
- * to drag multiple blocks at the same time. Expects the selection anchor and head to be between nodes, i.e. just before
6
- * the first target node and just after the last, and that anchor and head are at the same nesting level.
7
- *
8
- * Partially based on ProseMirror's NodeSelection implementation:
9
- * (https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.ts)
10
- * MultipleNodeSelection differs from NodeSelection in the following ways:
11
- * 1. Stores which nodes are included in the selection instead of just a single node.
12
- * 2. Already expects the selection to start just before the first target node and ends just after the last, while a
13
- * NodeSelection automatically sets both anchor and head to just before the single target node.
14
- */
15
- export class MultipleNodeSelection extends Selection {
16
- nodes;
17
- constructor($anchor, $head) {
18
- super($anchor, $head);
19
- // Parent is at the same nesting level as anchor/head since they are just before/ just after target nodes.
20
- const parentNode = $anchor.node();
21
- this.nodes = [];
22
- $anchor.doc.nodesBetween($anchor.pos, $head.pos, (node, _pos, parent) => {
23
- if (parent !== null && parent.eq(parentNode)) {
24
- this.nodes.push(node);
25
- return false;
26
- }
27
- return;
28
- });
29
- }
30
- static create(doc, from, to = from) {
31
- return new MultipleNodeSelection(doc.resolve(from), doc.resolve(to));
32
- }
33
- content() {
34
- return new Slice(Fragment.from(this.nodes), 0, 0);
35
- }
36
- eq(selection) {
37
- if (!(selection instanceof MultipleNodeSelection)) {
38
- return false;
39
- }
40
- if (this.nodes.length !== selection.nodes.length) {
41
- return false;
42
- }
43
- if (this.from !== selection.from || this.to !== selection.to) {
44
- return false;
45
- }
46
- for (let i = 0; i < this.nodes.length; i++) {
47
- if (!this.nodes[i].eq(selection.nodes[i])) {
48
- return false;
49
- }
50
- }
51
- return true;
52
- }
53
- map(doc, mapping) {
54
- const fromResult = mapping.mapResult(this.from);
55
- const toResult = mapping.mapResult(this.to);
56
- if (toResult.deleted) {
57
- return Selection.near(doc.resolve(fromResult.pos));
58
- }
59
- if (fromResult.deleted) {
60
- return Selection.near(doc.resolve(toResult.pos));
61
- }
62
- return new MultipleNodeSelection(doc.resolve(fromResult.pos), doc.resolve(toResult.pos));
63
- }
64
- toJSON() {
65
- return { type: "node", anchor: this.anchor, head: this.head };
66
- }
67
- }
68
- //# sourceMappingURL=MultipleNodeSelection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipleNodeSelection.js","sourceRoot":"","sources":["../../../../src/extensions/SideMenu/MultipleNodeSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAc;IAEnB,YAAY,OAAoB,EAAE,KAAkB;QAClD,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEtB,0GAA0G;QAC1G,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAElC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;YACtE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO;QACT,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAS,EAAE,IAAY,EA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