@cgboiler/biz-basic 1.0.53 → 1.0.55

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 (321) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.js +1 -1
  3. package/es/rich-text-editor/RichTextEditor.d.ts +14 -5
  4. package/es/rich-text-editor/RichTextEditor.js +76 -196
  5. package/es/rich-text-editor/_atomic.css +2 -1
  6. package/es/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
  7. package/es/rich-text-editor/extensions/ConsumedTrigger.js +22 -0
  8. package/es/rich-text-editor/extensions/CustomContent.d.ts +5 -0
  9. package/es/rich-text-editor/extensions/CustomContent.js +103 -0
  10. package/es/rich-text-editor/extensions/HashTag.d.ts +15 -0
  11. package/es/rich-text-editor/extensions/HashTag.js +133 -0
  12. package/es/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
  13. package/es/rich-text-editor/extensions/HorizontalRule.js +16 -0
  14. package/es/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
  15. package/es/rich-text-editor/extensions/IMEComposition.js +30 -0
  16. package/es/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
  17. package/es/rich-text-editor/extensions/ImageUpload.js +80 -0
  18. package/es/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
  19. package/es/rich-text-editor/extensions/MarkdownExtensions.js +35 -0
  20. package/es/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
  21. package/es/rich-text-editor/extensions/MediaInputRules.js +47 -0
  22. package/es/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
  23. package/es/rich-text-editor/extensions/MentionExtension.js +60 -0
  24. package/es/rich-text-editor/extensions/index.d.ts +16 -0
  25. package/es/rich-text-editor/extensions/index.js +20 -0
  26. package/es/rich-text-editor/hooks/index.d.ts +6 -0
  27. package/es/rich-text-editor/hooks/index.js +4 -0
  28. package/es/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
  29. package/es/rich-text-editor/hooks/useEditorHistory.js +87 -0
  30. package/es/rich-text-editor/index copy 2.css +1 -0
  31. package/es/rich-text-editor/index copy 2.less +598 -0
  32. package/es/rich-text-editor/index copy.css +1 -0
  33. package/es/rich-text-editor/index copy.less +356 -0
  34. package/es/rich-text-editor/index.css +1 -1
  35. package/es/rich-text-editor/index.less +444 -254
  36. package/es/rich-text-editor/lib/utils.d.ts +123 -0
  37. package/es/rich-text-editor/lib/utils.js +244 -0
  38. package/es/rich-text-editor/menu-system/components/_atomic.css +44 -0
  39. package/es/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
  40. package/es/rich-text-editor/menu-system/components/blockquote-button.js +75 -0
  41. package/es/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
  42. package/es/rich-text-editor/menu-system/components/code-block-button.js +75 -0
  43. package/es/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
  44. package/es/rich-text-editor/menu-system/components/color-highlight-button.js +102 -0
  45. package/es/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
  46. package/es/rich-text-editor/menu-system/components/color-highlight-popover.js +99 -0
  47. package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
  48. package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.js +102 -0
  49. package/es/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
  50. package/es/rich-text-editor/menu-system/components/horizontal-rule-button.js +42 -0
  51. package/es/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
  52. package/es/rich-text-editor/menu-system/components/image-upload-button.js +71 -0
  53. package/es/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
  54. package/es/rich-text-editor/menu-system/components/image-upload-node.js +299 -0
  55. package/es/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
  56. package/es/rich-text-editor/menu-system/components/link-popover.js +127 -0
  57. package/es/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
  58. package/es/rich-text-editor/menu-system/components/list-button.js +69 -0
  59. package/es/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
  60. package/es/rich-text-editor/menu-system/components/list-dropdown-menu.js +97 -0
  61. package/es/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
  62. package/es/rich-text-editor/menu-system/components/mark-button.js +80 -0
  63. package/es/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
  64. package/es/rich-text-editor/menu-system/components/text-align-button.js +80 -0
  65. package/es/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
  66. package/es/rich-text-editor/menu-system/components/undo-redo-button.js +77 -0
  67. package/es/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
  68. package/es/rich-text-editor/menu-system/hooks/use-blockquote.js +140 -0
  69. package/es/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
  70. package/es/rich-text-editor/menu-system/hooks/use-code-block.js +140 -0
  71. package/es/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
  72. package/es/rich-text-editor/menu-system/hooks/use-color-highlight.js +166 -0
  73. package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
  74. package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +46 -0
  75. package/es/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
  76. package/es/rich-text-editor/menu-system/hooks/use-element-rect.js +132 -0
  77. package/es/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
  78. package/es/rich-text-editor/menu-system/hooks/use-file-upload.js +135 -0
  79. package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
  80. package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +70 -0
  81. package/es/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
  82. package/es/rich-text-editor/menu-system/hooks/use-heading.js +166 -0
  83. package/es/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
  84. package/es/rich-text-editor/menu-system/hooks/use-image-upload.js +103 -0
  85. package/es/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
  86. package/es/rich-text-editor/menu-system/hooks/use-link-popover.js +62 -0
  87. package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
  88. package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +121 -0
  89. package/es/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
  90. package/es/rich-text-editor/menu-system/hooks/use-list.js +191 -0
  91. package/es/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
  92. package/es/rich-text-editor/menu-system/hooks/use-mark.js +109 -0
  93. package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
  94. package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.js +134 -0
  95. package/es/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
  96. package/es/rich-text-editor/menu-system/hooks/use-mobile.js +20 -0
  97. package/es/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
  98. package/es/rich-text-editor/menu-system/hooks/use-text-align.js +113 -0
  99. package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
  100. package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.js +45 -0
  101. package/es/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
  102. package/es/rich-text-editor/menu-system/hooks/use-undo-redo.js +96 -0
  103. package/es/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
  104. package/es/rich-text-editor/menu-system/hooks/use-window-size.js +74 -0
  105. package/es/rich-text-editor/menu-system/icons/_atomic.css +32 -0
  106. package/es/rich-text-editor/menu-system/icons/index.d.ts +546 -0
  107. package/es/rich-text-editor/menu-system/icons/index.js +487 -0
  108. package/es/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
  109. package/es/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
  110. package/es/rich-text-editor/menu-system/primitives/button.js +107 -0
  111. package/es/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
  112. package/es/rich-text-editor/menu-system/primitives/card.js +116 -0
  113. package/es/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
  114. package/es/rich-text-editor/menu-system/primitives/input.js +55 -0
  115. package/es/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
  116. package/es/rich-text-editor/menu-system/primitives/separator.js +42 -0
  117. package/es/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
  118. package/es/rich-text-editor/menu-system/primitives/toolbar.js +149 -0
  119. package/es/rich-text-editor/menu-system/styles/animations.css +1 -0
  120. package/es/rich-text-editor/menu-system/styles/animations.less +91 -0
  121. package/es/rich-text-editor/menu-system/styles/button-colors.css +1 -0
  122. package/es/rich-text-editor/menu-system/styles/button-colors.less +142 -0
  123. package/es/rich-text-editor/menu-system/styles/button-group.css +1 -0
  124. package/es/rich-text-editor/menu-system/styles/button-group.less +23 -0
  125. package/es/rich-text-editor/menu-system/styles/button.css +1 -0
  126. package/es/rich-text-editor/menu-system/styles/button.less +322 -0
  127. package/es/rich-text-editor/menu-system/styles/card.css +1 -0
  128. package/es/rich-text-editor/menu-system/styles/card.less +78 -0
  129. package/es/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
  130. package/es/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
  131. package/es/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
  132. package/es/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
  133. package/es/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
  134. package/es/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
  135. package/es/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
  136. package/es/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
  137. package/es/rich-text-editor/menu-system/styles/input.css +1 -0
  138. package/es/rich-text-editor/menu-system/styles/input.less +53 -0
  139. package/es/rich-text-editor/menu-system/styles/link-popover.css +1 -0
  140. package/es/rich-text-editor/menu-system/styles/link-popover.less +32 -0
  141. package/es/rich-text-editor/menu-system/styles/separator.css +1 -0
  142. package/es/rich-text-editor/menu-system/styles/separator.less +26 -0
  143. package/es/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
  144. package/es/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
  145. package/es/rich-text-editor/menu-system/styles/toolbar.css +1 -0
  146. package/es/rich-text-editor/menu-system/styles/toolbar.less +87 -0
  147. package/es/rich-text-editor/menu-system/styles/variables.css +1 -0
  148. package/es/rich-text-editor/menu-system/styles/variables.less +296 -0
  149. package/es/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
  150. package/es/rich-text-editor/menu-system/utils/tiptap-utils.js +243 -0
  151. package/es/rich-text-editor/types.d.ts +4 -0
  152. package/es/rich-text-editor/types.js +4 -0
  153. package/es/rich-text-editor/useExtensions.d.ts +3 -3
  154. package/es/rich-text-editor/useExtensions.js +63 -428
  155. package/es/rich-text-editor/utils/eventHandlers.d.ts +37 -0
  156. package/es/rich-text-editor/utils/eventHandlers.js +103 -0
  157. package/es/rich-text-editor/utils/index.d.ts +6 -0
  158. package/es/rich-text-editor/utils/index.js +19 -0
  159. package/es/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
  160. package/es/rich-text-editor/utils/triggerHelpers.js +46 -0
  161. package/lib/index.d.ts +1 -1
  162. package/lib/index.js +1 -1
  163. package/lib/rich-text-editor/RichTextEditor.d.ts +14 -5
  164. package/lib/rich-text-editor/RichTextEditor.js +76 -206
  165. package/lib/rich-text-editor/_atomic.css +2 -1
  166. package/lib/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
  167. package/lib/rich-text-editor/extensions/ConsumedTrigger.js +41 -0
  168. package/lib/rich-text-editor/extensions/CustomContent.d.ts +5 -0
  169. package/lib/rich-text-editor/extensions/CustomContent.js +132 -0
  170. package/lib/rich-text-editor/extensions/HashTag.d.ts +15 -0
  171. package/lib/rich-text-editor/extensions/HashTag.js +157 -0
  172. package/lib/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
  173. package/lib/rich-text-editor/extensions/HorizontalRule.js +45 -0
  174. package/lib/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
  175. package/lib/rich-text-editor/extensions/IMEComposition.js +49 -0
  176. package/lib/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
  177. package/lib/rich-text-editor/extensions/ImageUpload.js +99 -0
  178. package/lib/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
  179. package/lib/rich-text-editor/extensions/MarkdownExtensions.js +54 -0
  180. package/lib/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
  181. package/lib/rich-text-editor/extensions/MediaInputRules.js +66 -0
  182. package/lib/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
  183. package/lib/rich-text-editor/extensions/MentionExtension.js +89 -0
  184. package/lib/rich-text-editor/extensions/index.d.ts +16 -0
  185. package/lib/rich-text-editor/extensions/index.js +49 -0
  186. package/lib/rich-text-editor/hooks/index.d.ts +6 -0
  187. package/lib/rich-text-editor/hooks/index.js +23 -0
  188. package/lib/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
  189. package/lib/rich-text-editor/hooks/useEditorHistory.js +116 -0
  190. package/lib/rich-text-editor/index copy 2.css +1 -0
  191. package/lib/rich-text-editor/index copy 2.less +598 -0
  192. package/lib/rich-text-editor/index copy.css +1 -0
  193. package/lib/rich-text-editor/index copy.less +356 -0
  194. package/lib/rich-text-editor/index.css +1 -1
  195. package/lib/rich-text-editor/index.less +444 -254
  196. package/lib/rich-text-editor/lib/utils.d.ts +123 -0
  197. package/lib/rich-text-editor/lib/utils.js +263 -0
  198. package/lib/rich-text-editor/menu-system/components/_atomic.css +44 -0
  199. package/lib/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
  200. package/lib/rich-text-editor/menu-system/components/blockquote-button.js +94 -0
  201. package/lib/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
  202. package/lib/rich-text-editor/menu-system/components/code-block-button.js +94 -0
  203. package/lib/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
  204. package/lib/rich-text-editor/menu-system/components/color-highlight-button.js +119 -0
  205. package/lib/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
  206. package/lib/rich-text-editor/menu-system/components/color-highlight-popover.js +118 -0
  207. package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
  208. package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.js +131 -0
  209. package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
  210. package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.js +61 -0
  211. package/lib/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
  212. package/lib/rich-text-editor/menu-system/components/image-upload-button.js +90 -0
  213. package/lib/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
  214. package/lib/rich-text-editor/menu-system/components/image-upload-node.js +316 -0
  215. package/lib/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
  216. package/lib/rich-text-editor/menu-system/components/link-popover.js +146 -0
  217. package/lib/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
  218. package/lib/rich-text-editor/menu-system/components/list-button.js +88 -0
  219. package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
  220. package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.js +116 -0
  221. package/lib/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
  222. package/lib/rich-text-editor/menu-system/components/mark-button.js +99 -0
  223. package/lib/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
  224. package/lib/rich-text-editor/menu-system/components/text-align-button.js +99 -0
  225. package/lib/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
  226. package/lib/rich-text-editor/menu-system/components/undo-redo-button.js +96 -0
  227. package/lib/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
  228. package/lib/rich-text-editor/menu-system/hooks/use-blockquote.js +154 -0
  229. package/lib/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
  230. package/lib/rich-text-editor/menu-system/hooks/use-code-block.js +154 -0
  231. package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
  232. package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.js +185 -0
  233. package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
  234. package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +65 -0
  235. package/lib/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
  236. package/lib/rich-text-editor/menu-system/hooks/use-element-rect.js +149 -0
  237. package/lib/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
  238. package/lib/rich-text-editor/menu-system/hooks/use-file-upload.js +154 -0
  239. package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
  240. package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +84 -0
  241. package/lib/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
  242. package/lib/rich-text-editor/menu-system/hooks/use-heading.js +190 -0
  243. package/lib/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
  244. package/lib/rich-text-editor/menu-system/hooks/use-image-upload.js +122 -0
  245. package/lib/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
  246. package/lib/rich-text-editor/menu-system/hooks/use-link-popover.js +81 -0
  247. package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
  248. package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +140 -0
  249. package/lib/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
  250. package/lib/rich-text-editor/menu-system/hooks/use-list.js +205 -0
  251. package/lib/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
  252. package/lib/rich-text-editor/menu-system/hooks/use-mark.js +138 -0
  253. package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
  254. package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.js +153 -0
  255. package/lib/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
  256. package/lib/rich-text-editor/menu-system/hooks/use-mobile.js +39 -0
  257. package/lib/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
  258. package/lib/rich-text-editor/menu-system/hooks/use-text-align.js +132 -0
  259. package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
  260. package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.js +64 -0
  261. package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
  262. package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.js +115 -0
  263. package/lib/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
  264. package/lib/rich-text-editor/menu-system/hooks/use-window-size.js +93 -0
  265. package/lib/rich-text-editor/menu-system/icons/_atomic.css +32 -0
  266. package/lib/rich-text-editor/menu-system/icons/index.d.ts +546 -0
  267. package/lib/rich-text-editor/menu-system/icons/index.js +506 -0
  268. package/lib/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
  269. package/lib/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
  270. package/lib/rich-text-editor/menu-system/primitives/button.js +126 -0
  271. package/lib/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
  272. package/lib/rich-text-editor/menu-system/primitives/card.js +135 -0
  273. package/lib/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
  274. package/lib/rich-text-editor/menu-system/primitives/input.js +74 -0
  275. package/lib/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
  276. package/lib/rich-text-editor/menu-system/primitives/separator.js +61 -0
  277. package/lib/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
  278. package/lib/rich-text-editor/menu-system/primitives/toolbar.js +168 -0
  279. package/lib/rich-text-editor/menu-system/styles/animations.css +1 -0
  280. package/lib/rich-text-editor/menu-system/styles/animations.less +91 -0
  281. package/lib/rich-text-editor/menu-system/styles/button-colors.css +1 -0
  282. package/lib/rich-text-editor/menu-system/styles/button-colors.less +142 -0
  283. package/lib/rich-text-editor/menu-system/styles/button-group.css +1 -0
  284. package/lib/rich-text-editor/menu-system/styles/button-group.less +23 -0
  285. package/lib/rich-text-editor/menu-system/styles/button.css +1 -0
  286. package/lib/rich-text-editor/menu-system/styles/button.less +322 -0
  287. package/lib/rich-text-editor/menu-system/styles/card.css +1 -0
  288. package/lib/rich-text-editor/menu-system/styles/card.less +78 -0
  289. package/lib/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
  290. package/lib/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
  291. package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
  292. package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
  293. package/lib/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
  294. package/lib/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
  295. package/lib/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
  296. package/lib/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
  297. package/lib/rich-text-editor/menu-system/styles/input.css +1 -0
  298. package/lib/rich-text-editor/menu-system/styles/input.less +53 -0
  299. package/lib/rich-text-editor/menu-system/styles/link-popover.css +1 -0
  300. package/lib/rich-text-editor/menu-system/styles/link-popover.less +32 -0
  301. package/lib/rich-text-editor/menu-system/styles/separator.css +1 -0
  302. package/lib/rich-text-editor/menu-system/styles/separator.less +26 -0
  303. package/lib/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
  304. package/lib/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
  305. package/lib/rich-text-editor/menu-system/styles/toolbar.css +1 -0
  306. package/lib/rich-text-editor/menu-system/styles/toolbar.less +87 -0
  307. package/lib/rich-text-editor/menu-system/styles/variables.css +1 -0
  308. package/lib/rich-text-editor/menu-system/styles/variables.less +296 -0
  309. package/lib/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
  310. package/lib/rich-text-editor/menu-system/utils/tiptap-utils.js +262 -0
  311. package/lib/rich-text-editor/types.d.ts +4 -0
  312. package/lib/rich-text-editor/types.js +4 -0
  313. package/lib/rich-text-editor/useExtensions.d.ts +3 -3
  314. package/lib/rich-text-editor/useExtensions.js +64 -429
  315. package/lib/rich-text-editor/utils/eventHandlers.d.ts +37 -0
  316. package/lib/rich-text-editor/utils/eventHandlers.js +132 -0
  317. package/lib/rich-text-editor/utils/index.d.ts +6 -0
  318. package/lib/rich-text-editor/utils/index.js +32 -0
  319. package/lib/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
  320. package/lib/rich-text-editor/utils/triggerHelpers.js +65 -0
  321. package/package.json +13 -3
package/es/index.d.ts CHANGED
@@ -5,6 +5,6 @@ declare namespace _default {
5
5
  }
6
6
  export default _default;
7
7
  export function install(app: any): void;
8
- export const version: "1.0.52";
8
+ export const version: "1.0.54";
9
9
  import RichTextEditor from './rich-text-editor';
10
10
  export { RichTextEditor };
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import RichTextEditor from "./rich-text-editor";
2
- const version = "1.0.52";
2
+ const version = "1.0.54";
3
3
  function install(app) {
4
4
  const components = [
5
5
  RichTextEditor
@@ -16,7 +16,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
- }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ showMenu: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "hashTag-clicked" | "mention-clicked" | "customContent-clicked" | "customContent-hovered" | "update:modelValue" | "customContent-triggered" | "customContent-input" | "customContent-exit")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "hashTag-clicked" | "mention-clicked" | "customContent-clicked" | "customContent-hovered" | "update:modelValue" | "customContent-triggered" | "customContent-input" | "customContent-exit", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
24
  modelValue: {
21
25
  type: StringConstructor;
22
26
  default: string;
@@ -32,26 +36,31 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
32
36
  type: BooleanConstructor;
33
37
  default: boolean;
34
38
  };
39
+ showMenu: {
40
+ type: BooleanConstructor;
41
+ default: boolean;
42
+ };
35
43
  }>> & Readonly<{
36
44
  onFocus?: ((...args: any[]) => any) | undefined;
37
45
  onBlur?: ((...args: any[]) => any) | undefined;
46
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
38
47
  "onHashTag-triggered"?: ((...args: any[]) => any) | undefined;
39
48
  "onHashTag-input"?: ((...args: any[]) => any) | undefined;
40
49
  "onHashTag-exit"?: ((...args: any[]) => any) | undefined;
41
50
  "onMention-triggered"?: ((...args: any[]) => any) | undefined;
42
51
  "onMention-input"?: ((...args: any[]) => any) | undefined;
43
52
  "onMention-exit"?: ((...args: any[]) => any) | undefined;
44
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
45
- "onMention-clicked"?: ((...args: any[]) => any) | undefined;
46
53
  "onHashTag-clicked"?: ((...args: any[]) => any) | undefined;
54
+ "onMention-clicked"?: ((...args: any[]) => any) | undefined;
55
+ "onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
56
+ "onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
47
57
  "onCustomContent-triggered"?: ((...args: any[]) => any) | undefined;
48
58
  "onCustomContent-input"?: ((...args: any[]) => any) | undefined;
49
59
  "onCustomContent-exit"?: ((...args: any[]) => any) | undefined;
50
- "onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
51
- "onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
52
60
  }>, {
53
61
  modelValue: string;
54
62
  placeholder: string;
55
63
  editable: boolean;
64
+ showMenu: boolean;
56
65
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
66
  export default _default;
@@ -1,33 +1,20 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
1
  import { createVNode as _createVNode } from "vue";
22
2
  import "./_atomic.css";
23
3
  import { defineComponent, onMounted, onBeforeUnmount, ref, watch, nextTick } from "vue";
24
4
  import { Editor, EditorContent } from "@tiptap/vue-3";
25
- import Viewer from "viewerjs";
26
5
  import "viewerjs/dist/viewer.css";
27
6
  import { useExtensions } from "./useExtensions";
28
- import localforage from "localforage";
7
+ import { useEditorHistory } from "./hooks/useEditorHistory";
8
+ import { createHashTagClickHandler, createMentionClickHandler, createCustomContentClickHandler, createCustomContentHoverHandler, createImageClickHandler } from "./utils/eventHandlers";
29
9
  import { richTextEditorProps } from "./types";
30
10
  import "./index.css";
11
+ import { Toolbar, ToolbarGroup, ToolbarSeparator } from "./menu-system/primitives/toolbar";
12
+ import { HeadingDropdownMenu } from "./menu-system/components/heading-dropdown-menu";
13
+ import { ListDropdownMenu } from "./menu-system/components/list-dropdown-menu";
14
+ import { BlockquoteButton } from "./menu-system/components/blockquote-button";
15
+ import { CodeBlockButton } from "./menu-system/components/code-block-button";
16
+ import { MarkButton } from "./menu-system/components/mark-button";
17
+ import { HorizontalRuleButton } from "./menu-system/components/horizontal-rule-button";
31
18
  var stdin_default = defineComponent({
32
19
  name: "RichTextEditor",
33
20
  props: richTextEditorProps,
@@ -37,24 +24,26 @@ var stdin_default = defineComponent({
37
24
  expose
38
25
  }) {
39
26
  const editor = ref();
27
+ const viewerRef = ref(null);
40
28
  const extensions = useExtensions({
41
29
  props,
42
30
  emit
43
31
  });
32
+ useEditorHistory({
33
+ editor: () => editor.value,
34
+ enabled: props.editable
35
+ });
36
+ const imageClickHandler = createImageClickHandler(viewerRef);
37
+ const hashTagClickHandler = createHashTagClickHandler(emit);
38
+ const mentionClickHandler = createMentionClickHandler(emit);
39
+ const customContentClickHandler = createCustomContentClickHandler(emit);
40
+ const customContentHoverHandler = createCustomContentHoverHandler(emit);
44
41
  let isFocusFromPlaceholder = false;
45
42
  const initEditor = () => {
46
43
  editor.value = new Editor({
47
44
  extensions,
48
45
  content: props.modelValue,
49
46
  editable: props.editable,
50
- // onMount: ({ editor }) => {
51
- // // 非可编辑状态下,需要手动设置 contenteditable 为 false
52
- // if (props.editable === false) {
53
- // editor.setOptions({
54
- // editable: false,
55
- // });
56
- // }
57
- // },
58
47
  onUpdate: ({
59
48
  editor: editor2
60
49
  }) => {
@@ -138,186 +127,77 @@ var stdin_default = defineComponent({
138
127
  var _a;
139
128
  (_a = editor.value) == null ? void 0 : _a.setEditable(val);
140
129
  });
141
- const viewerRef = ref(null);
142
- const imageClickHandler = (event) => {
143
- const target = event.target;
144
- if (target.tagName === "IMG") {
145
- if (viewerRef.value) {
146
- viewerRef.value.destroy();
147
- }
148
- viewerRef.value = new Viewer(target, {
149
- inline: false,
150
- navbar: true,
151
- title: true,
152
- toolbar: {
153
- zoomIn: true,
154
- zoomOut: true,
155
- oneToOne: true,
156
- reset: true,
157
- prev: false,
158
- next: false,
159
- rotateLeft: true,
160
- rotateRight: true,
161
- flipHorizontal: true,
162
- flipVertical: true
163
- }
164
- });
165
- viewerRef.value.show();
166
- event.stopPropagation();
167
- event.preventDefault();
168
- }
169
- };
170
- const hashTagClickHandler = (event) => {
171
- const target = event.target;
172
- const tagEl = target.closest(".hash-tag") || null;
173
- if (tagEl) {
174
- const id = tagEl.getAttribute("data-id") || "";
175
- const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
176
- const trigger = tagEl.getAttribute("data-hash-tag") || "#";
177
- const tagType = tagEl.getAttribute("data-tag-type") || "";
178
- emit("hashTag-clicked", {
179
- hashTagId: id,
180
- name: label,
181
- trigger,
182
- type: tagType
183
- });
184
- event.stopPropagation();
185
- event.preventDefault();
186
- return;
187
- }
188
- };
189
- const mentionClickHandler = (event) => {
190
- const target = event.target;
191
- const tagEl = target.closest(".mention") || null;
192
- if (tagEl) {
193
- const id = tagEl.getAttribute("data-id") || "";
194
- const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
195
- emit("mention-clicked", {
196
- userId: id,
197
- name: label
198
- });
199
- event.stopPropagation();
200
- event.preventDefault();
201
- return;
202
- }
203
- };
204
- const customContentClickHandler = (event) => {
205
- const target = event.target;
206
- const tagEl = target.closest(".custom-content") || null;
207
- if (tagEl) {
208
- const objStr = tagEl.getAttribute("obj") || "{}";
209
- const label = tagEl.getAttribute("file-label") || "";
210
- try {
211
- const obj = JSON.parse(objStr);
212
- emit("customContent-clicked", {
213
- obj,
214
- label
215
- });
216
- } catch (e) {
217
- console.error("Failed to parse custom content obj:", e);
218
- }
219
- event.stopPropagation();
220
- event.preventDefault();
221
- return;
130
+ const addEventListeners = () => {
131
+ var _a, _b;
132
+ const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
133
+ if (editorElement) {
134
+ editorElement.addEventListener("click", imageClickHandler);
135
+ editorElement.addEventListener("click", hashTagClickHandler);
136
+ editorElement.addEventListener("click", mentionClickHandler);
137
+ editorElement.addEventListener("click", customContentClickHandler);
138
+ editorElement.addEventListener("mouseover", customContentHoverHandler);
222
139
  }
223
140
  };
224
- const customContentHoverHandler = (event) => {
225
- const target = event.target;
226
- const tagEl = target.closest(".custom-content") || null;
227
- if (tagEl) {
228
- const objStr = tagEl.getAttribute("obj") || "{}";
229
- const label = tagEl.getAttribute("file-label") || "";
230
- try {
231
- const obj = JSON.parse(objStr);
232
- emit("customContent-hovered", {
233
- obj,
234
- label
235
- });
236
- } catch (e) {
237
- console.error("Failed to parse custom content obj:", e);
238
- }
239
- event.stopPropagation();
240
- event.preventDefault();
241
- return;
141
+ const removeEventListeners = () => {
142
+ var _a, _b;
143
+ const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
144
+ if (editorElement) {
145
+ editorElement.removeEventListener("click", imageClickHandler);
146
+ editorElement.removeEventListener("click", hashTagClickHandler);
147
+ editorElement.removeEventListener("click", mentionClickHandler);
148
+ editorElement.removeEventListener("click", customContentClickHandler);
149
+ editorElement.removeEventListener("mouseover", customContentHoverHandler);
242
150
  }
243
151
  };
244
- const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
245
- const MAX_HISTORY_ITEMS = 10;
246
- let saveTimeoutId = null;
247
- const noteId = ref("");
248
- const historyStore = localforage.createInstance({
249
- name: "RichTextEditorHistory",
250
- storeName: "notes"
251
- });
252
- const saveLoop = () => __async(this, null, function* () {
253
- if (editor.value && !editor.value.isDestroyed && editor.value.isEditable) {
254
- const content = editor.value.getHTML();
255
- const now = /* @__PURE__ */ new Date();
256
- const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
257
- const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
258
- if (content !== "<p></p>") {
259
- yield historyStore.setItem(noteId.value, {
260
- title: noteTitle,
261
- content
262
- });
263
- let metadata = (yield historyStore.getItem(HISTORY_METADATA_KEY)) || [];
264
- const existingNoteIndex = metadata.findIndex((meta) => meta.id === noteId.value);
265
- if (existingNoteIndex === -1) {
266
- metadata.push({
267
- id: noteId.value,
268
- timestamp: now.getTime()
269
- });
270
- metadata.sort((a, b) => b.timestamp - a.timestamp);
271
- if (metadata.length > MAX_HISTORY_ITEMS) {
272
- const itemsToRemove = metadata.splice(MAX_HISTORY_ITEMS);
273
- for (const item of itemsToRemove) {
274
- yield historyStore.removeItem(item.id);
275
- }
276
- }
277
- yield historyStore.setItem(HISTORY_METADATA_KEY, metadata);
278
- }
279
- }
280
- }
281
- saveTimeoutId = setTimeout(saveLoop, 1e4);
282
- });
283
152
  onMounted(() => {
284
153
  initEditor();
285
- const now = /* @__PURE__ */ new Date();
286
- noteId.value = `note-${now.getTime()}`;
287
- if (props.editable) {
288
- saveLoop();
289
- }
290
154
  nextTick(() => {
291
- var _a, _b;
292
- const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
293
- if (editorElement) {
294
- editorElement.addEventListener("click", imageClickHandler);
295
- editorElement.addEventListener("click", hashTagClickHandler);
296
- editorElement.addEventListener("click", mentionClickHandler);
297
- editorElement.addEventListener("click", customContentClickHandler);
298
- editorElement.addEventListener("mouseover", customContentHoverHandler);
299
- }
155
+ addEventListeners();
300
156
  });
301
157
  });
302
158
  onBeforeUnmount(() => {
303
- var _a, _b, _c;
304
- if (saveTimeoutId) {
305
- clearTimeout(saveTimeoutId);
306
- }
307
- const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
308
- if (editorElement) {
309
- editorElement.removeEventListener("click", imageClickHandler);
310
- editorElement.removeEventListener("click", hashTagClickHandler);
311
- editorElement.removeEventListener("click", mentionClickHandler);
312
- editorElement.removeEventListener("click", customContentClickHandler);
313
- editorElement.removeEventListener("mouseover", customContentHoverHandler);
159
+ var _a;
160
+ if (viewerRef.value) {
161
+ viewerRef.value.destroy();
314
162
  }
315
- (_c = editor.value) == null ? void 0 : _c.destroy();
163
+ removeEventListeners();
164
+ (_a = editor.value) == null ? void 0 : _a.destroy();
316
165
  });
317
- return () => _createVNode(EditorContent, {
166
+ return () => _createVNode("div", {
167
+ "class": "tiptap-editor-container"
168
+ }, [props.showMenu && editor.value && _createVNode(Toolbar, {
169
+ "class": "tiptap-editor-toolbar"
170
+ }, {
171
+ default: () => [_createVNode(ToolbarGroup, null, {
172
+ default: () => [_createVNode(HeadingDropdownMenu, {
173
+ "editor": editor.value
174
+ }, null), _createVNode(ListDropdownMenu, {
175
+ "editor": editor.value
176
+ }, null), _createVNode(HorizontalRuleButton, {
177
+ "editor": editor.value
178
+ }, null), _createVNode(BlockquoteButton, {
179
+ "editor": editor.value
180
+ }, null), _createVNode(CodeBlockButton, {
181
+ "editor": editor.value
182
+ }, null)]
183
+ }), _createVNode(ToolbarSeparator, null, null), _createVNode(ToolbarGroup, null, {
184
+ default: () => [_createVNode(MarkButton, {
185
+ "editor": editor.value,
186
+ "type": "bold"
187
+ }, null), _createVNode(MarkButton, {
188
+ "editor": editor.value,
189
+ "type": "italic"
190
+ }, null), _createVNode(MarkButton, {
191
+ "editor": editor.value,
192
+ "type": "code"
193
+ }, null)]
194
+ })]
195
+ }), _createVNode("div", {
196
+ "class": "tiptap-editor-content-wrapper"
197
+ }, [_createVNode(EditorContent, {
318
198
  "class": "ProseMirror",
319
199
  "editor": editor.value
320
- }, null);
200
+ }, null)])]);
321
201
  }
322
202
  });
323
203
  export {
@@ -31,5 +31,6 @@
31
31
  }
32
32
 
33
33
  /* layer: default */
34
- .cgx-atm .inline{display:inline;}
34
+ .cgx-atm .italic{font-style:italic;}
35
+ .cgx-atm .underline{text-decoration-line:underline;}
35
36
  .cgx-atm .blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 文件说明:
3
+ * - ConsumedTrigger Mark 扩展
4
+ * - 功能:标记已经触发过且被"消费"(建议态结束)的触发符(# 或 @)
5
+ * - 作用:持久化建议态失活记录。即使编辑器重新初始化,该字符也不会再次触发建议,除非被删除重新输入
6
+ */
7
+ import { Mark } from '@tiptap/core';
8
+ export declare const ConsumedTrigger: Mark<any, any>;
@@ -0,0 +1,22 @@
1
+ import { Mark, mergeAttributes } from "@tiptap/core";
2
+ const ConsumedTrigger = Mark.create({
3
+ name: "consumedTrigger",
4
+ keepOnSplit: false,
5
+ // 保证在标记后继续输入时不延续标记
6
+ parseHTML() {
7
+ return [{ tag: "span[data-consumed-trigger]" }];
8
+ },
9
+ renderHTML({ HTMLAttributes }) {
10
+ return [
11
+ "span",
12
+ mergeAttributes(HTMLAttributes, {
13
+ "data-consumed-trigger": "true",
14
+ style: "color: inherit;"
15
+ }),
16
+ 0
17
+ ];
18
+ }
19
+ });
20
+ export {
21
+ ConsumedTrigger
22
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 创建 CustomContent 扩展
3
+ * @returns TipTap Extension
4
+ */
5
+ export declare const createCustomContentExtension: () => import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
@@ -0,0 +1,103 @@
1
+ import Mention from "@tiptap/extension-mention";
2
+ const createCustomContentExtension = () => {
3
+ return Mention.extend({
4
+ name: "customContent",
5
+ parseHTML() {
6
+ return [{ tag: 'span[data-type="custom-content"]' }];
7
+ },
8
+ addAttributes() {
9
+ return {
10
+ id: {
11
+ default: null,
12
+ parseHTML: (element) => element.getAttribute("data-id"),
13
+ renderHTML: (attributes) => {
14
+ if (!attributes.id) {
15
+ return {};
16
+ }
17
+ return {
18
+ "data-id": attributes.id
19
+ };
20
+ }
21
+ },
22
+ label: {
23
+ default: null,
24
+ parseHTML: (element) => element.getAttribute("file-label"),
25
+ renderHTML: (attributes) => {
26
+ if (!attributes.label) {
27
+ return {};
28
+ }
29
+ return {
30
+ "file-label": attributes.label
31
+ };
32
+ }
33
+ },
34
+ obj: {
35
+ default: null,
36
+ parseHTML: (element) => {
37
+ const objStr = element.getAttribute("obj");
38
+ try {
39
+ return objStr ? JSON.parse(objStr) : null;
40
+ } catch (e) {
41
+ return null;
42
+ }
43
+ },
44
+ renderHTML: (attributes) => {
45
+ if (!attributes.obj) {
46
+ return {};
47
+ }
48
+ return {
49
+ obj: JSON.stringify(attributes.obj)
50
+ };
51
+ }
52
+ },
53
+ color: {
54
+ default: null,
55
+ parseHTML: (element) => element.getAttribute("data-color"),
56
+ renderHTML: (attributes) => {
57
+ if (!attributes.color)
58
+ return {};
59
+ return { "data-color": attributes.color };
60
+ }
61
+ },
62
+ hoverColor: {
63
+ default: null,
64
+ parseHTML: (element) => element.getAttribute("data-hover-color"),
65
+ renderHTML: (attributes) => {
66
+ if (!attributes.hoverColor)
67
+ return {};
68
+ return { "data-hover-color": attributes.hoverColor };
69
+ }
70
+ }
71
+ };
72
+ },
73
+ renderHTML({ node }) {
74
+ var _a, _b, _c, _d, _e, _f;
75
+ const obj = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.obj) != null ? _b : {};
76
+ const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
77
+ const color = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.color;
78
+ const hoverColor = (_f = node == null ? void 0 : node.attrs) == null ? void 0 : _f.hoverColor;
79
+ const styleParts = [];
80
+ if (color)
81
+ styleParts.push(`--custom-content-color: ${color}`);
82
+ if (hoverColor)
83
+ styleParts.push(`--custom-content-hover-color: ${hoverColor}`);
84
+ return [
85
+ "span",
86
+ {
87
+ class: "custom-content",
88
+ "data-type": "custom-content",
89
+ obj: JSON.stringify(obj),
90
+ "file-label": label,
91
+ "data-color": color,
92
+ "data-hover-color": hoverColor,
93
+ style: styleParts.length ? styleParts.join(";") : void 0,
94
+ contenteditable: "false"
95
+ },
96
+ label
97
+ ];
98
+ }
99
+ });
100
+ };
101
+ export {
102
+ createCustomContentExtension
103
+ };
@@ -0,0 +1,15 @@
1
+ export interface HashTagOptions {
2
+ emit: any;
3
+ imeState: {
4
+ isComposing: boolean;
5
+ };
6
+ editorRef: {
7
+ current: any;
8
+ };
9
+ }
10
+ /**
11
+ * 创建 HashTag 扩展
12
+ * @param options - 配置选项
13
+ * @returns TipTap Extension
14
+ */
15
+ export declare const createHashTagExtension: (options: HashTagOptions) => import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;