@blocknote/core 0.18.0 → 0.19.1

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 (537) hide show
  1. package/README.md +2 -0
  2. package/dist/blocknote.js +3145 -2970
  3. package/dist/blocknote.js.map +1 -1
  4. package/dist/blocknote.umd.cjs +9 -9
  5. package/dist/blocknote.umd.cjs.map +1 -1
  6. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +27 -0
  7. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +1 -0
  8. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +99 -0
  9. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +1 -0
  10. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +97 -0
  11. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +1 -0
  12. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +88 -0
  13. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +1 -0
  14. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js +116 -0
  15. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js.map +1 -0
  16. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +110 -0
  17. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +1 -0
  18. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +57 -0
  19. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +1 -0
  20. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +5 -0
  21. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +1 -0
  22. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +31 -0
  23. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +1 -0
  24. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +71 -0
  25. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +1 -0
  26. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +157 -0
  27. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +1 -0
  28. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +27 -0
  29. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +1 -0
  30. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +64 -0
  31. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +1 -0
  32. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +145 -0
  33. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +1 -0
  34. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +252 -0
  35. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +1 -0
  36. package/dist/src/api/blockManipulation/insertContentAt.js +64 -0
  37. package/dist/src/api/blockManipulation/insertContentAt.js.map +1 -0
  38. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +76 -0
  39. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +1 -0
  40. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +33 -0
  41. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +1 -0
  42. package/dist/src/api/blockManipulation/setupTestEnv.js +172 -0
  43. package/dist/src/api/blockManipulation/setupTestEnv.js.map +1 -0
  44. package/dist/src/api/clipboard/clipboard.test.js +246 -0
  45. package/dist/src/api/clipboard/clipboard.test.js.map +1 -0
  46. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +8 -0
  47. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +1 -0
  48. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +38 -0
  49. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +1 -0
  50. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +111 -0
  51. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -0
  52. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +26 -0
  53. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +1 -0
  54. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +57 -0
  55. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +1 -0
  56. package/dist/src/api/clipboard/toClipboard/copyExtension.js +132 -0
  57. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +1 -0
  58. package/dist/src/api/exporters/html/externalHTMLExporter.js +35 -0
  59. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +1 -0
  60. package/dist/src/api/exporters/html/htmlConversion.test.js +72 -0
  61. package/dist/src/api/exporters/html/htmlConversion.test.js.map +1 -0
  62. package/dist/src/api/exporters/html/internalHTMLSerializer.js +21 -0
  63. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +1 -0
  64. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +141 -0
  65. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +1 -0
  66. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +96 -0
  67. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +1 -0
  68. package/dist/src/api/exporters/markdown/markdownExporter.js +31 -0
  69. package/dist/src/api/exporters/markdown/markdownExporter.js.map +1 -0
  70. package/dist/src/api/exporters/markdown/markdownExporter.test.js +57 -0
  71. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +1 -0
  72. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +33 -0
  73. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +1 -0
  74. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +37 -0
  75. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +1 -0
  76. package/dist/src/api/getBlockInfoFromPos.js +165 -0
  77. package/dist/src/api/getBlockInfoFromPos.js.map +1 -0
  78. package/dist/src/api/nodeConversions/blockToNode.js +197 -0
  79. package/dist/src/api/nodeConversions/blockToNode.js.map +1 -0
  80. package/dist/src/api/nodeConversions/fragmentToBlocks.js +50 -0
  81. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +1 -0
  82. package/dist/src/api/nodeConversions/nodeConversions.test.js +54 -0
  83. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +1 -0
  84. package/dist/src/api/nodeConversions/nodeToBlock.js +316 -0
  85. package/dist/src/api/nodeConversions/nodeToBlock.js.map +1 -0
  86. package/dist/src/api/nodeUtil.js +28 -0
  87. package/dist/src/api/nodeUtil.js.map +1 -0
  88. package/dist/src/api/parsers/html/parseHTML.js +19 -0
  89. package/dist/src/api/parsers/html/parseHTML.js.map +1 -0
  90. package/dist/src/api/parsers/html/parseHTML.test.js +470 -0
  91. package/dist/src/api/parsers/html/parseHTML.test.js.map +1 -0
  92. package/dist/src/api/parsers/html/util/nestedLists.js +106 -0
  93. package/dist/src/api/parsers/html/util/nestedLists.js.map +1 -0
  94. package/dist/src/api/parsers/html/util/nestedLists.test.js +166 -0
  95. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +1 -0
  96. package/dist/src/api/parsers/markdown/parseMarkdown.js +52 -0
  97. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +1 -0
  98. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +109 -0
  99. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +1 -0
  100. package/dist/src/api/testUtil/cases/customBlocks.js +313 -0
  101. package/dist/src/api/testUtil/cases/customBlocks.js.map +1 -0
  102. package/dist/src/api/testUtil/cases/customInlineContent.js +91 -0
  103. package/dist/src/api/testUtil/cases/customInlineContent.js.map +1 -0
  104. package/dist/src/api/testUtil/cases/customStyles.js +83 -0
  105. package/dist/src/api/testUtil/cases/customStyles.js.map +1 -0
  106. package/dist/src/api/testUtil/cases/defaultSchema.js +673 -0
  107. package/dist/src/api/testUtil/cases/defaultSchema.js.map +1 -0
  108. package/dist/src/api/testUtil/index.js +2 -0
  109. package/dist/src/api/testUtil/index.js.map +1 -0
  110. package/dist/src/api/testUtil/partialBlockTestUtil.js +114 -0
  111. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +1 -0
  112. package/dist/src/api/testUtil/paste.js +29 -0
  113. package/dist/src/api/testUtil/paste.js.map +1 -0
  114. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +97 -0
  115. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +1 -0
  116. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +5 -0
  117. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +1 -0
  118. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +273 -0
  119. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +1 -0
  120. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +90 -0
  121. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +1 -0
  122. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +70 -0
  123. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +1 -0
  124. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +317 -0
  125. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +1 -0
  126. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +15 -0
  127. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +1 -0
  128. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +145 -0
  129. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +1 -0
  130. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +106 -0
  131. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +1 -0
  132. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +6 -0
  133. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +1 -0
  134. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +113 -0
  135. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +1 -0
  136. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +224 -0
  137. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +1 -0
  138. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +45 -0
  139. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +1 -0
  140. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +58 -0
  141. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +1 -0
  142. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +130 -0
  143. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +1 -0
  144. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +52 -0
  145. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +1 -0
  146. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +129 -0
  147. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +1 -0
  148. package/dist/src/blocks/TableBlockContent/TableExtension.js +57 -0
  149. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +1 -0
  150. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +103 -0
  151. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +1 -0
  152. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +6 -0
  153. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +1 -0
  154. package/dist/src/blocks/defaultBlockHelpers.js +50 -0
  155. package/dist/src/blocks/defaultBlockHelpers.js.map +1 -0
  156. package/dist/src/blocks/defaultBlockTypeGuards.js +40 -0
  157. package/dist/src/blocks/defaultBlockTypeGuards.js.map +1 -0
  158. package/dist/src/blocks/defaultBlocks.js +50 -0
  159. package/dist/src/blocks/defaultBlocks.js.map +1 -0
  160. package/dist/src/blocks/defaultProps.js +19 -0
  161. package/dist/src/blocks/defaultProps.js.map +1 -0
  162. package/dist/src/editor/BlockNoteEditor.js +746 -0
  163. package/dist/src/editor/BlockNoteEditor.js.map +1 -0
  164. package/dist/src/editor/BlockNoteEditor.test.js +65 -0
  165. package/dist/src/editor/BlockNoteEditor.test.js.map +1 -0
  166. package/dist/src/editor/BlockNoteExtensions.js +195 -0
  167. package/dist/src/editor/BlockNoteExtensions.js.map +1 -0
  168. package/dist/src/editor/BlockNoteSchema.js +38 -0
  169. package/dist/src/editor/BlockNoteSchema.js.map +1 -0
  170. package/dist/src/editor/BlockNoteTipTapEditor.js +169 -0
  171. package/dist/src/editor/BlockNoteTipTapEditor.js.map +1 -0
  172. package/dist/src/editor/cursorPositionTypes.js +2 -0
  173. package/dist/src/editor/cursorPositionTypes.js.map +1 -0
  174. package/dist/src/editor/defaultColors.js +77 -0
  175. package/dist/src/editor/defaultColors.js.map +1 -0
  176. package/dist/src/editor/selectionTypes.js +2 -0
  177. package/dist/src/editor/selectionTypes.js.map +1 -0
  178. package/dist/src/editor/transformPasted.js +79 -0
  179. package/dist/src/editor/transformPasted.js.map +1 -0
  180. package/dist/src/exporter/Exporter.js +36 -0
  181. package/dist/src/exporter/Exporter.js.map +1 -0
  182. package/dist/src/exporter/index.js +3 -0
  183. package/dist/src/exporter/index.js.map +1 -0
  184. package/dist/src/exporter/mapping.js +12 -0
  185. package/dist/src/exporter/mapping.js.map +1 -0
  186. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +30 -0
  187. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +1 -0
  188. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +39 -0
  189. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +1 -0
  190. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +131 -0
  191. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +1 -0
  192. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +195 -0
  193. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +1 -0
  194. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +339 -0
  195. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -0
  196. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +247 -0
  197. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +1 -0
  198. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +54 -0
  199. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +1 -0
  200. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +84 -0
  201. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -0
  202. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +187 -0
  203. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +1 -0
  204. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +68 -0
  205. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +1 -0
  206. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +339 -0
  207. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +1 -0
  208. package/dist/src/extensions/SideMenu/dragging.js +128 -0
  209. package/dist/src/extensions/SideMenu/dragging.js.map +1 -0
  210. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +2 -0
  211. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +1 -0
  212. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +2 -0
  213. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +1 -0
  214. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +245 -0
  215. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +1 -0
  216. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +26 -0
  217. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +1 -0
  218. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +244 -0
  219. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +1 -0
  220. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +553 -0
  221. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +1 -0
  222. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +36 -0
  223. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +1 -0
  224. package/dist/src/extensions/TextColor/TextColorExtension.js +29 -0
  225. package/dist/src/extensions/TextColor/TextColorExtension.js.map +1 -0
  226. package/dist/src/extensions/TextColor/TextColorMark.js +37 -0
  227. package/dist/src/extensions/TextColor/TextColorMark.js.map +1 -0
  228. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +58 -0
  229. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +1 -0
  230. package/dist/src/extensions/UniqueID/UniqueID.js +283 -0
  231. package/dist/src/extensions/UniqueID/UniqueID.js.map +1 -0
  232. package/dist/src/extensions/getDraggableBlockFromElement.js +13 -0
  233. package/dist/src/extensions/getDraggableBlockFromElement.js.map +1 -0
  234. package/dist/src/extensions-shared/UiElementPosition.js +2 -0
  235. package/dist/src/extensions-shared/UiElementPosition.js.map +1 -0
  236. package/dist/src/i18n/dictionary.js +4 -0
  237. package/dist/src/i18n/dictionary.js.map +1 -0
  238. package/dist/src/i18n/locales/ar.js +298 -0
  239. package/dist/src/i18n/locales/ar.js.map +1 -0
  240. package/dist/src/i18n/locales/de.js +313 -0
  241. package/dist/src/i18n/locales/de.js.map +1 -0
  242. package/dist/src/i18n/locales/en.js +314 -0
  243. package/dist/src/i18n/locales/en.js.map +1 -0
  244. package/dist/src/i18n/locales/es.js +312 -0
  245. package/dist/src/i18n/locales/es.js.map +1 -0
  246. package/dist/src/i18n/locales/fr.js +313 -0
  247. package/dist/src/i18n/locales/fr.js.map +1 -0
  248. package/dist/src/i18n/locales/hr.js +308 -0
  249. package/dist/src/i18n/locales/hr.js.map +1 -0
  250. package/dist/src/i18n/locales/index.js +16 -0
  251. package/dist/src/i18n/locales/index.js.map +1 -0
  252. package/dist/src/i18n/locales/is.js +305 -0
  253. package/dist/src/i18n/locales/is.js.map +1 -0
  254. package/dist/src/i18n/locales/ja.js +333 -0
  255. package/dist/src/i18n/locales/ja.js.map +1 -0
  256. package/dist/src/i18n/locales/ko.js +326 -0
  257. package/dist/src/i18n/locales/ko.js.map +1 -0
  258. package/dist/src/i18n/locales/nl.js +313 -0
  259. package/dist/src/i18n/locales/nl.js.map +1 -0
  260. package/dist/src/i18n/locales/pl.js +297 -0
  261. package/dist/src/i18n/locales/pl.js.map +1 -0
  262. package/dist/src/i18n/locales/pt.js +305 -0
  263. package/dist/src/i18n/locales/pt.js.map +1 -0
  264. package/dist/src/i18n/locales/ru.js +340 -0
  265. package/dist/src/i18n/locales/ru.js.map +1 -0
  266. package/dist/src/i18n/locales/vi.js +312 -0
  267. package/dist/src/i18n/locales/vi.js.map +1 -0
  268. package/dist/src/i18n/locales/zh.js +346 -0
  269. package/dist/src/i18n/locales/zh.js.map +1 -0
  270. package/dist/src/index.js +55 -0
  271. package/dist/src/index.js.map +1 -0
  272. package/dist/src/pm-nodes/BlockContainer.js +72 -0
  273. package/dist/src/pm-nodes/BlockContainer.js.map +1 -0
  274. package/dist/src/pm-nodes/BlockGroup.js +43 -0
  275. package/dist/src/pm-nodes/BlockGroup.js.map +1 -0
  276. package/dist/src/pm-nodes/Doc.js +7 -0
  277. package/dist/src/pm-nodes/Doc.js.map +1 -0
  278. package/dist/src/pm-nodes/index.js +4 -0
  279. package/dist/src/pm-nodes/index.js.map +1 -0
  280. package/dist/src/schema/blocks/createSpec.js +126 -0
  281. package/dist/src/schema/blocks/createSpec.js.map +1 -0
  282. package/dist/src/schema/blocks/internal.js +147 -0
  283. package/dist/src/schema/blocks/internal.js.map +1 -0
  284. package/dist/src/schema/blocks/types.js +2 -0
  285. package/dist/src/schema/blocks/types.js.map +1 -0
  286. package/dist/src/schema/index.js +11 -0
  287. package/dist/src/schema/index.js.map +1 -0
  288. package/dist/src/schema/inlineContent/createSpec.js +64 -0
  289. package/dist/src/schema/inlineContent/createSpec.js.map +1 -0
  290. package/dist/src/schema/inlineContent/internal.js +52 -0
  291. package/dist/src/schema/inlineContent/internal.js.map +1 -0
  292. package/dist/src/schema/inlineContent/types.js +10 -0
  293. package/dist/src/schema/inlineContent/types.js.map +1 -0
  294. package/dist/src/schema/propTypes.js +2 -0
  295. package/dist/src/schema/propTypes.js.map +1 -0
  296. package/dist/src/schema/styles/createSpec.js +48 -0
  297. package/dist/src/schema/styles/createSpec.js.map +1 -0
  298. package/dist/src/schema/styles/internal.js +53 -0
  299. package/dist/src/schema/styles/internal.js.map +1 -0
  300. package/dist/src/schema/styles/types.js +2 -0
  301. package/dist/src/schema/styles/types.js.map +1 -0
  302. package/dist/src/util/EventEmitter.js +33 -0
  303. package/dist/src/util/EventEmitter.js.map +1 -0
  304. package/dist/src/util/browser.js +17 -0
  305. package/dist/src/util/browser.js.map +1 -0
  306. package/dist/src/util/combineByGroup.js +20 -0
  307. package/dist/src/util/combineByGroup.js.map +1 -0
  308. package/dist/src/util/esmDependencies.js +35 -0
  309. package/dist/src/util/esmDependencies.js.map +1 -0
  310. package/dist/src/util/string.js +14 -0
  311. package/dist/src/util/string.js.map +1 -0
  312. package/dist/src/util/typescript.js +12 -0
  313. package/dist/src/util/typescript.js.map +1 -0
  314. package/dist/style.css +1 -1
  315. package/dist/tsconfig.tsbuildinfo +1 -0
  316. package/dist/webpack-stats.json +1 -1
  317. package/package.json +5 -5
  318. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -6
  319. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +2 -0
  320. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -5
  321. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +2 -2
  322. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +104 -39
  323. package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +0 -8
  324. package/src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts +7 -3
  325. package/src/api/blockManipulation/commands/moveBlock/moveBlock.ts +3 -5
  326. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +100 -0
  327. package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +439 -2
  328. package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.ts +6 -0
  329. package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +2 -82
  330. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -8
  331. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +96 -20
  332. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -6
  333. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +8 -4
  334. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +13 -12
  335. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -490
  336. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +5 -5
  337. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +192 -107
  338. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +48 -33
  339. package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -1
  340. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +7 -6
  341. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -1
  342. package/src/api/exporters/html/htmlConversion.test.ts +1 -4
  343. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  344. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +56 -19
  345. package/src/api/exporters/markdown/markdownExporter.test.ts +1 -4
  346. package/src/api/getBlockInfoFromPos.ts +125 -80
  347. package/src/api/nodeConversions/blockToNode.ts +50 -25
  348. package/src/api/nodeConversions/fragmentToBlocks.ts +18 -0
  349. package/src/api/nodeConversions/nodeToBlock.ts +24 -21
  350. package/src/api/nodeUtil.ts +1 -1
  351. package/src/api/parsers/html/__snapshots__/parse-notion-html.json +1 -2
  352. package/src/api/testUtil/partialBlockTestUtil.ts +15 -3
  353. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -2
  354. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +5 -4
  355. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +35 -35
  356. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -2
  357. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +14 -12
  358. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +28 -16
  359. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +5 -3
  360. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -4
  361. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +13 -11
  362. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +8 -9
  363. package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
  364. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -2
  365. package/src/blocks/defaultBlockHelpers.ts +7 -2
  366. package/src/editor/Block.css +22 -1
  367. package/src/editor/BlockNoteEditor.test.ts +4 -7
  368. package/src/editor/BlockNoteEditor.ts +87 -61
  369. package/src/editor/BlockNoteExtensions.ts +92 -17
  370. package/src/editor/BlockNoteTipTapEditor.ts +8 -1
  371. package/src/editor/defaultColors.ts +77 -0
  372. package/src/editor/editor.css +10 -0
  373. package/src/editor/transformPasted.ts +6 -3
  374. package/src/exporter/Exporter.ts +101 -0
  375. package/src/exporter/index.ts +2 -0
  376. package/src/exporter/mapping.ts +75 -0
  377. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +233 -53
  378. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
  379. package/src/extensions/Placeholder/PlaceholderPlugin.ts +94 -90
  380. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +173 -169
  381. package/src/extensions/SideMenu/SideMenuPlugin.ts +141 -52
  382. package/src/extensions/SideMenu/dragging.ts +3 -54
  383. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +4 -6
  384. package/src/extensions/TableHandles/TableHandlesPlugin.ts +1 -1
  385. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  386. package/src/extensions/getDraggableBlockFromElement.ts +19 -0
  387. package/src/i18n/locales/de.ts +5 -5
  388. package/src/i18n/locales/pt.ts +5 -5
  389. package/src/index.ts +9 -5
  390. package/src/pm-nodes/BlockContainer.ts +1 -1
  391. package/src/pm-nodes/BlockGroup.ts +2 -2
  392. package/src/pm-nodes/README.md +127 -28
  393. package/src/schema/blocks/createSpec.ts +4 -1
  394. package/src/schema/blocks/internal.ts +12 -2
  395. package/src/schema/blocks/types.ts +1 -1
  396. package/src/util/combineByGroup.ts +25 -0
  397. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +22 -2
  398. package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.d.ts +5 -0
  399. package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +0 -3
  400. package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +4 -0
  401. package/types/src/api/blockManipulation/setupTestEnv.d.ts +0 -6
  402. package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
  403. package/types/src/api/getBlockInfoFromPos.d.ts +38 -13
  404. package/types/src/api/nodeConversions/blockToNode.d.ts +1 -1
  405. package/types/src/api/nodeConversions/nodeToBlock.d.ts +3 -1
  406. package/types/src/api/testUtil/cases/customBlocks.d.ts +0 -6
  407. package/types/src/api/testUtil/cases/customInlineContent.d.ts +0 -6
  408. package/types/src/api/testUtil/cases/customStyles.d.ts +0 -6
  409. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
  410. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +1 -0
  411. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +1 -0
  412. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +1 -0
  413. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -9
  414. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +1 -0
  415. package/types/src/blocks/defaultBlocks.d.ts +0 -12
  416. package/types/src/editor/BlockNoteEditor.d.ts +23 -5
  417. package/types/src/editor/BlockNoteExtensions.d.ts +14 -7
  418. package/types/src/editor/BlockNoteTipTapEditor.d.ts +1 -0
  419. package/types/src/editor/defaultColors.d.ts +76 -0
  420. package/types/src/exporter/Exporter.d.ts +43 -0
  421. package/types/src/exporter/index.d.ts +2 -0
  422. package/types/src/exporter/mapping.d.ts +30 -0
  423. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +4 -1
  424. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +4 -1
  425. package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +4 -5
  426. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +2 -1
  427. package/types/src/extensions/SideMenu/dragging.d.ts +1 -6
  428. package/types/src/extensions/getDraggableBlockFromElement.d.ts +5 -0
  429. package/types/src/index.d.ts +9 -5
  430. package/types/src/schema/blocks/createSpec.d.ts +1 -1
  431. package/types/src/schema/blocks/internal.d.ts +2 -2
  432. package/types/src/schema/blocks/types.d.ts +1 -1
  433. package/types/src/util/combineByGroup.d.ts +9 -0
  434. package/dist/angular-html-HQGguTAE.js +0 -33
  435. package/dist/angular-html-HQGguTAE.js.map +0 -1
  436. package/dist/angular-ts-q9PqJiJb.js +0 -22
  437. package/dist/angular-ts-q9PqJiJb.js.map +0 -1
  438. package/dist/astro-0iWgpDaK.js +0 -17
  439. package/dist/astro-0iWgpDaK.js.map +0 -1
  440. package/dist/blade-C3Z8AhvY.js +0 -19
  441. package/dist/blade-C3Z8AhvY.js.map +0 -1
  442. package/dist/c-TKJGJdXV.js +0 -7
  443. package/dist/c-TKJGJdXV.js.map +0 -1
  444. package/dist/coffee-CN_y6cG3.js +0 -9
  445. package/dist/coffee-CN_y6cG3.js.map +0 -1
  446. package/dist/cpp-Be_e67JE.js +0 -19
  447. package/dist/cpp-Be_e67JE.js.map +0 -1
  448. package/dist/css-DHLSoXzW.js +0 -7
  449. package/dist/css-DHLSoXzW.js.map +0 -1
  450. package/dist/glsl-8qSUIm5B.js +0 -9
  451. package/dist/glsl-8qSUIm5B.js.map +0 -1
  452. package/dist/graphql-D7_Dk2ma.js +0 -15
  453. package/dist/graphql-D7_Dk2ma.js.map +0 -1
  454. package/dist/haml-S3dmcfEW.js +0 -11
  455. package/dist/haml-S3dmcfEW.js.map +0 -1
  456. package/dist/handlebars-DaIrqVg3.js +0 -15
  457. package/dist/handlebars-DaIrqVg3.js.map +0 -1
  458. package/dist/html-Bx3A18fV.js +0 -11
  459. package/dist/html-Bx3A18fV.js.map +0 -1
  460. package/dist/html-derivative-Cf3KTZBS.js +0 -9
  461. package/dist/html-derivative-Cf3KTZBS.js.map +0 -1
  462. package/dist/http-BphR83YX.js +0 -15
  463. package/dist/http-BphR83YX.js.map +0 -1
  464. package/dist/imba-CmP25v0O.js +0 -9
  465. package/dist/imba-CmP25v0O.js.map +0 -1
  466. package/dist/java-Dg4kxH6C.js +0 -7
  467. package/dist/java-Dg4kxH6C.js.map +0 -1
  468. package/dist/javascript-CipAzIn1.js +0 -7
  469. package/dist/javascript-CipAzIn1.js.map +0 -1
  470. package/dist/jinja-tioldiz6.js +0 -12
  471. package/dist/jinja-tioldiz6.js.map +0 -1
  472. package/dist/jison-DWJFEE_I.js +0 -9
  473. package/dist/jison-DWJFEE_I.js.map +0 -1
  474. package/dist/json-_04EL6MS.js +0 -7
  475. package/dist/json-_04EL6MS.js.map +0 -1
  476. package/dist/json5-Dwmp5XFI.js +0 -7
  477. package/dist/json5-Dwmp5XFI.js.map +0 -1
  478. package/dist/jsonc-LqD5auy0.js +0 -7
  479. package/dist/jsonc-LqD5auy0.js.map +0 -1
  480. package/dist/jsonl-B4yVuYQH.js +0 -7
  481. package/dist/jsonl-B4yVuYQH.js.map +0 -1
  482. package/dist/jsx-Mg4WaD5k.js +0 -7
  483. package/dist/jsx-Mg4WaD5k.js.map +0 -1
  484. package/dist/julia-CWi-ZdpN.js +0 -17
  485. package/dist/julia-CWi-ZdpN.js.map +0 -1
  486. package/dist/less-BBvTHIGe.js +0 -7
  487. package/dist/less-BBvTHIGe.js.map +0 -1
  488. package/dist/markdown-DAXqtk9a.js +0 -7
  489. package/dist/markdown-DAXqtk9a.js.map +0 -1
  490. package/dist/marko-0aaNgUGV.js +0 -15
  491. package/dist/marko-0aaNgUGV.js.map +0 -1
  492. package/dist/mdc-hXJ2B4O0.js +0 -13
  493. package/dist/mdc-hXJ2B4O0.js.map +0 -1
  494. package/dist/mdx-CSCKbb_f.js +0 -7
  495. package/dist/mdx-CSCKbb_f.js.map +0 -1
  496. package/dist/php-B_-4RJ09.js +0 -19
  497. package/dist/php-B_-4RJ09.js.map +0 -1
  498. package/dist/postcss-SJfTvo_B.js +0 -7
  499. package/dist/postcss-SJfTvo_B.js.map +0 -1
  500. package/dist/pug-3q2tx0nf.js +0 -13
  501. package/dist/pug-3q2tx0nf.js.map +0 -1
  502. package/dist/python-Dpup1-fE.js +0 -7
  503. package/dist/python-Dpup1-fE.js.map +0 -1
  504. package/dist/r-Chyv38Fv.js +0 -7
  505. package/dist/r-Chyv38Fv.js.map +0 -1
  506. package/dist/regexp-BF0hfxNW.js +0 -7
  507. package/dist/regexp-BF0hfxNW.js.map +0 -1
  508. package/dist/sass-p2RMoqDT.js +0 -7
  509. package/dist/sass-p2RMoqDT.js.map +0 -1
  510. package/dist/scss-DmlHSoOY.js +0 -9
  511. package/dist/scss-DmlHSoOY.js.map +0 -1
  512. package/dist/shellscript-CZpPN8_x.js +0 -7
  513. package/dist/shellscript-CZpPN8_x.js.map +0 -1
  514. package/dist/sql-DtlkUz2m.js +0 -7
  515. package/dist/sql-DtlkUz2m.js.map +0 -1
  516. package/dist/stylus-DEr8eSLm.js +0 -7
  517. package/dist/stylus-DEr8eSLm.js.map +0 -1
  518. package/dist/svelte-BRIJF62h.js +0 -15
  519. package/dist/svelte-BRIJF62h.js.map +0 -1
  520. package/dist/ts-tags-qkUtuI0N.js +0 -42
  521. package/dist/ts-tags-qkUtuI0N.js.map +0 -1
  522. package/dist/tsx-DTfbgJxi.js +0 -7
  523. package/dist/tsx-DTfbgJxi.js.map +0 -1
  524. package/dist/typescript-CCd4aQHh.js +0 -7
  525. package/dist/typescript-CCd4aQHh.js.map +0 -1
  526. package/dist/vue-B3TdbERm.js +0 -32
  527. package/dist/vue-B3TdbERm.js.map +0 -1
  528. package/dist/vue-html-BGmTBZk0.js +0 -11
  529. package/dist/vue-html-BGmTBZk0.js.map +0 -1
  530. package/dist/wasm-VDIDph3E.js +0 -7
  531. package/dist/wasm-VDIDph3E.js.map +0 -1
  532. package/dist/wgsl-2np_U3Z8.js +0 -7
  533. package/dist/wgsl-2np_U3Z8.js.map +0 -1
  534. package/dist/xml-CNyphW9R.js +0 -9
  535. package/dist/xml-CNyphW9R.js.map +0 -1
  536. package/dist/yaml-DxFiVFcM.js +0 -7
  537. package/dist/yaml-DxFiVFcM.js.map +0 -1
@@ -0,0 +1,553 @@
1
+ import { Plugin, PluginKey } from "prosemirror-state";
2
+ import { Decoration, DecorationSet } from "prosemirror-view";
3
+ import { nodeToBlock } from "../../api/nodeConversions/nodeToBlock.js";
4
+ import { getNodeById } from "../../api/nodeUtil.js";
5
+ import { checkBlockIsDefaultType } from "../../blocks/defaultBlockTypeGuards.js";
6
+ import { EventEmitter } from "../../util/EventEmitter.js";
7
+ import { getDraggableBlockFromElement } from "../getDraggableBlockFromElement.js";
8
+ let dragImageElement;
9
+ function setHiddenDragImage(rootEl) {
10
+ if (dragImageElement) {
11
+ return;
12
+ }
13
+ dragImageElement = document.createElement("div");
14
+ dragImageElement.innerHTML = "_";
15
+ dragImageElement.style.opacity = "0";
16
+ dragImageElement.style.height = "1px";
17
+ dragImageElement.style.width = "1px";
18
+ if (rootEl instanceof Document) {
19
+ rootEl.body.appendChild(dragImageElement);
20
+ }
21
+ else {
22
+ rootEl.appendChild(dragImageElement);
23
+ }
24
+ }
25
+ function unsetHiddenDragImage(rootEl) {
26
+ if (dragImageElement) {
27
+ if (rootEl instanceof Document) {
28
+ rootEl.body.removeChild(dragImageElement);
29
+ }
30
+ else {
31
+ rootEl.removeChild(dragImageElement);
32
+ }
33
+ dragImageElement = undefined;
34
+ }
35
+ }
36
+ function getChildIndex(node) {
37
+ return Array.prototype.indexOf.call(node.parentElement.childNodes, node);
38
+ }
39
+ // Finds the DOM element corresponding to the table cell that the target element
40
+ // is currently in. If the target element is not in a table cell, returns null.
41
+ function domCellAround(target) {
42
+ let currentTarget = target;
43
+ while (currentTarget &&
44
+ currentTarget.nodeName !== "TD" &&
45
+ currentTarget.nodeName !== "TH" &&
46
+ !currentTarget.classList.contains("tableWrapper")) {
47
+ if (currentTarget.classList.contains("ProseMirror")) {
48
+ return undefined;
49
+ }
50
+ const parent = currentTarget.parentNode;
51
+ if (!parent || !(parent instanceof Element)) {
52
+ return undefined;
53
+ }
54
+ currentTarget = parent;
55
+ }
56
+ return currentTarget.nodeName === "TD" || currentTarget.nodeName === "TH"
57
+ ? {
58
+ type: "cell",
59
+ domNode: currentTarget,
60
+ tbodyNode: currentTarget.closest("tbody"),
61
+ }
62
+ : {
63
+ type: "wrapper",
64
+ domNode: currentTarget,
65
+ tbodyNode: currentTarget.querySelector("tbody"),
66
+ };
67
+ }
68
+ // Hides elements in the DOMwith the provided class names.
69
+ function hideElements(selector, rootEl) {
70
+ const elementsToHide = rootEl.querySelectorAll(selector);
71
+ for (let i = 0; i < elementsToHide.length; i++) {
72
+ elementsToHide[i].style.visibility = "hidden";
73
+ }
74
+ }
75
+ export class TableHandlesView {
76
+ editor;
77
+ pmView;
78
+ state;
79
+ emitUpdate;
80
+ tableId;
81
+ tablePos;
82
+ tableElement;
83
+ menuFrozen = false;
84
+ mouseState = "up";
85
+ prevWasEditable = null;
86
+ constructor(editor, pmView, emitUpdate) {
87
+ this.editor = editor;
88
+ this.pmView = pmView;
89
+ this.emitUpdate = () => {
90
+ if (!this.state) {
91
+ throw new Error("Attempting to update uninitialized image toolbar");
92
+ }
93
+ emitUpdate(this.state);
94
+ };
95
+ pmView.dom.addEventListener("mousemove", this.mouseMoveHandler);
96
+ pmView.dom.addEventListener("mousedown", this.viewMousedownHandler);
97
+ window.addEventListener("mouseup", this.mouseUpHandler);
98
+ pmView.root.addEventListener("dragover", this.dragOverHandler);
99
+ pmView.root.addEventListener("drop", this.dropHandler);
100
+ }
101
+ viewMousedownHandler = () => {
102
+ this.mouseState = "down";
103
+ };
104
+ mouseUpHandler = (event) => {
105
+ this.mouseState = "up";
106
+ this.mouseMoveHandler(event);
107
+ };
108
+ mouseMoveHandler = (event) => {
109
+ if (this.menuFrozen) {
110
+ return;
111
+ }
112
+ if (this.mouseState === "selecting") {
113
+ return;
114
+ }
115
+ if (!(event.target instanceof Element) ||
116
+ !this.pmView.dom.contains(event.target)) {
117
+ return;
118
+ }
119
+ const target = domCellAround(event.target);
120
+ if (target?.type === "cell" &&
121
+ this.mouseState === "down" &&
122
+ !this.state?.draggingState) {
123
+ // hide draghandles when selecting text as they could be in the way of the user
124
+ this.mouseState = "selecting";
125
+ if (this.state?.show) {
126
+ this.state.show = false;
127
+ this.state.showAddOrRemoveRowsButton = false;
128
+ this.state.showAddOrRemoveColumnsButton = false;
129
+ this.emitUpdate();
130
+ }
131
+ return;
132
+ }
133
+ if (!target || !this.editor.isEditable) {
134
+ if (this.state?.show) {
135
+ this.state.show = false;
136
+ this.state.showAddOrRemoveRowsButton = false;
137
+ this.state.showAddOrRemoveColumnsButton = false;
138
+ this.emitUpdate();
139
+ }
140
+ return;
141
+ }
142
+ if (!target.tbodyNode) {
143
+ return;
144
+ }
145
+ const tableRect = target.tbodyNode.getBoundingClientRect();
146
+ const blockEl = getDraggableBlockFromElement(target.domNode, this.pmView);
147
+ if (!blockEl) {
148
+ return;
149
+ }
150
+ this.tableElement = blockEl.node;
151
+ let tableBlock;
152
+ const pmNodeInfo = getNodeById(blockEl.id, this.editor._tiptapEditor.state.doc);
153
+ const block = nodeToBlock(pmNodeInfo.node, this.editor.schema.blockSchema, this.editor.schema.inlineContentSchema, this.editor.schema.styleSchema, this.editor.blockCache);
154
+ if (checkBlockIsDefaultType("table", block, this.editor)) {
155
+ this.tablePos = pmNodeInfo.posBeforeNode + 1;
156
+ tableBlock = block;
157
+ }
158
+ if (!tableBlock) {
159
+ return;
160
+ }
161
+ this.tableId = blockEl.id;
162
+ const widgetContainer = target.domNode
163
+ .closest(".tableWrapper")
164
+ ?.querySelector(".table-widgets-container");
165
+ if (target?.type === "wrapper") {
166
+ // if we're just to the right or below the table, show the extend buttons
167
+ // (this is a bit hacky. It would probably be cleaner to render the extend buttons in the Table NodeView instead)
168
+ const belowTable = event.clientY >= tableRect.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
169
+ event.clientY < tableRect.bottom + 20;
170
+ const toRightOfTable = event.clientX >= tableRect.right - 1 &&
171
+ event.clientX < tableRect.right + 20;
172
+ // without this check, we'd also hide draghandles when hovering over them
173
+ const hideHandles = event.clientX > tableRect.right || event.clientY > tableRect.bottom;
174
+ this.state = {
175
+ ...this.state,
176
+ show: true,
177
+ showAddOrRemoveRowsButton: belowTable,
178
+ showAddOrRemoveColumnsButton: toRightOfTable,
179
+ referencePosTable: tableRect,
180
+ block: tableBlock,
181
+ widgetContainer,
182
+ colIndex: hideHandles ? undefined : this.state.colIndex,
183
+ rowIndex: hideHandles ? undefined : this.state.rowIndex,
184
+ referencePosCell: hideHandles
185
+ ? undefined
186
+ : this.state.referencePosCell,
187
+ };
188
+ }
189
+ else {
190
+ const colIndex = getChildIndex(target.domNode);
191
+ const rowIndex = getChildIndex(target.domNode.parentElement);
192
+ const cellRect = target.domNode.getBoundingClientRect();
193
+ if (this.state !== undefined &&
194
+ this.state.show &&
195
+ this.tableId === blockEl.id &&
196
+ this.state.rowIndex === rowIndex &&
197
+ this.state.colIndex === colIndex) {
198
+ // no update needed
199
+ return;
200
+ }
201
+ this.state = {
202
+ show: true,
203
+ showAddOrRemoveColumnsButton: colIndex === tableBlock.content.rows[0].cells.length - 1,
204
+ showAddOrRemoveRowsButton: rowIndex === tableBlock.content.rows.length - 1,
205
+ referencePosTable: tableRect,
206
+ block: tableBlock,
207
+ draggingState: undefined,
208
+ referencePosCell: cellRect,
209
+ colIndex: colIndex,
210
+ rowIndex: rowIndex,
211
+ widgetContainer,
212
+ };
213
+ }
214
+ this.emitUpdate();
215
+ return false;
216
+ };
217
+ dragOverHandler = (event) => {
218
+ if (this.state?.draggingState === undefined) {
219
+ return;
220
+ }
221
+ event.preventDefault();
222
+ event.dataTransfer.dropEffect = "move";
223
+ hideElements(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
224
+ // The mouse cursor coordinates, bounded to the table's bounding box. The
225
+ // bounding box is shrunk by 1px on each side to ensure that the bounded
226
+ // coordinates are always inside a table cell.
227
+ const boundedMouseCoords = {
228
+ left: Math.min(Math.max(event.clientX, this.state.referencePosTable.left + 1), this.state.referencePosTable.right - 1),
229
+ top: Math.min(Math.max(event.clientY, this.state.referencePosTable.top + 1), this.state.referencePosTable.bottom - 1),
230
+ };
231
+ // Gets the table cell element that the bounded mouse cursor coordinates lie
232
+ // in.
233
+ const tableCellElements = this.pmView.root
234
+ .elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top)
235
+ .filter((element) => element.tagName === "TD" || element.tagName === "TH");
236
+ if (tableCellElements.length === 0) {
237
+ throw new Error("Could not find table cell element that the mouse cursor is hovering over.");
238
+ }
239
+ const tableCellElement = tableCellElements[0];
240
+ let emitStateUpdate = false;
241
+ // Gets current row and column index.
242
+ const rowIndex = getChildIndex(tableCellElement.parentElement);
243
+ const colIndex = getChildIndex(tableCellElement);
244
+ // Checks if the drop cursor needs to be updated. This affects decorations
245
+ // only so it doesn't trigger a state update.
246
+ const oldIndex = this.state.draggingState.draggedCellOrientation === "row"
247
+ ? this.state.rowIndex
248
+ : this.state.colIndex;
249
+ const newIndex = this.state.draggingState.draggedCellOrientation === "row"
250
+ ? rowIndex
251
+ : colIndex;
252
+ const dispatchDecorationsTransaction = newIndex !== oldIndex;
253
+ // Checks if either the hovered cell has changed and updates the row and
254
+ // column index. Also updates the reference DOMRect.
255
+ if (this.state.rowIndex !== rowIndex || this.state.colIndex !== colIndex) {
256
+ this.state.rowIndex = rowIndex;
257
+ this.state.colIndex = colIndex;
258
+ this.state.referencePosCell = tableCellElement.getBoundingClientRect();
259
+ emitStateUpdate = true;
260
+ }
261
+ // Checks if the mouse cursor position along the axis that the user is
262
+ // dragging on has changed and updates it.
263
+ const mousePos = this.state.draggingState.draggedCellOrientation === "row"
264
+ ? boundedMouseCoords.top
265
+ : boundedMouseCoords.left;
266
+ if (this.state.draggingState.mousePos !== mousePos) {
267
+ this.state.draggingState.mousePos = mousePos;
268
+ emitStateUpdate = true;
269
+ }
270
+ // Emits a state update if any of the fields have changed.
271
+ if (emitStateUpdate) {
272
+ this.emitUpdate();
273
+ }
274
+ // Dispatches a dummy transaction to force a decorations update if
275
+ // necessary.
276
+ if (dispatchDecorationsTransaction) {
277
+ this.editor.dispatch(this.pmView.state.tr.setMeta(tableHandlesPluginKey, true));
278
+ }
279
+ };
280
+ dropHandler = (event) => {
281
+ this.mouseState = "up";
282
+ if (this.state === undefined || this.state.draggingState === undefined) {
283
+ return;
284
+ }
285
+ if (this.state.rowIndex === undefined ||
286
+ this.state.colIndex === undefined) {
287
+ throw new Error("Attempted to drop table row or column, but no table block was hovered prior.");
288
+ }
289
+ event.preventDefault();
290
+ const { draggingState, colIndex, rowIndex } = this.state;
291
+ const rows = this.state.block.content.rows;
292
+ if (draggingState.draggedCellOrientation === "row") {
293
+ const rowToMove = rows[draggingState.originalIndex];
294
+ rows.splice(draggingState.originalIndex, 1);
295
+ rows.splice(rowIndex, 0, rowToMove);
296
+ }
297
+ else {
298
+ const cellsToMove = rows.map((row) => row.cells[draggingState.originalIndex]);
299
+ rows.forEach((row, rowIndex) => {
300
+ row.cells.splice(draggingState.originalIndex, 1);
301
+ row.cells.splice(colIndex, 0, cellsToMove[rowIndex]);
302
+ });
303
+ }
304
+ this.editor.updateBlock(this.state.block, {
305
+ type: "table",
306
+ content: {
307
+ type: "tableContent",
308
+ rows: rows,
309
+ },
310
+ });
311
+ // Have to reset text cursor position to the block as `updateBlock` moves
312
+ // the existing selection out of the block.
313
+ this.editor.setTextCursorPosition(this.state.block.id);
314
+ };
315
+ // Updates drag handle positions on table content updates.
316
+ update() {
317
+ if (!this.state || !this.state.show) {
318
+ return;
319
+ }
320
+ const tableBody = this.tableElement.querySelector("tbody");
321
+ if (!tableBody) {
322
+ return;
323
+ }
324
+ if (this.state.rowIndex !== undefined &&
325
+ this.state.colIndex !== undefined) {
326
+ // If rows or columns are deleted in the update, the hovered indices for
327
+ // those may now be out of bounds. If this is the case, they are moved to
328
+ // the new last row or column.
329
+ if (this.state.rowIndex >= tableBody.children.length) {
330
+ this.state.rowIndex = tableBody.children.length - 1;
331
+ }
332
+ if (this.state.colIndex >= tableBody.children[0].children.length) {
333
+ this.state.colIndex = tableBody.children[0].children.length - 1;
334
+ }
335
+ const row = tableBody.children[this.state.rowIndex];
336
+ const cell = row.children[this.state.colIndex];
337
+ this.state.referencePosCell = cell.getBoundingClientRect();
338
+ }
339
+ this.state.block = this.editor.getBlock(this.state.block.id);
340
+ this.state.referencePosTable = tableBody.getBoundingClientRect();
341
+ this.emitUpdate();
342
+ }
343
+ destroy() {
344
+ this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler);
345
+ window.removeEventListener("mouseup", this.mouseUpHandler);
346
+ this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler);
347
+ this.pmView.root.removeEventListener("dragover", this.dragOverHandler);
348
+ this.pmView.root.removeEventListener("drop", this.dropHandler);
349
+ }
350
+ }
351
+ export const tableHandlesPluginKey = new PluginKey("TableHandlesPlugin");
352
+ export class TableHandlesProsemirrorPlugin extends EventEmitter {
353
+ editor;
354
+ view;
355
+ plugin;
356
+ constructor(editor) {
357
+ super();
358
+ this.editor = editor;
359
+ this.plugin = new Plugin({
360
+ key: tableHandlesPluginKey,
361
+ view: (editorView) => {
362
+ this.view = new TableHandlesView(editor, editorView, (state) => {
363
+ this.emit("update", state);
364
+ });
365
+ return this.view;
366
+ },
367
+ // We use decorations to render the drop cursor when dragging a table row
368
+ // or column. The decorations are updated in the `dragOverHandler` method.
369
+ props: {
370
+ decorations: (state) => {
371
+ if (this.view === undefined ||
372
+ this.view.state === undefined ||
373
+ this.view.state.draggingState === undefined ||
374
+ this.view.tablePos === undefined) {
375
+ return;
376
+ }
377
+ const newIndex = this.view.state.draggingState.draggedCellOrientation === "row"
378
+ ? this.view.state.rowIndex
379
+ : this.view.state.colIndex;
380
+ if (newIndex === undefined) {
381
+ return;
382
+ }
383
+ const decorations = [];
384
+ if (newIndex === this.view.state.draggingState.originalIndex) {
385
+ return DecorationSet.create(state.doc, decorations);
386
+ }
387
+ // Gets the table to show the drop cursor in.
388
+ const tableResolvedPos = state.doc.resolve(this.view.tablePos + 1);
389
+ const tableNode = tableResolvedPos.node();
390
+ if (this.view.state.draggingState.draggedCellOrientation === "row") {
391
+ // Gets the row at the new index.
392
+ const rowResolvedPos = state.doc.resolve(tableResolvedPos.posAtIndex(newIndex) + 1);
393
+ const rowNode = rowResolvedPos.node();
394
+ // Iterates over all cells in the row.
395
+ for (let i = 0; i < rowNode.childCount; i++) {
396
+ // Gets each cell in the row.
397
+ const cellResolvedPos = state.doc.resolve(rowResolvedPos.posAtIndex(i) + 1);
398
+ const cellNode = cellResolvedPos.node();
399
+ // Creates a decoration at the start or end of each cell,
400
+ // depending on whether the new index is before or after the
401
+ // original index.
402
+ const decorationPos = cellResolvedPos.pos +
403
+ (newIndex > this.view.state.draggingState.originalIndex
404
+ ? cellNode.nodeSize - 2
405
+ : 0);
406
+ decorations.push(
407
+ // The widget is a small bar which spans the width of the cell.
408
+ Decoration.widget(decorationPos, () => {
409
+ const widget = document.createElement("div");
410
+ widget.className = "bn-table-drop-cursor";
411
+ widget.style.left = "0";
412
+ widget.style.right = "0";
413
+ // This is only necessary because the drop indicator's height
414
+ // is an even number of pixels, whereas the border between
415
+ // table cells is an odd number of pixels. So this makes the
416
+ // positioning slightly more consistent regardless of where
417
+ // the row is being dropped.
418
+ if (newIndex > this.view.state.draggingState.originalIndex) {
419
+ widget.style.bottom = "-2px";
420
+ }
421
+ else {
422
+ widget.style.top = "-3px";
423
+ }
424
+ widget.style.height = "4px";
425
+ return widget;
426
+ }));
427
+ }
428
+ }
429
+ else {
430
+ // Iterates over all rows in the table.
431
+ for (let i = 0; i < tableNode.childCount; i++) {
432
+ // Gets each row in the table.
433
+ const rowResolvedPos = state.doc.resolve(tableResolvedPos.posAtIndex(i) + 1);
434
+ // Gets the cell at the new index in the row.
435
+ const cellResolvedPos = state.doc.resolve(rowResolvedPos.posAtIndex(newIndex) + 1);
436
+ const cellNode = cellResolvedPos.node();
437
+ // Creates a decoration at the start or end of each cell,
438
+ // depending on whether the new index is before or after the
439
+ // original index.
440
+ const decorationPos = cellResolvedPos.pos +
441
+ (newIndex > this.view.state.draggingState.originalIndex
442
+ ? cellNode.nodeSize - 2
443
+ : 0);
444
+ decorations.push(
445
+ // The widget is a small bar which spans the height of the cell.
446
+ Decoration.widget(decorationPos, () => {
447
+ const widget = document.createElement("div");
448
+ widget.className = "bn-table-drop-cursor";
449
+ widget.style.top = "0";
450
+ widget.style.bottom = "0";
451
+ // This is only necessary because the drop indicator's width
452
+ // is an even number of pixels, whereas the border between
453
+ // table cells is an odd number of pixels. So this makes the
454
+ // positioning slightly more consistent regardless of where
455
+ // the column is being dropped.
456
+ if (newIndex > this.view.state.draggingState.originalIndex) {
457
+ widget.style.right = "-2px";
458
+ }
459
+ else {
460
+ widget.style.left = "-3px";
461
+ }
462
+ widget.style.width = "4px";
463
+ return widget;
464
+ }));
465
+ }
466
+ }
467
+ return DecorationSet.create(state.doc, decorations);
468
+ },
469
+ },
470
+ });
471
+ }
472
+ onUpdate(callback) {
473
+ return this.on("update", callback);
474
+ }
475
+ /**
476
+ * Callback that should be set on the `dragStart` event for whichever element
477
+ * is used as the column drag handle.
478
+ */
479
+ colDragStart = (event) => {
480
+ if (this.view.state === undefined ||
481
+ this.view.state.colIndex === undefined) {
482
+ throw new Error("Attempted to drag table column, but no table block was hovered prior.");
483
+ }
484
+ this.view.state.draggingState = {
485
+ draggedCellOrientation: "col",
486
+ originalIndex: this.view.state.colIndex,
487
+ mousePos: event.clientX,
488
+ };
489
+ this.view.emitUpdate();
490
+ this.editor.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {
491
+ draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
492
+ originalIndex: this.view.state.colIndex,
493
+ newIndex: this.view.state.colIndex,
494
+ tablePos: this.view.tablePos,
495
+ }));
496
+ setHiddenDragImage(this.editor._tiptapEditor.view.root);
497
+ event.dataTransfer.setDragImage(dragImageElement, 0, 0);
498
+ event.dataTransfer.effectAllowed = "move";
499
+ };
500
+ /**
501
+ * Callback that should be set on the `dragStart` event for whichever element
502
+ * is used as the row drag handle.
503
+ */
504
+ rowDragStart = (event) => {
505
+ if (this.view.state === undefined ||
506
+ this.view.state.rowIndex === undefined) {
507
+ throw new Error("Attempted to drag table row, but no table block was hovered prior.");
508
+ }
509
+ this.view.state.draggingState = {
510
+ draggedCellOrientation: "row",
511
+ originalIndex: this.view.state.rowIndex,
512
+ mousePos: event.clientY,
513
+ };
514
+ this.view.emitUpdate();
515
+ this.editor.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {
516
+ draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
517
+ originalIndex: this.view.state.rowIndex,
518
+ newIndex: this.view.state.rowIndex,
519
+ tablePos: this.view.tablePos,
520
+ }));
521
+ setHiddenDragImage(this.editor._tiptapEditor.view.root);
522
+ event.dataTransfer.setDragImage(dragImageElement, 0, 0);
523
+ event.dataTransfer.effectAllowed = "copyMove";
524
+ };
525
+ /**
526
+ * Callback that should be set on the `dragEnd` event for both the element
527
+ * used as the row drag handle, and the one used as the column drag handle.
528
+ */
529
+ dragEnd = () => {
530
+ if (this.view.state === undefined) {
531
+ throw new Error("Attempted to drag table row, but no table block was hovered prior.");
532
+ }
533
+ this.view.state.draggingState = undefined;
534
+ this.view.emitUpdate();
535
+ this.editor.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, null));
536
+ unsetHiddenDragImage(this.editor._tiptapEditor.view.root);
537
+ };
538
+ /**
539
+ * Freezes the drag handles. When frozen, they will stay attached to the same
540
+ * cell regardless of which cell is hovered by the mouse cursor.
541
+ */
542
+ freezeHandles = () => {
543
+ this.view.menuFrozen = true;
544
+ };
545
+ /**
546
+ * Unfreezes the drag handles. When frozen, they will stay attached to the
547
+ * same cell regardless of which cell is hovered by the mouse cursor.
548
+ */
549
+ unfreezeHandles = () => {
550
+ this.view.menuFrozen = false;
551
+ };
552
+ }
553
+ //# sourceMappingURL=TableHandlesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableHandlesPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/TableHandles/TableHandlesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AASjF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,IAAI,gBAAyC,CAAC;AA2B9C,SAAS,kBAAkB,CAAC,MAA6B;IACvD,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,gBAAgB,CAAC,SAAS,GAAG,GAAG,CAAC;IACjC,gBAAgB,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;IACrC,gBAAgB,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IACtC,gBAAgB,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACrC,IAAI,MAAM,YAAY,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACvC,CAAC;AACH,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CAAC;CACH"}
@@ -0,0 +1,36 @@
1
+ import { Extension } from "@tiptap/core";
2
+ export const TextAlignmentExtension = Extension.create({
3
+ name: "textAlignment",
4
+ addGlobalAttributes() {
5
+ return [
6
+ {
7
+ // Attribute is applied to block content instead of container so that child blocks don't inherit the text
8
+ // alignment styling.
9
+ types: [
10
+ "paragraph",
11
+ "heading",
12
+ "bulletListItem",
13
+ "numberedListItem",
14
+ "checkListItem",
15
+ ],
16
+ attributes: {
17
+ textAlignment: {
18
+ default: "left",
19
+ parseHTML: (element) => {
20
+ return element.getAttribute("data-text-alignment");
21
+ },
22
+ renderHTML: (attributes) => {
23
+ if (attributes.textAlignment === "left") {
24
+ return {};
25
+ }
26
+ return {
27
+ "data-text-alignment": attributes.textAlignment,
28
+ };
29
+ },
30
+ },
31
+ },
32
+ },
33
+ ];
34
+ },
35
+ });
36
+ //# sourceMappingURL=TextAlignmentExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAlignmentExtension.js","sourceRoot":"","sources":["../../../../src/extensions/TextAlignment/TextAlignmentExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC,MAAM,CAAC;IACrD,IAAI,EAAE,eAAe;IAErB,mBAAmB;QACjB,OAAO;YACL;gBACE,yGAAyG;gBACzG,qBAAqB;gBACrB,KAAK,EAAE;oBACL,WAAW;oBACX,SAAS;oBACT,gBAAgB;oBAChB,kBAAkB;oBAClB,eAAe;iBAChB;gBACD,UAAU,EAAE;oBACV,aAAa,EAAE;wBACb,OAAO,EAAE,MAAM;wBACf,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;4BACrB,OAAO,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;wBACrD,CAAC;wBACD,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;4BACzB,IAAI,UAAU,CAAC,aAAa,KAAK,MAAM,EAAE,CAAC;gCACxC,OAAO,EAAE,CAAC;4BACZ,CAAC;4BACD,OAAO;gCACL,qBAAqB,EAAE,UAAU,CAAC,aAAa;6BAChD,CAAC;wBACJ,CAAC;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Extension } from "@tiptap/core";
2
+ import { defaultProps } from "../../blocks/defaultProps.js";
3
+ export const TextColorExtension = Extension.create({
4
+ name: "blockTextColor",
5
+ addGlobalAttributes() {
6
+ return [
7
+ {
8
+ types: ["blockContainer"],
9
+ attributes: {
10
+ textColor: {
11
+ default: defaultProps.textColor.default,
12
+ parseHTML: (element) => element.hasAttribute("data-text-color")
13
+ ? element.getAttribute("data-text-color")
14
+ : defaultProps.textColor.default,
15
+ renderHTML: (attributes) => {
16
+ if (attributes.textColor === defaultProps.textColor.default) {
17
+ return {};
18
+ }
19
+ return {
20
+ "data-text-color": attributes.textColor,
21
+ };
22
+ },
23
+ },
24
+ },
25
+ },
26
+ ];
27
+ },
28
+ });
29
+ //# sourceMappingURL=TextColorExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextColorExtension.js","sourceRoot":"","sources":["../../../../src/extensions/TextColor/TextColorExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,gBAAgB;IAEtB,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,CAAC,gBAAgB,CAAC;gBACzB,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,OAAO;wBACvC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CACrB,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC;4BACrC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC;4BACzC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO;wBACpC,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;4BACzB,IAAI,UAAU,CAAC,SAAS,KAAK,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;gCAC5D,OAAO,EAAE,CAAC;4BACZ,CAAC;4BACD,OAAO;gCACL,iBAAiB,EAAE,UAAU,CAAC,SAAS;6BACxC,CAAC;wBACJ,CAAC;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}