@antscorp/antsomi-ui 2.0.110 → 2.0.111

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 (344) hide show
  1. package/es/assets/css/main.scss +2 -0
  2. package/es/components/atoms/Eyedropper/Eyedropper.d.ts +2 -0
  3. package/es/components/atoms/Eyedropper/Eyedropper.js +53 -0
  4. package/es/components/atoms/Eyedropper/index.d.ts +0 -0
  5. package/es/components/atoms/Eyedropper/index.js +1 -0
  6. package/es/components/atoms/Eyedropper/styled.d.ts +9 -0
  7. package/es/components/atoms/Eyedropper/styled.js +45 -0
  8. package/es/components/atoms/Eyedropper/types.d.ts +5 -0
  9. package/es/components/atoms/Eyedropper/types.js +1 -0
  10. package/es/components/icons/ALignRightIcon.d.ts +3 -0
  11. package/es/components/icons/ALignRightIcon.js +7 -0
  12. package/es/components/icons/AlignCenterIcon.d.ts +3 -0
  13. package/es/components/icons/AlignCenterIcon.js +7 -0
  14. package/es/components/icons/AlignJustifyIcon.d.ts +3 -0
  15. package/es/components/icons/AlignJustifyIcon.js +7 -0
  16. package/es/components/icons/AlignLeftIcon.d.ts +3 -0
  17. package/es/components/icons/AlignLeftIcon.js +7 -0
  18. package/es/components/icons/ArrowDropDownIcon.d.ts +3 -0
  19. package/es/components/icons/ArrowDropDownIcon.js +7 -0
  20. package/es/components/icons/ChevronRightIcon.d.ts +3 -0
  21. package/es/components/icons/ChevronRightIcon.js +7 -0
  22. package/es/components/icons/ColorizeIcon.d.ts +3 -0
  23. package/es/components/icons/ColorizeIcon.js +7 -0
  24. package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -0
  25. package/es/components/icons/LazyIcon/LazyIcon.js +9 -0
  26. package/es/components/icons/LinkOffIcon.d.ts +3 -0
  27. package/es/components/icons/LinkOffIcon.js +7 -0
  28. package/es/components/icons/MinusIcon.d.ts +3 -0
  29. package/es/components/icons/MinusIcon.js +7 -0
  30. package/es/components/icons/index.d.ts +9 -0
  31. package/es/components/icons/index.js +9 -0
  32. package/es/components/index.scss +1 -0
  33. package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
  34. package/es/components/molecules/EmojiCollections/types.d.ts +1 -0
  35. package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +2 -0
  36. package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
  37. package/es/components/molecules/EmojiPopover/styled.js +1 -1
  38. package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +11 -0
  39. package/es/components/molecules/EyedropperButton/EyedropperButton.js +34 -0
  40. package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
  41. package/es/components/molecules/EyedropperButton/index.js +1 -0
  42. package/es/components/molecules/EyedropperButton/styled.d.ts +7 -0
  43. package/es/components/molecules/EyedropperButton/styled.js +23 -0
  44. package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
  45. package/es/components/molecules/FontSizeInput/FontSizeInput.js +134 -0
  46. package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +8 -0
  47. package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +14 -0
  48. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +21 -0
  49. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +19 -0
  50. package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
  51. package/es/components/molecules/FontSizeInput/constants.js +5 -0
  52. package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
  53. package/es/components/molecules/FontSizeInput/index.js +1 -0
  54. package/es/components/molecules/FontSizeInput/styled.d.ts +7 -0
  55. package/es/components/molecules/FontSizeInput/styled.js +39 -0
  56. package/es/components/molecules/FontSizeInput/types.d.ts +23 -0
  57. package/es/components/molecules/FontSizeInput/types.js +1 -0
  58. package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
  59. package/es/components/molecules/FontSizeInput/utils.js +9 -0
  60. package/es/components/molecules/SearchPopover/SearchPopover.d.ts +2 -1
  61. package/es/components/molecules/SearchPopover/SearchPopover.js +3 -3
  62. package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
  63. package/es/components/molecules/SearchPopover/styled.js +1 -2
  64. package/es/components/molecules/SearchPopover/types.d.ts +4 -3
  65. package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
  66. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +6 -8
  67. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
  68. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +49 -289
  69. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
  70. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
  71. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
  72. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
  73. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
  74. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
  75. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
  76. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
  77. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
  78. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
  79. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
  80. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
  81. package/es/components/molecules/VirtualizedMenu/styled.js +24 -3
  82. package/es/components/molecules/VirtualizedMenu/types.d.ts +2 -0
  83. package/es/components/molecules/VirtualizedMenu/utils.d.ts +2 -0
  84. package/es/components/molecules/VirtualizedMenu/utils.js +2 -0
  85. package/es/components/molecules/index.d.ts +1 -0
  86. package/es/components/molecules/index.js +1 -0
  87. package/es/components/molecules/index.scss +1 -0
  88. package/es/components/organism/TextEditor/TextEditor.d.ts +10 -0
  89. package/es/components/organism/TextEditor/TextEditor.js +388 -0
  90. package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
  91. package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
  92. package/es/components/organism/TextEditor/__mocks__/text-contennt.js +47 -0
  93. package/es/components/organism/TextEditor/constants.d.ts +196 -0
  94. package/es/components/organism/TextEditor/constants.js +398 -0
  95. package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
  96. package/es/components/organism/TextEditor/extensions/BackgroundColor.js +43 -0
  97. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +18 -0
  98. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +81 -0
  99. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
  100. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +35 -0
  101. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
  102. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
  103. package/es/components/organism/TextEditor/extensions/ClearFormatting.d.ts +16 -0
  104. package/es/components/organism/TextEditor/extensions/ClearFormatting.js +30 -0
  105. package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
  106. package/es/components/organism/TextEditor/extensions/Color.js +34 -0
  107. package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
  108. package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
  109. package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
  110. package/es/components/organism/TextEditor/extensions/FontFamily.js +36 -0
  111. package/es/components/organism/TextEditor/extensions/FontSize.d.ts +31 -0
  112. package/es/components/organism/TextEditor/extensions/FontSize.js +46 -0
  113. package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
  114. package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
  115. package/es/components/organism/TextEditor/extensions/Indent.d.ts +21 -0
  116. package/es/components/organism/TextEditor/extensions/Indent.js +63 -0
  117. package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +32 -0
  118. package/es/components/organism/TextEditor/extensions/LetterSpacing.js +48 -0
  119. package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
  120. package/es/components/organism/TextEditor/extensions/LineHeight.js +101 -0
  121. package/es/components/organism/TextEditor/extensions/Link.d.ts +22 -0
  122. package/es/components/organism/TextEditor/extensions/Link.js +178 -0
  123. package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
  124. package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
  125. package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
  126. package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
  127. package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +56 -0
  128. package/es/components/organism/TextEditor/extensions/OrderedList.js +187 -0
  129. package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +28 -0
  130. package/es/components/organism/TextEditor/extensions/SmartTag.js +103 -0
  131. package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
  132. package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
  133. package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +30 -0
  134. package/es/components/organism/TextEditor/extensions/TextTransform.js +36 -0
  135. package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +55 -0
  136. package/es/components/organism/TextEditor/extensions/UnorderedList.js +176 -0
  137. package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
  138. package/es/components/organism/TextEditor/hooks/index.js +6 -0
  139. package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
  140. package/es/components/organism/TextEditor/hooks/useColorSet.js +29 -0
  141. package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
  142. package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
  143. package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
  144. package/es/components/organism/TextEditor/hooks/useMarkTracking.js +69 -0
  145. package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
  146. package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
  147. package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
  148. package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
  149. package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
  150. package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
  151. package/es/components/organism/TextEditor/index.d.ts +18 -0
  152. package/es/components/organism/TextEditor/index.js +8 -0
  153. package/es/components/organism/TextEditor/index.scss +65 -0
  154. package/es/components/organism/TextEditor/provider.d.ts +15 -0
  155. package/es/components/organism/TextEditor/provider.js +36 -0
  156. package/es/components/organism/TextEditor/store.d.ts +20 -0
  157. package/es/components/organism/TextEditor/store.js +40 -0
  158. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
  159. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
  160. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
  161. package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
  162. package/es/components/organism/TextEditor/stories/shared.js +57 -0
  163. package/es/components/organism/TextEditor/styled.d.ts +9 -0
  164. package/es/components/organism/TextEditor/styled.js +61 -0
  165. package/es/components/organism/TextEditor/types.d.ts +311 -0
  166. package/es/components/organism/TextEditor/types.js +6 -0
  167. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +3 -0
  168. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +114 -0
  169. package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
  170. package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
  171. package/es/components/organism/TextEditor/ui/Button/Button.d.ts +9 -0
  172. package/es/components/organism/TextEditor/ui/Button/Button.js +35 -0
  173. package/es/components/organism/TextEditor/ui/Button/index.d.ts +2 -0
  174. package/es/components/organism/TextEditor/ui/Button/index.js +1 -0
  175. package/es/components/organism/TextEditor/ui/Button/types.d.ts +10 -0
  176. package/es/components/organism/TextEditor/ui/Button/types.js +1 -0
  177. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +39 -0
  178. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +131 -0
  179. package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
  180. package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
  181. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +17 -0
  182. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +51 -0
  183. package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +1 -0
  184. package/es/components/organism/TextEditor/ui/DropdownButton/index.js +1 -0
  185. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
  186. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
  187. package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
  188. package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
  189. package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
  190. package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
  191. package/es/components/organism/TextEditor/ui/FontPopover/FontItem.d.ts +2 -0
  192. package/es/components/organism/TextEditor/ui/FontPopover/FontItem.js +27 -0
  193. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +16 -0
  194. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +102 -0
  195. package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +2 -0
  196. package/es/components/organism/TextEditor/ui/FontPopover/styled.js +36 -0
  197. package/es/components/organism/TextEditor/ui/FontPopover/types.d.ts +35 -0
  198. package/es/components/organism/TextEditor/ui/FontPopover/types.js +1 -0
  199. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
  200. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
  201. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
  202. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
  203. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
  204. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
  205. package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
  206. package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
  207. package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
  208. package/es/components/organism/TextEditor/ui/Popover/Popover.js +9 -0
  209. package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
  210. package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
  211. package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
  212. package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
  213. package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
  214. package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
  215. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +2 -0
  216. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +44 -0
  217. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +1 -0
  218. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +1 -0
  219. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +2 -0
  220. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +58 -0
  221. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +19 -0
  222. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +1 -0
  223. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
  224. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +75 -0
  225. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
  226. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
  227. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.d.ts +19 -0
  228. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +85 -0
  229. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
  230. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
  231. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +6 -0
  232. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +19 -0
  233. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
  234. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +93 -0
  235. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
  236. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +20 -0
  237. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
  238. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +32 -0
  239. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +18 -0
  240. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +41 -0
  241. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +8 -0
  242. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +51 -0
  243. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +5 -0
  244. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +21 -0
  245. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
  246. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +17 -0
  247. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
  248. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +18 -0
  249. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +5 -0
  250. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +28 -0
  251. package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.d.ts +10 -0
  252. package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.js +45 -0
  253. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
  254. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +17 -0
  255. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
  256. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +67 -0
  257. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
  258. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +17 -0
  259. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
  260. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +18 -0
  261. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
  262. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +18 -0
  263. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
  264. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +26 -0
  265. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
  266. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +26 -0
  267. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
  268. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
  269. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +5 -0
  270. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +29 -0
  271. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +14 -0
  272. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +22 -0
  273. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
  274. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +36 -0
  275. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
  276. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +18 -0
  277. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +7 -0
  278. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +18 -0
  279. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +24 -0
  280. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +24 -0
  281. package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -0
  282. package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -0
  283. package/es/components/organism/TextEditor/utils/documentState.d.ts +73 -0
  284. package/es/components/organism/TextEditor/utils/documentState.js +149 -0
  285. package/es/components/organism/TextEditor/utils/font.d.ts +74 -0
  286. package/es/components/organism/TextEditor/utils/font.js +147 -0
  287. package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +87 -0
  288. package/es/components/organism/TextEditor/utils/htmlProcessing.js +460 -0
  289. package/es/components/organism/TextEditor/utils/indent.d.ts +11 -0
  290. package/es/components/organism/TextEditor/utils/indent.js +56 -0
  291. package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
  292. package/es/components/organism/TextEditor/utils/index.js +16 -0
  293. package/es/components/organism/TextEditor/utils/link.d.ts +116 -0
  294. package/es/components/organism/TextEditor/utils/link.js +304 -0
  295. package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
  296. package/es/components/organism/TextEditor/utils/menu.js +321 -0
  297. package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
  298. package/es/components/organism/TextEditor/utils/selection.js +58 -0
  299. package/es/components/organism/TextEditor/utils/shared.d.ts +13 -0
  300. package/es/components/organism/TextEditor/utils/shared.js +52 -0
  301. package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
  302. package/es/components/organism/TextEditor/utils/smartTag.js +90 -0
  303. package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
  304. package/es/components/organism/TextEditor/utils/style.js +193 -0
  305. package/es/components/organism/index.d.ts +1 -0
  306. package/es/components/organism/index.js +1 -0
  307. package/es/components/organism/index.scss +1 -0
  308. package/es/constants/index.d.ts +1 -0
  309. package/es/constants/index.js +1 -0
  310. package/es/constants/web.d.ts +8 -0
  311. package/es/constants/web.js +57 -0
  312. package/es/hooks/index.d.ts +4 -0
  313. package/es/hooks/index.js +4 -0
  314. package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
  315. package/es/hooks/useBroadcastedLocalStorage.js +71 -0
  316. package/es/hooks/useElementSize.d.ts +7 -0
  317. package/es/hooks/useElementSize.js +56 -0
  318. package/es/hooks/useEyedropper/attach.d.ts +4 -0
  319. package/es/hooks/useEyedropper/attach.js +9 -0
  320. package/es/hooks/useEyedropper/eyedropper.d.ts +69 -0
  321. package/es/hooks/useEyedropper/eyedropper.js +205 -0
  322. package/es/hooks/useEyedropper/index.d.ts +2 -0
  323. package/es/hooks/useEyedropper/index.js +7 -0
  324. package/es/hooks/useEyedropper/support.d.ts +1 -0
  325. package/es/hooks/useEyedropper/support.js +3 -0
  326. package/es/hooks/useEyedropper/types.d.ts +9 -0
  327. package/es/hooks/useEyedropper/types.js +1 -0
  328. package/es/hooks/useEyedropper/useEyedropper.d.ts +8 -0
  329. package/es/hooks/useEyedropper/useEyedropper.js +50 -0
  330. package/es/hooks/useEyedropper/utils.d.ts +11 -0
  331. package/es/hooks/useEyedropper/utils.js +17 -0
  332. package/es/hooks/useIsMounted.d.ts +1 -0
  333. package/es/hooks/useIsMounted.js +11 -0
  334. package/es/index.d.ts +1 -1
  335. package/es/index.js +1 -1
  336. package/es/locales/i18n.d.ts +1 -1
  337. package/es/types/index.d.ts +9 -0
  338. package/es/utils/common.d.ts +15 -9
  339. package/es/utils/common.js +62 -24
  340. package/es/utils/index.d.ts +1 -0
  341. package/es/utils/index.js +1 -0
  342. package/es/utils/web.d.ts +80 -0
  343. package/es/utils/web.js +226 -0
  344. package/package.json +26 -17
@@ -0,0 +1,57 @@
1
+ import { produce } from 'immer';
2
+ import uniqid from 'uniqid';
3
+ import { HTML_DOM } from '../__mocks__/text-contennt';
4
+ /**
5
+ * Parse HTML content from mock data
6
+ */
7
+ export const htmlContent = (() => {
8
+ const dom = new DOMParser().parseFromString(HTML_DOM, 'text/html');
9
+ const body = dom.querySelector('body');
10
+ if (body) {
11
+ return body.innerHTML;
12
+ }
13
+ return '';
14
+ })();
15
+ /**
16
+ * Reducer for TextBlock component state management
17
+ */
18
+ export const reducer = (state, action) => produce(state, draft => {
19
+ switch (action.type) {
20
+ case 'add_smart_tag': {
21
+ draft.dynamic.selectedId = uniqid();
22
+ break;
23
+ }
24
+ case 'edit_smart_tag': {
25
+ draft.dynamic.selectedId = action.payload.id;
26
+ break;
27
+ }
28
+ case 'close_smart_tag_modal': {
29
+ draft.dynamic.selectedId = '';
30
+ break;
31
+ }
32
+ case 'add_link': {
33
+ const newLinkId = uniqid();
34
+ draft.link.selectedId = newLinkId;
35
+ draft.link.data[newLinkId] = {
36
+ title: '',
37
+ url: '',
38
+ text: action.payload.selectionText,
39
+ };
40
+ break;
41
+ }
42
+ case 'edit_link': {
43
+ draft.link.selectedId = action.payload.id;
44
+ draft.link.data[action.payload.id] = {
45
+ ...state.link.data[action.payload.id],
46
+ ...action.payload.data,
47
+ };
48
+ break;
49
+ }
50
+ case 'close_link_modal': {
51
+ draft.link.selectedId = '';
52
+ break;
53
+ }
54
+ default:
55
+ break;
56
+ }
57
+ });
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { TextStyle } from './types';
3
+ export declare const StyledEditorContent: import("styled-components").StyledComponent<import("react").NamedExoticComponent<Omit<import("@tiptap/react").EditorContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
4
+ $textStyle: TextStyle;
5
+ }, never>;
6
+ export declare const ColorBox: import("styled-components").StyledComponent<"div", any, {
7
+ $color?: string | undefined;
8
+ }, never>;
9
+ export declare const ToolbarWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
@@ -0,0 +1,61 @@
1
+ import { EditorContent } from '@tiptap/react';
2
+ import styled from 'styled-components';
3
+ import { Flex } from 'antd';
4
+ import tinycolor from 'tinycolor2';
5
+ export const StyledEditorContent = styled(EditorContent) `
6
+ .tiptap {
7
+ outline: none;
8
+
9
+ p {
10
+ margin: 0;
11
+ padding: 0;
12
+
13
+ // Some apps have global p styles, so we need to override it
14
+
15
+ font-size: ${p => p.$textStyle.fontSize};
16
+ line-height: ${p => p.$textStyle.lineHeight};
17
+ font-family: ${p => p.$textStyle.fontFamily};
18
+ color: ${p => p.$textStyle.color};
19
+ letter-spacing: ${p => p.$textStyle.letterSpacing};
20
+ }
21
+
22
+ &:not([contenteditable='false']) {
23
+ p {
24
+ cursor: text;
25
+ }
26
+
27
+ .selection {
28
+ background-color: #d7cac9;
29
+ background-color: color-mix(in lab, var(--text-style-bg-color, transparent), #d7cac9);
30
+ }
31
+
32
+ .smart-tag {
33
+ cursor: pointer;
34
+ }
35
+ }
36
+ }
37
+ `;
38
+ export const ColorBox = styled.div `
39
+ cursor: pointer;
40
+ width: 20px;
41
+ height: 20px;
42
+ border-radius: 50%;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ padding: 2px;
47
+ transition: box-shadow 0.3s ease-in-out;
48
+ border: 1px solid #d9d9d9;
49
+ background-color: ${p => p.$color};
50
+
51
+ &:hover {
52
+ box-shadow: 0 0 5px ${p => tinycolor(p.$color).setAlpha(0.45).toRgbString()};
53
+ cursor: pointer;
54
+ }
55
+ `;
56
+ export const ToolbarWrapper = styled(Flex) `
57
+ .antsomi-divider.toolbar-separator {
58
+ height: 28px;
59
+ margin: 2px;
60
+ }
61
+ `;
@@ -0,0 +1,311 @@
1
+ import type React from 'react';
2
+ import type { JSONContent, Editor, MarkRange } from '@tiptap/core';
3
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
4
+ import type { Mark, Node } from '@tiptap/pm/model';
5
+ import { ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE } from './constants';
6
+ import type { OverrideProperties } from 'type-fest';
7
+ export type HandleSmartTagRef = {
8
+ setSmartTag: (attrs: SmartTagAttrs) => void;
9
+ deleteSmartTag: (id: string) => void;
10
+ updateSmartTagAttrs: (id: string, updatedAttrs: Omit<SmartTagAttrs, 'id'>) => void;
11
+ };
12
+ export type HandleLinkRef = {
13
+ setLink: (params: {
14
+ attrs: LinkAttrs;
15
+ content?: string;
16
+ }) => void;
17
+ deleteLink: (predicate: (attrs: LinkAttrs) => boolean) => void;
18
+ updateLinkAttrs: (predicate: (currentAttrs: LinkAttrs) => boolean, updateFn: (currentAttrs: LinkAttrs) => LinkAttrs | false) => void;
19
+ updateLinkText: (params: {
20
+ predicate: (attrs: LinkAttrs) => boolean;
21
+ updated: (currentText: string) => string;
22
+ mergeAdjacentEqualFn?: (currentAttrs: LinkAttrs, candidateAttrs: LinkAttrs) => boolean;
23
+ }) => void;
24
+ eachLinkGroup: (callback: (params: {
25
+ attrs: LinkAttrs;
26
+ content: string;
27
+ }) => void) => void;
28
+ eachSmartag: (callback: (attrs: SmartTagAttrs) => void) => void;
29
+ };
30
+ export type TextEditorRef = HandleSmartTagRef & HandleLinkRef & {
31
+ blur: (perserveSelection?: boolean) => void;
32
+ style?: CSSStyleDeclaration;
33
+ readonly editor: Editor | null;
34
+ };
35
+ export type SmartTagHandler = Partial<{
36
+ edit: (id: string, event: React.MouseEvent) => void;
37
+ setNew: (args: {
38
+ selectionText: string;
39
+ }) => void;
40
+ }>;
41
+ export type LinkHandler = Partial<{
42
+ setNew: (args: {
43
+ selectionText: string;
44
+ }) => void;
45
+ edit: (args: {
46
+ attrs: LinkAttrs;
47
+ selectionText: string;
48
+ }) => void;
49
+ }>;
50
+ /**
51
+ * Link form data structure
52
+ */
53
+ export type LinkFormData = {
54
+ /** The URL/href of the link */
55
+ url: string;
56
+ /** The text content to display */
57
+ text: string;
58
+ /** Whether to open link in new tab */
59
+ openInNewTab: boolean;
60
+ };
61
+ /**
62
+ * Link form state in store
63
+ */
64
+ export type LinkFormState = {
65
+ /** Whether the link form is visible */
66
+ isVisible: boolean;
67
+ /** Mode: insert new link or edit existing link */
68
+ mode: 'insert' | 'edit';
69
+ /** Form data */
70
+ data: LinkFormData;
71
+ } | null;
72
+ export type FontConfig = {
73
+ fontFamily: {
74
+ name: string;
75
+ fallback?: string[];
76
+ };
77
+ fontWeight: number[];
78
+ category?: string;
79
+ };
80
+ /**
81
+ * Function type for grouping fonts into categories
82
+ * @param font - The font configuration to categorize
83
+ * @returns Object with group key and display label, or void to skip grouping
84
+ */
85
+ export type FontGroupingFunction = (font: FontConfig) => {
86
+ key: string;
87
+ label: string;
88
+ } | void;
89
+ /**
90
+ * Result of font grouping operation
91
+ */
92
+ export type FontGroupResult = {
93
+ label: string;
94
+ fonts: FontConfig[];
95
+ };
96
+ /**
97
+ * Function type for determining group display order
98
+ * @param groups - Array of group keys that were generated
99
+ * @returns Array of group keys in desired display order
100
+ */
101
+ export type GroupOrderFunction = (groups: string[]) => string[];
102
+ /**
103
+ * Toolbar action names - union type for type safety
104
+ */
105
+ export type ToolbarActionName = 'bold' | 'italic' | 'underline' | 'strike' | 'superscript' | 'subscript' | 'fontFamily' | 'fontSize' | 'textColor' | 'backgroundColor' | 'textTransform' | 'bulletList' | 'orderedList' | 'indent' | 'outdent' | 'textAlign' | 'lineSpacing' | 'letterSpacing' | 'link' | 'smartTag' | 'emoji' | 'history' | 'clearFormatting';
106
+ /**
107
+ * Toolbar configuration options
108
+ */
109
+ export type ToolbarConfig = {
110
+ /**
111
+ * Which toolbar actions to show
112
+ * - Array: Show only specified actions in given order
113
+ * - 'all': Show all available actions (default)
114
+ * - false: Hide toolbar entirely
115
+ */
116
+ items?: ToolbarActionName[] | 'all' | false;
117
+ /**
118
+ * Which toolbar actions to hide (ignored if items is an array)
119
+ * Useful when you want to show most items but exclude a few
120
+ * @example
121
+ * config={{ Toolbar: { exclude: ['smartTag', 'emoji'] } }}
122
+ */
123
+ exclude?: ToolbarActionName[];
124
+ };
125
+ /**
126
+ * Configuration options for TextEditor components
127
+ */
128
+ export type Config = Partial<{
129
+ /** Font family configuration */
130
+ FontFamily: {
131
+ /** Array of available font configurations */
132
+ fonts?: FontConfig[];
133
+ /** Function to group fonts or false to disable grouping */
134
+ fontGroupingFn?: FontGroupingFunction | false;
135
+ /** Array of group keys or function to define display order. Groups not in this array will appear after ordered groups */
136
+ groupOrder?: string[] | GroupOrderFunction;
137
+ };
138
+ /** Unordered list configuration */
139
+ UnorderedList: {
140
+ /** Whether to use custom bullet styles */
141
+ useCustomBullet?: boolean;
142
+ };
143
+ /** Toolbar configuration */
144
+ Toolbar: ToolbarConfig;
145
+ }>;
146
+ export type TextStyle = {
147
+ fontFamily: string;
148
+ fontSize: string;
149
+ color: string;
150
+ backgroundColor: string;
151
+ lineHeight: string;
152
+ fontWeight: string;
153
+ letterSpacing: string;
154
+ };
155
+ export type TextEditorComponentsRender = {
156
+ renderLinkToolbar: (linkAttrs: LinkAttrs, defaultNode: React.ReactNode, defaultToolNodes: {
157
+ gotoLink: React.ReactNode;
158
+ copy: React.ReactNode;
159
+ edit: React.ReactNode;
160
+ unlink: React.ReactNode;
161
+ }) => React.ReactNode;
162
+ };
163
+ export type TextEditorProps = {
164
+ id?: string;
165
+ className?: string;
166
+ style?: React.CSSProperties;
167
+ initialContent?: string;
168
+ config?: Config;
169
+ smartTagHandler?: SmartTagHandler;
170
+ linkHandler?: LinkHandler;
171
+ editable?: boolean;
172
+ bubbleMenuProps?: Pick<BubbleMenuPluginProps, 'options' | 'appendTo'>;
173
+ defaultTextStyle?: Partial<TextStyle>;
174
+ dataAttributes?: Record<`data-${string}`, unknown>;
175
+ onUpdateDebounced?: number;
176
+ render?: Partial<TextEditorComponentsRender>;
177
+ onFocus?: (event: FocusEvent) => void;
178
+ onUpdate?: (args: {
179
+ html: string;
180
+ text: string;
181
+ json: JSONContent;
182
+ }) => void;
183
+ onChangeFont?: (changeInfo: {
184
+ font: FontConfig;
185
+ weight: number;
186
+ analysis: {
187
+ isFullyWebSafe: boolean;
188
+ isPrimaryFontWebSafe: boolean;
189
+ };
190
+ }) => void;
191
+ };
192
+ export type TextEditorAllProps = TextEditorProps & {
193
+ colors?: string[];
194
+ onChangeColors?: (colors: string[]) => void;
195
+ };
196
+ export type TextEditorWithProviderRef = TextEditorRef & {
197
+ updateColors?: (colors: string[]) => void;
198
+ };
199
+ export type OrderedListStyleType = (typeof ORDERED_LIST_STYLE_TYPE)[keyof typeof ORDERED_LIST_STYLE_TYPE];
200
+ export type UnorderedListStyleType = (typeof UNORDERED_LIST_STYLE_TYPE)[keyof typeof UNORDERED_LIST_STYLE_TYPE];
201
+ export declare const isOrderedListStyleType: (value: unknown) => value is OrderedListStyleType;
202
+ export declare const isUnorderedListStyleType: (value: unknown) => value is UnorderedListStyleType;
203
+ export type LinkAttrs = {
204
+ href: string;
205
+ } & Partial<{
206
+ target: string | null;
207
+ rel: string | null;
208
+ class: string | null;
209
+ title: string | null;
210
+ data: Record<string, string>;
211
+ }>;
212
+ export type SmartTagAttrs = {
213
+ id: string;
214
+ } & Partial<{
215
+ content: string;
216
+ tag: string;
217
+ }>;
218
+ export type LinkMark = OverrideProperties<Mark, {
219
+ attrs: LinkAttrs;
220
+ }>;
221
+ export type SmartTagNode = OverrideProperties<Node, {
222
+ attrs: SmartTagAttrs;
223
+ }>;
224
+ export type LinkMarkRange = OverrideProperties<MarkRange, {
225
+ mark: LinkMark;
226
+ }>;
227
+ export declare const isLinkMark: (mark: Mark) => mark is {
228
+ readonly type: import("prosemirror-model").MarkType;
229
+ addToSet: (set: readonly Mark[]) => readonly Mark[];
230
+ removeFromSet: (set: readonly Mark[]) => readonly Mark[];
231
+ isInSet: (set: readonly Mark[]) => boolean;
232
+ eq: (other: Mark) => boolean;
233
+ toJSON: () => any;
234
+ attrs: LinkAttrs;
235
+ };
236
+ type ProtocolOptions = {
237
+ /**
238
+ * The protocol scheme to be registered.
239
+ * @default '''
240
+ * @example 'ftp'
241
+ * @example 'git'
242
+ */
243
+ scheme: string;
244
+ /**
245
+ * If enabled, it allows optional slashes after the protocol.
246
+ * @default false
247
+ * @example true
248
+ */
249
+ optionalSlashes?: boolean;
250
+ };
251
+ export type ProtocolConfig = Array<ProtocolOptions | string>;
252
+ export declare const isSmartTagNode: (node: Node) => node is {
253
+ toString: () => string;
254
+ readonly type: import("prosemirror-model").NodeType;
255
+ readonly marks: readonly Mark[];
256
+ readonly content: import("prosemirror-model").Fragment;
257
+ readonly children: readonly Node[];
258
+ readonly text: string | undefined;
259
+ readonly nodeSize: number;
260
+ readonly childCount: number;
261
+ child: (index: number) => Node;
262
+ maybeChild: (index: number) => Node | null;
263
+ forEach: (f: (node: Node, offset: number, index: number) => void) => void;
264
+ nodesBetween: (from: number, to: number, f: (node: Node, pos: number, parent: Node | null, index: number) => boolean | void, startPos?: number | undefined) => void;
265
+ descendants: (f: (node: Node, pos: number, parent: Node | null, index: number) => boolean | void) => void;
266
+ readonly textContent: string;
267
+ textBetween: (from: number, to: number, blockSeparator?: string | null | undefined, leafText?: string | ((leafNode: Node) => string) | null | undefined) => string;
268
+ readonly firstChild: Node | null;
269
+ readonly lastChild: Node | null;
270
+ eq: (other: Node) => boolean;
271
+ sameMarkup: (other: Node) => boolean;
272
+ hasMarkup: (type: import("prosemirror-model").NodeType, attrs?: import("prosemirror-model").Attrs | null | undefined, marks?: readonly Mark[] | undefined) => boolean;
273
+ copy: (content?: import("prosemirror-model").Fragment | null | undefined) => Node;
274
+ mark: (marks: readonly Mark[]) => Node;
275
+ cut: (from: number, to?: number | undefined) => Node;
276
+ slice: (from: number, to?: number | undefined, includeParents?: boolean | undefined) => import("prosemirror-model").Slice;
277
+ replace: (from: number, to: number, slice: import("prosemirror-model").Slice) => Node;
278
+ nodeAt: (pos: number) => Node | null;
279
+ childAfter: (pos: number) => {
280
+ node: Node | null;
281
+ index: number;
282
+ offset: number;
283
+ };
284
+ childBefore: (pos: number) => {
285
+ node: Node | null;
286
+ index: number;
287
+ offset: number;
288
+ };
289
+ resolve: (pos: number) => import("prosemirror-model").ResolvedPos;
290
+ rangeHasMark: (from: number, to: number, type: import("prosemirror-model").MarkType | Mark) => boolean;
291
+ readonly isBlock: boolean;
292
+ readonly isTextblock: boolean;
293
+ readonly inlineContent: boolean;
294
+ readonly isInline: boolean;
295
+ readonly isText: boolean;
296
+ readonly isLeaf: boolean;
297
+ readonly isAtom: boolean;
298
+ contentMatchAt: (index: number) => import("prosemirror-model").ContentMatch;
299
+ canReplace: (from: number, to: number, replacement?: import("prosemirror-model").Fragment | undefined, start?: number | undefined, end?: number | undefined) => boolean;
300
+ canReplaceWith: (from: number, to: number, type: import("prosemirror-model").NodeType, marks?: readonly Mark[] | undefined) => boolean;
301
+ canAppend: (other: Node) => boolean;
302
+ check: () => void;
303
+ toJSON: () => any;
304
+ attrs: SmartTagAttrs;
305
+ };
306
+ export declare const isLinkMarkRange: (markRange: MarkRange) => markRange is {
307
+ from: number;
308
+ to: number;
309
+ mark: LinkMark;
310
+ };
311
+ export {};
@@ -0,0 +1,6 @@
1
+ import { CUSTOM_LINK_EXTENSION_NAME, ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE, } from './constants';
2
+ export const isOrderedListStyleType = (value) => typeof value === 'string' && Object.values(ORDERED_LIST_STYLE_TYPE).some(v => v === value);
3
+ export const isUnorderedListStyleType = (value) => typeof value === 'string' && Object.values(UNORDERED_LIST_STYLE_TYPE).some(v => v === value);
4
+ export const isLinkMark = (mark) => mark.type.name === CUSTOM_LINK_EXTENSION_NAME;
5
+ export const isSmartTagNode = (node) => node.type.name === 'smartTag';
6
+ export const isLinkMarkRange = (markRange) => isLinkMark(markRange.mark);
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
3
+ export declare const BubbleMenu: import("react").ForwardRefExoticComponent<Pick<Partial<Omit<Pick<Partial<BubbleMenuPluginProps>, "pluginKey"> & Omit<BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Pick<Partial<BubbleMenuPluginProps>, "pluginKey"> & Omit<BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,114 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCurrentEditor } from '@tiptap/react';
3
+ import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
+ import { createPortal } from 'react-dom';
5
+ import { BubbleMenuPlugin } from '../../extensions/BubbleMenu';
6
+ import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
7
+ import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
8
+ export const BubbleMenu = forwardRef(({ pluginKey = 'bubbleMenu', editor, updateDelay, resizeDelay, shouldShow = null, getReferencedVirtualElement, appendTo, options, children, ...restProps }, ref) => {
9
+ const menuEl = useRef(document.createElement('div'));
10
+ menuEl.current.classList.add(`${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor-bubble-menu`);
11
+ const { editor: currentEditor } = useCurrentEditor();
12
+ /**
13
+ * Tracks whether the bubble menu has been shown at least once.
14
+ * Used for lazy mounting optimization - children are only mounted after first show.
15
+ */
16
+ const [hasShown, setHasShown] = useState(false);
17
+ /**
18
+ * Ref to track hasShown synchronously (since state updates are async).
19
+ */
20
+ const hasShownRef = useRef(false);
21
+ /**
22
+ * Tracks whether we're in the first show process (to prevent empty flash).
23
+ * After first show completes, this flag is no longer used.
24
+ */
25
+ const isFirstShowRef = useRef(false);
26
+ /**
27
+ * The editor instance where the bubble menu plugin will be registered.
28
+ */
29
+ const pluginEditor = editor || currentEditor;
30
+ useEffect(() => {
31
+ if (typeof ref === 'function') {
32
+ ref(menuEl.current);
33
+ }
34
+ else if (ref) {
35
+ ref.current = menuEl.current;
36
+ }
37
+ }, [ref]);
38
+ const bubbleMenuPluginProps = {
39
+ updateDelay,
40
+ resizeDelay,
41
+ pluginKey,
42
+ shouldShow,
43
+ getReferencedVirtualElement,
44
+ options: {
45
+ ...options,
46
+ strategy: options?.strategy || 'absolute',
47
+ placement: options?.placement || 'bottom',
48
+ offset: options?.offset || 10,
49
+ onHide: () => {
50
+ options?.onHide?.();
51
+ },
52
+ onShow: () => {
53
+ if (!hasShownRef.current) {
54
+ // First show: mark as first show and force hide until children mount
55
+ hasShownRef.current = true;
56
+ isFirstShowRef.current = true;
57
+ menuEl.current.style.visibility = 'hidden';
58
+ setHasShown(true);
59
+ }
60
+ options?.onShow?.();
61
+ },
62
+ },
63
+ };
64
+ const bubbleMenuPluginPropsRef = useRef(bubbleMenuPluginProps);
65
+ bubbleMenuPluginPropsRef.current = bubbleMenuPluginProps;
66
+ useLayoutEffect(() => {
67
+ // After children mount in first show, make menuEl visible
68
+ if (isFirstShowRef.current) {
69
+ menuEl.current.style.visibility = 'visible';
70
+ isFirstShowRef.current = false;
71
+ }
72
+ });
73
+ useDeepCompareEffect(() => {
74
+ if (pluginEditor?.isDestroyed) {
75
+ return;
76
+ }
77
+ if (!pluginEditor) {
78
+ // eslint-disable-next-line no-console
79
+ console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.');
80
+ return;
81
+ }
82
+ const bubbleMenuElement = menuEl.current;
83
+ bubbleMenuElement.style.visibility = 'hidden';
84
+ bubbleMenuElement.style.position = 'absolute';
85
+ const plugin = BubbleMenuPlugin({
86
+ ...bubbleMenuPluginPropsRef.current,
87
+ appendTo,
88
+ editor: pluginEditor,
89
+ element: bubbleMenuElement,
90
+ });
91
+ pluginEditor.registerPlugin(plugin);
92
+ const createdPluginKey = bubbleMenuPluginPropsRef.current.pluginKey;
93
+ return () => {
94
+ pluginEditor.unregisterPlugin(createdPluginKey);
95
+ window.requestAnimationFrame(() => {
96
+ if (bubbleMenuElement.parentNode) {
97
+ bubbleMenuElement.parentNode.removeChild(bubbleMenuElement);
98
+ }
99
+ });
100
+ };
101
+ }, [appendTo, pluginEditor]);
102
+ /**
103
+ * Lazy mounting optimization: only mount children after the bubble menu
104
+ * has been shown at least once. This significantly improves performance
105
+ * when many TextEditor instances exist (e.g., in lists).
106
+ *
107
+ * After first show, children remain mounted and the tiptap plugin
108
+ * handles visibility automatically via CSS, avoiding flash effects.
109
+ */
110
+ if (!hasShown) {
111
+ return null;
112
+ }
113
+ return createPortal(_jsx("div", { ...restProps, children: children }), menuEl.current);
114
+ });
@@ -0,0 +1 @@
1
+ export { BubbleMenu } from './BubbleMenu';
@@ -0,0 +1 @@
1
+ export { BubbleMenu } from './BubbleMenu';
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare const TextEditorButton: import("react").ForwardRefExoticComponent<{
3
+ isActive?: boolean | undefined;
4
+ children?: import("react").ReactNode;
5
+ tooltipProps?: {
6
+ title?: string | undefined;
7
+ open?: boolean | undefined;
8
+ } | undefined;
9
+ } & Pick<import("antd").ButtonProps, "className" | "onClick" | "disabled" | "icon"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button, Tooltip } from 'antd';
3
+ import clsx from 'clsx';
4
+ import styled from 'styled-components';
5
+ import { forwardRef } from 'react';
6
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
7
+ const StyledButton = styled(Button) `
8
+ &.antsomi-btn.antsomi-btn-text {
9
+ height: 24px;
10
+ width: 24px;
11
+ padding: 0;
12
+ flex-shrink: 0;
13
+ border-radius: 2px;
14
+ color: ${THEME.token?.bw8};
15
+
16
+ &.is-active {
17
+ color: ${THEME.token?.colorPrimary};
18
+ background-color: #e0ebf7;
19
+
20
+ &:hover {
21
+ background-color: #e0ebf7;
22
+ }
23
+ }
24
+
25
+ &:hover:not(:disabled, .is-active) {
26
+ color: ${THEME.token?.colorPrimary};
27
+ }
28
+ }
29
+ `;
30
+ export const TextEditorButton = forwardRef((props, ref) => {
31
+ const { children, isActive, tooltipProps, className, disabled, ...restProps } = props;
32
+ return (_jsx(Tooltip, { mouseEnterDelay: 0.4, placement: "top", ...tooltipProps, open: disabled ? false : tooltipProps?.open, children: _jsx(StyledButton, { ref: ref, ...restProps, disabled: disabled, type: "text", className: clsx(className, {
33
+ 'is-active': isActive,
34
+ }), children: children }) }));
35
+ });
@@ -0,0 +1,2 @@
1
+ export { TextEditorButton } from './Button';
2
+ export { type TextEditorButtonProps } from './types';
@@ -0,0 +1 @@
1
+ export { TextEditorButton } from './Button';
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from 'antd';
3
+ export type TextEditorButtonProps = {
4
+ isActive?: boolean;
5
+ children?: React.ReactNode;
6
+ tooltipProps?: {
7
+ title?: string;
8
+ open?: boolean;
9
+ };
10
+ } & Pick<ButtonProps, 'icon' | 'onClick' | 'className' | 'disabled' | 'className'>;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { PopoverProps } from 'antd/lib';
3
+ export interface ColorPickerProps {
4
+ value?: string;
5
+ children?: React.ReactNode;
6
+ onChange?: (value: string) => void;
7
+ popoverProps?: Omit<PopoverProps, 'content'> & {
8
+ content?: ((args: {
9
+ colorGrid: React.ReactNode;
10
+ usedColors: React.ReactNode;
11
+ customColorPicker: React.ReactNode;
12
+ }) => React.ReactNode) | React.ReactNode;
13
+ };
14
+ }
15
+ export interface ColorPickerRef {
16
+ setOpen: (open: boolean) => void;
17
+ }
18
+ export interface UsedColorsProps {
19
+ value?: string;
20
+ onChange?: (value: string) => void;
21
+ }
22
+ export interface GridColorProps {
23
+ value?: string;
24
+ colorGrid?: string[][];
25
+ onChange?: (value: string) => void;
26
+ }
27
+ export interface UseUsedColorsParams {
28
+ numberOfColors?: number;
29
+ }
30
+ export interface BoxColorProps {
31
+ color?: string;
32
+ isActive?: boolean;
33
+ onClick?: (e: React.MouseEvent) => void;
34
+ }
35
+ export interface CustomColorPickerProps {
36
+ currentColor: string;
37
+ onApply?: (value: string) => void;
38
+ }
39
+ export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<ColorPickerRef>>;