@antscorp/antsomi-ui 2.0.90 → 2.0.91-text-editor-beta.1

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 (324) hide show
  1. package/es/assets/css/main.scss +4 -2
  2. package/es/components/icons/ALignRightIcon.d.ts +3 -0
  3. package/es/components/icons/ALignRightIcon.js +7 -0
  4. package/es/components/icons/AlignCenterIcon.d.ts +3 -0
  5. package/es/components/icons/AlignCenterIcon.js +7 -0
  6. package/es/components/icons/AlignJustifyIcon.d.ts +3 -0
  7. package/es/components/icons/AlignJustifyIcon.js +7 -0
  8. package/es/components/icons/AlignLeftIcon.d.ts +3 -0
  9. package/es/components/icons/AlignLeftIcon.js +7 -0
  10. package/es/components/icons/AntsomiAIIcon.d.ts +3 -0
  11. package/es/components/icons/AntsomiAIIcon.js +7 -0
  12. package/es/components/icons/ArrowDropDownIcon.d.ts +3 -0
  13. package/es/components/icons/ArrowDropDownIcon.js +7 -0
  14. package/es/components/icons/ChevronRightIcon.d.ts +3 -0
  15. package/es/components/icons/ChevronRightIcon.js +7 -0
  16. package/es/components/icons/EmotionFeedbackIcon.d.ts +6 -0
  17. package/es/components/icons/EmotionFeedbackIcon.js +8 -0
  18. package/es/components/icons/FeedbackRatingIcon.d.ts +3 -0
  19. package/es/components/icons/FeedbackRatingIcon.js +7 -0
  20. package/es/components/icons/LazyIcon/LazyIcon.d.ts +17 -0
  21. package/es/components/icons/LazyIcon/LazyIcon.js +14 -0
  22. package/es/components/icons/LinkOffIcon.d.ts +3 -0
  23. package/es/components/icons/LinkOffIcon.js +7 -0
  24. package/es/components/icons/MinusIcon.d.ts +3 -0
  25. package/es/components/icons/MinusIcon.js +7 -0
  26. package/es/components/icons/NoteNewIcon.d.ts +3 -0
  27. package/es/components/icons/NoteNewIcon.js +7 -0
  28. package/es/components/icons/SearchNotFoundIcon.d.ts +3 -0
  29. package/es/components/icons/SearchNotFoundIcon.js +7 -0
  30. package/es/components/icons/SummarizeIcon.d.ts +3 -0
  31. package/es/components/icons/SummarizeIcon.js +7 -0
  32. package/es/components/icons/index.d.ts +14 -0
  33. package/es/components/icons/index.js +14 -0
  34. package/es/components/index.scss +2 -0
  35. package/es/components/molecules/ColorSetting/index.js +2 -11
  36. package/es/components/molecules/ColorSetting/styled.d.ts +1 -1
  37. package/es/components/molecules/ColorSetting/styled.js +9 -1
  38. package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
  39. package/es/components/molecules/EmojiCollections/types.d.ts +1 -0
  40. package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +1 -0
  41. package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
  42. package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
  43. package/es/components/molecules/EmojiPopover/styled.js +1 -1
  44. package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
  45. package/es/components/molecules/FontSizeInput/FontSizeInput.js +127 -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 +20 -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 +36 -0
  56. package/es/components/molecules/FontSizeInput/styles.scss +15 -0
  57. package/es/components/molecules/FontSizeInput/types.d.ts +23 -0
  58. package/es/components/molecules/FontSizeInput/types.js +1 -0
  59. package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
  60. package/es/components/molecules/FontSizeInput/utils.js +9 -0
  61. package/es/components/molecules/ItemNotFound/ItemNotFound.d.ts +6 -0
  62. package/es/components/molecules/ItemNotFound/ItemNotFound.js +9 -0
  63. package/es/components/molecules/ItemNotFound/index.d.ts +1 -0
  64. package/es/components/molecules/ItemNotFound/index.js +1 -0
  65. package/es/components/molecules/ItemNotFound/styled.d.ts +4 -0
  66. package/es/components/molecules/ItemNotFound/styled.js +29 -0
  67. package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +23 -7
  68. package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.d.ts +1 -0
  69. package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.js +7 -2
  70. package/es/components/molecules/MatchAnySelect/types.d.ts +2 -1
  71. package/es/components/molecules/MatchAnySelect/utils.d.ts +1 -0
  72. package/es/components/molecules/MatchAnySelect/utils.js +2 -0
  73. package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +6 -3
  74. package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2550 -938
  75. package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +1 -11
  76. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +53 -25
  77. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +8 -5
  78. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +289 -46
  79. package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +1 -0
  80. package/es/components/molecules/VirtualizedMenu/styled.d.ts +2 -2
  81. package/es/components/molecules/VirtualizedMenu/styled.js +23 -4
  82. package/es/components/molecules/VirtualizedMenu/types.d.ts +27 -10
  83. package/es/components/molecules/VirtualizedMenu/utils.d.ts +8 -5
  84. package/es/components/molecules/VirtualizedMenu/utils.js +13 -18
  85. package/es/components/molecules/index.d.ts +2 -0
  86. package/es/components/molecules/index.js +2 -0
  87. package/es/components/molecules/index.scss +1 -0
  88. package/es/components/organism/ActivityTimeline/ActivityTimeline.js +15 -9
  89. package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
  90. package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
  91. package/es/components/organism/ActivityTimeline/components/ItemEvent/ItemEvent.d.ts +3 -4
  92. package/es/components/organism/ActivityTimeline/components/ItemEvent/ItemEvent.js +4 -3
  93. package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/ItemGroupEvent.d.ts +4 -6
  94. package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/ItemGroupEvent.js +4 -4
  95. package/es/components/organism/ActivityTimeline/components/TimeLineTitle/TimelineTitle.js +1 -1
  96. package/es/components/organism/ActivityTimeline/types.d.ts +2 -1
  97. package/es/components/organism/ActivityTimeline/utils.d.ts +1 -1
  98. package/es/components/organism/ActivityTimeline/utils.js +1 -1
  99. package/es/components/organism/TextEditor/TextEditor.d.ts +3 -0
  100. package/es/components/organism/TextEditor/TextEditor.js +257 -0
  101. package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
  102. package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
  103. package/es/components/organism/TextEditor/__mocks__/text-contennt.js +38 -0
  104. package/es/components/organism/TextEditor/constants.d.ts +175 -0
  105. package/es/components/organism/TextEditor/constants.js +321 -0
  106. package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
  107. package/es/components/organism/TextEditor/extensions/BackgroundColor.js +46 -0
  108. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +130 -0
  109. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +247 -0
  110. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
  111. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +31 -0
  112. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
  113. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
  114. package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
  115. package/es/components/organism/TextEditor/extensions/Color.js +34 -0
  116. package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
  117. package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
  118. package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
  119. package/es/components/organism/TextEditor/extensions/FontFamily.js +36 -0
  120. package/es/components/organism/TextEditor/extensions/FontSize.d.ts +32 -0
  121. package/es/components/organism/TextEditor/extensions/FontSize.js +47 -0
  122. package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
  123. package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
  124. package/es/components/organism/TextEditor/extensions/Highlight.d.ts +1 -0
  125. package/es/components/organism/TextEditor/extensions/Highlight.js +14 -0
  126. package/es/components/organism/TextEditor/extensions/Indent.d.ts +21 -0
  127. package/es/components/organism/TextEditor/extensions/Indent.js +63 -0
  128. package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +32 -0
  129. package/es/components/organism/TextEditor/extensions/LetterSpacing.js +48 -0
  130. package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
  131. package/es/components/organism/TextEditor/extensions/LineHeight.js +36 -0
  132. package/es/components/organism/TextEditor/extensions/Link.d.ts +16 -0
  133. package/es/components/organism/TextEditor/extensions/Link.js +48 -0
  134. package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
  135. package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
  136. package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +56 -0
  137. package/es/components/organism/TextEditor/extensions/OrderedList.js +187 -0
  138. package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +39 -0
  139. package/es/components/organism/TextEditor/extensions/SmartTag.js +167 -0
  140. package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
  141. package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
  142. package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +31 -0
  143. package/es/components/organism/TextEditor/extensions/TextTransform.js +37 -0
  144. package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +55 -0
  145. package/es/components/organism/TextEditor/extensions/UnorderedList.js +176 -0
  146. package/es/components/organism/TextEditor/hooks/index.d.ts +7 -0
  147. package/es/components/organism/TextEditor/hooks/index.js +7 -0
  148. package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
  149. package/es/components/organism/TextEditor/hooks/useColorSet.js +22 -0
  150. package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
  151. package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
  152. package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +11 -0
  153. package/es/components/organism/TextEditor/hooks/useLinkHandler.js +125 -0
  154. package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
  155. package/es/components/organism/TextEditor/hooks/useMarkTracking.js +68 -0
  156. package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
  157. package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
  158. package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
  159. package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
  160. package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
  161. package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
  162. package/es/components/organism/TextEditor/index.d.ts +14 -0
  163. package/es/components/organism/TextEditor/index.js +6 -0
  164. package/es/components/organism/TextEditor/index.scss +61 -0
  165. package/es/components/organism/TextEditor/provider.d.ts +15 -0
  166. package/es/components/organism/TextEditor/provider.js +33 -0
  167. package/es/components/organism/TextEditor/store.d.ts +13 -0
  168. package/es/components/organism/TextEditor/store.js +20 -0
  169. package/es/components/organism/TextEditor/styled.d.ts +10 -0
  170. package/es/components/organism/TextEditor/styled.js +94 -0
  171. package/es/components/organism/TextEditor/types.d.ts +96 -0
  172. package/es/components/organism/TextEditor/types.js +3 -0
  173. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +6 -0
  174. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +85 -0
  175. package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
  176. package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
  177. package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +1 -0
  178. package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +1 -0
  179. package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
  180. package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +1 -0
  181. package/es/components/organism/TextEditor/ui/Button/Button.d.ts +2 -0
  182. package/es/components/organism/TextEditor/ui/Button/Button.js +31 -0
  183. package/es/components/organism/TextEditor/ui/Button/index.d.ts +2 -0
  184. package/es/components/organism/TextEditor/ui/Button/index.js +1 -0
  185. package/es/components/organism/TextEditor/ui/Button/types.d.ts +10 -0
  186. package/es/components/organism/TextEditor/ui/Button/types.js +1 -0
  187. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +39 -0
  188. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +131 -0
  189. package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
  190. package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
  191. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +17 -0
  192. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +51 -0
  193. package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +1 -0
  194. package/es/components/organism/TextEditor/ui/DropdownButton/index.js +1 -0
  195. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
  196. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
  197. package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
  198. package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
  199. package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
  200. package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
  201. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +12 -0
  202. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +69 -0
  203. package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +1 -0
  204. package/es/components/organism/TextEditor/ui/FontPopover/styled.js +22 -0
  205. package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
  206. package/es/components/organism/TextEditor/ui/Popover/Popover.js +9 -0
  207. package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
  208. package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
  209. package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
  210. package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
  211. package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
  212. package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
  213. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +2 -0
  214. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +44 -0
  215. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +1 -0
  216. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +1 -0
  217. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +2 -0
  218. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +52 -0
  219. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +19 -0
  220. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +1 -0
  221. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
  222. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +77 -0
  223. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
  224. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
  225. package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +15 -0
  226. package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +41 -0
  227. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +5 -0
  228. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +18 -0
  229. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
  230. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +84 -0
  231. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
  232. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +27 -0
  233. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
  234. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +31 -0
  235. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +7 -0
  236. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +28 -0
  237. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +7 -0
  238. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +47 -0
  239. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +5 -0
  240. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +21 -0
  241. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
  242. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +17 -0
  243. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
  244. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +18 -0
  245. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +5 -0
  246. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +28 -0
  247. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
  248. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +17 -0
  249. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
  250. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +67 -0
  251. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
  252. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +17 -0
  253. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
  254. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +18 -0
  255. package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +10 -0
  256. package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +45 -0
  257. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
  258. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +18 -0
  259. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
  260. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +26 -0
  261. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
  262. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +26 -0
  263. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
  264. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
  265. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +5 -0
  266. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +29 -0
  267. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +14 -0
  268. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +22 -0
  269. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
  270. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +36 -0
  271. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
  272. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +18 -0
  273. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +6 -0
  274. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +19 -0
  275. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +19 -0
  276. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +19 -0
  277. package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +1 -0
  278. package/es/components/organism/TextEditor/ui/Toolbar/index.js +1 -0
  279. package/es/components/organism/TextEditor/utils/documentState.d.ts +57 -0
  280. package/es/components/organism/TextEditor/utils/documentState.js +100 -0
  281. package/es/components/organism/TextEditor/utils/font.d.ts +73 -0
  282. package/es/components/organism/TextEditor/utils/font.js +160 -0
  283. package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +63 -0
  284. package/es/components/organism/TextEditor/utils/htmlProcessing.js +319 -0
  285. package/es/components/organism/TextEditor/utils/indent.d.ts +11 -0
  286. package/es/components/organism/TextEditor/utils/indent.js +56 -0
  287. package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
  288. package/es/components/organism/TextEditor/utils/index.js +16 -0
  289. package/es/components/organism/TextEditor/utils/link.d.ts +100 -0
  290. package/es/components/organism/TextEditor/utils/link.js +149 -0
  291. package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
  292. package/es/components/organism/TextEditor/utils/menu.js +317 -0
  293. package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
  294. package/es/components/organism/TextEditor/utils/selection.js +57 -0
  295. package/es/components/organism/TextEditor/utils/shared.d.ts +1 -0
  296. package/es/components/organism/TextEditor/utils/shared.js +9 -0
  297. package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
  298. package/es/components/organism/TextEditor/utils/smartTag.js +89 -0
  299. package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
  300. package/es/components/organism/TextEditor/utils/style.js +193 -0
  301. package/es/components/organism/TicketEditor/index.js +24 -16
  302. package/es/components/organism/index.d.ts +1 -0
  303. package/es/components/organism/index.js +1 -0
  304. package/es/components/organism/index.scss +1 -0
  305. package/es/hooks/index.d.ts +3 -0
  306. package/es/hooks/index.js +3 -0
  307. package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
  308. package/es/hooks/useBroadcastedLocalStorage.js +71 -0
  309. package/es/hooks/useElementSize.d.ts +7 -0
  310. package/es/hooks/useElementSize.js +56 -0
  311. package/es/hooks/useIsMounted.d.ts +1 -0
  312. package/es/hooks/useIsMounted.js +11 -0
  313. package/es/locales/en/translation.json +2 -1
  314. package/es/locales/i18n.d.ts +3 -1
  315. package/es/locales/vi/translation.json +2 -1
  316. package/es/utils/common.d.ts +6 -9
  317. package/es/utils/common.js +44 -23
  318. package/es/utils/index.d.ts +1 -0
  319. package/es/utils/index.js +1 -0
  320. package/es/utils/tree.d.ts +225 -0
  321. package/es/utils/tree.js +469 -0
  322. package/es/utils/web.d.ts +15 -0
  323. package/es/utils/web.js +39 -0
  324. package/package.json +24 -4
@@ -0,0 +1,47 @@
1
+ import '@tiptap/extension-text-style';
2
+ import { Extension } from '@tiptap/core';
3
+ import { DEFAULT_TEXT_STYLE } from '../constants';
4
+ /**
5
+ * This extension allows you to set a font size for text.
6
+ */
7
+ export const FontSize = Extension.create({
8
+ name: 'fontSize',
9
+ addOptions() {
10
+ return {
11
+ types: ['textStyle'],
12
+ defaultFontSize: DEFAULT_TEXT_STYLE.fontSize,
13
+ };
14
+ },
15
+ addGlobalAttributes() {
16
+ return [
17
+ {
18
+ types: this.options.types,
19
+ attributes: {
20
+ fontSize: {
21
+ default: this.options.defaultFontSize,
22
+ parseHTML: element => element.style.fontSize || this.options.defaultFontSize,
23
+ renderHTML: attrs => {
24
+ if (!attrs.fontSize || attrs.fontSize === this.options.defaultFontSize) {
25
+ return {};
26
+ }
27
+ return {
28
+ style: `font-size: ${attrs.fontSize}`,
29
+ };
30
+ },
31
+ },
32
+ },
33
+ },
34
+ ];
35
+ },
36
+ addCommands() {
37
+ return {
38
+ setFontSize: fontSize => ({ chain }) => chain().setMark('textStyle', { fontSize }).run(),
39
+ unsetFontSize: () => ({ chain }) => chain()
40
+ .setMark('textStyle', {
41
+ fontSize: this.options.defaultFontSize || null,
42
+ })
43
+ .removeEmptyTextStyle()
44
+ .run(),
45
+ };
46
+ },
47
+ });
@@ -0,0 +1,23 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export interface FontWeightOptions {
3
+ types: string[];
4
+ defaultWeight: string | number;
5
+ }
6
+ declare module '@tiptap/core' {
7
+ interface Commands<ReturnType> {
8
+ fontWeight: {
9
+ /**
10
+ * Set the font weight
11
+ * @param fontWeight The font weight
12
+ * @example editor.commands.setFontWeight('bold')
13
+ */
14
+ setFontWeight: (fontWeight: string | number) => ReturnType;
15
+ /**
16
+ * Unset the font weight
17
+ * @example editor.commands.unsetFontWeight()
18
+ */
19
+ unsetFontWeight: () => ReturnType;
20
+ };
21
+ }
22
+ }
23
+ export declare const FontWeight: Extension<any, any>;
@@ -0,0 +1,41 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { DEFAULT_TEXT_STYLE } from '../constants';
3
+ export const FontWeight = Extension.create({
4
+ name: 'fontWeight',
5
+ addOptions() {
6
+ return {
7
+ types: ['textStyle'],
8
+ defaultWeight: DEFAULT_TEXT_STYLE.fontWeight,
9
+ };
10
+ },
11
+ addGlobalAttributes() {
12
+ return [
13
+ {
14
+ types: this.options.types,
15
+ attributes: {
16
+ fontWeight: {
17
+ default: this.options.defaultWeight,
18
+ renderHTML: attributes => {
19
+ if (!attributes.fontWeight) {
20
+ return {};
21
+ }
22
+ return {
23
+ style: `font-weight: ${attributes.fontWeight}`,
24
+ };
25
+ },
26
+ parseHTML: element => element.style.fontWeight,
27
+ },
28
+ },
29
+ },
30
+ ];
31
+ },
32
+ addCommands() {
33
+ return {
34
+ setFontWeight: fontWeight => ({ chain }) => chain().setMark('textStyle', { fontWeight }).run(),
35
+ unsetFontWeight: () => ({ chain }) => chain()
36
+ .setMark('textStyle', { fontWeight: this.options.defaultWeight })
37
+ .removeEmptyTextStyle()
38
+ .run(),
39
+ };
40
+ },
41
+ });
@@ -0,0 +1 @@
1
+ export declare const Highlight: import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>;
@@ -0,0 +1,14 @@
1
+ import { Highlight as TiptapHighlightExtension } from '@tiptap/extension-highlight';
2
+ export const Highlight = TiptapHighlightExtension.extend({
3
+ parseHTML() {
4
+ return [
5
+ {
6
+ tag: 'mark',
7
+ },
8
+ {
9
+ tag: 'span',
10
+ getAttrs: node => node.style.backgroundColor !== undefined && null,
11
+ },
12
+ ];
13
+ },
14
+ });
@@ -0,0 +1,21 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export interface IndentOptions {
3
+ types: string[];
4
+ minIndent: number;
5
+ maxIndent: number;
6
+ }
7
+ declare module '@tiptap/core' {
8
+ interface Commands<ReturnType> {
9
+ indent: {
10
+ /**
11
+ * Set the indent attribute
12
+ */
13
+ indent: () => ReturnType;
14
+ /**
15
+ * Set the outdent attribute
16
+ */
17
+ outdent: () => ReturnType;
18
+ };
19
+ }
20
+ }
21
+ export declare const Indent: Extension<IndentOptions, any>;
@@ -0,0 +1,63 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { createIndentCommand } from '../utils/indent';
3
+ export const Indent = Extension.create({
4
+ name: 'indent',
5
+ addOptions() {
6
+ return {
7
+ types: ['paragraph', 'heading', 'blockquote'],
8
+ minIndent: 0 /* IndentProps.min */,
9
+ maxIndent: 7 /* IndentProps.max */,
10
+ };
11
+ },
12
+ addGlobalAttributes() {
13
+ return [
14
+ {
15
+ types: this.options.types,
16
+ attributes: {
17
+ indent: {
18
+ default: 0,
19
+ parseHTML: element => {
20
+ const identAttr = element.getAttribute('data-indent');
21
+ return (identAttr ? parseInt(identAttr, 10) : 0) || 0;
22
+ },
23
+ renderHTML: attributes => {
24
+ if (!attributes.indent) {
25
+ return {};
26
+ }
27
+ return {
28
+ 'data-indent': attributes.indent,
29
+ style: `padding-left: ${attributes.indent * 1}em`,
30
+ };
31
+ },
32
+ },
33
+ },
34
+ },
35
+ ];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ indent: () => createIndentCommand({
40
+ delta: 1 /* IndentProps.more */,
41
+ types: this.options.types,
42
+ }),
43
+ outdent: () => createIndentCommand({
44
+ delta: -1 /* IndentProps.less */,
45
+ types: this.options.types,
46
+ }),
47
+ };
48
+ },
49
+ addKeyboardShortcuts() {
50
+ return {
51
+ Tab: () => {
52
+ if (!(this.editor.isActive('bulletList') || this.editor.isActive('orderedList')))
53
+ return this.editor.commands.indent();
54
+ return this.editor.commands.sinkListItem('listItem');
55
+ },
56
+ 'Shift-Tab': () => {
57
+ if (!(this.editor.isActive('bulletList') || this.editor.isActive('orderedList')))
58
+ return this.editor.commands.outdent();
59
+ return this.editor.commands.sinkListItem('listItem');
60
+ },
61
+ };
62
+ },
63
+ });
@@ -0,0 +1,32 @@
1
+ import '@tiptap/extension-text-style';
2
+ import { Extension } from '@tiptap/core';
3
+ export type LetterSpacingOptions = {
4
+ /**
5
+ * A list of node names where the letter spacing can be applied.
6
+ * @default ['textStyle']
7
+ * @example ['heading', 'paragraph']
8
+ */
9
+ types: string[];
10
+ defaultLetterSpacing?: string;
11
+ };
12
+ declare module '@tiptap/core' {
13
+ interface Commands<ReturnType> {
14
+ letterSpacing: {
15
+ /**
16
+ * Set the letter spacing
17
+ * @param letterSpacing The letter spacing
18
+ * @example editor.commands.setLetterSpacing('1px')
19
+ */
20
+ setLetterSpacing: (letterSpacing: string) => ReturnType;
21
+ /**
22
+ * Unset the letter spacing
23
+ * @example editor.commands.unsetLetterSpacing()
24
+ */
25
+ unsetLetterSpacing: () => ReturnType;
26
+ };
27
+ }
28
+ }
29
+ /**
30
+ * This extension allows you to set a letter spacing for text.
31
+ */
32
+ export declare const LetterSpacing: Extension<LetterSpacingOptions, any>;
@@ -0,0 +1,48 @@
1
+ import '@tiptap/extension-text-style';
2
+ import { Extension } from '@tiptap/core';
3
+ import { DEFAULT_TEXT_STYLE } from '../constants';
4
+ /**
5
+ * This extension allows you to set a letter spacing for text.
6
+ */
7
+ export const LetterSpacing = Extension.create({
8
+ name: 'letterSpacing',
9
+ addOptions() {
10
+ return {
11
+ defaultWeight: DEFAULT_TEXT_STYLE.letterSpacing,
12
+ types: ['textStyle'],
13
+ };
14
+ },
15
+ addGlobalAttributes() {
16
+ return [
17
+ {
18
+ types: this.options.types,
19
+ attributes: {
20
+ letterSpacing: {
21
+ default: this.options.defaultLetterSpacing,
22
+ parseHTML: el => el.style.letterSpacing || this.options.defaultLetterSpacing,
23
+ renderHTML: attrs => {
24
+ const { letterSpacing } = attrs;
25
+ if (!letterSpacing || letterSpacing === this.options.defaultLetterSpacing) {
26
+ return {};
27
+ }
28
+ return {
29
+ style: `letter-spacing: ${attrs.letterSpacing}`,
30
+ };
31
+ },
32
+ },
33
+ },
34
+ },
35
+ ];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ setLetterSpacing: letterSpacing => ({ chain }) => chain().setMark('textStyle', { letterSpacing }).run(),
40
+ unsetLetterSpacing: () => ({ chain }) => chain()
41
+ .setMark('textStyle', {
42
+ letterSpacing: null,
43
+ })
44
+ .removeEmptyTextStyle()
45
+ .run(),
46
+ };
47
+ },
48
+ });
@@ -0,0 +1,20 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export interface LineHeightOptions {
3
+ types: string[];
4
+ defaultHeight: string;
5
+ }
6
+ declare module '@tiptap/core' {
7
+ interface Commands<ReturnType> {
8
+ lineHeight: {
9
+ /**
10
+ * Set the line height attribute
11
+ */
12
+ setLineHeight: (height: string) => ReturnType;
13
+ /**
14
+ * Unset the text align attribute
15
+ */
16
+ unsetLineHeight: () => ReturnType;
17
+ };
18
+ }
19
+ }
20
+ export declare const LineHeight: Extension<LineHeightOptions, any>;
@@ -0,0 +1,36 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { DEFAULT_TEXT_STYLE } from '../constants';
3
+ export const LineHeight = Extension.create({
4
+ name: 'lineHeight',
5
+ addOptions() {
6
+ return {
7
+ defaultHeight: DEFAULT_TEXT_STYLE.lineHeight,
8
+ types: ['heading', 'paragraph'],
9
+ };
10
+ },
11
+ addGlobalAttributes() {
12
+ return [
13
+ {
14
+ types: this.options.types,
15
+ attributes: {
16
+ lineHeight: {
17
+ default: this.options.defaultHeight,
18
+ parseHTML: element => element.style.lineHeight,
19
+ renderHTML: attrs => {
20
+ if (!attrs.lineHeight || attrs.lineHeight === this.options.defaultHeight) {
21
+ return {};
22
+ }
23
+ return { style: `line-height: ${attrs.lineHeight}` };
24
+ },
25
+ },
26
+ },
27
+ },
28
+ ];
29
+ },
30
+ addCommands() {
31
+ return {
32
+ setLineHeight: (height) => ({ commands }) => this.options.types.every(type => commands.updateAttributes(type, { lineHeight: height })),
33
+ unsetLineHeight: () => ({ commands }) => this.options.types.every(type => commands.resetAttributes(type, 'lineHeight')),
34
+ };
35
+ },
36
+ });
@@ -0,0 +1,16 @@
1
+ import { LinkOptions as TiptapLinkOptions } from '@tiptap/extension-link';
2
+ export type LinkAttrs = {
3
+ id: string;
4
+ href: string;
5
+ } & Partial<{
6
+ content: string;
7
+ target: string | null;
8
+ rel: string | null;
9
+ class: string | null;
10
+ title: string | null;
11
+ dynamic: boolean | null;
12
+ tag: string | null;
13
+ elementName: string | null;
14
+ }>;
15
+ export type LinkOptions = TiptapLinkOptions & {};
16
+ export declare const Link: import("@tiptap/core").Mark<TiptapLinkOptions, any>;
@@ -0,0 +1,48 @@
1
+ import TiptapLinkExtension from '@tiptap/extension-link';
2
+ import { LINK_TEXT_COLOR } from '../constants';
3
+ export const Link = TiptapLinkExtension.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ id: {
8
+ default: null,
9
+ parseHTML: el => el.getAttribute('data-link-id'),
10
+ renderHTML: attrs => ({
11
+ 'data-link-id': attrs.id,
12
+ }),
13
+ },
14
+ title: {
15
+ default: null,
16
+ parseHTML: el => el.title,
17
+ },
18
+ dynamic: {
19
+ default: null,
20
+ parseHTML: el => el.getAttribute('data-dynamic') === 'true',
21
+ renderHTML: attrs => (attrs.dynamic ? { 'data-dynamic': attrs.dynamic } : null),
22
+ },
23
+ tag: {
24
+ default: null,
25
+ parseHTML: el => el.getAttribute('data-tag'),
26
+ renderHTML: attrs => (attrs.tag ? { 'data-tag': attrs.tag } : null),
27
+ },
28
+ elementName: {
29
+ default: null,
30
+ parseHTML: el => el.getAttribute('data-el-name'),
31
+ renderHTML: attrs => (attrs.elementName ? { 'data-el-name': attrs.elementName } : null),
32
+ },
33
+ };
34
+ },
35
+ addKeyboardShortcuts() {
36
+ return {
37
+ ...this.parent?.(),
38
+ Enter: ({ editor }) => {
39
+ editor.chain().unsetUnderline().run();
40
+ const currentColor = editor.getAttributes('textStyle').color;
41
+ if (currentColor === LINK_TEXT_COLOR) {
42
+ editor.chain().unsetColor().run();
43
+ }
44
+ return false;
45
+ },
46
+ };
47
+ },
48
+ });
@@ -0,0 +1,13 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export interface ListItemMarkerOptions {
3
+ paddingRight: number;
4
+ defaultFontSize: string;
5
+ defaultFontFamily: string;
6
+ }
7
+ /**
8
+ * Extension tạo marker tùy chỉnh cho danh sách trong p
9
+ *
10
+ * Extension này thay thế marker mặc định của danh sách bằng các marker
11
+ * có thể kế thừa style (font, size, color...) từ text node đầu tiên.
12
+ */
13
+ export declare const ListItemMarker: Extension<ListItemMarkerOptions, any>;
@@ -0,0 +1,174 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { Plugin, PluginKey } from '@tiptap/pm/state';
3
+ import { Decoration, DecorationSet } from '@tiptap/pm/view';
4
+ import { kebabCase } from 'lodash';
5
+ function getMaxMarkerWidth(markers, font = '16px Arial') {
6
+ let max = 0;
7
+ const canvas = document.createElement('canvas');
8
+ const ctx = canvas.getContext('2d');
9
+ if (!ctx)
10
+ return max;
11
+ ctx.font = font;
12
+ for (const m of markers) {
13
+ const w = ctx.measureText(m).width;
14
+ if (w > max)
15
+ max = w;
16
+ }
17
+ return max;
18
+ }
19
+ /**
20
+ * Tạo các marker tùy chỉnh cho danh sách (bullet và ordered) với style kế thừa từ text node
21
+ *
22
+ * @param doc - ProseMirror document node
23
+ * @returns DecorationSet chứa tất cả các widget decoration cho marker
24
+ */
25
+ const styleMarker = (doc, options) => {
26
+ const decorations = [];
27
+ doc.descendants((listNode, listNodePos) => {
28
+ const isBulletList = listNode.type.name === 'bulletList';
29
+ const isOrderedList = listNode.type.name === 'orderedList';
30
+ if (!isBulletList && !isOrderedList) {
31
+ return;
32
+ }
33
+ // Khởi tạo marker dựa trên loại danh sách
34
+ const getMarker = (isOrderedList, index) => isOrderedList ? `${index + 1}.` : '•';
35
+ const markers = [];
36
+ const listItems = [];
37
+ listNode.descendants((listItem, listItemPos) => {
38
+ if (listItem.type.name !== 'listItem') {
39
+ return;
40
+ }
41
+ const itemInfo = {
42
+ node: listItem,
43
+ pos: listItemPos,
44
+ isEmpty: true,
45
+ };
46
+ listItems.push(itemInfo);
47
+ // Tìm paragraph đầu tiên và text node đầu tiên
48
+ let foundText = false;
49
+ let foundParagraph = false;
50
+ listItem.descendants((node, nodePos) => {
51
+ if (!foundParagraph && node.type.name === 'paragraph') {
52
+ foundParagraph = true;
53
+ itemInfo.paragraphPos = nodePos;
54
+ itemInfo.paragraphNode = node;
55
+ }
56
+ if (!foundText && node.type.name === 'text') {
57
+ foundText = true;
58
+ itemInfo.isEmpty = false;
59
+ itemInfo.textNode = node;
60
+ itemInfo.textNodePos = nodePos;
61
+ const textStyleMark = node.marks.find(nodeMark => nodeMark.type.name === 'textStyle');
62
+ if (textStyleMark) {
63
+ itemInfo.textStyleMark = textStyleMark;
64
+ }
65
+ }
66
+ });
67
+ const index = listItems.length;
68
+ const marker = getMarker(isOrderedList, index - 1);
69
+ markers.push(marker);
70
+ });
71
+ for (let i = 0; i < listItems.length; i++) {
72
+ const item = listItems[i];
73
+ if (!item.textStyleMark) {
74
+ for (let j = i - 1; j >= 0; j--) {
75
+ if (listItems[j].textStyleMark) {
76
+ item.textStyleMark = listItems[j].textStyleMark;
77
+ break;
78
+ }
79
+ }
80
+ }
81
+ }
82
+ let font = `${options.defaultFontSize} ${options.defaultFontFamily}`;
83
+ for (const item of listItems) {
84
+ if (item.textStyleMark) {
85
+ const { fontSize, fontFamily } = item.textStyleMark.attrs;
86
+ if (fontSize && fontFamily) {
87
+ font = `${fontSize} ${fontFamily}`;
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ const maxWidth = getMaxMarkerWidth(markers, font);
93
+ const { paddingRight } = options;
94
+ const totalWidth = maxWidth + paddingRight;
95
+ listItems.forEach((item, index) => {
96
+ if (item.paragraphPos === undefined) {
97
+ return;
98
+ }
99
+ const marker = getMarker(isOrderedList, index);
100
+ const widget = document.createElement('span');
101
+ widget.innerHTML = marker;
102
+ // Đặt các thuộc tính style cơ bản
103
+ widget.style.setProperty('user-select', 'none');
104
+ widget.style.setProperty('text-decoration', 'none');
105
+ widget.style.setProperty('display', 'inline-block');
106
+ widget.style.setProperty('width', `${totalWidth}px`);
107
+ widget.style.setProperty('text-align', 'left');
108
+ // Sao chép tất cả các thuộc tính style từ mark textStyle
109
+ if (item.textStyleMark) {
110
+ for (const styleProp in item.textStyleMark.attrs) {
111
+ widget.style.setProperty(kebabCase(styleProp), String(item.textStyleMark.attrs[styleProp]));
112
+ }
113
+ }
114
+ // Tính toán vị trí chính xác cho marker
115
+ const absoluteListItemPos = listNodePos + item.pos + 1;
116
+ const absoluteParagraphPos = absoluteListItemPos + item.paragraphPos;
117
+ const markerPos = absoluteParagraphPos + 1;
118
+ // Đặt marker widget tại vị trí đã tính toán (bên trong paragraph)
119
+ // Decoration.widget sẽ tạo một widget tại vị trí markerPos
120
+ decorations.push(Decoration.widget(markerPos, widget, {
121
+ ignoreSelection: true,
122
+ }));
123
+ if (item.paragraphNode) {
124
+ // Tính toán vị trí bắt đầu và kết thúc của paragraph
125
+ const paragraphStart = absoluteParagraphPos;
126
+ const paragraphEnd = paragraphStart + item.paragraphNode.nodeSize;
127
+ // Thêm decoration cho paragraph với style inline-block
128
+ decorations.push(Decoration.node(paragraphStart + 1, paragraphEnd + 1, {
129
+ style: 'display: inline;',
130
+ }));
131
+ }
132
+ });
133
+ });
134
+ return DecorationSet.create(doc, decorations);
135
+ };
136
+ /**
137
+ * Extension tạo marker tùy chỉnh cho danh sách trong p
138
+ *
139
+ * Extension này thay thế marker mặc định của danh sách bằng các marker
140
+ * có thể kế thừa style (font, size, color...) từ text node đầu tiên.
141
+ */
142
+ export const ListItemMarker = Extension.create({
143
+ name: 'list-item-marker',
144
+ addOptions() {
145
+ return {
146
+ ...this.parent?.(),
147
+ paddingRight: 10,
148
+ defaultFontSize: '16px',
149
+ defaultFontFamily: 'Arial',
150
+ };
151
+ },
152
+ addProseMirrorPlugins() {
153
+ const { options } = this;
154
+ return [
155
+ new Plugin({
156
+ key: new PluginKey('custom-list-item-marker'),
157
+ state: {
158
+ init(_, { doc }) {
159
+ return styleMarker(doc, options);
160
+ },
161
+ // Chỉ tính toán lại nếu document thay đổi
162
+ apply(tr, oldState) {
163
+ return tr.docChanged ? styleMarker(tr.doc, options) : oldState;
164
+ },
165
+ },
166
+ props: {
167
+ decorations(state) {
168
+ return this.getState(state);
169
+ },
170
+ },
171
+ }),
172
+ ];
173
+ },
174
+ });
@@ -0,0 +1,56 @@
1
+ import { Node } from '@tiptap/core';
2
+ import { OrderedListStyleType } from '../types';
3
+ type ListStyleType = OrderedListStyleType;
4
+ export interface CustomOrderedListOptions {
5
+ /**
6
+ * The node type name for list items.
7
+ * @default 'listItem'
8
+ */
9
+ itemTypeName: string;
10
+ /**
11
+ * The HTML attributes for an ordered list node.
12
+ * @default {}
13
+ */
14
+ HTMLAttributes: Record<string, any>;
15
+ /**
16
+ * Keep the marks when splitting a list item.
17
+ * @default false
18
+ */
19
+ keepMarks: boolean;
20
+ /**
21
+ * Keep the attributes when splitting a list item.
22
+ * @default false
23
+ */
24
+ keepAttributes: boolean;
25
+ /**
26
+ * Default list style type
27
+ * @default 'decimal'
28
+ */
29
+ defaultListStyleType: ListStyleType;
30
+ /**
31
+ * Available list style types
32
+ * @default ['decimal', 'lower-alpha', 'upper-alpha', 'lower-roman', 'upper-roman']
33
+ */
34
+ availableListStyleTypes: ListStyleType[];
35
+ }
36
+ declare module '@tiptap/core' {
37
+ interface Commands<ReturnType> {
38
+ customOrderedList: {
39
+ /**
40
+ * Toggle a custom ordered list
41
+ */
42
+ toggleCustomOrderedList: (options?: {
43
+ listStyleType?: ListStyleType;
44
+ }) => ReturnType;
45
+ /**
46
+ * Set list style type for current ordered list
47
+ */
48
+ setOrderedListStyleType: (listStyleType: ListStyleType) => ReturnType;
49
+ };
50
+ }
51
+ }
52
+ /**
53
+ * This extension allows you to create ordered lists with custom list-style-type.
54
+ */
55
+ export declare const CustomOrderedList: Node<CustomOrderedListOptions, any>;
56
+ export {};