@antscorp/antsomi-ui 1.3.7-beta.7 → 1.3.7-beta.71

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 (302) hide show
  1. package/README.md +70 -0
  2. package/es/components/atoms/Input/Input.js +3 -1
  3. package/es/components/atoms/InputDynamic/InputDynamic.js +3 -3
  4. package/es/components/atoms/Tag/Tag.js +1 -1
  5. package/es/components/icons/LazyIcon/LazyIcon.d.ts +2 -0
  6. package/es/components/icons/LazyIcon/LazyIcon.js +2 -0
  7. package/es/components/icons/QRCodeManagementIcon.d.ts +3 -0
  8. package/es/components/icons/QRCodeManagementIcon.js +7 -0
  9. package/es/components/icons/QRSetDashboardIcon.d.ts +3 -0
  10. package/es/components/icons/QRSetDashboardIcon.js +7 -0
  11. package/es/components/icons/index.d.ts +2 -0
  12. package/es/components/icons/index.js +2 -0
  13. package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +28 -2
  14. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +1 -0
  15. package/es/components/molecules/AddDynamicContent/constants.d.ts +2 -0
  16. package/es/components/molecules/AddDynamicContent/constants.js +2 -0
  17. package/es/components/molecules/ColorPicker/index.d.ts +2 -0
  18. package/es/components/molecules/ColorPicker/index.js +8 -3
  19. package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +1 -0
  20. package/es/components/molecules/EmojiPopover/EmojiPopover.js +2 -2
  21. package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
  22. package/es/components/molecules/EmojiPopover/styled.js +1 -1
  23. package/es/components/molecules/EmptyData/EmptyData.d.ts +1 -1
  24. package/es/components/molecules/EmptyData/EmptyData.js +4 -2
  25. package/es/components/molecules/HeaderV2/HeaderV2.d.ts +1 -1
  26. package/es/components/molecules/InputSearch/index.d.ts +1 -1
  27. package/es/components/molecules/InputSearch/index.js +2 -1
  28. package/es/components/molecules/Modal/Modal.js +7 -1
  29. package/es/components/molecules/ModalV2/ModalV2.js +2 -1
  30. package/es/components/molecules/SearchPopover/SearchPopover.js +2 -2
  31. package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
  32. package/es/components/molecules/SearchPopover/styled.js +1 -2
  33. package/es/components/molecules/SearchPopover/types.d.ts +4 -3
  34. package/es/components/molecules/Select/Select.js +3 -3
  35. package/es/components/molecules/Select/styled.d.ts +3 -1
  36. package/es/components/molecules/Select/styled.js +50 -6
  37. package/es/components/molecules/ShareAccess/ShareAccess.d.ts +2 -1
  38. package/es/components/molecules/ShareAccess/ShareAccess.js +12 -9
  39. package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +5 -5
  40. package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +2 -2
  41. package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +2 -1
  42. package/es/components/molecules/ShareAccess/index.d.ts +1 -0
  43. package/es/components/molecules/ShareAccess/reducer.d.ts +1 -1
  44. package/es/components/molecules/ShareAccess/reducer.js +7 -4
  45. package/es/components/molecules/ShareAccess/types.d.ts +22 -0
  46. package/es/components/molecules/ShareAccess/utils.d.ts +3 -1
  47. package/es/components/molecules/ShareAccess/utils.js +35 -2
  48. package/es/components/molecules/TagifyInput/TagifyInput.js +48 -27
  49. package/es/components/molecules/TagifyInput/types.d.ts +14 -8
  50. package/es/components/molecules/TagifyInput/utils.d.ts +6 -1
  51. package/es/components/molecules/TagifyInput/utils.js +19 -0
  52. package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
  53. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +3 -7
  54. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
  55. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -327
  56. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
  57. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
  58. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
  59. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
  60. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
  61. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
  62. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
  63. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
  64. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
  65. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
  66. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
  67. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
  68. package/es/components/molecules/VirtualizedMenu/styled.js +14 -3
  69. package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
  70. package/es/components/molecules/VirtualizedMenu/utils.d.ts +1 -0
  71. package/es/components/molecules/VirtualizedMenu/utils.js +1 -0
  72. package/es/components/molecules/index.d.ts +1 -0
  73. package/es/components/organism/AccountSharing/AccountSharing.d.ts +1 -0
  74. package/es/components/organism/AccountSharing/AccountSharing.js +17 -33
  75. package/es/components/organism/AccountSharing/styled.js +1 -1
  76. package/es/components/organism/ActivityTimeline/ActivityTimeline.js +3 -3
  77. package/es/components/organism/ActivityTimeline/constants.d.ts +9 -9
  78. package/es/components/organism/ActivityTimeline/constants.js +3 -3
  79. package/es/components/organism/ActivityTimeline/index.d.ts +530 -1
  80. package/es/components/organism/ActivityTimeline/index.js +9 -1
  81. package/es/components/organism/ActivityTimeline/utils.js +186 -15
  82. package/es/components/organism/LeftMenu/LeftMenu.js +6 -6
  83. package/es/components/organism/LeftMenu/hooks/usePermission.js +1 -1
  84. package/es/components/organism/LeftMenu/styled.js +2 -0
  85. package/es/components/organism/LeftMenu/types/index.d.ts +7 -0
  86. package/es/components/organism/LeftMenu/utils/index.js +1 -1
  87. package/es/components/organism/Login/Login.js +19 -36
  88. package/es/components/organism/Login/components/IconInfo/IconInfo.js +1 -1
  89. package/es/components/organism/Login/components/LoginSelectPortal/LoginSelectPortal.js +1 -1
  90. package/es/components/organism/Login/components/SignIn/SignIn.js +2 -2
  91. package/es/components/organism/Login/types/index.d.ts +2 -0
  92. package/es/components/organism/LoginV2/LoginV2.d.ts +3 -0
  93. package/es/components/organism/LoginV2/LoginV2.js +957 -0
  94. package/es/components/organism/LoginV2/components/Avatar/Avatar.d.ts +8 -0
  95. package/es/components/organism/LoginV2/components/Avatar/Avatar.js +11 -0
  96. package/es/components/organism/LoginV2/components/Avatar/index.d.ts +1 -0
  97. package/es/components/organism/LoginV2/components/Avatar/index.js +1 -0
  98. package/es/components/organism/LoginV2/components/ChooseMethod/ChooseMethod.d.ts +9 -0
  99. package/es/components/organism/LoginV2/components/ChooseMethod/ChooseMethod.js +54 -0
  100. package/es/components/organism/LoginV2/components/ChooseMethod/Method.d.ts +10 -0
  101. package/es/components/organism/LoginV2/components/ChooseMethod/Method.js +13 -0
  102. package/es/components/organism/LoginV2/components/ChooseMethod/index.d.ts +1 -0
  103. package/es/components/organism/LoginV2/components/ChooseMethod/index.js +1 -0
  104. package/es/components/organism/LoginV2/components/ChooseMethod/styled.d.ts +10 -0
  105. package/es/components/organism/LoginV2/components/ChooseMethod/styled.js +24 -0
  106. package/es/components/organism/LoginV2/components/ChooseMethod/utils.d.ts +1 -0
  107. package/es/components/organism/LoginV2/components/ChooseMethod/utils.js +1 -0
  108. package/es/components/organism/LoginV2/components/ForgotPassword/ForgotPassword.d.ts +14 -0
  109. package/es/components/organism/LoginV2/components/ForgotPassword/ForgotPassword.js +195 -0
  110. package/es/components/organism/LoginV2/components/ForgotPassword/index.d.ts +2 -0
  111. package/es/components/organism/LoginV2/components/ForgotPassword/index.js +2 -0
  112. package/es/components/organism/LoginV2/components/ForgotPassword/styled.d.ts +1 -0
  113. package/es/components/organism/LoginV2/components/ForgotPassword/styled.js +10 -0
  114. package/es/components/organism/LoginV2/components/IconInfo/IconInfo.d.ts +7 -0
  115. package/es/components/organism/LoginV2/components/IconInfo/IconInfo.js +18 -0
  116. package/es/components/organism/LoginV2/components/IconInfo/index.d.ts +1 -0
  117. package/es/components/organism/LoginV2/components/IconInfo/index.js +1 -0
  118. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/Item.d.ts +10 -0
  119. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/Item.js +12 -0
  120. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/index.d.ts +1 -0
  121. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/index.js +1 -0
  122. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/styled.d.ts +2 -0
  123. package/es/components/organism/LoginV2/components/LoginSelectPortal/Item/styled.js +34 -0
  124. package/es/components/organism/LoginV2/components/LoginSelectPortal/LoginSelectPortal.d.ts +19 -0
  125. package/es/components/organism/LoginV2/components/LoginSelectPortal/LoginSelectPortal.js +194 -0
  126. package/es/components/organism/LoginV2/components/LoginSelectPortal/index.d.ts +1 -0
  127. package/es/components/organism/LoginV2/components/LoginSelectPortal/index.js +1 -0
  128. package/es/components/organism/LoginV2/components/LoginSelectPortal/styled.d.ts +1 -0
  129. package/es/components/organism/LoginV2/components/LoginSelectPortal/styled.js +5 -0
  130. package/es/components/organism/LoginV2/components/LoginWithEmail/LoginWithEmail.d.ts +15 -0
  131. package/es/components/organism/LoginV2/components/LoginWithEmail/LoginWithEmail.js +211 -0
  132. package/es/components/organism/LoginV2/components/LoginWithEmail/index.d.ts +1 -0
  133. package/es/components/organism/LoginV2/components/LoginWithEmail/index.js +1 -0
  134. package/es/components/organism/LoginV2/components/LoginWithEmail/styled.d.ts +3 -0
  135. package/es/components/organism/LoginV2/components/LoginWithEmail/styled.js +5 -0
  136. package/es/components/organism/LoginV2/components/LoginWithGG/LoginWithGG.d.ts +14 -0
  137. package/es/components/organism/LoginV2/components/LoginWithGG/LoginWithGG.js +116 -0
  138. package/es/components/organism/LoginV2/components/LoginWithGG/index.d.ts +1 -0
  139. package/es/components/organism/LoginV2/components/LoginWithGG/index.js +1 -0
  140. package/es/components/organism/LoginV2/components/LoginWithGG/styled.d.ts +3 -0
  141. package/es/components/organism/LoginV2/components/LoginWithGG/styled.js +5 -0
  142. package/es/components/organism/LoginV2/components/Logo/Logo.d.ts +6 -0
  143. package/es/components/organism/LoginV2/components/Logo/Logo.js +9 -0
  144. package/es/components/organism/LoginV2/components/Logo/index.d.ts +1 -0
  145. package/es/components/organism/LoginV2/components/Logo/index.js +1 -0
  146. package/es/components/organism/LoginV2/components/OryConsent/OryAuthLayout.d.ts +9 -0
  147. package/es/components/organism/LoginV2/components/OryConsent/OryAuthLayout.js +4 -0
  148. package/es/components/organism/LoginV2/components/OryConsent/OryConsent.d.ts +17 -0
  149. package/es/components/organism/LoginV2/components/OryConsent/OryConsent.js +204 -0
  150. package/es/components/organism/LoginV2/components/OryConsent/OryThemeProvider.d.ts +8 -0
  151. package/es/components/organism/LoginV2/components/OryConsent/OryThemeProvider.js +10 -0
  152. package/es/components/organism/LoginV2/components/OryConsent/PortalSelect.d.ts +15 -0
  153. package/es/components/organism/LoginV2/components/OryConsent/PortalSelect.js +30 -0
  154. package/es/components/organism/LoginV2/components/OryConsent/ScopeConsent.d.ts +20 -0
  155. package/es/components/organism/LoginV2/components/OryConsent/ScopeConsent.js +29 -0
  156. package/es/components/organism/LoginV2/components/OryConsent/index.d.ts +2 -0
  157. package/es/components/organism/LoginV2/components/OryConsent/index.js +2 -0
  158. package/es/components/organism/LoginV2/components/OryConsent/styled.d.ts +31 -0
  159. package/es/components/organism/LoginV2/components/OryConsent/styled.js +292 -0
  160. package/es/components/organism/LoginV2/components/OrySignIn/OryFormShell.d.ts +9 -0
  161. package/es/components/organism/LoginV2/components/OrySignIn/OryFormShell.js +36 -0
  162. package/es/components/organism/LoginV2/components/OrySignIn/OryMfa.d.ts +11 -0
  163. package/es/components/organism/LoginV2/components/OrySignIn/OryMfa.js +144 -0
  164. package/es/components/organism/LoginV2/components/OrySignIn/OryRecovery.d.ts +9 -0
  165. package/es/components/organism/LoginV2/components/OrySignIn/OryRecovery.js +128 -0
  166. package/es/components/organism/LoginV2/components/OrySignIn/OryStatus.d.ts +17 -0
  167. package/es/components/organism/LoginV2/components/OrySignIn/OryStatus.js +33 -0
  168. package/es/components/organism/LoginV2/components/OrySignIn/index.d.ts +3 -0
  169. package/es/components/organism/LoginV2/components/OrySignIn/index.js +3 -0
  170. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/SetupGGAuthenticator.d.ts +14 -0
  171. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/SetupGGAuthenticator.js +100 -0
  172. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/index.d.ts +2 -0
  173. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/index.js +2 -0
  174. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/styled.d.ts +4 -0
  175. package/es/components/organism/LoginV2/components/SetupGGAuthenticator/styled.js +10 -0
  176. package/es/components/organism/LoginV2/components/SignIn/SignIn.d.ts +22 -0
  177. package/es/components/organism/LoginV2/components/SignIn/SignIn.js +107 -0
  178. package/es/components/organism/LoginV2/components/SignIn/index.d.ts +1 -0
  179. package/es/components/organism/LoginV2/components/SignIn/index.js +1 -0
  180. package/es/components/organism/LoginV2/components/SignIn/styled.d.ts +3 -0
  181. package/es/components/organism/LoginV2/components/SignIn/styled.js +10 -0
  182. package/es/components/organism/LoginV2/components/VerifyAccount/VerifyAccount.d.ts +25 -0
  183. package/es/components/organism/LoginV2/components/VerifyAccount/VerifyAccount.js +42 -0
  184. package/es/components/organism/LoginV2/components/VerifyAccount/index.d.ts +1 -0
  185. package/es/components/organism/LoginV2/components/VerifyAccount/index.js +1 -0
  186. package/es/components/organism/LoginV2/components/VerifyAccount/styled.d.ts +22 -0
  187. package/es/components/organism/LoginV2/components/VerifyAccount/styled.js +17 -0
  188. package/es/components/organism/LoginV2/components/WidgetLayout/WidgetLayout.d.ts +13 -0
  189. package/es/components/organism/LoginV2/components/WidgetLayout/WidgetLayout.js +18 -0
  190. package/es/components/organism/LoginV2/components/WidgetLayout/index.d.ts +1 -0
  191. package/es/components/organism/LoginV2/components/WidgetLayout/index.js +1 -0
  192. package/es/components/organism/LoginV2/components/WidgetLayout/styled.d.ts +5 -0
  193. package/es/components/organism/LoginV2/components/WidgetLayout/styled.js +22 -0
  194. package/es/components/organism/LoginV2/components/index.d.ts +11 -0
  195. package/es/components/organism/LoginV2/components/index.js +11 -0
  196. package/es/components/organism/LoginV2/constants/index.d.ts +48 -0
  197. package/es/components/organism/LoginV2/constants/index.js +48 -0
  198. package/es/components/organism/LoginV2/hooks/index.d.ts +1 -0
  199. package/es/components/organism/LoginV2/hooks/index.js +1 -0
  200. package/es/components/organism/LoginV2/hooks/useResize.d.ts +7 -0
  201. package/es/components/organism/LoginV2/hooks/useResize.js +21 -0
  202. package/es/components/organism/LoginV2/index.d.ts +6 -0
  203. package/es/components/organism/LoginV2/index.js +4 -0
  204. package/es/components/organism/LoginV2/styled.d.ts +51 -0
  205. package/es/components/organism/LoginV2/styled.js +129 -0
  206. package/es/components/organism/LoginV2/types/index.d.ts +79 -0
  207. package/es/components/organism/LoginV2/types/index.js +1 -0
  208. package/es/components/organism/LoginV2/types/ory.d.ts +52 -0
  209. package/es/components/organism/LoginV2/types/ory.js +1 -0
  210. package/es/components/organism/LoginV2/utils/index.d.ts +14 -0
  211. package/es/components/organism/LoginV2/utils/index.js +49 -0
  212. package/es/components/organism/LoginV2/utils/ory.d.ts +138 -0
  213. package/es/components/organism/LoginV2/utils/ory.js +408 -0
  214. package/es/components/organism/LoginV2/utils/oryConsent.d.ts +52 -0
  215. package/es/components/organism/LoginV2/utils/oryConsent.js +174 -0
  216. package/es/components/organism/LoginV2/utils/oryFlows.d.ts +100 -0
  217. package/es/components/organism/LoginV2/utils/oryFlows.js +319 -0
  218. package/es/components/organism/TextEditor/TextEditor.d.ts +9 -2
  219. package/es/components/organism/TextEditor/TextEditor.js +203 -42
  220. package/es/components/organism/TextEditor/constants.d.ts +9 -0
  221. package/es/components/organism/TextEditor/constants.js +66 -0
  222. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +6 -128
  223. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +7 -292
  224. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +1 -1
  225. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +4 -0
  226. package/es/components/organism/TextEditor/extensions/Link.js +33 -14
  227. package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
  228. package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
  229. package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +5 -6
  230. package/es/components/organism/TextEditor/extensions/SmartTag.js +96 -4
  231. package/es/components/organism/TextEditor/hooks/useColorSet.js +7 -0
  232. package/es/components/organism/TextEditor/hooks/useMarkTracking.js +2 -1
  233. package/es/components/organism/TextEditor/index.d.ts +7 -5
  234. package/es/components/organism/TextEditor/index.scss +4 -7
  235. package/es/components/organism/TextEditor/provider.d.ts +1 -0
  236. package/es/components/organism/TextEditor/provider.js +6 -3
  237. package/es/components/organism/TextEditor/store.d.ts +11 -4
  238. package/es/components/organism/TextEditor/store.js +22 -2
  239. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
  240. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
  241. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
  242. package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
  243. package/es/components/organism/TextEditor/stories/shared.js +57 -0
  244. package/es/components/organism/TextEditor/styled.d.ts +1 -1
  245. package/es/components/organism/TextEditor/styled.js +1 -0
  246. package/es/components/organism/TextEditor/types.d.ts +161 -11
  247. package/es/components/organism/TextEditor/types.js +1 -0
  248. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +2 -1
  249. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +80 -51
  250. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +1 -1
  251. package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +1 -1
  252. package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +2 -2
  253. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +12 -2
  254. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
  255. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
  256. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
  257. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
  258. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
  259. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
  260. package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
  261. package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
  262. package/es/components/organism/TextEditor/ui/Popover/Popover.js +1 -1
  263. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +1 -3
  264. package/es/components/organism/TextEditor/ui/Toolbar/{Toolbar.d.ts → FormattingToolbar.d.ts} +3 -4
  265. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +90 -0
  266. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
  267. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
  268. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +4 -3
  269. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +1 -0
  270. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +2 -2
  271. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +6 -1
  272. package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -1
  273. package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -1
  274. package/es/components/organism/TextEditor/utils/documentState.d.ts +14 -0
  275. package/es/components/organism/TextEditor/utils/documentState.js +25 -0
  276. package/es/components/organism/TextEditor/utils/htmlProcessing.js +60 -0
  277. package/es/components/organism/TextEditor/utils/link.d.ts +10 -1
  278. package/es/components/organism/TextEditor/utils/link.js +161 -7
  279. package/es/components/organism/TextEditor/utils/menu.js +2 -1
  280. package/es/components/organism/TextEditor/utils/selection.js +3 -2
  281. package/es/components/organism/TextEditor/utils/smartTag.js +2 -1
  282. package/es/components/organism/index.d.ts +3 -1
  283. package/es/components/organism/index.js +1 -0
  284. package/es/components/template/TemplateListing/Loadable.d.ts +1 -0
  285. package/es/hooks/index.d.ts +1 -1
  286. package/es/hooks/index.js +1 -1
  287. package/es/providers/ConfigProvider/ConfigProvider.d.ts +4 -0
  288. package/es/providers/ConfigProvider/ConfigProvider.js +2 -3
  289. package/es/providers/ConfigProvider/GlobalStyle.d.ts +2 -2
  290. package/es/providers/ConfigProvider/GlobalStyle.js +67 -64
  291. package/es/services/MediaTemplateDesign/UploadFile/index.js +4 -4
  292. package/es/utils/common.d.ts +1 -1
  293. package/es/utils/common.js +3 -3
  294. package/es/utils/cookie.js +2 -1
  295. package/es/utils/crossSubdomainCookieOptions.d.ts +14 -0
  296. package/es/utils/crossSubdomainCookieOptions.js +12 -0
  297. package/package.json +26 -30
  298. package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +0 -1
  299. package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +0 -1
  300. package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
  301. package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +0 -1
  302. package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -39
@@ -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
+ });
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TextStyle } from './types';
3
- export declare const StyledEditorContent: import("styled-components").StyledComponent<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@tiptap/react").EditorContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>>, any, {
3
+ export declare const StyledEditorContent: import("styled-components").StyledComponent<import("react").NamedExoticComponent<Omit<import("@tiptap/react").EditorContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
4
4
  $textStyle: TextStyle;
5
5
  }, never>;
6
6
  export declare const ColorBox: import("styled-components").StyledComponent<"div", any, {
@@ -12,6 +12,7 @@ export const StyledEditorContent = styled(EditorContent) `
12
12
 
13
13
  // Some apps have global p styles, so we need to override it
14
14
 
15
+ font-size: ${p => p.$textStyle.fontSize};
15
16
  line-height: ${p => p.$textStyle.lineHeight};
16
17
  font-family: ${p => p.$textStyle.fontFamily};
17
18
  color: ${p => p.$textStyle.color};
@@ -1,14 +1,13 @@
1
1
  import type React from 'react';
2
- import type { JSONContent, Editor, MarkRange } from '@tiptap/core';
3
- import type { Mark } from '@tiptap/pm/model';
4
- import type { SmartTagAttrs } from './extensions/SmartTag';
2
+ import type { Editor, JSONContent, MarkRange } from '@tiptap/core';
3
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
4
+ import type { Mark, Node } from '@tiptap/pm/model';
5
5
  import { ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE } from './constants';
6
6
  import type { OverrideProperties } from 'type-fest';
7
- import { BubbleMenuPluginProps } from './extensions/BubbleMenu';
8
7
  export type HandleSmartTagRef = {
9
8
  setSmartTag: (attrs: SmartTagAttrs) => void;
10
9
  deleteSmartTag: (id: string) => void;
11
- updateSmartTagAttrs: (id: string, updatedAttrs: Omit<SmartTagAttrs, 'id'>) => void;
10
+ updateSmartTagAttrs: (id: string, updatedAttrs: Partial<SmartTagAttrs>) => void;
12
11
  };
13
12
  export type HandleLinkRef = {
14
13
  setLink: (params: {
@@ -22,11 +21,21 @@ export type HandleLinkRef = {
22
21
  updated: (currentText: string) => string;
23
22
  mergeAdjacentEqualFn?: (currentAttrs: LinkAttrs, candidateAttrs: LinkAttrs) => boolean;
24
23
  }) => void;
24
+ eachLinkGroup: (callback: (params: {
25
+ attrs: LinkAttrs;
26
+ content: string;
27
+ }) => void) => void;
28
+ eachSmartag: (callback: (attrs: SmartTagAttrs) => void) => void;
25
29
  };
26
30
  export type TextEditorRef = HandleSmartTagRef & HandleLinkRef & {
27
31
  blur: (perserveSelection?: boolean) => void;
32
+ focus: () => void;
28
33
  style?: CSSStyleDeclaration;
29
- readonly editor: Editor | null;
34
+ getHTML?: () => string;
35
+ setContent?: (text: string, options?: Partial<{
36
+ emitUpdate: boolean;
37
+ }>) => void;
38
+ readonly editor: Editor;
30
39
  };
31
40
  export type SmartTagHandler = Partial<{
32
41
  edit: (id: string, event: React.MouseEvent) => void;
@@ -43,6 +52,28 @@ export type LinkHandler = Partial<{
43
52
  selectionText: string;
44
53
  }) => void;
45
54
  }>;
55
+ /**
56
+ * Link form data structure
57
+ */
58
+ export type LinkFormData = {
59
+ /** The URL/href of the link */
60
+ url: string;
61
+ /** The text content to display */
62
+ text: string;
63
+ /** Whether to open link in new tab */
64
+ openInNewTab: boolean;
65
+ };
66
+ /**
67
+ * Link form state in store
68
+ */
69
+ export type LinkFormState = {
70
+ /** Whether the link form is visible */
71
+ isVisible: boolean;
72
+ /** Mode: insert new link or edit existing link */
73
+ mode: 'insert' | 'edit';
74
+ /** Form data */
75
+ data: LinkFormData;
76
+ } | null;
46
77
  export type FontConfig = {
47
78
  fontFamily: {
48
79
  name: string;
@@ -73,10 +104,34 @@ export type FontGroupResult = {
73
104
  * @returns Array of group keys in desired display order
74
105
  */
75
106
  export type GroupOrderFunction = (groups: string[]) => string[];
107
+ /**
108
+ * Toolbar action names - union type for type safety
109
+ */
110
+ 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';
111
+ /**
112
+ * Toolbar configuration options
113
+ */
114
+ export type ToolbarConfig = {
115
+ /**
116
+ * Which toolbar actions to show
117
+ * - Array: Show only specified actions in given order
118
+ * - 'all': Show all available actions (default)
119
+ * - false: Hide toolbar entirely
120
+ */
121
+ items?: ToolbarActionName[] | 'all' | false;
122
+ /**
123
+ * Which toolbar actions to hide (ignored if items is an array)
124
+ * Useful when you want to show most items but exclude a few
125
+ * @example
126
+ * config={{ Toolbar: { exclude: ['smartTag', 'emoji'] } }}
127
+ */
128
+ exclude?: ToolbarActionName[];
129
+ };
76
130
  /**
77
131
  * Configuration options for TextEditor components
78
132
  */
79
133
  export type Config = Partial<{
134
+ UndoRedo: false;
80
135
  /** Font family configuration */
81
136
  FontFamily: {
82
137
  /** Array of available font configurations */
@@ -91,6 +146,11 @@ export type Config = Partial<{
91
146
  /** Whether to use custom bullet styles */
92
147
  useCustomBullet?: boolean;
93
148
  };
149
+ SmartTag: {
150
+ generateId?: () => string;
151
+ };
152
+ /** Toolbar configuration */
153
+ Toolbar: ToolbarConfig;
94
154
  }>;
95
155
  export type TextStyle = {
96
156
  fontFamily: string;
@@ -109,8 +169,6 @@ export type TextEditorComponentsRender = {
109
169
  unlink: React.ReactNode;
110
170
  }) => React.ReactNode;
111
171
  };
112
- type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
113
- export type BubbleMenuProps = Optional<Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'>, 'editor'> & React.HTMLAttributes<HTMLDivElement>;
114
172
  export type TextEditorProps = {
115
173
  id?: string;
116
174
  className?: string;
@@ -120,9 +178,9 @@ export type TextEditorProps = {
120
178
  smartTagHandler?: SmartTagHandler;
121
179
  linkHandler?: LinkHandler;
122
180
  editable?: boolean;
123
- bubbleMenuProps?: {
124
- container?: HTMLElement | null;
125
- } & Pick<BubbleMenuProps, 'options'>;
181
+ bubbleMenuProps?: Pick<BubbleMenuPluginProps, 'options' | 'appendTo'> & {
182
+ enabled?: boolean;
183
+ };
126
184
  defaultTextStyle?: Partial<TextStyle>;
127
185
  dataAttributes?: Record<`data-${string}`, unknown>;
128
186
  onUpdateDebounced?: number;
@@ -133,6 +191,11 @@ export type TextEditorProps = {
133
191
  text: string;
134
192
  json: JSONContent;
135
193
  }) => void;
194
+ onCreate?: (args: {
195
+ html: string;
196
+ text: string;
197
+ json: JSONContent;
198
+ }) => void;
136
199
  onChangeFont?: (changeInfo: {
137
200
  font: FontConfig;
138
201
  weight: number;
@@ -142,6 +205,13 @@ export type TextEditorProps = {
142
205
  };
143
206
  }) => void;
144
207
  };
208
+ export type TextEditorAllProps = TextEditorProps & {
209
+ colors?: string[];
210
+ onChangeColors?: (colors: string[]) => void;
211
+ };
212
+ export type TextEditorWithProviderRef = TextEditorRef & {
213
+ updateColors?: (colors: string[]) => void;
214
+ };
145
215
  export type OrderedListStyleType = (typeof ORDERED_LIST_STYLE_TYPE)[keyof typeof ORDERED_LIST_STYLE_TYPE];
146
216
  export type UnorderedListStyleType = (typeof UNORDERED_LIST_STYLE_TYPE)[keyof typeof UNORDERED_LIST_STYLE_TYPE];
147
217
  export declare const isOrderedListStyleType: (value: unknown) => value is OrderedListStyleType;
@@ -155,9 +225,19 @@ export type LinkAttrs = {
155
225
  title: string | null;
156
226
  data: Record<string, string>;
157
227
  }>;
228
+ export type SmartTagAttrs = {
229
+ id: string;
230
+ sourceId?: string;
231
+ } & Partial<{
232
+ content: string;
233
+ tag: string;
234
+ }>;
158
235
  export type LinkMark = OverrideProperties<Mark, {
159
236
  attrs: LinkAttrs;
160
237
  }>;
238
+ export type SmartTagNode = OverrideProperties<Node, {
239
+ attrs: SmartTagAttrs;
240
+ }>;
161
241
  export type LinkMarkRange = OverrideProperties<MarkRange, {
162
242
  mark: LinkMark;
163
243
  }>;
@@ -170,6 +250,76 @@ export declare const isLinkMark: (mark: Mark) => mark is {
170
250
  toJSON: () => any;
171
251
  attrs: LinkAttrs;
172
252
  };
253
+ type ProtocolOptions = {
254
+ /**
255
+ * The protocol scheme to be registered.
256
+ * @default '''
257
+ * @example 'ftp'
258
+ * @example 'git'
259
+ */
260
+ scheme: string;
261
+ /**
262
+ * If enabled, it allows optional slashes after the protocol.
263
+ * @default false
264
+ * @example true
265
+ */
266
+ optionalSlashes?: boolean;
267
+ };
268
+ export type ProtocolConfig = Array<ProtocolOptions | string>;
269
+ export declare const isSmartTagNode: (node: Node) => node is {
270
+ toString: () => string;
271
+ readonly type: import("prosemirror-model").NodeType;
272
+ readonly marks: readonly Mark[];
273
+ readonly content: import("prosemirror-model").Fragment;
274
+ readonly children: readonly Node[];
275
+ readonly text: string | undefined;
276
+ readonly nodeSize: number;
277
+ readonly childCount: number;
278
+ child: (index: number) => Node;
279
+ maybeChild: (index: number) => Node | null;
280
+ forEach: (f: (node: Node, offset: number, index: number) => void) => void;
281
+ nodesBetween: (from: number, to: number, f: (node: Node, pos: number, parent: Node | null, index: number) => boolean | void, startPos?: number | undefined) => void;
282
+ descendants: (f: (node: Node, pos: number, parent: Node | null, index: number) => boolean | void) => void;
283
+ readonly textContent: string;
284
+ textBetween: (from: number, to: number, blockSeparator?: string | null | undefined, leafText?: string | ((leafNode: Node) => string) | null | undefined) => string;
285
+ readonly firstChild: Node | null;
286
+ readonly lastChild: Node | null;
287
+ eq: (other: Node) => boolean;
288
+ sameMarkup: (other: Node) => boolean;
289
+ hasMarkup: (type: import("prosemirror-model").NodeType, attrs?: import("prosemirror-model").Attrs | null | undefined, marks?: readonly Mark[] | undefined) => boolean;
290
+ copy: (content?: import("prosemirror-model").Fragment | null | undefined) => Node;
291
+ mark: (marks: readonly Mark[]) => Node;
292
+ cut: (from: number, to?: number | undefined) => Node;
293
+ slice: (from: number, to?: number | undefined, includeParents?: boolean | undefined) => import("prosemirror-model").Slice;
294
+ replace: (from: number, to: number, slice: import("prosemirror-model").Slice) => Node;
295
+ nodeAt: (pos: number) => Node | null;
296
+ childAfter: (pos: number) => {
297
+ node: Node | null;
298
+ index: number;
299
+ offset: number;
300
+ };
301
+ childBefore: (pos: number) => {
302
+ node: Node | null;
303
+ index: number;
304
+ offset: number;
305
+ };
306
+ resolve: (pos: number) => import("prosemirror-model").ResolvedPos;
307
+ rangeHasMark: (from: number, to: number, type: import("prosemirror-model").MarkType | Mark) => boolean;
308
+ readonly isBlock: boolean;
309
+ readonly isTextblock: boolean;
310
+ readonly inlineContent: boolean;
311
+ readonly isInline: boolean;
312
+ readonly isText: boolean;
313
+ readonly isLeaf: boolean;
314
+ readonly isAtom: boolean;
315
+ contentMatchAt: (index: number) => import("prosemirror-model").ContentMatch;
316
+ canReplace: (from: number, to: number, replacement?: import("prosemirror-model").Fragment | undefined, start?: number | undefined, end?: number | undefined) => boolean;
317
+ canReplaceWith: (from: number, to: number, type: import("prosemirror-model").NodeType, marks?: readonly Mark[] | undefined) => boolean;
318
+ canAppend: (other: Node) => boolean;
319
+ check: () => void;
320
+ toJSON: () => any;
321
+ attrs: SmartTagAttrs;
322
+ };
173
323
  export declare const isLinkMarkRange: (markRange: MarkRange) => markRange is {
174
324
  from: number;
175
325
  to: number;
@@ -2,4 +2,5 @@ import { CUSTOM_LINK_EXTENSION_NAME, ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STY
2
2
  export const isOrderedListStyleType = (value) => typeof value === 'string' && Object.values(ORDERED_LIST_STYLE_TYPE).some(v => v === value);
3
3
  export const isUnorderedListStyleType = (value) => typeof value === 'string' && Object.values(UNORDERED_LIST_STYLE_TYPE).some(v => v === value);
4
4
  export const isLinkMark = (mark) => mark.type.name === CUSTOM_LINK_EXTENSION_NAME;
5
+ export const isSmartTagNode = (node) => node.type.name === 'smartTag';
5
6
  export const isLinkMarkRange = (markRange) => isLinkMark(markRange.mark);
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare const BubbleMenu: import("react").ForwardRefExoticComponent<Pick<Partial<Omit<Pick<Partial<import("../../extensions/BubbleMenu").BubbleMenuPluginProps>, "pluginKey"> & Omit<import("../../extensions/BubbleMenu").BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Pick<Partial<import("../../extensions/BubbleMenu").BubbleMenuPluginProps>, "pluginKey"> & Omit<import("../../extensions/BubbleMenu").BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
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>>;
@@ -1,17 +1,32 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCurrentEditor } from '@tiptap/react';
3
- import { forwardRef, useEffect, useRef } from 'react';
3
+ import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { BubbleMenuPlugin } from '../../extensions/BubbleMenu';
6
- import { useDeepCompareEffect, useIsMounted } from '@antscorp/antsomi-ui/es/hooks';
7
- import { useTextEditorStore } from '../../provider';
8
- import clsx from 'clsx';
6
+ import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
9
7
  import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
10
- export const BubbleMenu = forwardRef(({ pluginKey = 'bubbleMenu', editor, updateDelay, resizeDelay, shouldShow = null, options, children, container, className, ...restProps }, ref) => {
8
+ export const BubbleMenu = forwardRef(({ pluginKey = 'bubbleMenu', editor, updateDelay, resizeDelay, shouldShow = null, getReferencedVirtualElement, appendTo, options, children, ...restProps }, ref) => {
11
9
  const menuEl = useRef(document.createElement('div'));
12
- const isMounted = useIsMounted();
13
- const setIsShowBubbleMenu = useTextEditorStore(state => state.setIsShowBubbleMenu);
10
+ menuEl.current.classList.add(`${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor-bubble-menu`);
14
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;
15
30
  useEffect(() => {
16
31
  if (typeof ref === 'function') {
17
32
  ref(menuEl.current);
@@ -20,66 +35,80 @@ export const BubbleMenu = forwardRef(({ pluginKey = 'bubbleMenu', editor, update
20
35
  ref.current = menuEl.current;
21
36
  }
22
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
+ });
23
73
  useDeepCompareEffect(() => {
24
- const bubbleMenuElement = menuEl.current;
25
- bubbleMenuElement.className = clsx(className, `${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor-bubble-menu`);
26
- if (editor?.isDestroyed || currentEditor?.isDestroyed) {
74
+ if (pluginEditor?.isDestroyed) {
27
75
  return;
28
76
  }
29
- const attachToEditor = editor || currentEditor;
30
- if (!attachToEditor) {
77
+ if (!pluginEditor) {
31
78
  // eslint-disable-next-line no-console
32
79
  console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.');
33
80
  return;
34
81
  }
82
+ const bubbleMenuElement = menuEl.current;
83
+ bubbleMenuElement.style.visibility = 'hidden';
84
+ bubbleMenuElement.style.position = 'absolute';
35
85
  const plugin = BubbleMenuPlugin({
36
- updateDelay,
37
- resizeDelay,
38
- editor: attachToEditor,
86
+ ...bubbleMenuPluginPropsRef.current,
87
+ appendTo,
88
+ editor: pluginEditor,
39
89
  element: bubbleMenuElement,
40
- container,
41
- pluginKey,
42
- options: {
43
- ...options,
44
- strategy: options?.strategy || 'absolute',
45
- placement: options?.placement || 'bottom',
46
- offset: options?.offset,
47
- onShow: () => {
48
- if (isMounted()) {
49
- setIsShowBubbleMenu(true);
50
- }
51
- options?.onShow?.();
52
- },
53
- onHide: () => {
54
- if (isMounted()) {
55
- setIsShowBubbleMenu(false);
56
- }
57
- options?.onHide?.();
58
- },
59
- },
60
- shouldShow,
61
90
  });
62
- attachToEditor.registerPlugin(plugin);
91
+ pluginEditor.registerPlugin(plugin);
92
+ const createdPluginKey = bubbleMenuPluginPropsRef.current.pluginKey;
63
93
  return () => {
64
- attachToEditor.unregisterPlugin(pluginKey);
94
+ pluginEditor.unregisterPlugin(createdPluginKey);
65
95
  window.requestAnimationFrame(() => {
66
96
  if (bubbleMenuElement.parentNode) {
67
97
  bubbleMenuElement.parentNode.removeChild(bubbleMenuElement);
68
98
  }
69
99
  });
70
100
  };
71
- }, [
72
- editor,
73
- container,
74
- updateDelay,
75
- resizeDelay,
76
- pluginKey,
77
- options,
78
- className,
79
- currentEditor,
80
- isMounted,
81
- shouldShow,
82
- setIsShowBubbleMenu,
83
- ]);
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
+ }
84
113
  return createPortal(_jsx("div", { ...restProps, children: children }), menuEl.current);
85
114
  });
@@ -44,7 +44,7 @@ export const EmojiList = forwardRef((props, ref) => {
44
44
  if (items.length <= 0) {
45
45
  return null;
46
46
  }
47
- return (_jsx(VirtualizedMenu, { className: `${COMPONENT_CLS}-emoji-list`, itemSize: ITEM_SIZE, selected: items.at(selectedIndex) ? [items[selectedIndex].slug] : [], onClick: item => {
47
+ return (_jsx(VirtualizedMenu, { className: `${COMPONENT_CLS}-emoji-list`, itemSize: ITEM_SIZE, selected: items.at(selectedIndex) ? [items[selectedIndex].slug] : [], focusedKey: items[selectedIndex]?.slug, onClick: item => {
48
48
  const idx = items.findIndex(i => i.slug === item.item.key);
49
49
  if (idx !== -1) {
50
50
  selectItem(idx);
@@ -1,4 +1,4 @@
1
1
  import { EmojiOptions } from '../../extensions/Emoji';
2
2
  export declare const suggestion: ({ container, }: {
3
- container?: HTMLElement | null;
3
+ container?: HTMLElement | (() => HTMLElement);
4
4
  }) => EmojiOptions['suggestion'];
@@ -10,7 +10,7 @@ const updatePosition = (editor, element, itemLength) => {
10
10
  getBoundingClientRect: () => posToDOMRect(editor.view, editor.state.selection.from, editor.state.selection.to),
11
11
  };
12
12
  computePosition(virtualElement, element, {
13
- placement: 'top-start',
13
+ placement: 'bottom-start',
14
14
  strategy: 'absolute',
15
15
  middleware: [shift(), flip()],
16
16
  }).then(({ x, y, strategy }) => {
@@ -45,7 +45,7 @@ export const suggestion = ({ container }) => ({
45
45
  }
46
46
  const rendererEl = safeGetRenndererEl();
47
47
  rendererEl.classList.add(`${COMPONENT_CLS}-emoji-popover`);
48
- (container || document.body).appendChild(rendererEl);
48
+ ((typeof container === 'function' ? container() : container) || document.body).appendChild(rendererEl);
49
49
  updatePosition(props.editor, rendererEl, props.items.length);
50
50
  },
51
51
  onUpdate(props) {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo, useCallback, useEffect, useMemo, useState } from 'react';
2
+ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { Typography } from 'antd';
4
4
  import { SearchPopover, VirtualizedMenu } from '@antscorp/antsomi-ui/es/components/molecules';
5
5
  import { FontGroupTitle, PopoverTrigger } from './styled';
@@ -52,6 +52,7 @@ export const FontPopover = memo((props) => {
52
52
  const itemSize = 30;
53
53
  const itemSpacing = 4;
54
54
  const activeFontName = fontValue?.font.fontFamily.name;
55
+ const inputSearchRef = useRef(null);
55
56
  const [search, setSearch] = useState('');
56
57
  const [open, setOpen] = useState(false);
57
58
  const [fontItemsSize, setFontItemSize] = useDebounce(0, 200);
@@ -83,10 +84,19 @@ export const FontPopover = memo((props) => {
83
84
  const listSize = calInlineListSize(Math.min(items.length, 6), itemSize, itemSpacing);
84
85
  setFontItemSize(listSize);
85
86
  }, [items.length, setFontItemSize]);
87
+ useEffect(() => {
88
+ if (open) {
89
+ // Use setTimeout to ensure the popover content is fully mounted in the DOM
90
+ const timeoutId = setTimeout(() => {
91
+ inputSearchRef.current?.focus();
92
+ }, 0);
93
+ return () => clearTimeout(timeoutId);
94
+ }
95
+ }, [open]);
86
96
  return (_jsx(SearchPopover, { open: open, placement: "bottomLeft", onOpenChange: handleOpenChange, getPopupContainer: () => bubbleMenuContainer || document.body, inputSearchProps: {
87
97
  value: search,
88
98
  onAfterChange: setSearch,
89
- }, overlayClassName: "font-popover-overlay", content: _jsx("div", { className: "list-font-root", style: {
99
+ }, inputSearchRef: inputSearchRef, overlayClassName: "font-popover-overlay", content: _jsx("div", { className: "list-font-root", style: {
90
100
  height: `${fontItemsSize}px`,
91
101
  }, children: _jsx(VirtualizedMenu, { itemSize: itemSize, inlinePadding: 0, itemSpacing: itemSpacing, selectable: false, items: items }) }), children: _jsx(PopoverTrigger, { className: "font-popover-trigger", children: _jsx(Typography.Text, { ellipsis: { tooltip: true }, children: activeFontName }) }) }));
92
102
  });
@@ -0,0 +1,16 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import React from 'react';
3
+ import type { LinkFormData } from '../../types';
4
+ export type LinkInsertFormProps = {
5
+ /** TipTap editor instance */
6
+ editor: Editor;
7
+ /** Form mode: insert or edit */
8
+ mode: 'insert' | 'edit';
9
+ /** Initial form data */
10
+ initialData: LinkFormData;
11
+ /** Callback when form is submitted */
12
+ onSubmit: () => void;
13
+ /** Callback when form is cancelled */
14
+ onCancel: () => void;
15
+ };
16
+ export declare const LinkInsertForm: React.FC<LinkInsertFormProps>;
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Checkbox, Flex, Input } from 'antd';
3
+ import { useState, useCallback, useRef, useEffect } from 'react';
4
+ export const LinkInsertForm = props => {
5
+ const { editor, mode, initialData, onSubmit, onCancel } = props;
6
+ const [url, setUrl] = useState(initialData.url);
7
+ const [text, setText] = useState(initialData.text);
8
+ const [openInNewTab, setOpenInNewTab] = useState(initialData.openInNewTab);
9
+ const urlInputRef = useRef(null);
10
+ // Auto-focus the URL input without scrolling
11
+ useEffect(() => {
12
+ urlInputRef.current?.focus({
13
+ preventScroll: true,
14
+ });
15
+ }, []);
16
+ const handleSubmit = useCallback(() => {
17
+ if (!url.trim()) {
18
+ // Don't submit if URL is empty
19
+ return;
20
+ }
21
+ // If text is different from initial, update the content
22
+ if (text !== initialData.text && text.trim()) {
23
+ editor
24
+ .chain()
25
+ .focus()
26
+ .setCustomLink({
27
+ attrs: {
28
+ href: url,
29
+ target: openInNewTab ? '_blank' : null,
30
+ },
31
+ content: text,
32
+ })
33
+ .run();
34
+ }
35
+ else {
36
+ // Just update the link attributes
37
+ editor
38
+ .chain()
39
+ .focus()
40
+ .setCustomLink({
41
+ attrs: {
42
+ href: url,
43
+ target: openInNewTab ? '_blank' : null,
44
+ },
45
+ })
46
+ .run();
47
+ }
48
+ onSubmit();
49
+ }, [editor, url, text, initialData.text, openInNewTab, onSubmit]);
50
+ const handleKeyDown = useCallback((e) => {
51
+ if (e.key === 'Enter' && !e.shiftKey) {
52
+ e.preventDefault();
53
+ handleSubmit();
54
+ }
55
+ else if (e.key === 'Escape') {
56
+ e.preventDefault();
57
+ onCancel();
58
+ }
59
+ }, [handleSubmit, onCancel]);
60
+ return (_jsxs(Flex, { vertical: true, gap: 8, children: [_jsxs(Flex, { gap: 8, vertical: true, children: [_jsx(Input, { ref: urlInputRef, placeholder: "URL", value: url, onChange: e => setUrl(e.target.value), onKeyDown: handleKeyDown }), _jsx(Input, { placeholder: "Text", value: text, onChange: e => setText(e.target.value), onKeyDown: handleKeyDown })] }), _jsx(Checkbox, { checked: openInNewTab, onChange: e => setOpenInNewTab(e.target.checked), children: "Open in new tab" }), _jsxs(Flex, { justify: "flex-end", gap: 8, children: [_jsx(Button, { onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "primary", onClick: handleSubmit, disabled: !url.trim(), children: mode === 'insert' ? 'Insert' : 'Update' })] })] }));
61
+ };