@cgboiler/biz-basic 1.0.52 → 1.0.54

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 +88 -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 -391
  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 +88 -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 -392
  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
@@ -1,6 +1,6 @@
1
- import { Extension, Mark } from '@tiptap/core';
2
1
  /**
3
2
  * useExtensions
4
- * - 功能:构建并返回 TipTap 编辑器使用的扩展集合。
3
+ * - 功能:构建并返回 TipTap 编辑器使用的扩展集合
4
+ * - 重构:采用模块化架构,各扩展独立管理
5
5
  */
6
- export declare function useExtensions({ props, emit }: any): (import("@tiptap/core").Node<any, any> | Mark<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any> | Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | Extension<any, any> | Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | Extension<import("@tiptap/extension-text-style").ColorOptions, any> | Extension<import("tiptap-markdown").MarkdownOptions, import("tiptap-markdown").MarkdownStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | Extension<import("@tiptap/extension-table").TableKitOptions, any> | Extension<import("@tiptap/extensions").PlaceholderOptions, any> | Extension<import("@tiptap/extension-list").ListKitOptions, any>)[];
6
+ export declare function useExtensions({ props, emit }: any): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Extension<import("tiptap-markdown").MarkdownOptions, import("tiptap-markdown").MarkdownStorage> | import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any> | import("@tiptap/core").Node<import("@tiptap/extension-horizontal-rule").HorizontalRuleOptions, any> | import("@tiptap/core").Node<import("./extensions/ImageUpload").ImageUploadNodeOptions, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-style").ColorOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-align").TextAlignOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-list").TaskListOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-list").TaskItemOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extensions").PlaceholderOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-list").ListKitOptions, any>)[];
@@ -2,366 +2,81 @@ import StarterKit from "@tiptap/starter-kit";
2
2
  import { TableKit } from "@tiptap/extension-table";
3
3
  import { ListKit } from "@tiptap/extension-list";
4
4
  import Image from "@tiptap/extension-image";
5
- import Mention from "@tiptap/extension-mention";
6
5
  import { TextStyle } from "@tiptap/extension-text-style";
7
6
  import { Color } from "@tiptap/extension-color";
8
- import { Markdown } from "tiptap-markdown";
9
- import { Extension, InputRule, Mark, mergeAttributes } from "@tiptap/core";
10
- import HtmlBlock from "./extensions/HtmlBlock";
11
7
  import { Placeholder } from "@tiptap/extensions";
8
+ import Underline from "@tiptap/extension-underline";
9
+ import Superscript from "@tiptap/extension-superscript";
10
+ import Subscript from "@tiptap/extension-subscript";
11
+ import TextAlign from "@tiptap/extension-text-align";
12
+ import Highlight from "@tiptap/extension-highlight";
13
+ import Link from "@tiptap/extension-link";
14
+ import { TaskList } from "@tiptap/extension-task-list";
15
+ import { TaskItem } from "@tiptap/extension-task-item";
16
+ import Typography from "@tiptap/extension-typography";
17
+ import HtmlBlock from "./extensions/HtmlBlock";
18
+ import { ConsumedTrigger } from "./extensions/ConsumedTrigger";
19
+ import { createIMECompositionExtension } from "./extensions/IMEComposition";
20
+ import { VideoInputRule, AudioInputRule } from "./extensions/MediaInputRules";
21
+ import { MarkdownExtension, MarkdownLinkInputRule } from "./extensions/MarkdownExtensions";
22
+ import { createHashTagExtension } from "./extensions/HashTag";
23
+ import { createMentionExtension } from "./extensions/MentionExtension";
24
+ import { createCustomContentExtension } from "./extensions/CustomContent";
25
+ import HorizontalRule from "./extensions/HorizontalRule";
26
+ import ImageUpload from "./extensions/ImageUpload";
27
+ import { handleImageUpload, MAX_FILE_SIZE } from "./menu-system/utils/tiptap-utils";
12
28
  function useExtensions({ props, emit }) {
13
- let activeEditor = null;
14
- const ConsumedTrigger = Mark.create({
15
- name: "consumedTrigger",
16
- keepOnSplit: false,
17
- // 保证在标记后继续输入时不延续标记
18
- parseHTML() {
19
- return [{ tag: "span[data-consumed-trigger]" }];
20
- },
21
- renderHTML({ HTMLAttributes }) {
22
- return [
23
- "span",
24
- mergeAttributes(HTMLAttributes, {
25
- "data-consumed-trigger": "true",
26
- style: "color: inherit;"
27
- }),
28
- 0
29
- ];
30
- }
31
- });
32
- const checkConsumed = (state, range) => {
33
- const { doc, schema } = state;
34
- const markType = schema.marks.consumedTrigger;
35
- if (!markType)
36
- return false;
37
- let isConsumed = false;
38
- doc.nodesBetween(range.from, range.to, (node) => {
39
- if (node.marks.some((m) => m.type === markType)) {
40
- isConsumed = true;
41
- }
42
- });
43
- return isConsumed;
44
- };
45
- const markAsConsumed = (editor, range, char) => {
46
- if (!editor || !range || range.from === void 0)
47
- return;
48
- try {
49
- const { doc } = editor.state;
50
- const actualChar = doc.textBetween(range.from, range.from + 1);
51
- if (actualChar === char) {
52
- editor.chain().setMeta("addToHistory", false).setTextSelection({ from: range.from, to: range.from + 1 }).setMark("consumedTrigger").setTextSelection(editor.state.selection.to).unsetMark("consumedTrigger").run();
53
- }
54
- } catch (e) {
55
- }
29
+ const editorRef = { current: null };
30
+ const imeState = {
31
+ isComposing: false
56
32
  };
57
- const HashTag = Mention.extend({
58
- name: "hashTag",
59
- parseHTML() {
60
- return [{ tag: 'span[data-type="hashTag"]' }];
61
- },
62
- addAttributes() {
63
- return {
64
- id: {
65
- default: null,
66
- parseHTML: (element) => element.getAttribute("data-id"),
67
- renderHTML: (attributes) => {
68
- if (!attributes.id)
69
- return {};
70
- return { "data-id": attributes.id };
71
- }
72
- },
73
- label: {
74
- default: null,
75
- parseHTML: (element) => element.getAttribute("data-label"),
76
- renderHTML: (attributes) => {
77
- if (!attributes.label)
78
- return {};
79
- return { "data-label": attributes.label };
80
- }
81
- },
82
- type: {
83
- default: null,
84
- parseHTML: (element) => element.getAttribute("data-tag-type"),
85
- renderHTML: (attributes) => {
86
- if (!attributes.type)
87
- return {};
88
- return { "data-tag-type": attributes.type };
89
- }
90
- }
91
- };
92
- },
93
- renderHTML({ node }) {
94
- var _a, _b, _c, _d, _e, _f;
95
- const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
96
- const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
97
- const type = (_f = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.type) != null ? _f : "";
98
- return [
99
- "span",
100
- {
101
- class: "hash-tag",
102
- "data-type": "hashTag",
103
- "data-id": id,
104
- "data-label": label,
105
- "data-tag-type": type,
106
- "data-hash-tag": "#",
107
- contenteditable: "false"
108
- },
109
- `#${label}`
110
- ];
111
- }
112
- }).configure({
113
- deleteTriggerWithBackspace: true,
114
- suggestion: {
115
- char: "#",
116
- allowedPrefixes: null,
117
- allowSpaces: false,
118
- /**
119
- * allow
120
- * - 功能:判断是否允许触发建议态。
121
- * - 若该字符带有 consumedTrigger 标记,说明此前已触发过或用户选择忽略,则不再触发建议。
122
- */
123
- allow: ({ state, range }) => {
124
- return !checkConsumed(state, range);
125
- },
126
- render() {
127
- let activeRange = null;
128
- let exitCause = "unknown";
129
- return {
130
- onStart({ editor, range, command, query }) {
131
- activeRange = range;
132
- activeEditor = editor;
133
- exitCause = "unknown";
134
- emit("hashTag-triggered", (data) => {
135
- try {
136
- (activeEditor || editor).chain().focus().deleteRange(activeRange || range).insertContentAt((activeRange || range).from, {
137
- type: "hashTag",
138
- attrs: { id: data.hashTagId, label: data.name, type: data.type }
139
- }).setTextSelection((activeRange || range).from + 1).insertContent(" ").run();
140
- } catch (e) {
141
- command({ id: data.hashTagId, label: data.name, type: data.type });
142
- (activeEditor || editor).chain().focus().insertContent(" ").run();
143
- }
144
- });
145
- emit("hashTag-input", query != null ? query : "");
146
- },
147
- onUpdate({ query, range, editor }) {
148
- activeRange = range || activeRange;
149
- activeEditor = editor || activeEditor;
150
- emit("hashTag-input", query != null ? query : "");
151
- },
152
- onKeyDown({ event }) {
153
- const isSpaceKey = [" ", "Space", "Spacebar"].includes(event.key) || // @ts-ignore
154
- event.keyCode === 32 || event.code === "Space";
155
- if (isSpaceKey) {
156
- exitCause = "space";
157
- }
158
- return false;
159
- },
160
- onExit({ editor, range }) {
161
- var _a, _b, _c, _d, _e;
162
- try {
163
- const sel = (_a = editor.state) == null ? void 0 : _a.selection;
164
- const from = (_b = sel == null ? void 0 : sel.from) != null ? _b : 0;
165
- const prevChar = (_e = (_d = (_c = editor.state) == null ? void 0 : _c.doc) == null ? void 0 : _d.textBetween(Math.max(from - 1, 0), from, "\0", "\0")) != null ? _e : "";
166
- if (prevChar === " ") {
167
- exitCause = "space";
168
- }
169
- } catch (e) {
170
- }
171
- markAsConsumed(editor, range, "#");
172
- activeRange = null;
173
- activeEditor = null;
174
- emit("hashTag-exit", {
175
- reason: exitCause,
176
- nonContiguous: exitCause === "space"
177
- });
178
- }
179
- };
180
- }
181
- }
182
- });
183
- const CustomContent = Mention.extend({
184
- name: "customContent",
185
- parseHTML() {
186
- return [{ tag: 'span[data-type="custom-content"]' }];
187
- },
188
- addAttributes() {
189
- return {
190
- id: {
191
- default: null,
192
- parseHTML: (element) => element.getAttribute("data-id"),
193
- renderHTML: (attributes) => {
194
- if (!attributes.id) {
195
- return {};
196
- }
197
- return {
198
- "data-id": attributes.id
199
- };
200
- }
201
- },
202
- label: {
203
- default: null,
204
- parseHTML: (element) => element.getAttribute("file-label"),
205
- renderHTML: (attributes) => {
206
- if (!attributes.label) {
207
- return {};
208
- }
209
- return {
210
- "file-label": attributes.label
211
- };
212
- }
213
- },
214
- obj: {
215
- default: null,
216
- parseHTML: (element) => {
217
- const objStr = element.getAttribute("obj");
218
- try {
219
- return objStr ? JSON.parse(objStr) : null;
220
- } catch (e) {
221
- return null;
222
- }
223
- },
224
- renderHTML: (attributes) => {
225
- if (!attributes.obj) {
226
- return {};
227
- }
228
- return {
229
- obj: JSON.stringify(attributes.obj)
230
- };
231
- }
232
- },
233
- color: {
234
- default: null,
235
- parseHTML: (element) => element.getAttribute("data-color"),
236
- renderHTML: (attributes) => {
237
- if (!attributes.color)
238
- return {};
239
- return { "data-color": attributes.color };
240
- }
241
- },
242
- hoverColor: {
243
- default: null,
244
- parseHTML: (element) => element.getAttribute("data-hover-color"),
245
- renderHTML: (attributes) => {
246
- if (!attributes.hoverColor)
247
- return {};
248
- return { "data-hover-color": attributes.hoverColor };
249
- }
250
- }
251
- };
252
- },
253
- renderHTML({ node }) {
254
- var _a, _b, _c, _d, _e, _f;
255
- const obj = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.obj) != null ? _b : {};
256
- const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
257
- const color = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.color;
258
- const hoverColor = (_f = node == null ? void 0 : node.attrs) == null ? void 0 : _f.hoverColor;
259
- const styleParts = [];
260
- if (color)
261
- styleParts.push(`--custom-content-color: ${color}`);
262
- if (hoverColor)
263
- styleParts.push(`--custom-content-hover-color: ${hoverColor}`);
264
- return [
265
- "span",
266
- {
267
- class: "custom-content",
268
- "data-type": "custom-content",
269
- obj: JSON.stringify(obj),
270
- "file-label": label,
271
- "data-color": color,
272
- "data-hover-color": hoverColor,
273
- style: styleParts.length ? styleParts.join(";") : void 0,
274
- contenteditable: "false"
275
- },
276
- label
277
- ];
278
- }
279
- });
280
33
  const extensions = [
34
+ // 基础扩展
281
35
  StarterKit,
282
36
  HtmlBlock,
283
37
  ConsumedTrigger,
284
- // Video input rule extension
285
- Extension.create({
286
- name: "videoInputRule",
287
- addInputRules() {
288
- return [
289
- new InputRule({
290
- find: /!video\(([^)]+)\)\s/,
291
- handler: ({ range, match, commands }) => {
292
- const [, url] = match;
293
- if (url) {
294
- const html = `<video src="${url}" autoplay="" loop="" muted="" controls="" playsinline=""></video>`;
295
- commands.deleteRange(range);
296
- commands.insertContent({
297
- type: "htmlBlock",
298
- attrs: { html }
299
- });
300
- }
301
- }
302
- })
303
- ];
304
- }
305
- }),
306
- Extension.create({
307
- name: "audioInputRule",
308
- addInputRules() {
309
- return [
310
- new InputRule({
311
- find: /!audio\(([^)]+)\)\s/,
312
- handler: ({ range, match, commands }) => {
313
- const [, url] = match;
314
- if (url) {
315
- const html = `<audio src="${url}" controls="" playsinline=""></audio>`;
316
- commands.deleteRange(range);
317
- commands.insertContent({
318
- type: "htmlBlock",
319
- attrs: { html }
320
- });
321
- }
322
- }
323
- })
324
- ];
325
- }
326
- }),
38
+ // IME 输入法跟踪
39
+ createIMECompositionExtension(imeState),
40
+ // 媒体输入规则
41
+ VideoInputRule,
42
+ AudioInputRule,
43
+ // 文本样式
327
44
  TextStyle,
328
45
  Color,
329
- Markdown.configure({
330
- html: true,
331
- tightLists: true,
332
- tightListClass: "tight",
333
- bulletListMarker: "-",
334
- linkify: true,
335
- breaks: false,
336
- transformPastedText: true,
337
- transformCopiedText: true
338
- }),
339
- Extension.create({
340
- name: "markdownLinkInputRule",
341
- addInputRules() {
342
- return [
343
- new InputRule({
344
- find: /\[([^\]]+)\]\(([^\)]+)\)\s/,
345
- handler: ({ range, match, commands }) => {
346
- const [, text, href] = match;
347
- commands.deleteRange({ from: range.from, to: range.to });
348
- commands.insertContent({
349
- type: "text",
350
- text,
351
- marks: [{ type: "link", attrs: { href } }]
352
- });
353
- }
354
- })
355
- ];
356
- }
357
- }),
46
+ // Markdown 支持
47
+ MarkdownExtension,
48
+ MarkdownLinkInputRule,
49
+ // 图片
358
50
  Image,
51
+ // 表格
359
52
  TableKit.configure({
360
53
  table: { resizable: true }
361
54
  }),
55
+ // 其他内置扩展
56
+ Underline,
57
+ Superscript,
58
+ Subscript,
59
+ TextAlign.configure({ types: ["heading", "paragraph"] }),
60
+ Highlight.configure({ multicolor: true }),
61
+ Link.configure({
62
+ openOnClick: false
63
+ }),
64
+ TaskList,
65
+ TaskItem.configure({ nested: true }),
66
+ Typography,
67
+ HorizontalRule,
68
+ ImageUpload.configure({
69
+ accept: "image/*",
70
+ maxSize: MAX_FILE_SIZE,
71
+ limit: 3,
72
+ upload: handleImageUpload,
73
+ onError: (error) => console.error("Upload failed:", error)
74
+ }),
75
+ // 占位符
362
76
  Placeholder.configure({
363
77
  placeholder: () => props.placeholder
364
78
  }),
79
+ // 列表(自定义键盘快捷键)
365
80
  ListKit.extend({
366
81
  addKeyboardShortcuts() {
367
82
  return {
@@ -377,55 +92,12 @@ function useExtensions({ props, emit }) {
377
92
  };
378
93
  }
379
94
  }),
380
- Mention.configure({
381
- HTMLAttributes: {
382
- class: "mention"
383
- },
384
- deleteTriggerWithBackspace: true,
385
- suggestion: {
386
- char: "@",
387
- allowedPrefixes: null,
388
- allowSpaces: false,
389
- allow: ({ state, range }) => {
390
- if (checkConsumed(state, range))
391
- return false;
392
- const doc = state.doc;
393
- const $from = doc.resolve(range.from);
394
- const isAtStart = range.from === $from.start();
395
- const prevChar = isAtStart ? "" : doc.textBetween(range.from - 1, range.from);
396
- if (/[a-zA-Z0-9]/.test(prevChar))
397
- return false;
398
- const query = doc.textBetween(range.from + 1, range.to);
399
- if (/[0-9]/.test(query))
400
- return false;
401
- return true;
402
- },
403
- render() {
404
- return {
405
- onStart({ editor, command, query }) {
406
- activeEditor = editor;
407
- emit("mention-triggered", (data) => {
408
- command({
409
- id: data.userId,
410
- label: data.name
411
- });
412
- });
413
- emit("mention-input", query != null ? query : "");
414
- },
415
- onUpdate({ query, editor }) {
416
- activeEditor = editor;
417
- emit("mention-input", query != null ? query : "");
418
- },
419
- onExit({ editor, range }) {
420
- markAsConsumed(editor, range, "@");
421
- emit("mention-exit");
422
- }
423
- };
424
- }
425
- }
426
- }),
427
- HashTag,
428
- CustomContent
95
+ // Mention 扩展(@ 提及)
96
+ createMentionExtension({ emit, imeState, editorRef }),
97
+ // HashTag 扩展(# 标签)
98
+ createHashTagExtension({ emit, imeState, editorRef }),
99
+ // CustomContent 扩展(自定义内容)
100
+ createCustomContentExtension()
429
101
  ];
430
102
  return extensions;
431
103
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 文件说明:
3
+ * - 提供编辑器事件处理器工厂函数
4
+ * - 包括图片预览、标签点击、自定义内容交互等
5
+ */
6
+ /**
7
+ * 创建 HashTag 点击处理器
8
+ * @param emit - Vue emit 函数
9
+ * @returns 事件处理函数
10
+ */
11
+ export declare const createHashTagClickHandler: (emit: any) => (event: MouseEvent) => void;
12
+ /**
13
+ * 创建 Mention 点击处理器
14
+ * @param emit - Vue emit 函数
15
+ * @returns 事件处理函数
16
+ */
17
+ export declare const createMentionClickHandler: (emit: any) => (event: MouseEvent) => void;
18
+ /**
19
+ * 创建自定义内容点击处理器
20
+ * @param emit - Vue emit 函数
21
+ * @returns 事件处理函数
22
+ */
23
+ export declare const createCustomContentClickHandler: (emit: any) => (event: MouseEvent) => void;
24
+ /**
25
+ * 创建自定义内容悬停处理器
26
+ * @param emit - Vue emit 函数
27
+ * @returns 事件处理函数
28
+ */
29
+ export declare const createCustomContentHoverHandler: (emit: any) => (event: MouseEvent) => void;
30
+ /**
31
+ * 创建图片点击处理器(使用 ViewerJS 预览)
32
+ * @param viewerRef - Viewer 实例引用
33
+ * @returns 事件处理函数
34
+ */
35
+ export declare const createImageClickHandler: (viewerRef: {
36
+ value: any;
37
+ }) => (event: MouseEvent) => void;
@@ -0,0 +1,103 @@
1
+ const createHashTagClickHandler = (emit) => {
2
+ return (event) => {
3
+ const target = event.target;
4
+ const tagEl = target.closest(".hash-tag") || null;
5
+ if (tagEl) {
6
+ const id = tagEl.getAttribute("data-id") || "";
7
+ const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
8
+ const trigger = tagEl.getAttribute("data-hash-tag") || "#";
9
+ const tagType = tagEl.getAttribute("data-tag-type") || "";
10
+ emit("hashTag-clicked", { hashTagId: id, name: label, trigger, type: tagType });
11
+ event.stopPropagation();
12
+ event.preventDefault();
13
+ }
14
+ };
15
+ };
16
+ const createMentionClickHandler = (emit) => {
17
+ return (event) => {
18
+ const target = event.target;
19
+ const tagEl = target.closest(".mention") || null;
20
+ if (tagEl) {
21
+ const id = tagEl.getAttribute("data-id") || "";
22
+ const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
23
+ emit("mention-clicked", { userId: id, name: label });
24
+ event.stopPropagation();
25
+ event.preventDefault();
26
+ }
27
+ };
28
+ };
29
+ const createCustomContentClickHandler = (emit) => {
30
+ return (event) => {
31
+ const target = event.target;
32
+ const tagEl = target.closest(".custom-content") || null;
33
+ if (tagEl) {
34
+ const objStr = tagEl.getAttribute("obj") || "{}";
35
+ const label = tagEl.getAttribute("file-label") || "";
36
+ try {
37
+ const obj = JSON.parse(objStr);
38
+ emit("customContent-clicked", { obj, label });
39
+ } catch (e) {
40
+ console.error("Failed to parse custom content obj:", e);
41
+ }
42
+ event.stopPropagation();
43
+ event.preventDefault();
44
+ }
45
+ };
46
+ };
47
+ const createCustomContentHoverHandler = (emit) => {
48
+ return (event) => {
49
+ const target = event.target;
50
+ const tagEl = target.closest(".custom-content") || null;
51
+ if (tagEl) {
52
+ const objStr = tagEl.getAttribute("obj") || "{}";
53
+ const label = tagEl.getAttribute("file-label") || "";
54
+ try {
55
+ const obj = JSON.parse(objStr);
56
+ emit("customContent-hovered", { obj, label });
57
+ } catch (e) {
58
+ console.error("Failed to parse custom content obj:", e);
59
+ }
60
+ event.stopPropagation();
61
+ event.preventDefault();
62
+ }
63
+ };
64
+ };
65
+ const createImageClickHandler = (viewerRef) => {
66
+ return (event) => {
67
+ const target = event.target;
68
+ if (target.tagName === "IMG") {
69
+ import("viewerjs").then(({ default: Viewer }) => {
70
+ if (viewerRef.value) {
71
+ viewerRef.value.destroy();
72
+ }
73
+ viewerRef.value = new Viewer(target, {
74
+ inline: false,
75
+ navbar: true,
76
+ title: true,
77
+ toolbar: {
78
+ zoomIn: true,
79
+ zoomOut: true,
80
+ oneToOne: true,
81
+ reset: true,
82
+ prev: false,
83
+ next: false,
84
+ rotateLeft: true,
85
+ rotateRight: true,
86
+ flipHorizontal: true,
87
+ flipVertical: true
88
+ }
89
+ });
90
+ viewerRef.value.show();
91
+ });
92
+ event.stopPropagation();
93
+ event.preventDefault();
94
+ }
95
+ };
96
+ };
97
+ export {
98
+ createCustomContentClickHandler,
99
+ createCustomContentHoverHandler,
100
+ createHashTagClickHandler,
101
+ createImageClickHandler,
102
+ createMentionClickHandler
103
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 文件说明:
3
+ * - 工具函数统一导出入口
4
+ */
5
+ export { checkConsumed, markAsConsumed, isSpaceKey, checkLastCharIsSpace } from './triggerHelpers';
6
+ export { createHashTagClickHandler, createMentionClickHandler, createCustomContentClickHandler, createCustomContentHoverHandler, createImageClickHandler, } from './eventHandlers';
@@ -0,0 +1,19 @@
1
+ import { checkConsumed, markAsConsumed, isSpaceKey, checkLastCharIsSpace } from "./triggerHelpers";
2
+ import {
3
+ createHashTagClickHandler,
4
+ createMentionClickHandler,
5
+ createCustomContentClickHandler,
6
+ createCustomContentHoverHandler,
7
+ createImageClickHandler
8
+ } from "./eventHandlers";
9
+ export {
10
+ checkConsumed,
11
+ checkLastCharIsSpace,
12
+ createCustomContentClickHandler,
13
+ createCustomContentHoverHandler,
14
+ createHashTagClickHandler,
15
+ createImageClickHandler,
16
+ createMentionClickHandler,
17
+ isSpaceKey,
18
+ markAsConsumed
19
+ };