@antscorp/antsomi-ui 2.0.85 → 2.0.86-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 (228) hide show
  1. package/es/assets/css/main.scss +4 -2
  2. package/es/components/index.scss +2 -0
  3. package/es/components/molecules/EmojiPopover/EmojiPopover.js +5 -1
  4. package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
  5. package/es/components/molecules/FontSizeInput/FontSizeInput.js +128 -0
  6. package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +8 -0
  7. package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +14 -0
  8. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +20 -0
  9. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +17 -0
  10. package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
  11. package/es/components/molecules/FontSizeInput/constants.js +5 -0
  12. package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
  13. package/es/components/molecules/FontSizeInput/index.js +1 -0
  14. package/es/components/molecules/FontSizeInput/styled.d.ts +3 -0
  15. package/es/components/molecules/FontSizeInput/styled.js +22 -0
  16. package/es/components/molecules/FontSizeInput/styles.scss +15 -0
  17. package/es/components/molecules/FontSizeInput/types.d.ts +24 -0
  18. package/es/components/molecules/FontSizeInput/types.js +1 -0
  19. package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
  20. package/es/components/molecules/FontSizeInput/utils.js +9 -0
  21. package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +6 -3
  22. package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2550 -938
  23. package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +13 -3
  24. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +53 -25
  25. package/es/components/molecules/VirtualizedMenu/components/Item/index.d.ts +1 -1
  26. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +8 -5
  27. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +289 -46
  28. package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +1 -0
  29. package/es/components/molecules/VirtualizedMenu/styled.d.ts +1 -1
  30. package/es/components/molecules/VirtualizedMenu/styled.js +23 -4
  31. package/es/components/molecules/VirtualizedMenu/types.d.ts +6 -9
  32. package/es/components/molecules/VirtualizedMenu/utils.d.ts +8 -5
  33. package/es/components/molecules/VirtualizedMenu/utils.js +13 -18
  34. package/es/components/molecules/index.d.ts +1 -0
  35. package/es/components/molecules/index.js +1 -0
  36. package/es/components/molecules/index.scss +1 -0
  37. package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
  38. package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
  39. package/es/components/organism/TextEditor/TextEditor.d.ts +3 -0
  40. package/es/components/organism/TextEditor/TextEditor.js +251 -0
  41. package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
  42. package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
  43. package/es/components/organism/TextEditor/__mocks__/text-contennt.js +38 -0
  44. package/es/components/organism/TextEditor/constants.d.ts +135 -0
  45. package/es/components/organism/TextEditor/constants.js +280 -0
  46. package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
  47. package/es/components/organism/TextEditor/extensions/BackgroundColor.js +46 -0
  48. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +130 -0
  49. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +247 -0
  50. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
  51. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +31 -0
  52. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
  53. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
  54. package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
  55. package/es/components/organism/TextEditor/extensions/Color.js +41 -0
  56. package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
  57. package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
  58. package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
  59. package/es/components/organism/TextEditor/extensions/FontFamily.js +43 -0
  60. package/es/components/organism/TextEditor/extensions/FontSize.d.ts +32 -0
  61. package/es/components/organism/TextEditor/extensions/FontSize.js +47 -0
  62. package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
  63. package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
  64. package/es/components/organism/TextEditor/extensions/Highlight.d.ts +1 -0
  65. package/es/components/organism/TextEditor/extensions/Highlight.js +14 -0
  66. package/es/components/organism/TextEditor/extensions/Indent.d.ts +28 -0
  67. package/es/components/organism/TextEditor/extensions/Indent.js +68 -0
  68. package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
  69. package/es/components/organism/TextEditor/extensions/LineHeight.js +36 -0
  70. package/es/components/organism/TextEditor/extensions/Link.d.ts +15 -0
  71. package/es/components/organism/TextEditor/extensions/Link.js +50 -0
  72. package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
  73. package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
  74. package/es/components/organism/TextEditor/extensions/Selection.d.ts +6 -0
  75. package/es/components/organism/TextEditor/extensions/Selection.js +40 -0
  76. package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +39 -0
  77. package/es/components/organism/TextEditor/extensions/SmartTag.js +167 -0
  78. package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
  79. package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
  80. package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +31 -0
  81. package/es/components/organism/TextEditor/extensions/TextTransform.js +37 -0
  82. package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
  83. package/es/components/organism/TextEditor/hooks/index.js +6 -0
  84. package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
  85. package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
  86. package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +10 -0
  87. package/es/components/organism/TextEditor/hooks/useLinkHandler.js +223 -0
  88. package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
  89. package/es/components/organism/TextEditor/hooks/useMarkTracking.js +68 -0
  90. package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
  91. package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
  92. package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
  93. package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
  94. package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
  95. package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
  96. package/es/components/organism/TextEditor/index.d.ts +14 -0
  97. package/es/components/organism/TextEditor/index.js +6 -0
  98. package/es/components/organism/TextEditor/index.scss +61 -0
  99. package/es/components/organism/TextEditor/provider.d.ts +10 -0
  100. package/es/components/organism/TextEditor/provider.js +20 -0
  101. package/es/components/organism/TextEditor/store.d.ts +11 -0
  102. package/es/components/organism/TextEditor/store.js +12 -0
  103. package/es/components/organism/TextEditor/styled.d.ts +8 -0
  104. package/es/components/organism/TextEditor/styled.js +90 -0
  105. package/es/components/organism/TextEditor/types.d.ts +92 -0
  106. package/es/components/organism/TextEditor/types.js +1 -0
  107. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +6 -0
  108. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +78 -0
  109. package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
  110. package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
  111. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +43 -0
  112. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +120 -0
  113. package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
  114. package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
  115. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
  116. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
  117. package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
  118. package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
  119. package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
  120. package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
  121. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +12 -0
  122. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +69 -0
  123. package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +1 -0
  124. package/es/components/organism/TextEditor/ui/FontPopover/styled.js +20 -0
  125. package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
  126. package/es/components/organism/TextEditor/ui/Popover/Popover.js +7 -0
  127. package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
  128. package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
  129. package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
  130. package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
  131. package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
  132. package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
  133. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
  134. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +49 -0
  135. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
  136. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
  137. package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +14 -0
  138. package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +42 -0
  139. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +5 -0
  140. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +7 -0
  141. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +5 -0
  142. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +7 -0
  143. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
  144. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +18 -0
  145. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
  146. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +13 -0
  147. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +7 -0
  148. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +18 -0
  149. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +7 -0
  150. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +37 -0
  151. package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.d.ts +5 -0
  152. package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.js +7 -0
  153. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
  154. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +7 -0
  155. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
  156. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +7 -0
  157. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
  158. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +4 -0
  159. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
  160. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +7 -0
  161. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
  162. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +7 -0
  163. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
  164. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +9 -0
  165. package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +9 -0
  166. package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +22 -0
  167. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
  168. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +7 -0
  169. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
  170. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +13 -0
  171. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
  172. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +13 -0
  173. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
  174. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
  175. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +7 -0
  176. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +19 -0
  177. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +15 -0
  178. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +14 -0
  179. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
  180. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +30 -0
  181. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
  182. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +5 -0
  183. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +6 -0
  184. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +10 -0
  185. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +20 -0
  186. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +20 -0
  187. package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +1 -0
  188. package/es/components/organism/TextEditor/ui/Toolbar/index.js +1 -0
  189. package/es/components/organism/TextEditor/utils/documentState.d.ts +57 -0
  190. package/es/components/organism/TextEditor/utils/documentState.js +100 -0
  191. package/es/components/organism/TextEditor/utils/font.d.ts +84 -0
  192. package/es/components/organism/TextEditor/utils/font.js +175 -0
  193. package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +63 -0
  194. package/es/components/organism/TextEditor/utils/htmlProcessing.js +321 -0
  195. package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
  196. package/es/components/organism/TextEditor/utils/index.js +16 -0
  197. package/es/components/organism/TextEditor/utils/link.d.ts +100 -0
  198. package/es/components/organism/TextEditor/utils/link.js +149 -0
  199. package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
  200. package/es/components/organism/TextEditor/utils/menu.js +317 -0
  201. package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
  202. package/es/components/organism/TextEditor/utils/selection.js +57 -0
  203. package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
  204. package/es/components/organism/TextEditor/utils/smartTag.js +89 -0
  205. package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
  206. package/es/components/organism/TextEditor/utils/style.js +193 -0
  207. package/es/components/organism/index.d.ts +1 -0
  208. package/es/components/organism/index.js +1 -0
  209. package/es/components/organism/index.scss +1 -0
  210. package/es/config/index.d.ts +1 -0
  211. package/es/config/index.js +1 -0
  212. package/es/constants/api.d.ts +10 -0
  213. package/es/constants/api.js +10 -0
  214. package/es/hooks/index.d.ts +1 -0
  215. package/es/hooks/index.js +1 -0
  216. package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
  217. package/es/hooks/useBroadcastedLocalStorage.js +71 -0
  218. package/es/hooks/useElementSize.d.ts +7 -0
  219. package/es/hooks/useElementSize.js +56 -0
  220. package/es/utils/common.d.ts +6 -9
  221. package/es/utils/common.js +44 -23
  222. package/es/utils/index.d.ts +1 -0
  223. package/es/utils/index.js +1 -0
  224. package/es/utils/tree.d.ts +225 -0
  225. package/es/utils/tree.js +469 -0
  226. package/es/utils/web.d.ts +4 -0
  227. package/es/utils/web.js +25 -0
  228. package/package.json +29 -3
@@ -0,0 +1,135 @@
1
+ export declare const SMART_TAG_HIGHLIGHT_BG = "rgba(0, 199, 97, 0.2)";
2
+ export declare const DEFAULT_TEXT_STYLE: {
3
+ fontSize: string;
4
+ color: string;
5
+ fontFamily: string;
6
+ backgroundColor: string;
7
+ lineHeight: string;
8
+ fontWeight: string;
9
+ };
10
+ export declare const FONT_WEIGHT_LABELS: {
11
+ readonly thin: "Thin";
12
+ readonly extraLight: "Extra Light";
13
+ readonly light: "Light";
14
+ readonly normal: "Normal";
15
+ readonly medium: "Medium";
16
+ readonly semiBold: "Semi Bold";
17
+ readonly bold: "Bold";
18
+ readonly extraBold: "Extra Bold";
19
+ readonly black: "Black";
20
+ };
21
+ export declare const FONT_WEIGHT_MAP: Record<number, string>;
22
+ export declare const DEFAULT_FONT_CONFIGS: {
23
+ fontFamily: {
24
+ name: string;
25
+ };
26
+ fontWeight: number[];
27
+ }[];
28
+ export declare const LINK_TEXT_COLOR = "#0066CC";
29
+ export declare const COMPONENT_CLS = "antsomi-text-editor";
30
+ export declare const TEXT_EDITOR_CONSTANTS: {
31
+ COLOR_GIRD: string[][];
32
+ TEXT_ALIGN: {
33
+ TITLE: string;
34
+ OPTIONS: {
35
+ LEFT: {
36
+ LABEL: string;
37
+ VALUE: string;
38
+ };
39
+ CENTER: {
40
+ LABEL: string;
41
+ VALUE: string;
42
+ };
43
+ RIGHT: {
44
+ LABEL: string;
45
+ VALUE: string;
46
+ };
47
+ JUSTIFY: {
48
+ LABEL: string;
49
+ VALUE: string;
50
+ };
51
+ };
52
+ TOOLTIP: string;
53
+ };
54
+ TEXT_TRANSFORM: {
55
+ PLACEHOLDER: string;
56
+ OPTIONS: {
57
+ UPPERCASE: {
58
+ LABEL: string;
59
+ VALUE: string;
60
+ };
61
+ LOWERCASE: {
62
+ LABEL: string;
63
+ VALUE: string;
64
+ };
65
+ CAPITALIZE: {
66
+ LABEL: string;
67
+ VALUE: string;
68
+ };
69
+ NONE: {
70
+ LABEL: string;
71
+ VALUE: string;
72
+ };
73
+ };
74
+ };
75
+ TOOLTIPS: {
76
+ BOLD: {
77
+ TITLE: string;
78
+ SHORTCUT: string;
79
+ };
80
+ ITALIC: {
81
+ TITLE: string;
82
+ SHORTCUT: string;
83
+ };
84
+ UNDERLINE: {
85
+ TITLE: string;
86
+ SHORTCUT: string;
87
+ };
88
+ STRIKE: {
89
+ TITLE: string;
90
+ SHORTCUT: string;
91
+ };
92
+ BULLET_LIST: {
93
+ TITLE: string;
94
+ SHORTCUT: string;
95
+ };
96
+ ORDERED_LIST: {
97
+ TITLE: string;
98
+ SHORTCUT: string;
99
+ };
100
+ CLEAR_FORMATTING: {
101
+ TITLE: string;
102
+ };
103
+ FONT_FAMILY: {
104
+ PLACEHOLDER: string;
105
+ };
106
+ FONT_SIZE: {
107
+ PLACEHOLDER: string;
108
+ };
109
+ HIGHLIGHT: {
110
+ TITLE: string;
111
+ };
112
+ INDENT: {
113
+ TITLE: string;
114
+ };
115
+ OUTDENT: {
116
+ TITLE: string;
117
+ };
118
+ LINK: {
119
+ TITLE: string;
120
+ };
121
+ SMART_TAG: {
122
+ TITLE: string;
123
+ };
124
+ SUPERSCRIPT: {
125
+ TITLE: string;
126
+ };
127
+ SUBSCRIPT: {
128
+ TITLE: string;
129
+ };
130
+ TEXT_COLOR: {
131
+ TITLE: string;
132
+ };
133
+ };
134
+ LINK_TEXT_COLOR: string;
135
+ };
@@ -0,0 +1,280 @@
1
+ import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
2
+ const COLOR_GIRD = [
3
+ // Dòng đầu: màu chuẩn
4
+ [
5
+ '#000000',
6
+ '#434343',
7
+ '#666666',
8
+ '#999999',
9
+ '#B7B7B7',
10
+ '#CCCCCC',
11
+ '#D9D9D9',
12
+ '#EFEFEF',
13
+ '#F3F3F3',
14
+ '#FFFFFF',
15
+ ],
16
+ // Dòng 2: màu cơ bản
17
+ [
18
+ '#980000',
19
+ '#FF0000',
20
+ '#FF9900',
21
+ '#FFFF00',
22
+ '#00FF00',
23
+ '#00FFFF',
24
+ '#4A86E8',
25
+ '#0000FF',
26
+ '#9900FF',
27
+ '#FF00FF',
28
+ ],
29
+ // Dòng 3+
30
+ [
31
+ '#E6B8AF',
32
+ '#F4CCCC',
33
+ '#FCE5CD',
34
+ '#FFF2CC',
35
+ '#D9EAD3',
36
+ '#D0E0E3',
37
+ '#C9DAF8',
38
+ '#CFE2F3',
39
+ '#D9D2E9',
40
+ '#EAD1DC',
41
+ ],
42
+ [
43
+ '#DD7E6B',
44
+ '#EA9999',
45
+ '#F9CB9C',
46
+ '#FFE599',
47
+ '#B6D7A8',
48
+ '#A2C4C9',
49
+ '#A4C2F4',
50
+ '#9FC5E8',
51
+ '#B4A7D6',
52
+ '#D5A6BD',
53
+ ],
54
+ [
55
+ '#CC4125',
56
+ '#E06666',
57
+ '#F6B26B',
58
+ '#FFD966',
59
+ '#93C47D',
60
+ '#76A5AF',
61
+ '#6D9EEB',
62
+ '#6FA8DC',
63
+ '#8E7CC3',
64
+ '#C27BA0',
65
+ ],
66
+ [
67
+ '#A61C00',
68
+ '#CC0000',
69
+ '#E69138',
70
+ '#F1C232',
71
+ '#6AA84F',
72
+ '#45818E',
73
+ '#3C78D8',
74
+ '#3D85C6',
75
+ '#674EA7',
76
+ '#A64D79',
77
+ ],
78
+ [
79
+ '#85200C',
80
+ '#990000',
81
+ '#B45F06',
82
+ '#BF9000',
83
+ '#38761D',
84
+ '#134F5C',
85
+ '#1155CC',
86
+ '#0B5394',
87
+ '#351C75',
88
+ '#741B47',
89
+ ],
90
+ [
91
+ '#5B0F00',
92
+ '#660000',
93
+ '#783F04',
94
+ '#7F6000',
95
+ '#274E13',
96
+ '#0C343D',
97
+ '#1C4587',
98
+ '#073763',
99
+ '#20124D',
100
+ '#4C1130',
101
+ ],
102
+ ];
103
+ // TextAlignSelect component
104
+ const TEXT_ALIGN = {
105
+ TITLE: 'Text Align',
106
+ OPTIONS: {
107
+ LEFT: {
108
+ LABEL: 'Left',
109
+ VALUE: 'left',
110
+ },
111
+ CENTER: {
112
+ LABEL: 'Center',
113
+ VALUE: 'center',
114
+ },
115
+ RIGHT: {
116
+ LABEL: 'Right',
117
+ VALUE: 'right',
118
+ },
119
+ JUSTIFY: {
120
+ LABEL: 'Justify',
121
+ VALUE: 'justify',
122
+ },
123
+ },
124
+ TOOLTIP: 'Align',
125
+ };
126
+ // TextTransformAction component
127
+ const TEXT_TRANSFORM = {
128
+ PLACEHOLDER: 'Text Transform',
129
+ OPTIONS: {
130
+ UPPERCASE: {
131
+ LABEL: 'UPPERCASE',
132
+ VALUE: 'uppercase',
133
+ },
134
+ LOWERCASE: {
135
+ LABEL: 'lowercase',
136
+ VALUE: 'lowercase',
137
+ },
138
+ CAPITALIZE: {
139
+ LABEL: 'Capitalize',
140
+ VALUE: 'capitalize',
141
+ },
142
+ NONE: {
143
+ LABEL: 'none',
144
+ VALUE: 'none',
145
+ },
146
+ },
147
+ };
148
+ const TOOLTIPS = {
149
+ BOLD: {
150
+ TITLE: 'Bold',
151
+ SHORTCUT: 'B',
152
+ },
153
+ ITALIC: {
154
+ TITLE: 'Italic',
155
+ SHORTCUT: 'I',
156
+ },
157
+ UNDERLINE: {
158
+ TITLE: 'Underline',
159
+ SHORTCUT: 'U',
160
+ },
161
+ STRIKE: {
162
+ TITLE: 'Strike',
163
+ SHORTCUT: 'S',
164
+ },
165
+ BULLET_LIST: {
166
+ TITLE: 'Bullet List',
167
+ SHORTCUT: '8',
168
+ },
169
+ ORDERED_LIST: {
170
+ TITLE: 'Ordered List',
171
+ SHORTCUT: '7',
172
+ },
173
+ CLEAR_FORMATTING: {
174
+ TITLE: 'Clear Formatting',
175
+ },
176
+ FONT_FAMILY: {
177
+ PLACEHOLDER: 'Font Family',
178
+ },
179
+ FONT_SIZE: {
180
+ PLACEHOLDER: 'Font Size',
181
+ },
182
+ HIGHLIGHT: {
183
+ TITLE: 'Text Background',
184
+ },
185
+ INDENT: {
186
+ TITLE: 'Indent',
187
+ },
188
+ OUTDENT: {
189
+ TITLE: 'Outdent',
190
+ },
191
+ LINK: {
192
+ TITLE: 'Link',
193
+ },
194
+ SMART_TAG: {
195
+ TITLE: 'Smart Tag',
196
+ },
197
+ SUPERSCRIPT: {
198
+ TITLE: 'Superscript',
199
+ },
200
+ SUBSCRIPT: {
201
+ TITLE: 'Subscript',
202
+ },
203
+ TEXT_COLOR: {
204
+ TITLE: 'Text Color',
205
+ },
206
+ };
207
+ export const SMART_TAG_HIGHLIGHT_BG = 'rgba(0, 199, 97, 0.2)';
208
+ export const DEFAULT_TEXT_STYLE = {
209
+ fontSize: '22px',
210
+ color: '#000',
211
+ fontFamily: 'inherit',
212
+ backgroundColor: 'inherit',
213
+ lineHeight: '1.15',
214
+ fontWeight: 'inherit',
215
+ };
216
+ export const FONT_WEIGHT_LABELS = {
217
+ thin: 'Thin',
218
+ extraLight: 'Extra Light',
219
+ light: 'Light',
220
+ normal: 'Normal',
221
+ medium: 'Medium',
222
+ semiBold: 'Semi Bold',
223
+ bold: 'Bold',
224
+ extraBold: 'Extra Bold',
225
+ black: 'Black',
226
+ };
227
+ export const FONT_WEIGHT_MAP = {
228
+ 100: FONT_WEIGHT_LABELS.thin,
229
+ 200: FONT_WEIGHT_LABELS.extraLight,
230
+ 300: FONT_WEIGHT_LABELS.light,
231
+ 400: FONT_WEIGHT_LABELS.normal,
232
+ 500: FONT_WEIGHT_LABELS.medium,
233
+ 600: FONT_WEIGHT_LABELS.semiBold,
234
+ 700: FONT_WEIGHT_LABELS.bold,
235
+ 800: FONT_WEIGHT_LABELS.extraBold,
236
+ 900: FONT_WEIGHT_LABELS.black,
237
+ };
238
+ export const DEFAULT_FONT_CONFIGS = [
239
+ {
240
+ fontFamily: { name: 'Arial' },
241
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
242
+ },
243
+ {
244
+ fontFamily: { name: 'Roboto' }, // Google Font, not inherently system-wide
245
+ fontWeight: [100, 300, 400, 500, 700, 900],
246
+ },
247
+ {
248
+ fontFamily: { name: 'Georgia' },
249
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
250
+ },
251
+ {
252
+ fontFamily: { name: 'Helvetica' },
253
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
254
+ },
255
+ {
256
+ fontFamily: { name: 'Lucida Grande' },
257
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
258
+ },
259
+ {
260
+ fontFamily: { name: 'Tahoma' },
261
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
262
+ },
263
+ {
264
+ fontFamily: { name: 'Times New Roman' },
265
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
266
+ },
267
+ {
268
+ fontFamily: { name: 'Verdana' },
269
+ fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
270
+ },
271
+ ];
272
+ export const LINK_TEXT_COLOR = '#0066CC';
273
+ export const COMPONENT_CLS = `${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor`;
274
+ export const TEXT_EDITOR_CONSTANTS = {
275
+ COLOR_GIRD,
276
+ TEXT_ALIGN,
277
+ TEXT_TRANSFORM,
278
+ TOOLTIPS,
279
+ LINK_TEXT_COLOR,
280
+ };
@@ -0,0 +1,25 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export type BackgroundColorOptions = {
3
+ /**
4
+ * The types where the color can be applied
5
+ * @default ['textStyle']
6
+ * @example ['heading', 'paragraph']
7
+ */
8
+ types: string[];
9
+ defaultBackgroundColor: string;
10
+ };
11
+ declare module '@tiptap/core' {
12
+ interface Commands<ReturnType> {
13
+ backgroundColor: {
14
+ /**
15
+ * Set the background color
16
+ */
17
+ setBackgroundColor: (color: string) => ReturnType;
18
+ /**
19
+ * Unset the background color
20
+ */
21
+ unsetBackgroundColor: () => ReturnType;
22
+ };
23
+ }
24
+ }
25
+ export declare const BackgroundColor: Extension<BackgroundColorOptions, any>;
@@ -0,0 +1,46 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { DEFAULT_TEXT_STYLE } from '../constants';
3
+ import tinycolor from 'tinycolor2';
4
+ export const BackgroundColor = Extension.create({
5
+ name: 'backgroundColor',
6
+ addOptions() {
7
+ return {
8
+ types: ['textStyle'],
9
+ defaultBackgroundColor: DEFAULT_TEXT_STYLE.backgroundColor,
10
+ };
11
+ },
12
+ addGlobalAttributes() {
13
+ return [
14
+ {
15
+ types: this.options.types,
16
+ attributes: {
17
+ backgroundColor: {
18
+ default: this.options.defaultBackgroundColor,
19
+ parseHTML: element => element.style.backgroundColor?.replace(/['"]+/g, ''),
20
+ renderHTML: attributes => {
21
+ if (!tinycolor(attributes.backgroundColor).isValid()) {
22
+ return {};
23
+ }
24
+ const hexBgColor = tinycolor(attributes.backgroundColor).toString('hex');
25
+ return {
26
+ style: `
27
+ --text-style-bg-color: ${hexBgColor};
28
+ background-color: ${hexBgColor};
29
+ `,
30
+ };
31
+ },
32
+ },
33
+ },
34
+ },
35
+ ];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ setBackgroundColor: color => ({ chain }) => chain().setMark('textStyle', { backgroundColor: color }).run(),
40
+ unsetBackgroundColor: () => ({ chain }) => chain()
41
+ .setMark('textStyle', { backgroundColor: this.options.defaultBackgroundColor || null })
42
+ .removeEmptyTextStyle()
43
+ .run(),
44
+ };
45
+ },
46
+ });
@@ -0,0 +1,130 @@
1
+ import { arrow, autoPlacement, flip, hide, inline, offset, shift, size } from '@floating-ui/dom';
2
+ import type { Editor } from '@tiptap/core';
3
+ import type { EditorState, PluginView } from '@tiptap/pm/state';
4
+ import { Plugin, PluginKey } from '@tiptap/pm/state';
5
+ import type { EditorView } from '@tiptap/pm/view';
6
+ export interface BubbleMenuPluginProps {
7
+ /**
8
+ * The plugin key.
9
+ * @type {PluginKey | string}
10
+ * @default 'bubbleMenu'
11
+ */
12
+ pluginKey: PluginKey | string;
13
+ /**
14
+ * The editor instance.
15
+ */
16
+ editor: Editor;
17
+ /**
18
+ * The DOM element that contains your menu.
19
+ * @type {HTMLElement}
20
+ * @default null
21
+ */
22
+ element: HTMLElement;
23
+ /**
24
+ * The container element where the bubble menu will be rendered.
25
+ * If not provided, it will default to document.body
26
+ * @type {HTMLElement | (() => HTMLElement) | null}
27
+ * @default document.body
28
+ */
29
+ container?: HTMLElement | (() => HTMLElement) | null;
30
+ /**
31
+ * The delay in milliseconds before the menu should be updated.
32
+ * This can be useful to prevent performance issues.
33
+ * @type {number}
34
+ * @default 250
35
+ */
36
+ updateDelay?: number;
37
+ /**
38
+ * The delay in milliseconds before the menu position should be updated on window resize.
39
+ * This can be useful to prevent performance issues.
40
+ * @type {number}
41
+ * @default 60
42
+ */
43
+ resizeDelay?: number;
44
+ /**
45
+ * A function that determines whether the menu should be shown or not.
46
+ * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
47
+ */
48
+ shouldShow: ((props: {
49
+ editor: Editor;
50
+ element: HTMLElement;
51
+ view: EditorView;
52
+ state: EditorState;
53
+ oldState?: EditorState;
54
+ from: number;
55
+ to: number;
56
+ }) => boolean) | null;
57
+ /**
58
+ * Callback function when the bubble menu is shown.
59
+ */
60
+ onShow?: () => void;
61
+ /**
62
+ * Callback function when the bubble menu is hidden.
63
+ */
64
+ onHide?: () => void;
65
+ /**
66
+ * FloatingUI options.
67
+ */
68
+ options?: {
69
+ strategy?: 'absolute' | 'fixed';
70
+ placement?: 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
71
+ offset?: Parameters<typeof offset>[0] | boolean;
72
+ flip?: Parameters<typeof flip>[0] | boolean;
73
+ shift?: Parameters<typeof shift>[0] | boolean;
74
+ arrow?: Parameters<typeof arrow>[0] | false;
75
+ size?: Parameters<typeof size>[0] | boolean;
76
+ autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean;
77
+ hide?: Parameters<typeof hide>[0] | boolean;
78
+ inline?: Parameters<typeof inline>[0] | boolean;
79
+ };
80
+ }
81
+ export type BubbleMenuViewProps = BubbleMenuPluginProps & {
82
+ view: EditorView;
83
+ };
84
+ export declare class BubbleMenuView implements PluginView {
85
+ editor: Editor;
86
+ element: HTMLElement;
87
+ container?: HTMLElement | (() => HTMLElement) | null;
88
+ view: EditorView;
89
+ preventHide: boolean;
90
+ updateDelay: number;
91
+ resizeDelay: number;
92
+ onShow?: () => void;
93
+ onHide?: () => void;
94
+ private updateDebounceTimer;
95
+ private resizeDebounceTimer;
96
+ private floatingUIOptions;
97
+ shouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null>;
98
+ get middlewares(): {
99
+ name: string;
100
+ options?: any;
101
+ fn: (state: {
102
+ x: number;
103
+ y: number;
104
+ platform: import("@floating-ui/core").Platform;
105
+ placement: import("@floating-ui/utils").Placement;
106
+ initialPlacement: import("@floating-ui/utils").Placement;
107
+ strategy: import("@floating-ui/utils").Strategy;
108
+ middlewareData: import("@floating-ui/core").MiddlewareData;
109
+ rects: import("@floating-ui/utils").ElementRects;
110
+ elements: import("@floating-ui/dom").Elements;
111
+ }) => import("@floating-ui/core").MiddlewareReturn | Promise<import("@floating-ui/core").MiddlewareReturn>;
112
+ }[];
113
+ constructor({ editor, element, view, updateDelay, resizeDelay, container, shouldShow, options, onShow, onHide, }: BubbleMenuViewProps);
114
+ mousedownHandler: () => void;
115
+ dragstartHandler: () => void;
116
+ focusHandler: () => void;
117
+ blurHandler: ({ event }: {
118
+ event: FocusEvent;
119
+ }) => void;
120
+ updatePosition(): void;
121
+ update(view: EditorView, oldState?: EditorState): void;
122
+ handleDebouncedUpdate: (view: EditorView, oldState?: EditorState) => void;
123
+ getShouldShow(oldState?: EditorState): boolean;
124
+ updateHandler: (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => void;
125
+ private getContainer;
126
+ show(): void;
127
+ hide(): void;
128
+ destroy(): void;
129
+ }
130
+ export declare const BubbleMenuPlugin: (options: BubbleMenuPluginProps) => Plugin<any>;