@ctzhian/tiptap 1.5.1 → 1.5.2

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 (515) hide show
  1. package/package.json +1 -1
  2. package/dist/Editor/demo.d.ts +0 -4
  3. package/dist/Editor/demo.js +0 -153
  4. package/dist/Editor/index.d.ts +0 -4
  5. package/dist/Editor/index.js +0 -21
  6. package/dist/EditorDiff/demo.d.ts +0 -4
  7. package/dist/EditorDiff/demo.js +0 -12
  8. package/dist/EditorDiff/index.d.ts +0 -7
  9. package/dist/EditorDiff/index.js +0 -24
  10. package/dist/EditorThemeProvider/index.d.ts +0 -11
  11. package/dist/EditorThemeProvider/index.js +0 -90
  12. package/dist/EditorToolbar/index.d.ts +0 -9
  13. package/dist/EditorToolbar/index.js +0 -325
  14. package/dist/asset/css/index.css +0 -165
  15. package/dist/asset/images/disk.png +0 -0
  16. package/dist/component/CustomBubbleMenu/SelectionText.d.ts +0 -9
  17. package/dist/component/CustomBubbleMenu/SelectionText.js +0 -292
  18. package/dist/component/CustomDragHandle/index.d.ts +0 -9
  19. package/dist/component/CustomDragHandle/index.js +0 -1407
  20. package/dist/component/CustomFloatingMenu/index.d.ts +0 -0
  21. package/dist/component/CustomFloatingMenu/index.js +0 -85
  22. package/dist/component/FloatingPopover/index.d.ts +0 -15
  23. package/dist/component/FloatingPopover/index.js +0 -113
  24. package/dist/component/Icons/add-line-icon.d.ts +0 -6
  25. package/dist/component/Icons/add-line-icon.js +0 -13
  26. package/dist/component/Icons/ai-generate-2-icon.d.ts +0 -6
  27. package/dist/component/Icons/ai-generate-2-icon.js +0 -13
  28. package/dist/component/Icons/ai-generate-text-icon.d.ts +0 -6
  29. package/dist/component/Icons/ai-generate-text-icon.js +0 -13
  30. package/dist/component/Icons/align-bottom-icon.d.ts +0 -6
  31. package/dist/component/Icons/align-bottom-icon.js +0 -13
  32. package/dist/component/Icons/align-center-icon.d.ts +0 -6
  33. package/dist/component/Icons/align-center-icon.js +0 -13
  34. package/dist/component/Icons/align-justify-icon.d.ts +0 -6
  35. package/dist/component/Icons/align-justify-icon.js +0 -13
  36. package/dist/component/Icons/align-left-icon.d.ts +0 -6
  37. package/dist/component/Icons/align-left-icon.js +0 -13
  38. package/dist/component/Icons/align-right-icon.d.ts +0 -6
  39. package/dist/component/Icons/align-right-icon.js +0 -13
  40. package/dist/component/Icons/align-top-icon.d.ts +0 -6
  41. package/dist/component/Icons/align-top-icon.js +0 -13
  42. package/dist/component/Icons/align-vertically-icon.d.ts +0 -6
  43. package/dist/component/Icons/align-vertically-icon.js +0 -13
  44. package/dist/component/Icons/anticlockwise-line-icon.d.ts +0 -6
  45. package/dist/component/Icons/anticlockwise-line-icon.js +0 -13
  46. package/dist/component/Icons/arrow-down-s-line-icon.d.ts +0 -6
  47. package/dist/component/Icons/arrow-down-s-line-icon.js +0 -13
  48. package/dist/component/Icons/arrow-go-back-line-icon.d.ts +0 -6
  49. package/dist/component/Icons/arrow-go-back-line-icon.js +0 -13
  50. package/dist/component/Icons/arrow-go-forward-line-icon.d.ts +0 -6
  51. package/dist/component/Icons/arrow-go-forward-line-icon.js +0 -13
  52. package/dist/component/Icons/arrow-left-wide-line-icon.d.ts +0 -6
  53. package/dist/component/Icons/arrow-left-wide-line-icon.js +0 -13
  54. package/dist/component/Icons/at-line-icon.d.ts +0 -6
  55. package/dist/component/Icons/at-line-icon.js +0 -13
  56. package/dist/component/Icons/attachment-2-icon.d.ts +0 -6
  57. package/dist/component/Icons/attachment-2-icon.js +0 -13
  58. package/dist/component/Icons/attachment-line-icon.d.ts +0 -6
  59. package/dist/component/Icons/attachment-line-icon.js +0 -13
  60. package/dist/component/Icons/bold-icon.d.ts +0 -6
  61. package/dist/component/Icons/bold-icon.js +0 -13
  62. package/dist/component/Icons/brush-line-icon.d.ts +0 -6
  63. package/dist/component/Icons/brush-line-icon.js +0 -13
  64. package/dist/component/Icons/carousel-view-icon.d.ts +0 -6
  65. package/dist/component/Icons/carousel-view-icon.js +0 -13
  66. package/dist/component/Icons/checkbox-blank-circle-line-icon.d.ts +0 -6
  67. package/dist/component/Icons/checkbox-blank-circle-line-icon.js +0 -13
  68. package/dist/component/Icons/checkbox-circle-fill-icon.d.ts +0 -6
  69. package/dist/component/Icons/checkbox-circle-fill-icon.js +0 -13
  70. package/dist/component/Icons/checkbox-circle-line-icon.d.ts +0 -6
  71. package/dist/component/Icons/checkbox-circle-line-icon.js +0 -13
  72. package/dist/component/Icons/clockwise-line-icon.d.ts +0 -6
  73. package/dist/component/Icons/clockwise-line-icon.js +0 -13
  74. package/dist/component/Icons/close-circle-fill-icon.d.ts +0 -6
  75. package/dist/component/Icons/close-circle-fill-icon.js +0 -13
  76. package/dist/component/Icons/code-box-line-icon.d.ts +0 -6
  77. package/dist/component/Icons/code-box-line-icon.js +0 -13
  78. package/dist/component/Icons/code-line-icon.d.ts +0 -6
  79. package/dist/component/Icons/code-line-icon.js +0 -13
  80. package/dist/component/Icons/code-s-slash-line-icon.d.ts +0 -6
  81. package/dist/component/Icons/code-s-slash-line-icon.js +0 -13
  82. package/dist/component/Icons/copy-icon.d.ts +0 -6
  83. package/dist/component/Icons/copy-icon.js +0 -13
  84. package/dist/component/Icons/custom-size-icon.d.ts +0 -6
  85. package/dist/component/Icons/custom-size-icon.js +0 -13
  86. package/dist/component/Icons/delete-column-icon.d.ts +0 -6
  87. package/dist/component/Icons/delete-column-icon.js +0 -13
  88. package/dist/component/Icons/delete-line-icon.d.ts +0 -6
  89. package/dist/component/Icons/delete-line-icon.js +0 -13
  90. package/dist/component/Icons/delete-row-icon.d.ts +0 -6
  91. package/dist/component/Icons/delete-row-icon.js +0 -13
  92. package/dist/component/Icons/double-quotes-l-icon.d.ts +0 -6
  93. package/dist/component/Icons/double-quotes-l-icon.js +0 -13
  94. package/dist/component/Icons/download-line-icon.d.ts +0 -6
  95. package/dist/component/Icons/download-line-icon.js +0 -13
  96. package/dist/component/Icons/draggable-icon.d.ts +0 -6
  97. package/dist/component/Icons/draggable-icon.js +0 -13
  98. package/dist/component/Icons/edit-box-line-icon.d.ts +0 -6
  99. package/dist/component/Icons/edit-box-line-icon.js +0 -13
  100. package/dist/component/Icons/error-warning-fill-icon.d.ts +0 -6
  101. package/dist/component/Icons/error-warning-fill-icon.js +0 -13
  102. package/dist/component/Icons/export-line-icon.d.ts +0 -6
  103. package/dist/component/Icons/export-line-icon.js +0 -13
  104. package/dist/component/Icons/file-copy-line-icon.d.ts +0 -6
  105. package/dist/component/Icons/file-copy-line-icon.js +0 -13
  106. package/dist/component/Icons/file-upload-line-icon.d.ts +0 -6
  107. package/dist/component/Icons/file-upload-line-icon.js +0 -13
  108. package/dist/component/Icons/flow-chart-icon.d.ts +0 -6
  109. package/dist/component/Icons/flow-chart-icon.js +0 -13
  110. package/dist/component/Icons/font-color-icon.d.ts +0 -6
  111. package/dist/component/Icons/font-color-icon.js +0 -13
  112. package/dist/component/Icons/font-family-icon.d.ts +0 -6
  113. package/dist/component/Icons/font-family-icon.js +0 -13
  114. package/dist/component/Icons/font-size-icon.d.ts +0 -6
  115. package/dist/component/Icons/font-size-icon.js +0 -13
  116. package/dist/component/Icons/format-clear-icon.d.ts +0 -6
  117. package/dist/component/Icons/format-clear-icon.js +0 -13
  118. package/dist/component/Icons/formula-icon.d.ts +0 -6
  119. package/dist/component/Icons/formula-icon.js +0 -13
  120. package/dist/component/Icons/fullscreen-exit-line-icon.d.ts +0 -6
  121. package/dist/component/Icons/fullscreen-exit-line-icon.js +0 -13
  122. package/dist/component/Icons/fullscreen-line-icon.d.ts +0 -6
  123. package/dist/component/Icons/fullscreen-line-icon.js +0 -13
  124. package/dist/component/Icons/functions-icon.d.ts +0 -6
  125. package/dist/component/Icons/functions-icon.js +0 -13
  126. package/dist/component/Icons/game-line-icon.d.ts +0 -6
  127. package/dist/component/Icons/game-line-icon.js +0 -13
  128. package/dist/component/Icons/h-1-icon.d.ts +0 -6
  129. package/dist/component/Icons/h-1-icon.js +0 -13
  130. package/dist/component/Icons/h-2-icon.d.ts +0 -6
  131. package/dist/component/Icons/h-2-icon.js +0 -13
  132. package/dist/component/Icons/h-3-icon.d.ts +0 -6
  133. package/dist/component/Icons/h-3-icon.js +0 -13
  134. package/dist/component/Icons/h-4-icon.d.ts +0 -6
  135. package/dist/component/Icons/h-4-icon.js +0 -13
  136. package/dist/component/Icons/h-5-icon.d.ts +0 -6
  137. package/dist/component/Icons/h-5-icon.js +0 -13
  138. package/dist/component/Icons/h-6-icon.d.ts +0 -6
  139. package/dist/component/Icons/h-6-icon.js +0 -13
  140. package/dist/component/Icons/heading-icon.d.ts +0 -6
  141. package/dist/component/Icons/heading-icon.js +0 -13
  142. package/dist/component/Icons/image-add-line-icon.d.ts +0 -6
  143. package/dist/component/Icons/image-add-line-icon.js +0 -13
  144. package/dist/component/Icons/image-line-icon.d.ts +0 -6
  145. package/dist/component/Icons/image-line-icon.js +0 -13
  146. package/dist/component/Icons/import-line-icon.d.ts +0 -6
  147. package/dist/component/Icons/import-line-icon.js +0 -13
  148. package/dist/component/Icons/indent-decrease-icon.d.ts +0 -6
  149. package/dist/component/Icons/indent-decrease-icon.js +0 -13
  150. package/dist/component/Icons/indent-increase-icon.d.ts +0 -6
  151. package/dist/component/Icons/indent-increase-icon.js +0 -13
  152. package/dist/component/Icons/index.d.ts +0 -120
  153. package/dist/component/Icons/index.js +0 -123
  154. package/dist/component/Icons/information-2-fill-icon.d.ts +0 -6
  155. package/dist/component/Icons/information-2-fill-icon.js +0 -13
  156. package/dist/component/Icons/information-2-line-icon.d.ts +0 -6
  157. package/dist/component/Icons/information-2-line-icon.js +0 -13
  158. package/dist/component/Icons/insert-column-left-icon.d.ts +0 -6
  159. package/dist/component/Icons/insert-column-left-icon.js +0 -13
  160. package/dist/component/Icons/insert-column-right-icon.d.ts +0 -6
  161. package/dist/component/Icons/insert-column-right-icon.js +0 -13
  162. package/dist/component/Icons/insert-row-bottom-icon.d.ts +0 -6
  163. package/dist/component/Icons/insert-row-bottom-icon.js +0 -13
  164. package/dist/component/Icons/insert-row-top-icon.d.ts +0 -6
  165. package/dist/component/Icons/insert-row-top-icon.js +0 -13
  166. package/dist/component/Icons/italic-icon.d.ts +0 -6
  167. package/dist/component/Icons/italic-icon.js +0 -13
  168. package/dist/component/Icons/layout-left-2-line-icon.d.ts +0 -6
  169. package/dist/component/Icons/layout-left-2-line-icon.js +0 -13
  170. package/dist/component/Icons/layout-top-2-line-icon.d.ts +0 -6
  171. package/dist/component/Icons/layout-top-2-line-icon.js +0 -13
  172. package/dist/component/Icons/link-icon.d.ts +0 -6
  173. package/dist/component/Icons/link-icon.js +0 -13
  174. package/dist/component/Icons/link-unlink-icon.d.ts +0 -6
  175. package/dist/component/Icons/link-unlink-icon.js +0 -13
  176. package/dist/component/Icons/list-check-2-icon.d.ts +0 -6
  177. package/dist/component/Icons/list-check-2-icon.js +0 -13
  178. package/dist/component/Icons/list-check-3-icon.d.ts +0 -6
  179. package/dist/component/Icons/list-check-3-icon.js +0 -13
  180. package/dist/component/Icons/list-ordered-2-icon.d.ts +0 -6
  181. package/dist/component/Icons/list-ordered-2-icon.js +0 -13
  182. package/dist/component/Icons/list-unordered-icon.d.ts +0 -6
  183. package/dist/component/Icons/list-unordered-icon.js +0 -13
  184. package/dist/component/Icons/markdown-line-icon.d.ts +0 -6
  185. package/dist/component/Icons/markdown-line-icon.js +0 -13
  186. package/dist/component/Icons/markup-line-icon.d.ts +0 -6
  187. package/dist/component/Icons/markup-line-icon.js +0 -13
  188. package/dist/component/Icons/menu-fold-2-fill-icon.d.ts +0 -6
  189. package/dist/component/Icons/menu-fold-2-fill-icon.js +0 -13
  190. package/dist/component/Icons/merge-cells-horizontal-icon.d.ts +0 -6
  191. package/dist/component/Icons/merge-cells-horizontal-icon.js +0 -13
  192. package/dist/component/Icons/merge-cells-vertical-icon.d.ts +0 -6
  193. package/dist/component/Icons/merge-cells-vertical-icon.js +0 -13
  194. package/dist/component/Icons/mind-map-icon.d.ts +0 -6
  195. package/dist/component/Icons/mind-map-icon.js +0 -13
  196. package/dist/component/Icons/more-line-icon.d.ts +0 -6
  197. package/dist/component/Icons/more-line-icon.js +0 -13
  198. package/dist/component/Icons/movie-line-icon.d.ts +0 -6
  199. package/dist/component/Icons/movie-line-icon.js +0 -13
  200. package/dist/component/Icons/music-2-line-icon.d.ts +0 -6
  201. package/dist/component/Icons/music-2-line-icon.js +0 -13
  202. package/dist/component/Icons/node-tree-icon.d.ts +0 -6
  203. package/dist/component/Icons/node-tree-icon.js +0 -13
  204. package/dist/component/Icons/notification-3-line-icon.d.ts +0 -6
  205. package/dist/component/Icons/notification-3-line-icon.js +0 -13
  206. package/dist/component/Icons/organization-chart-icon.d.ts +0 -6
  207. package/dist/component/Icons/organization-chart-icon.js +0 -13
  208. package/dist/component/Icons/pause-line-icon.d.ts +0 -6
  209. package/dist/component/Icons/pause-line-icon.js +0 -13
  210. package/dist/component/Icons/play-line-icon.d.ts +0 -6
  211. package/dist/component/Icons/play-line-icon.js +0 -13
  212. package/dist/component/Icons/question-fill-icon.d.ts +0 -6
  213. package/dist/component/Icons/question-fill-icon.js +0 -13
  214. package/dist/component/Icons/quote-text-icon.d.ts +0 -6
  215. package/dist/component/Icons/quote-text-icon.js +0 -13
  216. package/dist/component/Icons/repeat-2-line-icon.d.ts +0 -6
  217. package/dist/component/Icons/repeat-2-line-icon.js +0 -13
  218. package/dist/component/Icons/reset-left-fill-icon.d.ts +0 -6
  219. package/dist/component/Icons/reset-left-fill-icon.js +0 -13
  220. package/dist/component/Icons/scissors-cut-line-icon.d.ts +0 -6
  221. package/dist/component/Icons/scissors-cut-line-icon.js +0 -13
  222. package/dist/component/Icons/screenshot-line-icon.d.ts +0 -6
  223. package/dist/component/Icons/screenshot-line-icon.js +0 -13
  224. package/dist/component/Icons/scroll-to-bottom-line-icon.d.ts +0 -6
  225. package/dist/component/Icons/scroll-to-bottom-line-icon.js +0 -13
  226. package/dist/component/Icons/separator-icon.d.ts +0 -6
  227. package/dist/component/Icons/separator-icon.js +0 -13
  228. package/dist/component/Icons/share-box-line-icon.d.ts +0 -6
  229. package/dist/component/Icons/share-box-line-icon.js +0 -13
  230. package/dist/component/Icons/slash-commands-2-icon.d.ts +0 -3
  231. package/dist/component/Icons/slash-commands-2-icon.js +0 -13
  232. package/dist/component/Icons/speed-line-icon.d.ts +0 -6
  233. package/dist/component/Icons/speed-line-icon.js +0 -13
  234. package/dist/component/Icons/split-cells-horizontal-icon.d.ts +0 -6
  235. package/dist/component/Icons/split-cells-horizontal-icon.js +0 -13
  236. package/dist/component/Icons/split-cells-vertical-icon.d.ts +0 -6
  237. package/dist/component/Icons/split-cells-vertical-icon.js +0 -13
  238. package/dist/component/Icons/square-root-icon.d.ts +0 -6
  239. package/dist/component/Icons/square-root-icon.js +0 -13
  240. package/dist/component/Icons/strikethrough-icon.d.ts +0 -6
  241. package/dist/component/Icons/strikethrough-icon.js +0 -13
  242. package/dist/component/Icons/subscript-icon.d.ts +0 -6
  243. package/dist/component/Icons/subscript-icon.js +0 -13
  244. package/dist/component/Icons/superscript-icon.d.ts +0 -6
  245. package/dist/component/Icons/superscript-icon.js +0 -13
  246. package/dist/component/Icons/table-2-icon.d.ts +0 -6
  247. package/dist/component/Icons/table-2-icon.js +0 -13
  248. package/dist/component/Icons/text-icon.d.ts +0 -6
  249. package/dist/component/Icons/text-icon.js +0 -13
  250. package/dist/component/Icons/text-wrap-icon.d.ts +0 -6
  251. package/dist/component/Icons/text-wrap-icon.js +0 -13
  252. package/dist/component/Icons/title-icon.d.ts +0 -6
  253. package/dist/component/Icons/title-icon.js +0 -13
  254. package/dist/component/Icons/underline-icon.d.ts +0 -6
  255. package/dist/component/Icons/underline-icon.js +0 -13
  256. package/dist/component/Icons/upload-cloud-2-line-icon.d.ts +0 -6
  257. package/dist/component/Icons/upload-cloud-2-line-icon.js +0 -13
  258. package/dist/component/Icons/upload-icon.d.ts +0 -6
  259. package/dist/component/Icons/upload-icon.js +0 -13
  260. package/dist/component/Icons/volume-mute-line-icon.d.ts +0 -6
  261. package/dist/component/Icons/volume-mute-line-icon.js +0 -13
  262. package/dist/component/Icons/volume-up-line-icon.d.ts +0 -6
  263. package/dist/component/Icons/volume-up-line-icon.js +0 -13
  264. package/dist/component/Icons/window-fill-icon.d.ts +0 -6
  265. package/dist/component/Icons/window-fill-icon.js +0 -13
  266. package/dist/component/Menu/NestedList.d.ts +0 -14
  267. package/dist/component/Menu/NestedList.js +0 -151
  268. package/dist/component/Menu/index.d.ts +0 -4
  269. package/dist/component/Menu/index.js +0 -84
  270. package/dist/component/Toolbar/EditorAlignSelect.d.ts +0 -7
  271. package/dist/component/Toolbar/EditorAlignSelect.js +0 -187
  272. package/dist/component/Toolbar/EditorCode.d.ts +0 -7
  273. package/dist/component/Toolbar/EditorCode.js +0 -161
  274. package/dist/component/Toolbar/EditorFontBgColor.d.ts +0 -7
  275. package/dist/component/Toolbar/EditorFontBgColor.js +0 -244
  276. package/dist/component/Toolbar/EditorFontColor.d.ts +0 -7
  277. package/dist/component/Toolbar/EditorFontColor.js +0 -246
  278. package/dist/component/Toolbar/EditorFontSize.d.ts +0 -7
  279. package/dist/component/Toolbar/EditorFontSize.js +0 -149
  280. package/dist/component/Toolbar/EditorHeading.d.ts +0 -7
  281. package/dist/component/Toolbar/EditorHeading.js +0 -185
  282. package/dist/component/Toolbar/EditorInsert/index.d.ts +0 -7
  283. package/dist/component/Toolbar/EditorInsert/index.js +0 -197
  284. package/dist/component/Toolbar/EditorListSelect.d.ts +0 -7
  285. package/dist/component/Toolbar/EditorListSelect.js +0 -174
  286. package/dist/component/Toolbar/EditorMath.d.ts +0 -7
  287. package/dist/component/Toolbar/EditorMath.js +0 -159
  288. package/dist/component/Toolbar/EditorMore/NotificationDialog.d.ts +0 -7
  289. package/dist/component/Toolbar/EditorMore/NotificationDialog.js +0 -73
  290. package/dist/component/Toolbar/EditorMore/index.d.ts +0 -7
  291. package/dist/component/Toolbar/EditorMore/index.js +0 -112
  292. package/dist/component/Toolbar/EditorScript.d.ts +0 -7
  293. package/dist/component/Toolbar/EditorScript.js +0 -161
  294. package/dist/component/Toolbar/EditorVerticalAlignSelect.d.ts +0 -7
  295. package/dist/component/Toolbar/EditorVerticalAlignSelect.js +0 -174
  296. package/dist/component/Toolbar/Item.d.ts +0 -16
  297. package/dist/component/Toolbar/Item.js +0 -74
  298. package/dist/component/Toolbar/TableSizePicker.d.ts +0 -5
  299. package/dist/component/Toolbar/TableSizePicker.js +0 -80
  300. package/dist/component/Toolbar/index.d.ts +0 -13
  301. package/dist/component/Toolbar/index.js +0 -13
  302. package/dist/component/index.d.ts +0 -3
  303. package/dist/component/index.js +0 -3
  304. package/dist/contants/enums.d.ts +0 -32
  305. package/dist/contants/enums.js +0 -108
  306. package/dist/contants/highlight.d.ts +0 -4
  307. package/dist/contants/highlight.js +0 -580
  308. package/dist/contants/placeholder.d.ts +0 -16
  309. package/dist/contants/placeholder.js +0 -16
  310. package/dist/contants/shortcut-key.d.ts +0 -48
  311. package/dist/contants/shortcut-key.js +0 -224
  312. package/dist/contants/slash-commands.d.ts +0 -14
  313. package/dist/contants/slash-commands.js +0 -370
  314. package/dist/extension/component/Alert/index.d.ts +0 -9
  315. package/dist/extension/component/Alert/index.js +0 -204
  316. package/dist/extension/component/Attachment/Insert.d.ts +0 -13
  317. package/dist/extension/component/Attachment/Insert.js +0 -222
  318. package/dist/extension/component/Attachment/Readonly.d.ts +0 -9
  319. package/dist/extension/component/Attachment/Readonly.js +0 -92
  320. package/dist/extension/component/Attachment/index.d.ts +0 -13
  321. package/dist/extension/component/Attachment/index.js +0 -317
  322. package/dist/extension/component/Audio/Insert.d.ts +0 -10
  323. package/dist/extension/component/Audio/Insert.js +0 -351
  324. package/dist/extension/component/Audio/Readonly.d.ts +0 -8
  325. package/dist/extension/component/Audio/Readonly.js +0 -428
  326. package/dist/extension/component/Audio/index.d.ts +0 -14
  327. package/dist/extension/component/Audio/index.js +0 -740
  328. package/dist/extension/component/CodeBlock/Readonly.d.ts +0 -4
  329. package/dist/extension/component/CodeBlock/Readonly.js +0 -133
  330. package/dist/extension/component/CodeBlock/index.d.ts +0 -4
  331. package/dist/extension/component/CodeBlock/index.js +0 -291
  332. package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
  333. package/dist/extension/component/CustomLink/Insert.js +0 -176
  334. package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
  335. package/dist/extension/component/CustomLink/Readonly.js +0 -106
  336. package/dist/extension/component/CustomLink/index.d.ts +0 -0
  337. package/dist/extension/component/CustomLink/index.js +0 -440
  338. package/dist/extension/component/EmojiList/index.d.ts +0 -14
  339. package/dist/extension/component/EmojiList/index.js +0 -104
  340. package/dist/extension/component/Iframe/Insert.d.ts +0 -14
  341. package/dist/extension/component/Iframe/Insert.js +0 -112
  342. package/dist/extension/component/Iframe/Readonly.d.ts +0 -10
  343. package/dist/extension/component/Iframe/Readonly.js +0 -14
  344. package/dist/extension/component/Iframe/index.d.ts +0 -5
  345. package/dist/extension/component/Iframe/index.js +0 -290
  346. package/dist/extension/component/Image/Crop.d.ts +0 -12
  347. package/dist/extension/component/Image/Crop.js +0 -218
  348. package/dist/extension/component/Image/Insert.d.ts +0 -10
  349. package/dist/extension/component/Image/Insert.js +0 -309
  350. package/dist/extension/component/Image/Readonly.d.ts +0 -8
  351. package/dist/extension/component/Image/Readonly.js +0 -51
  352. package/dist/extension/component/Image/index.d.ts +0 -21
  353. package/dist/extension/component/Image/index.js +0 -372
  354. package/dist/extension/component/Link/Insert.d.ts +0 -10
  355. package/dist/extension/component/Link/Insert.js +0 -253
  356. package/dist/extension/component/Link/Readonly.d.ts +0 -8
  357. package/dist/extension/component/Link/Readonly.js +0 -111
  358. package/dist/extension/component/Link/index.d.ts +0 -12
  359. package/dist/extension/component/Link/index.js +0 -512
  360. package/dist/extension/component/Mathematics/block/Readonly.d.ts +0 -9
  361. package/dist/extension/component/Mathematics/block/Readonly.js +0 -35
  362. package/dist/extension/component/Mathematics/block/index.d.ts +0 -8
  363. package/dist/extension/component/Mathematics/block/index.js +0 -149
  364. package/dist/extension/component/Mathematics/index.d.ts +0 -3
  365. package/dist/extension/component/Mathematics/index.js +0 -3
  366. package/dist/extension/component/Mathematics/inline/Readonly.d.ts +0 -9
  367. package/dist/extension/component/Mathematics/inline/Readonly.js +0 -33
  368. package/dist/extension/component/Mathematics/inline/index.d.ts +0 -8
  369. package/dist/extension/component/Mathematics/inline/index.js +0 -148
  370. package/dist/extension/component/MentionList/index.d.ts +0 -13
  371. package/dist/extension/component/MentionList/index.js +0 -92
  372. package/dist/extension/component/SlashCommandsList/Overlay.d.ts +0 -10
  373. package/dist/extension/component/SlashCommandsList/Overlay.js +0 -26
  374. package/dist/extension/component/SlashCommandsList/index.d.ts +0 -4
  375. package/dist/extension/component/SlashCommandsList/index.js +0 -266
  376. package/dist/extension/component/Table/ContextMenu.d.ts +0 -10
  377. package/dist/extension/component/Table/ContextMenu.js +0 -228
  378. package/dist/extension/component/Table/TableContextMenuPlugin.d.ts +0 -9
  379. package/dist/extension/component/Table/TableContextMenuPlugin.js +0 -272
  380. package/dist/extension/component/Table/index.d.ts +0 -2
  381. package/dist/extension/component/Table/index.js +0 -2
  382. package/dist/extension/component/UploadProgress/index.d.ts +0 -10
  383. package/dist/extension/component/UploadProgress/index.js +0 -103
  384. package/dist/extension/component/Video/Insert.d.ts +0 -10
  385. package/dist/extension/component/Video/Insert.js +0 -257
  386. package/dist/extension/component/Video/Readonly.d.ts +0 -8
  387. package/dist/extension/component/Video/Readonly.js +0 -40
  388. package/dist/extension/component/Video/index.d.ts +0 -14
  389. package/dist/extension/component/Video/index.js +0 -166
  390. package/dist/extension/extension/SlashCommands.d.ts +0 -3
  391. package/dist/extension/extension/SlashCommands.js +0 -25
  392. package/dist/extension/extension/StructuredDiff.d.ts +0 -18
  393. package/dist/extension/extension/StructuredDiff.js +0 -131
  394. package/dist/extension/extension/index.d.ts +0 -2
  395. package/dist/extension/extension/index.js +0 -2
  396. package/dist/extension/index.d.ts +0 -2
  397. package/dist/extension/index.js +0 -146
  398. package/dist/extension/mark/Code.d.ts +0 -2
  399. package/dist/extension/mark/Code.js +0 -9
  400. package/dist/extension/mark/Link.d.ts +0 -0
  401. package/dist/extension/mark/Link.js +0 -58
  402. package/dist/extension/mark/index.d.ts +0 -0
  403. package/dist/extension/mark/index.js +0 -1
  404. package/dist/extension/node/Alert.d.ts +0 -33
  405. package/dist/extension/node/Alert.js +0 -116
  406. package/dist/extension/node/Attachment.d.ts +0 -28
  407. package/dist/extension/node/Attachment.js +0 -227
  408. package/dist/extension/node/Audio.d.ts +0 -23
  409. package/dist/extension/node/Audio.js +0 -194
  410. package/dist/extension/node/CodeBlockLowlight.d.ts +0 -1
  411. package/dist/extension/node/CodeBlockLowlight.js +0 -42
  412. package/dist/extension/node/Details.d.ts +0 -3
  413. package/dist/extension/node/Details.js +0 -39
  414. package/dist/extension/node/Emoji.d.ts +0 -1
  415. package/dist/extension/node/Emoji.js +0 -7
  416. package/dist/extension/node/FileHandler.d.ts +0 -4
  417. package/dist/extension/node/FileHandler.js +0 -294
  418. package/dist/extension/node/Iframe.d.ts +0 -16
  419. package/dist/extension/node/Iframe.js +0 -120
  420. package/dist/extension/node/Image.d.ts +0 -3
  421. package/dist/extension/node/Image.js +0 -38
  422. package/dist/extension/node/Indent.d.ts +0 -17
  423. package/dist/extension/node/Indent.js +0 -103
  424. package/dist/extension/node/Link/helpers/autolink.d.ts +0 -15
  425. package/dist/extension/node/Link/helpers/autolink.js +0 -162
  426. package/dist/extension/node/Link/helpers/clickHandler.d.ts +0 -10
  427. package/dist/extension/node/Link/helpers/clickHandler.js +0 -46
  428. package/dist/extension/node/Link/helpers/pasteHandler.d.ts +0 -10
  429. package/dist/extension/node/Link/helpers/pasteHandler.js +0 -32
  430. package/dist/extension/node/Link/helpers/whitespace.d.ts +0 -4
  431. package/dist/extension/node/Link/helpers/whitespace.js +0 -6
  432. package/dist/extension/node/Link/index.d.ts +0 -162
  433. package/dist/extension/node/Link/index.js +0 -461
  434. package/dist/extension/node/ListKit.d.ts +0 -2
  435. package/dist/extension/node/ListKit.js +0 -23
  436. package/dist/extension/node/Mathematics.d.ts +0 -27
  437. package/dist/extension/node/Mathematics.js +0 -97
  438. package/dist/extension/node/Mention.d.ts +0 -2
  439. package/dist/extension/node/Mention.js +0 -10
  440. package/dist/extension/node/Table.d.ts +0 -5
  441. package/dist/extension/node/Table.js +0 -283
  442. package/dist/extension/node/TableOfContents/index.d.ts +0 -9
  443. package/dist/extension/node/TableOfContents/index.js +0 -391
  444. package/dist/extension/node/TableOfContents/plugin.d.ts +0 -6
  445. package/dist/extension/node/TableOfContents/plugin.js +0 -58
  446. package/dist/extension/node/TableOfContents/type.d.ts +0 -45
  447. package/dist/extension/node/TableOfContents/type.js +0 -1
  448. package/dist/extension/node/TableOfContents/utils.d.ts +0 -6
  449. package/dist/extension/node/TableOfContents/utils.js +0 -70
  450. package/dist/extension/node/UploadProgress.d.ts +0 -21
  451. package/dist/extension/node/UploadProgress.js +0 -135
  452. package/dist/extension/node/VerticalAlign.d.ts +0 -49
  453. package/dist/extension/node/VerticalAlign.js +0 -88
  454. package/dist/extension/node/Video.d.ts +0 -23
  455. package/dist/extension/node/Video.js +0 -195
  456. package/dist/extension/node/Youtube.d.ts +0 -3
  457. package/dist/extension/node/Youtube.js +0 -14
  458. package/dist/extension/node/index.d.ts +0 -20
  459. package/dist/extension/node/index.js +0 -20
  460. package/dist/extension/suggestion/emoji.d.ts +0 -3
  461. package/dist/extension/suggestion/emoji.js +0 -57
  462. package/dist/extension/suggestion/mention.d.ts +0 -4
  463. package/dist/extension/suggestion/mention.js +0 -88
  464. package/dist/extension/suggestion/slash.d.ts +0 -39
  465. package/dist/extension/suggestion/slash.js +0 -94
  466. package/dist/hook/fn.d.ts +0 -13
  467. package/dist/hook/fn.js +0 -37
  468. package/dist/hook/index.d.ts +0 -4
  469. package/dist/hook/index.js +0 -110
  470. package/dist/index.css +0 -555
  471. package/dist/index.d.ts +0 -8
  472. package/dist/index.js +0 -8
  473. package/dist/themes/color.d.ts +0 -5
  474. package/dist/themes/color.js +0 -4
  475. package/dist/themes/componentStyleOverrides.d.ts +0 -365
  476. package/dist/themes/componentStyleOverrides.js +0 -392
  477. package/dist/themes/custom.d.ts +0 -5
  478. package/dist/themes/custom.js +0 -4
  479. package/dist/themes/dark.d.ts +0 -84
  480. package/dist/themes/dark.js +0 -84
  481. package/dist/themes/index.d.ts +0 -19
  482. package/dist/themes/index.js +0 -37
  483. package/dist/themes/light.d.ts +0 -84
  484. package/dist/themes/light.js +0 -84
  485. package/dist/themes/palette.d.ts +0 -92
  486. package/dist/themes/palette.js +0 -24
  487. package/dist/themes/shadows.d.ts +0 -2
  488. package/dist/themes/shadows.js +0 -3
  489. package/dist/themes/themeContext.d.ts +0 -8
  490. package/dist/themes/themeContext.js +0 -3
  491. package/dist/themes/typography.d.ts +0 -6
  492. package/dist/themes/typography.js +0 -8
  493. package/dist/type/index.d.ts +0 -121
  494. package/dist/type/index.js +0 -1
  495. package/dist/types/images.d.ts +0 -19
  496. package/dist/util/decorations.d.ts +0 -22
  497. package/dist/util/decorations.js +0 -302
  498. package/dist/util/fileDownload.d.ts +0 -16
  499. package/dist/util/fileDownload.js +0 -268
  500. package/dist/util/fileHandler.d.ts +0 -7
  501. package/dist/util/fileHandler.js +0 -79
  502. package/dist/util/floating.d.ts +0 -3
  503. package/dist/util/floating.js +0 -23
  504. package/dist/util/index.d.ts +0 -12
  505. package/dist/util/index.js +0 -40
  506. package/dist/util/linewiseConvert.d.ts +0 -40
  507. package/dist/util/linewiseConvert.js +0 -221
  508. package/dist/util/migrateMathStrings.d.ts +0 -73
  509. package/dist/util/migrateMathStrings.js +0 -192
  510. package/dist/util/resourceExtractor.d.ts +0 -15
  511. package/dist/util/resourceExtractor.js +0 -61
  512. package/dist/util/shortcutKey.d.ts +0 -2
  513. package/dist/util/shortcutKey.js +0 -9
  514. package/dist/util/structuredDiff.d.ts +0 -59
  515. package/dist/util/structuredDiff.js +0 -550
@@ -1,1407 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
7
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
8
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
9
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- import { AddLineIcon, AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, AttachmentLineIcon, BrushLineIcon, DeleteLineIcon, DownloadLineIcon, DraggableIcon, FontSizeIcon, FormatClearIcon, H1Icon, H2Icon, H3Icon, ImageLineIcon, IndentDecreaseIcon, IndentIncreaseIcon, Information2LineIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MovieLineIcon, Music2LineIcon, QuoteTextIcon, Repeat2LineIcon, ScissorsCutLineIcon, SeparatorIcon, TextIcon, TextWrapIcon } from "../Icons";
21
- import { NODE_TYPE_LABEL, NodeTypeEnum } from "../../contants/enums";
22
- import { Box, Divider, Stack, Typography, useTheme } from '@mui/material';
23
- import DragHandle from '@tiptap/extension-drag-handle-react';
24
- import { Fragment, Slice } from '@tiptap/pm/model';
25
- import { NodeSelection } from '@tiptap/pm/state';
26
- import React, { useCallback, useState } from 'react';
27
- import { convertNodeAt, downloadFiles, filterResourcesByType, getAllResources } from "../../util";
28
- import { FileCopyLineIcon } from "../Icons/file-copy-line-icon";
29
- import Menu from "../Menu";
30
- import { ToolbarItem } from "../Toolbar";
31
- var DragIcon = function DragIcon(_ref) {
32
- var onClick = _ref.onClick;
33
- return /*#__PURE__*/React.createElement(Box, {
34
- onClick: onClick,
35
- sx: {
36
- width: '1.25rem',
37
- height: '1.25rem',
38
- borderRadius: '0.25rem',
39
- border: '1px solid',
40
- display: 'flex',
41
- alignItems: 'center',
42
- justifyContent: 'center',
43
- color: 'text.tertiary',
44
- cursor: 'grab',
45
- borderColor: 'divider',
46
- bgcolor: 'background.paper',
47
- transition: 'all 0.2s ease-in-out',
48
- '&:hover': {
49
- color: 'text.secondary',
50
- bgcolor: 'divider'
51
- },
52
- '&:active': {
53
- color: 'text.primary',
54
- cursor: 'grabbing'
55
- }
56
- }
57
- }, /*#__PURE__*/React.createElement(DraggableIcon, {
58
- sx: {
59
- fontSize: '1.25rem'
60
- }
61
- }));
62
- };
63
- var AddIcon = function AddIcon(_ref2) {
64
- var onClick = _ref2.onClick;
65
- return /*#__PURE__*/React.createElement(Box, {
66
- onClick: onClick,
67
- sx: {
68
- width: '1.25rem',
69
- height: '1.25rem',
70
- borderRadius: '0.25rem',
71
- border: '1px solid',
72
- display: 'flex',
73
- alignItems: 'center',
74
- justifyContent: 'center',
75
- color: 'text.tertiary',
76
- cursor: 'grab',
77
- borderColor: 'divider',
78
- bgcolor: 'background.paper',
79
- transition: 'all 0.2s ease-in-out',
80
- '&:hover': {
81
- color: 'text.secondary',
82
- bgcolor: 'divider'
83
- },
84
- '&:active': {
85
- color: 'text.primary',
86
- cursor: 'grabbing'
87
- }
88
- }
89
- }, /*#__PURE__*/React.createElement(AddLineIcon, {
90
- sx: {
91
- fontSize: '1.25rem'
92
- }
93
- }));
94
- };
95
- var CustomDragHandle = function CustomDragHandle(_ref3) {
96
- var _current$node3, _current$node4, _current$node5, _current$node6, _current$node7, _current$node8, _current$node9, _current$node10, _current$node11, _current$node12, _current$node13, _current$node14, _current$node15, _current$node16;
97
- var editor = _ref3.editor,
98
- more = _ref3.more,
99
- onTip = _ref3.onTip;
100
- var theme = useTheme();
101
- var _useState = useState(true),
102
- _useState2 = _slicedToArray(_useState, 2),
103
- showFormat = _useState2[0],
104
- setShowFormat = _useState2[1];
105
- var _useState3 = useState({
106
- editor: editor,
107
- node: null,
108
- pos: -1
109
- }),
110
- _useState4 = _slicedToArray(_useState3, 2),
111
- current = _useState4[0],
112
- setCurrent = _useState4[1];
113
- var _useState5 = useState({
114
- videos: [],
115
- audios: [],
116
- images: [],
117
- attachments: []
118
- }),
119
- _useState6 = _slicedToArray(_useState5, 2),
120
- resources = _useState6[0],
121
- setResources = _useState6[1];
122
- var _useState7 = useState(null),
123
- _useState8 = _slicedToArray(_useState7, 2),
124
- currentNode = _useState8[0],
125
- setCurrentNode = _useState8[1];
126
- var THEME_TEXT_COLOR = [{
127
- label: '默认色',
128
- value: theme.palette.text.primary
129
- }, {
130
- label: '主题色',
131
- value: theme.palette.primary.main
132
- }, {
133
- label: '成功色',
134
- value: theme.palette.success.main
135
- }, {
136
- label: '警告色',
137
- value: theme.palette.warning.main
138
- }, {
139
- label: '错误色',
140
- value: theme.palette.error.main
141
- }, {
142
- label: '黑色',
143
- value: theme.palette.common.black
144
- }, {
145
- label: '灰色',
146
- value: theme.palette.text.disabled
147
- }, {
148
- label: '白色',
149
- value: theme.palette.common.white
150
- }];
151
- var THEME_TEXT_BG_COLOR = [{
152
- label: '默认背景',
153
- value: theme.palette.background.paper
154
- }, {
155
- label: '灰色背景',
156
- value: '#f8f8f7'
157
- }, {
158
- label: '棕色背景',
159
- value: '#f4eeee'
160
- }, {
161
- label: '橙色背景',
162
- value: '#fbecdd'
163
- }, {
164
- label: '黄色背景',
165
- value: '#fef9c3'
166
- }, {
167
- label: '绿色背景',
168
- value: '#dcfce7'
169
- }, {
170
- label: '蓝色背景',
171
- value: '#e0f2fe'
172
- }, {
173
- label: '紫色背景',
174
- value: '#f3e8ff'
175
- }, {
176
- label: '粉色背景',
177
- value: '#fcf1f6'
178
- }, {
179
- label: '红色背景',
180
- value: '#ffe4e6'
181
- }];
182
- var cancelNodeType = function cancelNodeType() {
183
- var _current$node;
184
- var type = (_current$node = current.node) === null || _current$node === void 0 ? void 0 : _current$node.type.name;
185
- switch (type) {
186
- case NodeTypeEnum.Paragraph:
187
- current.editor.commands.setParagraph();
188
- break;
189
- case NodeTypeEnum.Heading:
190
- current.editor.commands.setParagraph();
191
- break;
192
- case NodeTypeEnum.BulletList:
193
- current.editor.commands.toggleBulletList();
194
- break;
195
- case NodeTypeEnum.OrderedList:
196
- current.editor.commands.toggleOrderedList();
197
- break;
198
- case NodeTypeEnum.TaskList:
199
- current.editor.commands.toggleTaskList();
200
- break;
201
- case NodeTypeEnum.Blockquote:
202
- current.editor.commands.toggleBlockquote();
203
- break;
204
- case NodeTypeEnum.CodeBlock:
205
- current.editor.commands.toggleCodeBlock();
206
- break;
207
- case NodeTypeEnum.Alert:
208
- current.editor.commands.setParagraph();
209
- break;
210
- }
211
- };
212
- var selectCurrentNode = function selectCurrentNode() {
213
- var _current$editor = current.editor,
214
- state = _current$editor.state,
215
- view = _current$editor.view;
216
- var tr = state.tr;
217
- var pos = current.pos;
218
- if (pos >= 0) {
219
- var selection = NodeSelection.create(tr.doc, pos);
220
- tr.setSelection(selection);
221
- view.dispatch(tr);
222
- view.focus();
223
- }
224
- };
225
- var hasMarksDeep = function hasMarksDeep(node) {
226
- var _content;
227
- if (!node) return false;
228
- if (node.marks && node.marks.length > 0) return true;
229
- var children = (_content = node.content) === null || _content === void 0 ? void 0 : _content.content;
230
- if (!children || children.length === 0) return false;
231
- return children.some(function (child) {
232
- return hasMarksDeep(child);
233
- });
234
- };
235
- var canCurrentNodeIndent = function canCurrentNodeIndent() {
236
- return !!(current.node && current.node.type);
237
- };
238
- var getCurrentIndentLevel = function getCurrentIndentLevel() {
239
- if (!canCurrentNodeIndent()) return 0;
240
- var node = current.node;
241
- var attrs = current.editor.getAttributes(node.type.name);
242
- return Number(attrs.indent) || 0;
243
- };
244
- var shouldShowButton = function shouldShowButton(_ref4) {
245
- var editor = _ref4.editor,
246
- data = _ref4.data;
247
- if (!editor || !editor.isEditable) return false;
248
- var currentNode = data.node;
249
- var empty = (currentNode === null || currentNode === void 0 ? void 0 : currentNode.textContent) === '';
250
- if (empty) return false;
251
- var content = currentNode === null || currentNode === void 0 ? void 0 : currentNode.content.content;
252
- if (content && content.length > 0) {
253
- return content.some(function (item) {
254
- return hasMarksDeep(item);
255
- });
256
- }
257
- return false;
258
- };
259
- var updateNodeChange = useCallback(function (data) {
260
- var _data$node, _current$node2;
261
- if ((data.pos !== current.pos || ((_data$node = data.node) === null || _data$node === void 0 ? void 0 : _data$node.type.name) !== ((_current$node2 = current.node) === null || _current$node2 === void 0 ? void 0 : _current$node2.type.name)) && data.pos !== -1 || data.node === null && data.pos >= 0) {
262
- var _data$node2;
263
- var allResources = data.node ? getAllResources(data.node) : [];
264
- var videos = filterResourcesByType(allResources, [NodeTypeEnum.Video]);
265
- var audios = filterResourcesByType(allResources, [NodeTypeEnum.Audio]);
266
- var images = filterResourcesByType(allResources, [NodeTypeEnum.Image]);
267
- var attachments = filterResourcesByType(allResources, [NodeTypeEnum.InlineAttachment, NodeTypeEnum.BlockAttachment]);
268
- setCurrent(data);
269
- setCurrentNode(NODE_TYPE_LABEL[((_data$node2 = data.node) === null || _data$node2 === void 0 ? void 0 : _data$node2.type.name) || 'paragraph']);
270
- setResources({
271
- videos: videos,
272
- audios: audios,
273
- images: images,
274
- attachments: attachments
275
- });
276
- setShowFormat(shouldShowButton({
277
- editor: editor,
278
- data: data
279
- }));
280
- }
281
- }, [current.pos, current.node]);
282
- return /*#__PURE__*/React.createElement(DragHandle, {
283
- editor: editor,
284
- onNodeChange: updateNodeChange
285
- }, /*#__PURE__*/React.createElement(Stack, {
286
- direction: 'row',
287
- alignItems: 'center',
288
- gap: 1,
289
- sx: {
290
- mr: 1,
291
- height: '1.625rem'
292
- }
293
- }, /*#__PURE__*/React.createElement(AddIcon, {
294
- onClick: function onClick(event) {
295
- event.stopPropagation();
296
- if (current.node && current.pos !== undefined) {
297
- if (current.pos === 0) {
298
- current.editor.chain().focus().insertContentAt(current.pos, {
299
- type: 'paragraph',
300
- content: [{
301
- type: 'text',
302
- text: '/'
303
- }]
304
- }).run();
305
- } else {
306
- current.editor.chain().focus().insertContentAt(current.pos + current.node.nodeSize, {
307
- type: 'paragraph',
308
- content: [{
309
- type: 'text',
310
- text: '/'
311
- }]
312
- }).run();
313
- }
314
- }
315
- }
316
- }), currentNode ? /*#__PURE__*/React.createElement(Menu, {
317
- context: /*#__PURE__*/React.createElement(DragIcon, null),
318
- anchorOrigin: {
319
- vertical: 'bottom',
320
- horizontal: 'left'
321
- },
322
- transformOrigin: {
323
- vertical: 'top',
324
- horizontal: 'left'
325
- },
326
- arrowIcon: /*#__PURE__*/React.createElement(ArrowDownSLineIcon, {
327
- sx: {
328
- fontSize: '1rem',
329
- transform: 'rotate(-90deg)'
330
- }
331
- }),
332
- header: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, {
333
- direction: 'row',
334
- flexWrap: 'wrap',
335
- sx: {
336
- fontSize: 14
337
- }
338
- }, /*#__PURE__*/React.createElement(ToolbarItem, {
339
- key: 'indent-decrease',
340
- onClick: function onClick() {
341
- if (!canCurrentNodeIndent()) return;
342
- selectCurrentNode();
343
- current.editor.chain().focus().decreaseIndent().run();
344
- setCurrent(function (prev) {
345
- return _objectSpread({}, prev);
346
- });
347
- },
348
- icon: /*#__PURE__*/React.createElement(IndentDecreaseIcon, {
349
- sx: {
350
- fontSize: '1rem'
351
- }
352
- }),
353
- tip: '减少缩进',
354
- disabled: getCurrentIndentLevel() <= 0
355
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
356
- key: 'indent-increase',
357
- onClick: function onClick() {
358
- if (!canCurrentNodeIndent()) return;
359
- selectCurrentNode();
360
- current.editor.chain().focus().increaseIndent().run();
361
- setCurrent(function (prev) {
362
- return _objectSpread({}, prev);
363
- });
364
- },
365
- icon: /*#__PURE__*/React.createElement(IndentIncreaseIcon, {
366
- sx: {
367
- fontSize: '1rem'
368
- }
369
- }),
370
- tip: '增加缩进',
371
- disabled: !canCurrentNodeIndent()
372
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
373
- key: 'insert-divider',
374
- onClick: function onClick() {
375
- if (current.node && current.pos !== undefined) {
376
- var afterPos = current.pos + current.node.nodeSize;
377
- current.editor.chain().focus().insertContentAt(afterPos, {
378
- type: 'horizontalRule'
379
- }).run();
380
- }
381
- },
382
- icon: /*#__PURE__*/React.createElement(SeparatorIcon, {
383
- sx: {
384
- fontSize: '1rem'
385
- }
386
- }),
387
- tip: '分割线'
388
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
389
- key: 'copy',
390
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
391
- var content, textContent, htmlContent, blob, clipboardItem;
392
- return _regeneratorRuntime().wrap(function _callee$(_context) {
393
- while (1) switch (_context.prev = _context.next) {
394
- case 0:
395
- if (!(current.node && current.pos !== undefined)) {
396
- _context.next = 17;
397
- break;
398
- }
399
- content = new Slice(Fragment.from(current.node), 0, 0);
400
- textContent = current.node.textContent;
401
- htmlContent = editor.view.serializeForClipboard(content).dom.innerHTML;
402
- _context.prev = 4;
403
- if (!(htmlContent && navigator.clipboard && "write" in navigator.clipboard)) {
404
- _context.next = 11;
405
- break;
406
- }
407
- blob = new Blob([htmlContent], {
408
- type: "text/html"
409
- });
410
- clipboardItem = new ClipboardItem({
411
- "text/html": blob
412
- });
413
- _context.next = 10;
414
- return navigator.clipboard.write([clipboardItem]);
415
- case 10:
416
- onTip === null || onTip === void 0 || onTip('success', '复制成功');
417
- case 11:
418
- _context.next = 17;
419
- break;
420
- case 13:
421
- _context.prev = 13;
422
- _context.t0 = _context["catch"](4);
423
- _context.next = 17;
424
- return navigator.clipboard.writeText(textContent);
425
- case 17:
426
- case "end":
427
- return _context.stop();
428
- }
429
- }, _callee, null, [[4, 13]]);
430
- })),
431
- icon: /*#__PURE__*/React.createElement(FileCopyLineIcon, {
432
- sx: {
433
- fontSize: '1rem'
434
- }
435
- }),
436
- tip: "\u590D\u5236".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label)
437
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
438
- key: 'cut',
439
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
440
- var content, textContent, htmlContent, blob, clipboardItem;
441
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
442
- while (1) switch (_context2.prev = _context2.next) {
443
- case 0:
444
- if (!(current.node && current.pos !== undefined)) {
445
- _context2.next = 23;
446
- break;
447
- }
448
- _context2.prev = 1;
449
- content = new Slice(Fragment.from(current.node), 0, 0);
450
- textContent = current.node.textContent;
451
- htmlContent = editor.view.serializeForClipboard(content).dom.innerHTML;
452
- _context2.prev = 5;
453
- if (!(htmlContent && navigator.clipboard && "write" in navigator.clipboard)) {
454
- _context2.next = 11;
455
- break;
456
- }
457
- blob = new Blob([htmlContent], {
458
- type: "text/html"
459
- });
460
- clipboardItem = new ClipboardItem({
461
- "text/html": blob
462
- });
463
- _context2.next = 11;
464
- return navigator.clipboard.write([clipboardItem]);
465
- case 11:
466
- _context2.next = 17;
467
- break;
468
- case 13:
469
- _context2.prev = 13;
470
- _context2.t0 = _context2["catch"](5);
471
- _context2.next = 17;
472
- return navigator.clipboard.writeText(textContent);
473
- case 17:
474
- current.editor.chain().focus().deleteRange({
475
- from: current.pos,
476
- to: current.pos + current.node.nodeSize
477
- }).run();
478
- _context2.next = 23;
479
- break;
480
- case 20:
481
- _context2.prev = 20;
482
- _context2.t1 = _context2["catch"](1);
483
- onTip === null || onTip === void 0 || onTip('error', '剪切失败');
484
- case 23:
485
- case "end":
486
- return _context2.stop();
487
- }
488
- }, _callee2, null, [[1, 20], [5, 13]]);
489
- })),
490
- icon: /*#__PURE__*/React.createElement(ScissorsCutLineIcon, {
491
- sx: {
492
- fontSize: '1rem'
493
- }
494
- }),
495
- tip: "\u526A\u5207".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label)
496
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
497
- key: 'delete',
498
- onClick: function onClick() {
499
- if (current.node && current.pos !== undefined) {
500
- current.editor.chain().focus().deleteRange({
501
- from: current.pos,
502
- to: current.pos + current.node.nodeSize
503
- }).run();
504
- }
505
- },
506
- icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
507
- sx: {
508
- fontSize: '1rem'
509
- }
510
- }),
511
- tip: "\u5220\u9664".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label)
512
- })), /*#__PURE__*/React.createElement(Stack, {
513
- direction: 'row',
514
- flexWrap: 'wrap',
515
- sx: {
516
- fontSize: 14
517
- }
518
- }, /*#__PURE__*/React.createElement(ToolbarItem, {
519
- key: 'insert-line-break-top',
520
- onClick: function onClick() {
521
- if (current.node && current.pos !== undefined) {
522
- var afterPos = current.pos;
523
- current.editor.chain().focus().insertContentAt(afterPos, {
524
- type: 'paragraph'
525
- }, {
526
- updateSelection: true
527
- }).run();
528
- }
529
- },
530
- icon: /*#__PURE__*/React.createElement(TextWrapIcon, {
531
- sx: {
532
- fontSize: '1rem',
533
- transform: 'rotate(180deg)'
534
- }
535
- }),
536
- text: '上方插入行'
537
- }), /*#__PURE__*/React.createElement(ToolbarItem, {
538
- key: 'insert-line-break',
539
- onClick: function onClick() {
540
- if (current.node && current.pos !== undefined) {
541
- var afterPos = current.pos + current.node.nodeSize;
542
- current.editor.chain().focus().insertContentAt(afterPos, {
543
- type: 'paragraph'
544
- }).run();
545
- }
546
- },
547
- icon: /*#__PURE__*/React.createElement(TextWrapIcon, {
548
- sx: {
549
- fontSize: '1rem'
550
- }
551
- }),
552
- text: '下方插入行'
553
- })), /*#__PURE__*/React.createElement(Divider, {
554
- sx: {
555
- my: 0.5
556
- }
557
- })),
558
- list: [{
559
- customLabel: /*#__PURE__*/React.createElement(Typography, {
560
- sx: {
561
- p: 1,
562
- fontSize: '0.75rem',
563
- color: 'text.secondary',
564
- fontWeight: 'bold'
565
- }
566
- }, currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
567
- key: 'current-node'
568
- }].concat(_toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.color ? [{
569
- key: 'color',
570
- label: '颜色',
571
- maxHeight: 400,
572
- icon: /*#__PURE__*/React.createElement(BrushLineIcon, {
573
- sx: {
574
- fontSize: '1rem'
575
- }
576
- }),
577
- children: [{
578
- customLabel: /*#__PURE__*/React.createElement(Typography, {
579
- sx: {
580
- p: 1,
581
- fontSize: '0.75rem',
582
- color: 'text.secondary',
583
- fontWeight: 'bold'
584
- }
585
- }, "\u6587\u5B57\u989C\u8272"),
586
- key: 'text-color'
587
- }].concat(_toConsumableArray(THEME_TEXT_COLOR.map(function (it) {
588
- return {
589
- label: it.label,
590
- key: it.value,
591
- icon: /*#__PURE__*/React.createElement(Box, {
592
- sx: {
593
- color: it.value,
594
- width: '1rem',
595
- height: '1rem',
596
- borderRadius: '50%',
597
- bgcolor: it.value,
598
- border: '1px solid',
599
- borderColor: it.value === theme.palette.common.white ? 'divider' : 'transparent'
600
- }
601
- }),
602
- onClick: function onClick() {
603
- if (current.node && current.pos !== undefined) {
604
- var from = current.pos;
605
- var to = current.pos + current.node.nodeSize;
606
- current.editor.chain().setTextSelection({
607
- from: from,
608
- to: to
609
- }).setColor(it.value).run();
610
- }
611
- }
612
- };
613
- })), [{
614
- customLabel: /*#__PURE__*/React.createElement(Typography, {
615
- sx: {
616
- p: 1,
617
- fontSize: '0.75rem',
618
- color: 'text.secondary',
619
- fontWeight: 'bold'
620
- }
621
- }, "\u80CC\u666F\u989C\u8272"),
622
- key: 'background-color'
623
- }], _toConsumableArray(THEME_TEXT_BG_COLOR.map(function (it) {
624
- return {
625
- label: it.label,
626
- key: it.value,
627
- icon: /*#__PURE__*/React.createElement(Box, {
628
- sx: {
629
- width: '1rem',
630
- height: '1rem',
631
- borderRadius: '50%',
632
- bgcolor: it.value,
633
- border: '1px solid',
634
- borderColor: 'divider'
635
- }
636
- }),
637
- onClick: function onClick() {
638
- if (current.node && current.pos !== undefined) {
639
- var from = current.pos;
640
- var to = current.pos + current.node.nodeSize;
641
- current.editor.chain().setTextSelection({
642
- from: from,
643
- to: to
644
- }).setBackgroundColor(it.value).run();
645
- }
646
- }
647
- };
648
- })))
649
- }] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.fontSize ? [{
650
- key: 'fontSize',
651
- label: '字号',
652
- icon: /*#__PURE__*/React.createElement(FontSizeIcon, {
653
- sx: {
654
- fontSize: '1rem'
655
- }
656
- }),
657
- minWidth: 100,
658
- maxHeight: 200,
659
- children: _toConsumableArray([10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60].map(function (it) {
660
- return {
661
- label: it,
662
- key: "".concat(it, "px"),
663
- textSx: {
664
- textAlign: 'center'
665
- },
666
- onClick: function onClick() {
667
- if (current.node && current.pos !== undefined) {
668
- var from = current.pos;
669
- var to = current.pos + current.node.nodeSize;
670
- current.editor.chain().setTextSelection({
671
- from: from,
672
- to: to
673
- }).setFontSize("".concat(it, "px")).run();
674
- }
675
- }
676
- };
677
- }))
678
- }] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.align ? [{
679
- key: 'align',
680
- label: '对齐方式',
681
- icon: /*#__PURE__*/React.createElement(AlignLeftIcon, {
682
- sx: {
683
- fontSize: '1rem'
684
- }
685
- }),
686
- children: [{
687
- customLabel: /*#__PURE__*/React.createElement(Typography, {
688
- sx: {
689
- p: 1,
690
- fontSize: '0.75rem',
691
- color: 'text.secondary',
692
- fontWeight: 'bold'
693
- }
694
- }, "\u6C34\u5E73\u5BF9\u9F50\u65B9\u5F0F"),
695
- key: 'align-horizontal'
696
- }, {
697
- label: '左侧对齐',
698
- key: 'align-horizontal-left',
699
- icon: /*#__PURE__*/React.createElement(AlignLeftIcon, {
700
- sx: {
701
- fontSize: '1rem'
702
- }
703
- }),
704
- onClick: function onClick() {
705
- if (current.node && current.pos !== undefined) {
706
- var from = current.pos;
707
- var to = current.pos + current.node.nodeSize;
708
- current.editor.chain().setTextSelection({
709
- from: from,
710
- to: to
711
- }).toggleTextAlign('left').run();
712
- }
713
- }
714
- }, {
715
- label: '居中对齐',
716
- key: 'align-horizontal-center',
717
- icon: /*#__PURE__*/React.createElement(AlignCenterIcon, {
718
- sx: {
719
- fontSize: '1rem'
720
- }
721
- }),
722
- onClick: function onClick() {
723
- if (current.node && current.pos !== undefined) {
724
- var from = current.pos;
725
- var to = current.pos + current.node.nodeSize;
726
- current.editor.chain().setTextSelection({
727
- from: from,
728
- to: to
729
- }).toggleTextAlign('center').run();
730
- }
731
- }
732
- }, {
733
- label: '右侧对齐',
734
- key: 'align-horizontal-right',
735
- icon: /*#__PURE__*/React.createElement(AlignRightIcon, {
736
- sx: {
737
- fontSize: '1rem'
738
- }
739
- }),
740
- onClick: function onClick() {
741
- if (current.node && current.pos !== undefined) {
742
- var from = current.pos;
743
- var to = current.pos + current.node.nodeSize;
744
- current.editor.chain().setTextSelection({
745
- from: from,
746
- to: to
747
- }).toggleTextAlign('right').run();
748
- }
749
- }
750
- }, {
751
- label: '两端对齐',
752
- key: 'align-horizontal-justify',
753
- icon: /*#__PURE__*/React.createElement(AlignJustifyIcon, {
754
- sx: {
755
- fontSize: '1rem'
756
- }
757
- }),
758
- onClick: function onClick() {
759
- if (current.node && current.pos !== undefined) {
760
- var from = current.pos;
761
- var to = current.pos + current.node.nodeSize;
762
- current.editor.chain().setTextSelection({
763
- from: from,
764
- to: to
765
- }).toggleTextAlign('justify').run();
766
- }
767
- }
768
- }, {
769
- customLabel: /*#__PURE__*/React.createElement(Typography, {
770
- sx: {
771
- p: 1,
772
- fontSize: '0.75rem',
773
- color: 'text.secondary',
774
- fontWeight: 'bold'
775
- }
776
- }, "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F"),
777
- key: 'align-vertical'
778
- }, {
779
- label: '顶部对齐',
780
- key: 'align-vertical-top',
781
- icon: /*#__PURE__*/React.createElement(AlignTopIcon, {
782
- sx: {
783
- fontSize: '1rem'
784
- }
785
- }),
786
- onClick: function onClick() {
787
- if (current.node && current.pos !== undefined) {
788
- var from = current.pos;
789
- var to = current.pos + current.node.nodeSize;
790
- current.editor.chain().setTextSelection({
791
- from: from,
792
- to: to
793
- }).toggleVerticalAlign('top').run();
794
- }
795
- }
796
- }, {
797
- label: '居中对齐',
798
- key: 'align-vertical-center',
799
- icon: /*#__PURE__*/React.createElement(AlignCenterIcon, {
800
- sx: {
801
- fontSize: '1rem'
802
- }
803
- }),
804
- onClick: function onClick() {
805
- if (current.node && current.pos !== undefined) {
806
- var from = current.pos;
807
- var to = current.pos + current.node.nodeSize;
808
- current.editor.chain().setTextSelection({
809
- from: from,
810
- to: to
811
- }).toggleVerticalAlign('middle').run();
812
- }
813
- }
814
- }, {
815
- label: '底部对齐',
816
- key: 'align-vertical-bottom',
817
- icon: /*#__PURE__*/React.createElement(AlignBottomIcon, {
818
- sx: {
819
- fontSize: '1rem'
820
- }
821
- }),
822
- onClick: function onClick() {
823
- if (current.node && current.pos !== undefined) {
824
- var from = current.pos;
825
- var to = current.pos + current.node.nodeSize;
826
- current.editor.chain().setTextSelection({
827
- from: from,
828
- to: to
829
- }).toggleVerticalAlign('bottom').run();
830
- }
831
- }
832
- }]
833
- }] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.convert ? [{
834
- label: '转换',
835
- key: 'convert',
836
- maxHeight: 400,
837
- icon: /*#__PURE__*/React.createElement(Repeat2LineIcon, {
838
- sx: {
839
- fontSize: '1rem'
840
- }
841
- }),
842
- children: [{
843
- label: '文本',
844
- selected: ((_current$node3 = current.node) === null || _current$node3 === void 0 ? void 0 : _current$node3.type.name) === 'paragraph',
845
- key: 'convert-to-paragraph',
846
- icon: /*#__PURE__*/React.createElement(TextIcon, {
847
- sx: {
848
- fontSize: '1rem'
849
- }
850
- }),
851
- onClick: function onClick() {
852
- if (!current.node) return;
853
- var type = current.node.type.name;
854
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
855
- if (groupTypes.includes(type)) {
856
- convertNodeAt(current.editor, current.pos, current.node, {
857
- type: 'paragraph'
858
- });
859
- } else {
860
- selectCurrentNode();
861
- cancelNodeType();
862
- current.editor.commands.setParagraph();
863
- }
864
- }
865
- }, {
866
- label: '一级标题',
867
- selected: ((_current$node4 = current.node) === null || _current$node4 === void 0 ? void 0 : _current$node4.type.name) === 'heading' && ((_current$node5 = current.node) === null || _current$node5 === void 0 ? void 0 : _current$node5.attrs.level) === 1,
868
- key: 'convert-to-heading-1',
869
- icon: /*#__PURE__*/React.createElement(H1Icon, {
870
- sx: {
871
- fontSize: '1rem'
872
- }
873
- }),
874
- onClick: function onClick() {
875
- if (!current.node) return;
876
- var type = current.node.type.name;
877
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
878
- if (groupTypes.includes(type)) {
879
- convertNodeAt(current.editor, current.pos, current.node, {
880
- type: 'heading',
881
- level: 1
882
- });
883
- } else {
884
- selectCurrentNode();
885
- cancelNodeType();
886
- current.editor.commands.setHeading({
887
- level: 1
888
- });
889
- }
890
- }
891
- }, {
892
- label: '二级标题',
893
- selected: ((_current$node6 = current.node) === null || _current$node6 === void 0 ? void 0 : _current$node6.type.name) === 'heading' && ((_current$node7 = current.node) === null || _current$node7 === void 0 ? void 0 : _current$node7.attrs.level) === 2,
894
- key: 'convert-to-heading-2',
895
- icon: /*#__PURE__*/React.createElement(H2Icon, {
896
- sx: {
897
- fontSize: '1rem'
898
- }
899
- }),
900
- onClick: function onClick() {
901
- if (!current.node) return;
902
- var type = current.node.type.name;
903
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
904
- if (groupTypes.includes(type)) {
905
- convertNodeAt(current.editor, current.pos, current.node, {
906
- type: 'heading',
907
- level: 2
908
- });
909
- } else {
910
- selectCurrentNode();
911
- cancelNodeType();
912
- current.editor.commands.setHeading({
913
- level: 2
914
- });
915
- }
916
- }
917
- }, {
918
- label: '三级标题',
919
- selected: ((_current$node8 = current.node) === null || _current$node8 === void 0 ? void 0 : _current$node8.type.name) === 'heading' && ((_current$node9 = current.node) === null || _current$node9 === void 0 ? void 0 : _current$node9.attrs.level) === 3,
920
- key: 'convert-to-heading-3',
921
- icon: /*#__PURE__*/React.createElement(H3Icon, {
922
- sx: {
923
- fontSize: '1rem'
924
- }
925
- }),
926
- onClick: function onClick() {
927
- if (!current.node) return;
928
- var type = current.node.type.name;
929
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
930
- if (groupTypes.includes(type)) {
931
- convertNodeAt(current.editor, current.pos, current.node, {
932
- type: 'heading',
933
- level: 3
934
- });
935
- } else {
936
- selectCurrentNode();
937
- cancelNodeType();
938
- current.editor.commands.setHeading({
939
- level: 3
940
- });
941
- }
942
- }
943
- }, {
944
- customLabel: /*#__PURE__*/React.createElement(Divider, {
945
- sx: {
946
- my: 0.5
947
- }
948
- }),
949
- key: 'divider2'
950
- }, {
951
- label: '有序列表',
952
- selected: ((_current$node10 = current.node) === null || _current$node10 === void 0 ? void 0 : _current$node10.type.name) === 'orderedList',
953
- key: 'convert-to-ordered-list',
954
- icon: /*#__PURE__*/React.createElement(ListOrdered2Icon, {
955
- sx: {
956
- fontSize: '1rem'
957
- }
958
- }),
959
- onClick: function onClick() {
960
- if (!current.node) return;
961
- var type = current.node.type.name;
962
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
963
- if (groupTypes.includes(type)) {
964
- convertNodeAt(current.editor, current.pos, current.node, {
965
- type: 'orderedList'
966
- });
967
- } else {
968
- selectCurrentNode();
969
- cancelNodeType();
970
- current.editor.commands.toggleOrderedList();
971
- }
972
- }
973
- }, {
974
- label: '无序列表',
975
- selected: ((_current$node11 = current.node) === null || _current$node11 === void 0 ? void 0 : _current$node11.type.name) === 'bulletList',
976
- key: 'convert-to-bullet-list',
977
- icon: /*#__PURE__*/React.createElement(ListUnorderedIcon, {
978
- sx: {
979
- fontSize: '1rem'
980
- }
981
- }),
982
- onClick: function onClick() {
983
- if (!current.node) return;
984
- var type = current.node.type.name;
985
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
986
- if (groupTypes.includes(type)) {
987
- convertNodeAt(current.editor, current.pos, current.node, {
988
- type: 'bulletList'
989
- });
990
- } else {
991
- selectCurrentNode();
992
- cancelNodeType();
993
- current.editor.commands.toggleBulletList();
994
- }
995
- }
996
- }, {
997
- label: '任务列表',
998
- selected: ((_current$node12 = current.node) === null || _current$node12 === void 0 ? void 0 : _current$node12.type.name) === 'taskList',
999
- key: 'convert-to-task-list',
1000
- icon: /*#__PURE__*/React.createElement(ListCheck3Icon, {
1001
- sx: {
1002
- fontSize: '1rem'
1003
- }
1004
- }),
1005
- onClick: function onClick() {
1006
- if (!current.node) return;
1007
- var type = current.node.type.name;
1008
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
1009
- if (groupTypes.includes(type)) {
1010
- convertNodeAt(current.editor, current.pos, current.node, {
1011
- type: 'taskList'
1012
- });
1013
- } else {
1014
- selectCurrentNode();
1015
- cancelNodeType();
1016
- current.editor.commands.toggleTaskList();
1017
- }
1018
- }
1019
- }, {
1020
- customLabel: /*#__PURE__*/React.createElement(Divider, {
1021
- sx: {
1022
- my: 0.5
1023
- }
1024
- }),
1025
- key: 'divider3'
1026
- }, {
1027
- label: '引用块',
1028
- selected: ((_current$node13 = current.node) === null || _current$node13 === void 0 ? void 0 : _current$node13.type.name) === 'blockquote',
1029
- key: 'convert-to-blockquote',
1030
- icon: /*#__PURE__*/React.createElement(QuoteTextIcon, {
1031
- sx: {
1032
- fontSize: '1rem'
1033
- }
1034
- }),
1035
- onClick: function onClick() {
1036
- if (!current.node) return;
1037
- var type = current.node.type.name;
1038
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
1039
- if (groupTypes.includes(type)) {
1040
- convertNodeAt(current.editor, current.pos, current.node, {
1041
- type: 'blockquote'
1042
- });
1043
- } else {
1044
- selectCurrentNode();
1045
- cancelNodeType();
1046
- current.editor.commands.toggleBlockquote();
1047
- }
1048
- }
1049
- }, {
1050
- label: '警告提示',
1051
- selected: ((_current$node14 = current.node) === null || _current$node14 === void 0 ? void 0 : _current$node14.type.name) === 'alert',
1052
- key: 'convert-to-alert',
1053
- icon: /*#__PURE__*/React.createElement(Information2LineIcon, {
1054
- sx: {
1055
- fontSize: '1rem'
1056
- }
1057
- }),
1058
- onClick: function onClick() {
1059
- if (!current.node) return;
1060
- var type = current.node.type.name;
1061
- var groupTypes = [NodeTypeEnum.BulletList, NodeTypeEnum.OrderedList, NodeTypeEnum.TaskList, NodeTypeEnum.Blockquote, NodeTypeEnum.CodeBlock, NodeTypeEnum.Alert];
1062
- if (groupTypes.includes(type)) {
1063
- convertNodeAt(current.editor, current.pos, current.node, {
1064
- type: 'alert',
1065
- attrs: {
1066
- variant: 'info',
1067
- type: 'icon'
1068
- }
1069
- });
1070
- } else {
1071
- selectCurrentNode();
1072
- cancelNodeType();
1073
- current.editor.commands.toggleAlert({
1074
- type: 'icon',
1075
- variant: 'info'
1076
- });
1077
- }
1078
- }
1079
- }]
1080
- }] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node15 = current.node) !== null && _current$node15 !== void 0 && _current$node15.attrs.src || (_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src) ? [{
1081
- label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
1082
- key: 'download',
1083
- icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
1084
- sx: {
1085
- fontSize: '1rem'
1086
- }
1087
- }),
1088
- onClick: function () {
1089
- var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1090
- var _current$node17, node, nodeFile, nodeBlob, nodeUrl, nodeName, a;
1091
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1092
- while (1) switch (_context3.prev = _context3.next) {
1093
- case 0:
1094
- if (!(current.node && current.pos !== undefined)) {
1095
- _context3.next = 16;
1096
- break;
1097
- }
1098
- if (![NodeTypeEnum.Video, NodeTypeEnum.Audio, NodeTypeEnum.BlockAttachment].includes((_current$node17 = current.node) === null || _current$node17 === void 0 ? void 0 : _current$node17.type.name)) {
1099
- _context3.next = 16;
1100
- break;
1101
- }
1102
- node = current.node;
1103
- _context3.next = 5;
1104
- return fetch(node.attrs.src || node.attrs.url);
1105
- case 5:
1106
- nodeFile = _context3.sent;
1107
- _context3.next = 8;
1108
- return nodeFile.blob();
1109
- case 8:
1110
- nodeBlob = _context3.sent;
1111
- nodeUrl = URL.createObjectURL(nodeBlob);
1112
- nodeName = node.attrs.title || "".concat(node.type.name, ".").concat(node.attrs.src.split('.').pop());
1113
- a = document.createElement('a');
1114
- a.href = nodeUrl;
1115
- a.download = nodeName;
1116
- a.click();
1117
- URL.revokeObjectURL(nodeUrl);
1118
- case 16:
1119
- case "end":
1120
- return _context3.stop();
1121
- }
1122
- }, _callee3);
1123
- }));
1124
- function onClick() {
1125
- return _onClick.apply(this, arguments);
1126
- }
1127
- return onClick;
1128
- }()
1129
- }] : [].concat(_toConsumableArray(resources.images.length > 0 ? [{
1130
- label: '下载图片',
1131
- key: 'download-img',
1132
- icon: /*#__PURE__*/React.createElement(ImageLineIcon, {
1133
- sx: {
1134
- fontSize: '1rem'
1135
- }
1136
- }),
1137
- extra: /*#__PURE__*/React.createElement(Box, {
1138
- sx: {
1139
- lineHeight: '0.75rem',
1140
- fontSize: '0.75rem',
1141
- color: 'text.disabled',
1142
- border: '1px solid',
1143
- borderColor: 'text.disabled',
1144
- borderRadius: 'var(--mui-shape-borderRadius)',
1145
- py: 0,
1146
- px: 0.5,
1147
- minWidth: '1.25rem',
1148
- cursor: 'pointer',
1149
- display: 'flex',
1150
- alignItems: 'center',
1151
- justifyContent: 'center'
1152
- }
1153
- }, resources.images.length),
1154
- onClick: function () {
1155
- var _onClick2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1156
- var imageInfos;
1157
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1158
- while (1) switch (_context4.prev = _context4.next) {
1159
- case 0:
1160
- _context4.prev = 0;
1161
- imageInfos = resources.images.map(function (img) {
1162
- return {
1163
- src: img.attrs.src,
1164
- filename: img.attrs.alt || img.attrs.title || undefined
1165
- };
1166
- });
1167
- _context4.next = 4;
1168
- return downloadFiles(imageInfos, 'img');
1169
- case 4:
1170
- _context4.next = 9;
1171
- break;
1172
- case 6:
1173
- _context4.prev = 6;
1174
- _context4.t0 = _context4["catch"](0);
1175
- console.error('下载图片失败:', _context4.t0);
1176
- case 9:
1177
- case "end":
1178
- return _context4.stop();
1179
- }
1180
- }, _callee4, null, [[0, 6]]);
1181
- }));
1182
- function onClick() {
1183
- return _onClick2.apply(this, arguments);
1184
- }
1185
- return onClick;
1186
- }()
1187
- }] : []), _toConsumableArray(resources.videos.length > 0 ? [{
1188
- label: '下载视频',
1189
- key: 'download-video',
1190
- icon: /*#__PURE__*/React.createElement(MovieLineIcon, {
1191
- sx: {
1192
- fontSize: '1rem'
1193
- }
1194
- }),
1195
- extra: /*#__PURE__*/React.createElement(Box, {
1196
- sx: {
1197
- lineHeight: '0.75rem',
1198
- fontSize: '0.75rem',
1199
- color: 'text.disabled',
1200
- border: '1px solid',
1201
- borderColor: 'text.disabled',
1202
- borderRadius: 'var(--mui-shape-borderRadius)',
1203
- py: 0,
1204
- px: 0.5,
1205
- minWidth: '1.25rem',
1206
- cursor: 'pointer',
1207
- display: 'flex',
1208
- alignItems: 'center',
1209
- justifyContent: 'center'
1210
- }
1211
- }, resources.videos.length),
1212
- onClick: function () {
1213
- var _onClick3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1214
- var videoInfos;
1215
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1216
- while (1) switch (_context5.prev = _context5.next) {
1217
- case 0:
1218
- _context5.prev = 0;
1219
- videoInfos = resources.videos.map(function (video) {
1220
- return {
1221
- src: video.attrs.src,
1222
- filename: video.attrs.alt || video.attrs.title || undefined
1223
- };
1224
- });
1225
- _context5.next = 4;
1226
- return downloadFiles(videoInfos, 'video');
1227
- case 4:
1228
- _context5.next = 9;
1229
- break;
1230
- case 6:
1231
- _context5.prev = 6;
1232
- _context5.t0 = _context5["catch"](0);
1233
- console.error('下载视频失败:', _context5.t0);
1234
- case 9:
1235
- case "end":
1236
- return _context5.stop();
1237
- }
1238
- }, _callee5, null, [[0, 6]]);
1239
- }));
1240
- function onClick() {
1241
- return _onClick3.apply(this, arguments);
1242
- }
1243
- return onClick;
1244
- }()
1245
- }] : []), _toConsumableArray(resources.audios.length > 0 ? [{
1246
- label: '下载音频',
1247
- key: 'download-audio',
1248
- icon: /*#__PURE__*/React.createElement(Music2LineIcon, {
1249
- sx: {
1250
- fontSize: '1rem'
1251
- }
1252
- }),
1253
- extra: /*#__PURE__*/React.createElement(Box, {
1254
- sx: {
1255
- lineHeight: '0.75rem',
1256
- fontSize: '0.75rem',
1257
- color: 'text.disabled',
1258
- border: '1px solid',
1259
- borderColor: 'text.disabled',
1260
- borderRadius: 'var(--mui-shape-borderRadius)',
1261
- py: 0,
1262
- px: 0.5,
1263
- minWidth: '1.25rem',
1264
- cursor: 'pointer',
1265
- display: 'flex',
1266
- alignItems: 'center',
1267
- justifyContent: 'center'
1268
- }
1269
- }, resources.audios.length),
1270
- onClick: function () {
1271
- var _onClick4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
1272
- var audioInfos;
1273
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1274
- while (1) switch (_context6.prev = _context6.next) {
1275
- case 0:
1276
- _context6.prev = 0;
1277
- audioInfos = resources.audios.map(function (audio) {
1278
- return {
1279
- src: audio.attrs.src,
1280
- filename: audio.attrs.alt || audio.attrs.title || undefined
1281
- };
1282
- });
1283
- _context6.next = 4;
1284
- return downloadFiles(audioInfos, 'audio');
1285
- case 4:
1286
- _context6.next = 9;
1287
- break;
1288
- case 6:
1289
- _context6.prev = 6;
1290
- _context6.t0 = _context6["catch"](0);
1291
- console.error('下载音频失败:', _context6.t0);
1292
- case 9:
1293
- case "end":
1294
- return _context6.stop();
1295
- }
1296
- }, _callee6, null, [[0, 6]]);
1297
- }));
1298
- function onClick() {
1299
- return _onClick4.apply(this, arguments);
1300
- }
1301
- return onClick;
1302
- }()
1303
- }] : []), _toConsumableArray(resources.attachments.length > 0 ? [{
1304
- label: '下载附件',
1305
- key: 'download-attachment',
1306
- icon: /*#__PURE__*/React.createElement(AttachmentLineIcon, {
1307
- sx: {
1308
- fontSize: '1rem'
1309
- }
1310
- }),
1311
- extra: /*#__PURE__*/React.createElement(Box, {
1312
- sx: {
1313
- lineHeight: '0.75rem',
1314
- fontSize: '0.75rem',
1315
- color: 'text.disabled',
1316
- border: '1px solid',
1317
- borderColor: 'text.disabled',
1318
- borderRadius: 'var(--mui-shape-borderRadius)',
1319
- py: 0,
1320
- px: 0.5,
1321
- minWidth: '1.25rem',
1322
- cursor: 'pointer',
1323
- display: 'flex',
1324
- alignItems: 'center',
1325
- justifyContent: 'center'
1326
- }
1327
- }, resources.attachments.length),
1328
- onClick: function () {
1329
- var _onClick5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1330
- var attachmentInfos;
1331
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1332
- while (1) switch (_context7.prev = _context7.next) {
1333
- case 0:
1334
- _context7.prev = 0;
1335
- attachmentInfos = resources.attachments.map(function (attachment) {
1336
- return {
1337
- src: attachment.attrs.url,
1338
- filename: attachment.attrs.title || undefined
1339
- };
1340
- });
1341
- _context7.next = 4;
1342
- return downloadFiles(attachmentInfos, 'attachment');
1343
- case 4:
1344
- _context7.next = 9;
1345
- break;
1346
- case 6:
1347
- _context7.prev = 6;
1348
- _context7.t0 = _context7["catch"](0);
1349
- console.error('下载附件失败:', _context7.t0);
1350
- case 9:
1351
- case "end":
1352
- return _context7.stop();
1353
- }
1354
- }, _callee7, null, [[0, 6]]);
1355
- }));
1356
- function onClick() {
1357
- return _onClick5.apply(this, arguments);
1358
- }
1359
- return onClick;
1360
- }()
1361
- }] : []))), _toConsumableArray(more ? more : []), _toConsumableArray(showFormat ? [{
1362
- label: '文本格式化',
1363
- key: 'format',
1364
- icon: /*#__PURE__*/React.createElement(FormatClearIcon, {
1365
- sx: {
1366
- fontSize: '1rem'
1367
- }
1368
- }),
1369
- onClick: function () {
1370
- var _onClick6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1371
- var tr, _currentNode, empty, content;
1372
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1373
- while (1) switch (_context8.prev = _context8.next) {
1374
- case 0:
1375
- if (current.node && current.pos !== undefined) {
1376
- tr = current.editor.state.tr;
1377
- _currentNode = current.node;
1378
- empty = (_currentNode === null || _currentNode === void 0 ? void 0 : _currentNode.textContent) === '';
1379
- if (!empty) {
1380
- content = _currentNode === null || _currentNode === void 0 ? void 0 : _currentNode.content.content;
1381
- if (content && content.length > 0) {
1382
- tr.doc.nodesBetween(current.pos, current.pos + current.node.nodeSize, function (node, pos) {
1383
- if (!node.isInline) return true;
1384
- node.marks.forEach(function (mark) {
1385
- tr.removeMark(pos, pos + node.nodeSize, mark.type);
1386
- });
1387
- return true;
1388
- });
1389
- }
1390
- }
1391
- editor.view.dispatch(tr);
1392
- }
1393
- case 1:
1394
- case "end":
1395
- return _context8.stop();
1396
- }
1397
- }, _callee8);
1398
- }));
1399
- function onClick() {
1400
- return _onClick6.apply(this, arguments);
1401
- }
1402
- return onClick;
1403
- }()
1404
- }] : []))
1405
- }) : /*#__PURE__*/React.createElement(DragIcon, null)));
1406
- };
1407
- export default CustomDragHandle;