@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,245 +0,0 @@
1
- import { findParentNode } from "@tiptap/core";
2
- import { Plugin, PluginKey } from "prosemirror-state";
3
- import { Decoration, DecorationSet } from "prosemirror-view";
4
- import { EventEmitter } from "../../util/EventEmitter.js";
5
- const findBlock = findParentNode((node) => node.type.name === "blockContainer");
6
- class SuggestionMenuView {
7
- editor;
8
- state;
9
- emitUpdate;
10
- rootEl;
11
- pluginState;
12
- constructor(editor, emitUpdate) {
13
- this.editor = editor;
14
- this.pluginState = undefined;
15
- this.emitUpdate = (menuName) => {
16
- if (!this.state) {
17
- throw new Error("Attempting to update uninitialized suggestions menu");
18
- }
19
- emitUpdate(menuName, {
20
- ...this.state,
21
- ignoreQueryLength: this.pluginState?.ignoreQueryLength,
22
- });
23
- };
24
- this.rootEl = this.editor.prosemirrorView?.root;
25
- // Setting capture=true ensures that any parent container of the editor that
26
- // gets scrolled will trigger the scroll event. Scroll events do not bubble
27
- // and so won't propagate to the document by default.
28
- this.rootEl?.addEventListener("scroll", this.handleScroll, true);
29
- }
30
- handleScroll = () => {
31
- if (this.state?.show) {
32
- const decorationNode = this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);
33
- if (!decorationNode) {
34
- return;
35
- }
36
- this.state.referencePos = decorationNode.getBoundingClientRect();
37
- this.emitUpdate(this.pluginState.triggerCharacter);
38
- }
39
- };
40
- update(view, prevState) {
41
- const prev = suggestionMenuPluginKey.getState(prevState);
42
- const next = suggestionMenuPluginKey.getState(view.state);
43
- // See how the state changed
44
- const started = prev === undefined && next !== undefined;
45
- const stopped = prev !== undefined && next === undefined;
46
- const changed = prev !== undefined && next !== undefined;
47
- // Cancel when suggestion isn't active
48
- if (!started && !changed && !stopped) {
49
- return;
50
- }
51
- this.pluginState = stopped ? prev : next;
52
- if (stopped || !this.editor.isEditable) {
53
- this.state.show = false;
54
- this.emitUpdate(this.pluginState.triggerCharacter);
55
- return;
56
- }
57
- const decorationNode = this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);
58
- if (this.editor.isEditable && decorationNode) {
59
- this.state = {
60
- show: true,
61
- referencePos: decorationNode.getBoundingClientRect(),
62
- query: this.pluginState.query,
63
- };
64
- this.emitUpdate(this.pluginState.triggerCharacter);
65
- }
66
- }
67
- destroy() {
68
- this.rootEl?.removeEventListener("scroll", this.handleScroll, true);
69
- }
70
- closeMenu = () => {
71
- this.editor.dispatch(this.editor._tiptapEditor.state.tr.setMeta(suggestionMenuPluginKey, null));
72
- };
73
- clearQuery = () => {
74
- if (this.pluginState === undefined) {
75
- return;
76
- }
77
- this.editor._tiptapEditor
78
- .chain()
79
- .focus()
80
- .deleteRange({
81
- from: this.pluginState.queryStartPos -
82
- (this.pluginState.deleteTriggerCharacter
83
- ? this.pluginState.triggerCharacter.length
84
- : 0),
85
- to: this.editor._tiptapEditor.state.selection.from,
86
- })
87
- .run();
88
- };
89
- }
90
- const suggestionMenuPluginKey = new PluginKey("SuggestionMenuPlugin");
91
- /**
92
- * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
93
- *
94
- * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.
95
- *
96
- * This version is adapted from the aforementioned version in the following ways:
97
- * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)
98
- * - This version hides some unnecessary complexity from the user of the plugin.
99
- * - This version handles key events differently
100
- */
101
- export class SuggestionMenuProseMirrorPlugin extends EventEmitter {
102
- view;
103
- plugin;
104
- triggerCharacters = [];
105
- constructor(editor) {
106
- super();
107
- const triggerCharacters = this.triggerCharacters;
108
- this.plugin = new Plugin({
109
- key: suggestionMenuPluginKey,
110
- view: () => {
111
- this.view = new SuggestionMenuView(editor, (triggerCharacter, state) => {
112
- this.emit(`update ${triggerCharacter}`, state);
113
- });
114
- return this.view;
115
- },
116
- state: {
117
- // Initialize the plugin's internal state.
118
- init() {
119
- return undefined;
120
- },
121
- // Apply changes to the plugin state from an editor transaction.
122
- apply(transaction, prev, _oldState, newState) {
123
- // TODO: More clearly define which transactions should be ignored.
124
- if (transaction.getMeta("orderedListIndexing") !== undefined) {
125
- return prev;
126
- }
127
- // Ignore transactions in code blocks.
128
- if (transaction.selection.$from.parent.type.spec.code) {
129
- return prev;
130
- }
131
- // Either contains the trigger character if the menu should be shown,
132
- // or null if it should be hidden.
133
- const suggestionPluginTransactionMeta = transaction.getMeta(suggestionMenuPluginKey);
134
- // Only opens a menu of no menu is already open
135
- if (typeof suggestionPluginTransactionMeta === "object" &&
136
- suggestionPluginTransactionMeta !== null &&
137
- prev === undefined) {
138
- return {
139
- triggerCharacter: suggestionPluginTransactionMeta.triggerCharacter,
140
- deleteTriggerCharacter: suggestionPluginTransactionMeta.deleteTriggerCharacter !==
141
- false,
142
- queryStartPos: newState.selection.from,
143
- query: "",
144
- decorationId: `id_${Math.floor(Math.random() * 0xffffffff)}`,
145
- ignoreQueryLength: suggestionPluginTransactionMeta?.ignoreQueryLength,
146
- };
147
- }
148
- // Checks if the menu is hidden, in which case it doesn't need to be hidden or updated.
149
- if (prev === undefined) {
150
- return prev;
151
- }
152
- // Checks if the menu should be hidden.
153
- if (
154
- // Highlighting text should hide the menu.
155
- newState.selection.from !== newState.selection.to ||
156
- // Transactions with plugin metadata should hide the menu.
157
- suggestionPluginTransactionMeta === null ||
158
- // Certain mouse events should hide the menu.
159
- // TODO: Change to global mousedown listener.
160
- transaction.getMeta("focus") ||
161
- transaction.getMeta("blur") ||
162
- transaction.getMeta("pointer") ||
163
- // Moving the caret before the character which triggered the menu should hide it.
164
- (prev.triggerCharacter !== undefined &&
165
- newState.selection.from < prev.queryStartPos)) {
166
- return undefined;
167
- }
168
- const next = { ...prev };
169
- // Updates the current query.
170
- next.query = newState.doc.textBetween(prev.queryStartPos, newState.selection.from);
171
- return next;
172
- },
173
- },
174
- props: {
175
- handleTextInput(view, _from, _to, text) {
176
- const suggestionPluginState = this.getState(view.state);
177
- if (triggerCharacters.includes(text) &&
178
- suggestionPluginState === undefined) {
179
- view.dispatch(view.state.tr
180
- .insertText(text)
181
- .scrollIntoView()
182
- .setMeta(suggestionMenuPluginKey, {
183
- triggerCharacter: text,
184
- }));
185
- return true;
186
- }
187
- return false;
188
- },
189
- // Setup decorator on the currently active suggestion.
190
- decorations(state) {
191
- const suggestionPluginState = this.getState(state);
192
- if (suggestionPluginState === undefined) {
193
- return null;
194
- }
195
- // If the menu was opened programmatically by another extension, it may not use a trigger character. In this
196
- // case, the decoration is set on the whole block instead, as the decoration range would otherwise be empty.
197
- if (!suggestionPluginState.deleteTriggerCharacter) {
198
- const blockNode = findBlock(state.selection);
199
- if (blockNode) {
200
- return DecorationSet.create(state.doc, [
201
- Decoration.node(blockNode.pos, blockNode.pos + blockNode.node.nodeSize, {
202
- nodeName: "span",
203
- class: "bn-suggestion-decorator",
204
- "data-decoration-id": suggestionPluginState.decorationId,
205
- }),
206
- ]);
207
- }
208
- }
209
- // Creates an inline decoration around the trigger character.
210
- return DecorationSet.create(state.doc, [
211
- Decoration.inline(suggestionPluginState.queryStartPos -
212
- suggestionPluginState.triggerCharacter.length, suggestionPluginState.queryStartPos, {
213
- nodeName: "span",
214
- class: "bn-suggestion-decorator",
215
- "data-decoration-id": suggestionPluginState.decorationId,
216
- }),
217
- ]);
218
- },
219
- },
220
- });
221
- }
222
- onUpdate(triggerCharacter, callback) {
223
- if (!this.triggerCharacters.includes(triggerCharacter)) {
224
- this.addTriggerCharacter(triggerCharacter);
225
- }
226
- // TODO: be able to remove the triggerCharacter
227
- return this.on(`update ${triggerCharacter}`, callback);
228
- }
229
- addTriggerCharacter = (triggerCharacter) => {
230
- this.triggerCharacters.push(triggerCharacter);
231
- };
232
- // TODO: Should this be called automatically when listeners are removed?
233
- removeTriggerCharacter = (triggerCharacter) => {
234
- this.triggerCharacters = this.triggerCharacters.filter((c) => c !== triggerCharacter);
235
- };
236
- closeMenu = () => this.view.closeMenu();
237
- clearQuery = () => this.view.clearQuery();
238
- get shown() {
239
- return this.view?.state?.show || false;
240
- }
241
- }
242
- export function createSuggestionMenu(editor, triggerCharacter) {
243
- editor.suggestionMenus.addTriggerCharacter(triggerCharacter);
244
- }
245
- //# sourceMappingURL=SuggestionPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SuggestionPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/SuggestionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AASzE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC;AAOhF,MAAM,kBAAkB;IAWH;IANZ,KAAK,CAAuB;IAC5B,UAAU,CAAqC;IAC9C,MAAM,CAAyB;IACvC,WAAW,CAAwB;IAEnC,YACmB,MAAsC,EACvD,UAAkE;QADjD,WAAM,GAAN,MAAM,CAAgC;QAGvD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAE7B,IAAI,CAAC,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAED,UAAU,CAAC,QAAQ,EAAE;gBACnB,GAAG,IAAI,CAAC,KAAK;gBACb,iBAAiB,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB;aAC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EF,wEAAwE;IACxE,sBAAsB,GAAG,CAAC,gBAAwB,EAAE,EAAE;QACpD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CACpD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAC9B,CAAC;IACJ,CAAC,CAAC;IAEF,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAK,CAAC,SAAS,EAAE,CAAC;IAEzC,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAK,CAAC,UAAU,EAAE,CAAC;IAE3C,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC;IACzC,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAIlC,MAAsC,EAAE,gBAAwB;IAChE,MAAM,CAAC,eAAe,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,26 +0,0 @@
1
- import { checkDefaultInlineContentTypeInSchema } from "../../blocks/defaultBlockTypeGuards.js";
2
- let data;
3
- let emojiMart;
4
- export async function getDefaultEmojiPickerItems(editor, query) {
5
- if (!checkDefaultInlineContentTypeInSchema("text", editor)) {
6
- return [];
7
- }
8
- if (!data) {
9
- // use a dynamic import to encourage bundle-splitting
10
- // and a smaller initial client bundle size
11
- data = import("@emoji-mart/data");
12
- // load dynamically because emoji-mart doesn't specify type: module and breaks in nodejs
13
- emojiMart = await import("emoji-mart");
14
- const emojiMartData = (await data).default;
15
- await emojiMart.init({ data: emojiMartData });
16
- }
17
- const emojiMartData = (await data).default;
18
- const emojisToShow = query.trim() === ""
19
- ? Object.values(emojiMartData.emojis)
20
- : (await emojiMart.SearchIndex.search(query));
21
- return emojisToShow.map((emoji) => ({
22
- id: emoji.skins[0].native,
23
- onItemClick: () => editor.insertInlineContent(emoji.skins[0].native + " "),
24
- }));
25
- }
26
- //# sourceMappingURL=getDefaultEmojiPickerItems.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDefaultEmojiPickerItems.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qCAAqC,EAAE,MAAM,wCAAwC,CAAC;AAS/F,IAAI,IAIS,CAAC;AAEd,IAAI,SAAkD,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAK9C,MAAsC,EACtC,KAAa;IAEb,IAAI,CAAC,qCAAqC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,qDAAqD;QACrD,2CAA2C;QAE3C,IAAI,GAAG,MAAM,CAAC,kBAAkB,CAAQ,CAAC;QAEzC,wFAAwF;QACxF,SAAS,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAE,CAAC,OAAO,CAAC;QAC5C,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAE,CAAC,OAAO,CAAC;IAE5C,MAAM,YAAY,GAChB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QACjB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QACrC,CAAC,CAAE,CAAC,MAAM,SAAU,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAa,CAAC;IAEhE,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM;QACzB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC;KAC3E,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1,241 +0,0 @@
1
- import { checkDefaultBlockTypeInSchema } from "../../blocks/defaultBlockTypeGuards.js";
2
- import { isStyledTextInlineContent, } from "../../schema/index.js";
3
- import { formatKeyboardShortcut } from "../../util/browser.js";
4
- // Sets the editor's text cursor position to the next content editable block,
5
- // so either a block with inline content or a table. The last block is always a
6
- // paragraph, so this function won't try to set the cursor position past the
7
- // last block.
8
- function setSelectionToNextContentEditableBlock(editor) {
9
- let block = editor.getTextCursorPosition().block;
10
- let contentType = editor.schema.blockSchema[block.type].content;
11
- while (contentType === "none") {
12
- block = editor.getTextCursorPosition().nextBlock;
13
- contentType = editor.schema.blockSchema[block.type].content;
14
- editor.setTextCursorPosition(block, "end");
15
- }
16
- }
17
- // Checks if the current block is empty or only contains a slash, and if so,
18
- // updates the current block instead of inserting a new one below. If the new
19
- // block doesn't contain editable content, the cursor is moved to the next block
20
- // that does.
21
- export function insertOrUpdateBlock(editor, block) {
22
- const currentBlock = editor.getTextCursorPosition().block;
23
- if (currentBlock.content === undefined) {
24
- throw new Error("Slash Menu open in a block that doesn't contain content.");
25
- }
26
- let newBlock;
27
- if (Array.isArray(currentBlock.content) &&
28
- ((currentBlock.content.length === 1 &&
29
- isStyledTextInlineContent(currentBlock.content[0]) &&
30
- currentBlock.content[0].type === "text" &&
31
- currentBlock.content[0].text === "/") ||
32
- currentBlock.content.length === 0)) {
33
- newBlock = editor.updateBlock(currentBlock, block);
34
- // We make sure to reset the cursor position to the new block as calling
35
- // `updateBlock` may move it out. This generally happens when the content
36
- // changes, or the update makes the block multi-column.
37
- editor.setTextCursorPosition(newBlock);
38
- }
39
- else {
40
- newBlock = editor.insertBlocks([block], currentBlock, "after")[0];
41
- editor.setTextCursorPosition(editor.getTextCursorPosition().nextBlock);
42
- }
43
- setSelectionToNextContentEditableBlock(editor);
44
- return newBlock;
45
- }
46
- export function getDefaultSlashMenuItems(editor) {
47
- const items = [];
48
- if (checkDefaultBlockTypeInSchema("heading", editor)) {
49
- items.push({
50
- onItemClick: () => {
51
- insertOrUpdateBlock(editor, {
52
- type: "heading",
53
- props: { level: 1 },
54
- });
55
- },
56
- badge: formatKeyboardShortcut("Mod-Alt-1"),
57
- key: "heading",
58
- ...editor.dictionary.slash_menu.heading,
59
- }, {
60
- onItemClick: () => {
61
- insertOrUpdateBlock(editor, {
62
- type: "heading",
63
- props: { level: 2 },
64
- });
65
- },
66
- badge: formatKeyboardShortcut("Mod-Alt-2"),
67
- key: "heading_2",
68
- ...editor.dictionary.slash_menu.heading_2,
69
- }, {
70
- onItemClick: () => {
71
- insertOrUpdateBlock(editor, {
72
- type: "heading",
73
- props: { level: 3 },
74
- });
75
- },
76
- badge: formatKeyboardShortcut("Mod-Alt-3"),
77
- key: "heading_3",
78
- ...editor.dictionary.slash_menu.heading_3,
79
- });
80
- }
81
- if (checkDefaultBlockTypeInSchema("numberedListItem", editor)) {
82
- items.push({
83
- onItemClick: () => {
84
- insertOrUpdateBlock(editor, {
85
- type: "numberedListItem",
86
- });
87
- },
88
- badge: formatKeyboardShortcut("Mod-Shift-7"),
89
- key: "numbered_list",
90
- ...editor.dictionary.slash_menu.numbered_list,
91
- });
92
- }
93
- if (checkDefaultBlockTypeInSchema("bulletListItem", editor)) {
94
- items.push({
95
- onItemClick: () => {
96
- insertOrUpdateBlock(editor, {
97
- type: "bulletListItem",
98
- });
99
- },
100
- badge: formatKeyboardShortcut("Mod-Shift-8"),
101
- key: "bullet_list",
102
- ...editor.dictionary.slash_menu.bullet_list,
103
- });
104
- }
105
- if (checkDefaultBlockTypeInSchema("checkListItem", editor)) {
106
- items.push({
107
- onItemClick: () => {
108
- insertOrUpdateBlock(editor, {
109
- type: "checkListItem",
110
- });
111
- },
112
- badge: formatKeyboardShortcut("Mod-Shift-9"),
113
- key: "check_list",
114
- ...editor.dictionary.slash_menu.check_list,
115
- });
116
- }
117
- if (checkDefaultBlockTypeInSchema("paragraph", editor)) {
118
- items.push({
119
- onItemClick: () => {
120
- insertOrUpdateBlock(editor, {
121
- type: "paragraph",
122
- });
123
- },
124
- badge: formatKeyboardShortcut("Mod-Alt-0"),
125
- key: "paragraph",
126
- ...editor.dictionary.slash_menu.paragraph,
127
- });
128
- }
129
- if (checkDefaultBlockTypeInSchema("codeBlock", editor)) {
130
- items.push({
131
- onItemClick: () => {
132
- insertOrUpdateBlock(editor, {
133
- type: "codeBlock",
134
- });
135
- },
136
- badge: formatKeyboardShortcut("Mod-Alt-c"),
137
- key: "code_block",
138
- ...editor.dictionary.slash_menu.code_block,
139
- });
140
- }
141
- if (checkDefaultBlockTypeInSchema("table", editor)) {
142
- items.push({
143
- onItemClick: () => {
144
- insertOrUpdateBlock(editor, {
145
- type: "table",
146
- content: {
147
- type: "tableContent",
148
- rows: [
149
- {
150
- cells: ["", "", ""],
151
- },
152
- {
153
- cells: ["", "", ""],
154
- },
155
- ],
156
- },
157
- });
158
- },
159
- badge: undefined,
160
- key: "table",
161
- ...editor.dictionary.slash_menu.table,
162
- });
163
- }
164
- if (checkDefaultBlockTypeInSchema("image", editor)) {
165
- items.push({
166
- onItemClick: () => {
167
- const insertedBlock = insertOrUpdateBlock(editor, {
168
- type: "image",
169
- });
170
- // Immediately open the file toolbar
171
- editor.dispatch(editor._tiptapEditor.state.tr.setMeta(editor.filePanel.plugin, {
172
- block: insertedBlock,
173
- }));
174
- },
175
- key: "image",
176
- ...editor.dictionary.slash_menu.image,
177
- });
178
- }
179
- if (checkDefaultBlockTypeInSchema("video", editor)) {
180
- items.push({
181
- onItemClick: () => {
182
- const insertedBlock = insertOrUpdateBlock(editor, {
183
- type: "video",
184
- });
185
- // Immediately open the file toolbar
186
- editor.dispatch(editor._tiptapEditor.state.tr.setMeta(editor.filePanel.plugin, {
187
- block: insertedBlock,
188
- }));
189
- },
190
- key: "video",
191
- ...editor.dictionary.slash_menu.video,
192
- });
193
- }
194
- if (checkDefaultBlockTypeInSchema("audio", editor)) {
195
- items.push({
196
- onItemClick: () => {
197
- const insertedBlock = insertOrUpdateBlock(editor, {
198
- type: "audio",
199
- });
200
- // Immediately open the file toolbar
201
- editor.dispatch(editor._tiptapEditor.state.tr.setMeta(editor.filePanel.plugin, {
202
- block: insertedBlock,
203
- }));
204
- },
205
- key: "audio",
206
- ...editor.dictionary.slash_menu.audio,
207
- });
208
- }
209
- if (checkDefaultBlockTypeInSchema("file", editor)) {
210
- items.push({
211
- onItemClick: () => {
212
- const insertedBlock = insertOrUpdateBlock(editor, {
213
- type: "file",
214
- });
215
- // Immediately open the file toolbar
216
- editor.dispatch(editor._tiptapEditor.state.tr.setMeta(editor.filePanel.plugin, {
217
- block: insertedBlock,
218
- }));
219
- },
220
- key: "file",
221
- ...editor.dictionary.slash_menu.file,
222
- });
223
- }
224
- items.push({
225
- onItemClick: () => {
226
- editor.openSuggestionMenu(":", {
227
- deleteTriggerCharacter: true,
228
- ignoreQueryLength: true,
229
- });
230
- },
231
- key: "emoji",
232
- ...editor.dictionary.slash_menu.emoji,
233
- });
234
- return items;
235
- }
236
- export function filterSuggestionItems(items, query) {
237
- return items.filter(({ title, aliases }) => title.toLowerCase().includes(query.toLowerCase()) ||
238
- (aliases &&
239
- aliases.filter((alias) => alias.toLowerCase().includes(query.toLowerCase())).length !== 0));
240
- }
241
- //# sourceMappingURL=getDefaultSlashMenuItems.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDefaultSlashMenuItems.js","sourceRoot":"","sources":["../../../../src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAIL,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4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