@antscorp/antsomi-ui 2.0.89 → 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.
- package/es/assets/css/main.scss +4 -2
- package/es/components/icons/ALignRightIcon.d.ts +3 -0
- package/es/components/icons/ALignRightIcon.js +7 -0
- package/es/components/icons/AlignCenterIcon.d.ts +3 -0
- package/es/components/icons/AlignCenterIcon.js +7 -0
- package/es/components/icons/AlignJustifyIcon.d.ts +3 -0
- package/es/components/icons/AlignJustifyIcon.js +7 -0
- package/es/components/icons/AlignLeftIcon.d.ts +3 -0
- package/es/components/icons/AlignLeftIcon.js +7 -0
- package/es/components/icons/AntsomiAIIcon.d.ts +3 -0
- package/es/components/icons/AntsomiAIIcon.js +7 -0
- package/es/components/icons/ArrowDropDownIcon.d.ts +3 -0
- package/es/components/icons/ArrowDropDownIcon.js +7 -0
- package/es/components/icons/ChevronRightIcon.d.ts +3 -0
- package/es/components/icons/ChevronRightIcon.js +7 -0
- package/es/components/icons/EmotionFeedbackIcon.d.ts +6 -0
- package/es/components/icons/EmotionFeedbackIcon.js +8 -0
- package/es/components/icons/FeedbackRatingIcon.d.ts +3 -0
- package/es/components/icons/FeedbackRatingIcon.js +7 -0
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +17 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +14 -0
- package/es/components/icons/LinkOffIcon.d.ts +3 -0
- package/es/components/icons/LinkOffIcon.js +7 -0
- package/es/components/icons/MinusIcon.d.ts +3 -0
- package/es/components/icons/MinusIcon.js +7 -0
- package/es/components/icons/NoteNewIcon.d.ts +3 -0
- package/es/components/icons/NoteNewIcon.js +7 -0
- package/es/components/icons/SearchNotFoundIcon.d.ts +3 -0
- package/es/components/icons/SearchNotFoundIcon.js +7 -0
- package/es/components/icons/SummarizeIcon.d.ts +3 -0
- package/es/components/icons/SummarizeIcon.js +7 -0
- package/es/components/icons/index.d.ts +14 -0
- package/es/components/icons/index.js +14 -0
- package/es/components/index.scss +2 -0
- package/es/components/molecules/ColorSetting/index.js +2 -11
- package/es/components/molecules/ColorSetting/styled.d.ts +1 -1
- package/es/components/molecules/ColorSetting/styled.js +9 -1
- package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
- package/es/components/molecules/EmojiCollections/types.d.ts +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
- package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +127 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +8 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +14 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +20 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +19 -0
- package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/constants.js +5 -0
- package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/index.js +1 -0
- package/es/components/molecules/FontSizeInput/styled.d.ts +7 -0
- package/es/components/molecules/FontSizeInput/styled.js +36 -0
- package/es/components/molecules/FontSizeInput/styles.scss +15 -0
- package/es/components/molecules/FontSizeInput/types.d.ts +23 -0
- package/es/components/molecules/FontSizeInput/types.js +1 -0
- package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
- package/es/components/molecules/FontSizeInput/utils.js +9 -0
- package/es/components/molecules/ItemNotFound/ItemNotFound.d.ts +6 -0
- package/es/components/molecules/ItemNotFound/ItemNotFound.js +9 -0
- package/es/components/molecules/ItemNotFound/index.d.ts +1 -0
- package/es/components/molecules/ItemNotFound/index.js +1 -0
- package/es/components/molecules/ItemNotFound/styled.d.ts +4 -0
- package/es/components/molecules/ItemNotFound/styled.js +29 -0
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +23 -7
- package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.d.ts +1 -0
- package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.js +7 -2
- package/es/components/molecules/MatchAnySelect/types.d.ts +2 -1
- package/es/components/molecules/MatchAnySelect/utils.d.ts +1 -0
- package/es/components/molecules/MatchAnySelect/utils.js +2 -0
- package/es/components/molecules/QuillEditor/EditorToolbar.js +1 -0
- package/es/components/molecules/QuillEditor/QuillEditor.d.ts +6 -1
- package/es/components/molecules/QuillEditor/QuillEditor.js +90 -55
- package/es/components/molecules/QuillEditor/styled.d.ts +5 -0
- package/es/components/molecules/QuillEditor/styled.js +29 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +6 -3
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2550 -938
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +1 -11
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +53 -25
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +8 -5
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +289 -46
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +1 -0
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +2 -2
- package/es/components/molecules/VirtualizedMenu/styled.js +23 -4
- package/es/components/molecules/VirtualizedMenu/types.d.ts +27 -10
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +8 -5
- package/es/components/molecules/VirtualizedMenu/utils.js +13 -18
- package/es/components/molecules/index.d.ts +2 -0
- package/es/components/molecules/index.js +2 -0
- package/es/components/molecules/index.scss +1 -0
- package/es/components/organism/ActivityTimeline/ActivityTimeline.js +15 -9
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
- package/es/components/organism/ActivityTimeline/components/ItemEvent/ItemEvent.d.ts +3 -4
- package/es/components/organism/ActivityTimeline/components/ItemEvent/ItemEvent.js +4 -3
- package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/ItemGroupEvent.d.ts +4 -6
- package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/ItemGroupEvent.js +4 -4
- package/es/components/organism/ActivityTimeline/components/TimeLineTitle/TimelineTitle.js +1 -1
- package/es/components/organism/ActivityTimeline/types.d.ts +2 -1
- package/es/components/organism/ActivityTimeline/utils.d.ts +1 -1
- package/es/components/organism/ActivityTimeline/utils.js +1 -1
- package/es/components/organism/Help/Help.js +47 -10
- package/es/components/organism/TextEditor/TextEditor.d.ts +3 -0
- package/es/components/organism/TextEditor/TextEditor.js +257 -0
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +38 -0
- package/es/components/organism/TextEditor/constants.d.ts +175 -0
- package/es/components/organism/TextEditor/constants.js +321 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +46 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +130 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +247 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +31 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
- package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Color.js +34 -0
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
- package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.js +36 -0
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +32 -0
- package/es/components/organism/TextEditor/extensions/FontSize.js +47 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
- package/es/components/organism/TextEditor/extensions/Highlight.d.ts +1 -0
- package/es/components/organism/TextEditor/extensions/Highlight.js +14 -0
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +21 -0
- package/es/components/organism/TextEditor/extensions/Indent.js +63 -0
- package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +32 -0
- package/es/components/organism/TextEditor/extensions/LetterSpacing.js +48 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.js +36 -0
- package/es/components/organism/TextEditor/extensions/Link.d.ts +16 -0
- package/es/components/organism/TextEditor/extensions/Link.js +48 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
- package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +56 -0
- package/es/components/organism/TextEditor/extensions/OrderedList.js +187 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +39 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +167 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +31 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.js +37 -0
- package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +55 -0
- package/es/components/organism/TextEditor/extensions/UnorderedList.js +176 -0
- package/es/components/organism/TextEditor/hooks/index.d.ts +7 -0
- package/es/components/organism/TextEditor/hooks/index.js +7 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.js +22 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +11 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.js +125 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +68 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
- package/es/components/organism/TextEditor/index.d.ts +14 -0
- package/es/components/organism/TextEditor/index.js +6 -0
- package/es/components/organism/TextEditor/index.scss +61 -0
- package/es/components/organism/TextEditor/provider.d.ts +15 -0
- package/es/components/organism/TextEditor/provider.js +33 -0
- package/es/components/organism/TextEditor/store.d.ts +13 -0
- package/es/components/organism/TextEditor/store.js +20 -0
- package/es/components/organism/TextEditor/styled.d.ts +10 -0
- package/es/components/organism/TextEditor/styled.js +94 -0
- package/es/components/organism/TextEditor/types.d.ts +96 -0
- package/es/components/organism/TextEditor/types.js +3 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +85 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Button/Button.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Button/Button.js +31 -0
- package/es/components/organism/TextEditor/ui/Button/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Button/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Button/types.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Button/types.js +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +39 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +131 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +17 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +51 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +12 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +69 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +22 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +9 -0
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +44 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +52 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +19 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +77 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +15 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +41 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +84 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +27 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +31 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +28 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +47 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +21 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +28 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +67 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +45 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +26 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +26 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +29 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +22 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +36 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +1 -0
- package/es/components/organism/TextEditor/utils/documentState.d.ts +57 -0
- package/es/components/organism/TextEditor/utils/documentState.js +100 -0
- package/es/components/organism/TextEditor/utils/font.d.ts +73 -0
- package/es/components/organism/TextEditor/utils/font.js +160 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +63 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +319 -0
- package/es/components/organism/TextEditor/utils/indent.d.ts +11 -0
- package/es/components/organism/TextEditor/utils/indent.js +56 -0
- package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
- package/es/components/organism/TextEditor/utils/index.js +16 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +100 -0
- package/es/components/organism/TextEditor/utils/link.js +149 -0
- package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
- package/es/components/organism/TextEditor/utils/menu.js +317 -0
- package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
- package/es/components/organism/TextEditor/utils/selection.js +57 -0
- package/es/components/organism/TextEditor/utils/shared.d.ts +1 -0
- package/es/components/organism/TextEditor/utils/shared.js +9 -0
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
- package/es/components/organism/TextEditor/utils/smartTag.js +89 -0
- package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
- package/es/components/organism/TextEditor/utils/style.js +193 -0
- package/es/components/organism/TicketEditor/Content.js +47 -33
- package/es/components/organism/TicketEditor/components/MessageComponent.js +1 -0
- package/es/components/organism/TicketEditor/index.js +24 -16
- package/es/components/organism/TicketEditor/styled.js +1 -0
- package/es/components/organism/TicketEditorV2/Content.js +41 -7
- package/es/components/organism/TicketEditorV2/components/MessageComponent.js +1 -0
- package/es/components/organism/TicketEditorV2/styled.js +2 -1
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/hooks/index.d.ts +3 -0
- package/es/hooks/index.js +3 -0
- package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
- package/es/hooks/useBroadcastedLocalStorage.js +71 -0
- package/es/hooks/useElementSize.d.ts +7 -0
- package/es/hooks/useElementSize.js +56 -0
- package/es/hooks/useIsMounted.d.ts +1 -0
- package/es/hooks/useIsMounted.js +11 -0
- package/es/locales/en/translation.json +2 -1
- package/es/locales/i18n.d.ts +3 -1
- package/es/locales/vi/translation.json +2 -1
- package/es/utils/common.d.ts +6 -9
- package/es/utils/common.js +44 -23
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/tree.d.ts +225 -0
- package/es/utils/tree.js +469 -0
- package/es/utils/web.d.ts +15 -0
- package/es/utils/web.js +39 -0
- package/package.json +25 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EditorState } from '@tiptap/pm/state';
|
|
2
|
+
/**
|
|
3
|
+
* Kiểm tra xem có selection nào trong tài liệu hay không
|
|
4
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
5
|
+
* @returns true nếu không có selection, false nếu có selection
|
|
6
|
+
*/
|
|
7
|
+
export declare const isNoSelection: (state: EditorState) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the text content of the current selection
|
|
10
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
11
|
+
* @returns Selected text content
|
|
12
|
+
*/
|
|
13
|
+
export declare const getSelectionText: (state: EditorState) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if selection spans multiple nodes
|
|
16
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
17
|
+
* @returns true if selection spans multiple nodes
|
|
18
|
+
*/
|
|
19
|
+
export declare const isMultiNodeSelection: (state: EditorState) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the depth of the current selection
|
|
22
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
23
|
+
* @returns Selection depth
|
|
24
|
+
*/
|
|
25
|
+
export declare const getSelectionDepth: (state: EditorState) => number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isNodeSelection, isTextSelection } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Kiểm tra xem có selection nào trong tài liệu hay không
|
|
4
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
5
|
+
* @returns true nếu không có selection, false nếu có selection
|
|
6
|
+
*/
|
|
7
|
+
export const isNoSelection = (state) => {
|
|
8
|
+
const { selection } = state;
|
|
9
|
+
if (selection.empty)
|
|
10
|
+
return true;
|
|
11
|
+
// Kiểm tra trường hợp text selection không có nội dung
|
|
12
|
+
if (isTextSelection(selection)) {
|
|
13
|
+
const { from, to } = selection;
|
|
14
|
+
if (from === to)
|
|
15
|
+
return true;
|
|
16
|
+
const selectedText = state.doc.textBetween(from, to);
|
|
17
|
+
return selectedText.length === 0;
|
|
18
|
+
}
|
|
19
|
+
// Nếu là node selection, thì có selection
|
|
20
|
+
if (isNodeSelection(selection))
|
|
21
|
+
return false;
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Gets the text content of the current selection
|
|
26
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
27
|
+
* @returns Selected text content
|
|
28
|
+
*/
|
|
29
|
+
export const getSelectionText = (state) => {
|
|
30
|
+
const { selection } = state;
|
|
31
|
+
const { from, to } = selection;
|
|
32
|
+
return state.doc.textBetween(from, to);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Checks if selection spans multiple nodes
|
|
36
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
37
|
+
* @returns true if selection spans multiple nodes
|
|
38
|
+
*/
|
|
39
|
+
export const isMultiNodeSelection = (state) => {
|
|
40
|
+
const { selection } = state;
|
|
41
|
+
if (selection.empty)
|
|
42
|
+
return false;
|
|
43
|
+
const { from, to } = selection;
|
|
44
|
+
const $from = state.doc.resolve(from);
|
|
45
|
+
const $to = state.doc.resolve(to);
|
|
46
|
+
return $from.parent !== $to.parent;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Gets the depth of the current selection
|
|
50
|
+
* @param state EditorState của Tiptap/ProseMirror
|
|
51
|
+
* @returns Selection depth
|
|
52
|
+
*/
|
|
53
|
+
export const getSelectionDepth = (state) => {
|
|
54
|
+
const { selection } = state;
|
|
55
|
+
const { $from } = selection;
|
|
56
|
+
return $from.depth;
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function clamp(val: number, min: number, max: number): number;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
2
|
+
import { SmartTagHandler } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Handles smart tag actions (create or edit)
|
|
5
|
+
* @param event Mouse event from the action
|
|
6
|
+
* @param view EditorView instance
|
|
7
|
+
* @param smartTagHandler Smart tag handler callbacks
|
|
8
|
+
*/
|
|
9
|
+
export declare const handleSmartTagAction: (event: React.MouseEvent, view: EditorView, smartTagHandler?: SmartTagHandler) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Gets smart tag node at a specific position
|
|
12
|
+
* @param view EditorView instance
|
|
13
|
+
* @param pos Position to check
|
|
14
|
+
* @returns Smart tag node or null
|
|
15
|
+
*/
|
|
16
|
+
export declare const getSmartTagAtPosition: (view: EditorView, pos: number) => import("prosemirror-model").Node | null;
|
|
17
|
+
/**
|
|
18
|
+
* Gets all smart tags in the document
|
|
19
|
+
* @param view EditorView instance
|
|
20
|
+
* @returns Array of smart tag nodes with their positions
|
|
21
|
+
*/
|
|
22
|
+
export declare const getAllSmartTags: (view: EditorView) => {
|
|
23
|
+
node: any;
|
|
24
|
+
pos: number;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Finds smart tag by ID
|
|
28
|
+
* @param view EditorView instance
|
|
29
|
+
* @param id Smart tag ID to find
|
|
30
|
+
* @returns Smart tag node and position or null
|
|
31
|
+
*/
|
|
32
|
+
export declare const findSmartTagById: (view: EditorView, id: string) => null;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if position is inside a smart tag
|
|
35
|
+
* @param view EditorView instance
|
|
36
|
+
* @param pos Position to check
|
|
37
|
+
* @returns true if position is inside a smart tag
|
|
38
|
+
*/
|
|
39
|
+
export declare const isPositionInSmartTag: (view: EditorView, pos: number) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Gets smart tag content at cursor position
|
|
42
|
+
* @param view EditorView instance
|
|
43
|
+
* @returns Smart tag content or null
|
|
44
|
+
*/
|
|
45
|
+
export declare const getSmartTagAtCursor: (view: EditorView) => {
|
|
46
|
+
id: any;
|
|
47
|
+
content: any;
|
|
48
|
+
node: import("prosemirror-model").Node;
|
|
49
|
+
} | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles smart tag actions (create or edit)
|
|
3
|
+
* @param event Mouse event from the action
|
|
4
|
+
* @param view EditorView instance
|
|
5
|
+
* @param smartTagHandler Smart tag handler callbacks
|
|
6
|
+
*/
|
|
7
|
+
export const handleSmartTagAction = (event, view, smartTagHandler) => {
|
|
8
|
+
const { state } = view;
|
|
9
|
+
const { from, to } = state.selection;
|
|
10
|
+
const smartTagNode = state.doc.nodeAt(from);
|
|
11
|
+
const smartTagId = smartTagNode?.attrs.id;
|
|
12
|
+
if (smartTagId) {
|
|
13
|
+
smartTagHandler?.edit?.(smartTagId, event);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const selectedText = state.doc.textBetween(from, to);
|
|
17
|
+
if (selectedText) {
|
|
18
|
+
smartTagHandler?.setNew?.({
|
|
19
|
+
selectionText: selectedText,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Gets smart tag node at a specific position
|
|
26
|
+
* @param view EditorView instance
|
|
27
|
+
* @param pos Position to check
|
|
28
|
+
* @returns Smart tag node or null
|
|
29
|
+
*/
|
|
30
|
+
export const getSmartTagAtPosition = (view, pos) => {
|
|
31
|
+
const node = view.state.doc.nodeAt(pos);
|
|
32
|
+
if (node && node.type.name === 'smartTag') {
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Gets all smart tags in the document
|
|
39
|
+
* @param view EditorView instance
|
|
40
|
+
* @returns Array of smart tag nodes with their positions
|
|
41
|
+
*/
|
|
42
|
+
export const getAllSmartTags = (view) => {
|
|
43
|
+
const smartTags = [];
|
|
44
|
+
view.state.doc.descendants((node, pos) => {
|
|
45
|
+
if (node.type.name === 'smartTag') {
|
|
46
|
+
smartTags.push({ node, pos });
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return smartTags;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Finds smart tag by ID
|
|
53
|
+
* @param view EditorView instance
|
|
54
|
+
* @param id Smart tag ID to find
|
|
55
|
+
* @returns Smart tag node and position or null
|
|
56
|
+
*/
|
|
57
|
+
export const findSmartTagById = (view, id) => {
|
|
58
|
+
let result = null;
|
|
59
|
+
view.state.doc.descendants((node, pos) => {
|
|
60
|
+
if (node.type.name === 'smartTag' && node.attrs.id === id) {
|
|
61
|
+
result = { node, pos };
|
|
62
|
+
return false; // Stop traversal
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Checks if position is inside a smart tag
|
|
69
|
+
* @param view EditorView instance
|
|
70
|
+
* @param pos Position to check
|
|
71
|
+
* @returns true if position is inside a smart tag
|
|
72
|
+
*/
|
|
73
|
+
export const isPositionInSmartTag = (view, pos) => getSmartTagAtPosition(view, pos) !== null;
|
|
74
|
+
/**
|
|
75
|
+
* Gets smart tag content at cursor position
|
|
76
|
+
* @param view EditorView instance
|
|
77
|
+
* @returns Smart tag content or null
|
|
78
|
+
*/
|
|
79
|
+
export const getSmartTagAtCursor = (view) => {
|
|
80
|
+
const { selection } = view.state;
|
|
81
|
+
const node = getSmartTagAtPosition(view, selection.from);
|
|
82
|
+
return node
|
|
83
|
+
? {
|
|
84
|
+
id: node.attrs.id,
|
|
85
|
+
content: node.attrs.content,
|
|
86
|
+
node,
|
|
87
|
+
}
|
|
88
|
+
: null;
|
|
89
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TextStyle } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts text style from element's computed style
|
|
4
|
+
* @param style CSSStyleDeclaration from element
|
|
5
|
+
* @returns Partial TextStyle object
|
|
6
|
+
*/
|
|
7
|
+
export declare const textStyleFromElStyle: <T extends CSSStyleDeclaration>(style: T) => Partial<TextStyle>;
|
|
8
|
+
/**
|
|
9
|
+
* Applies text style to HTML element
|
|
10
|
+
* @param el HTML element to apply styles to
|
|
11
|
+
* @param style TextStyle object
|
|
12
|
+
*/
|
|
13
|
+
export declare const appendTextStyleToEl: (el: HTMLElement, style: Partial<TextStyle>) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Converts a style object to a CSS string representation
|
|
16
|
+
* @param styleObj The style object to convert
|
|
17
|
+
* @returns The CSS string representation
|
|
18
|
+
* @example
|
|
19
|
+
* styleObjectToString({ color: 'red', fontSize: '16px' })
|
|
20
|
+
* // returns "color: red; font-size: 16px"
|
|
21
|
+
*/
|
|
22
|
+
export declare function styleObjectToString(styleObj: Record<string, unknown>): string;
|
|
23
|
+
/**
|
|
24
|
+
* Normalizes a font-family string by adding quotes when needed
|
|
25
|
+
* @param fontFamily The font-family string to normalize
|
|
26
|
+
* @returns The normalized font-family string
|
|
27
|
+
* @description
|
|
28
|
+
* - Preserves existing quoted names
|
|
29
|
+
* - Doesn't quote generic families (e.g. sans-serif)
|
|
30
|
+
* - Quotes names containing spaces or special characters
|
|
31
|
+
* @example
|
|
32
|
+
* normalizeFontFamily('Arial, Helvetica, sans-serif')
|
|
33
|
+
* // returns 'Arial, Helvetica, sans-serif'
|
|
34
|
+
*
|
|
35
|
+
* normalizeFontFamily('Times New Roman, serif')
|
|
36
|
+
* // returns '"Times New Roman", serif'
|
|
37
|
+
*/
|
|
38
|
+
export declare function normalizeFontFamily(fontFamily: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Creates font-family string with fallback
|
|
41
|
+
* @param fontFamily Primary font family
|
|
42
|
+
* @param defaultFont Default fallback font
|
|
43
|
+
* @returns Normalized font-family string with fallback
|
|
44
|
+
*/
|
|
45
|
+
export declare const fontWithFallback: (fontFamily: string, defaultFont?: string) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a color matches the link color
|
|
48
|
+
* @param color Color to check
|
|
49
|
+
* @returns true if color matches link color
|
|
50
|
+
*/
|
|
51
|
+
export declare const isLinkColor: (color: string) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Extracts CSS variables from a style object
|
|
54
|
+
* @param styleObj Style object that may contain CSS variables
|
|
55
|
+
* @returns Object with CSS variables and regular styles separated
|
|
56
|
+
*/
|
|
57
|
+
export declare function extractCSSVariables(styleObj: Record<string, unknown>): {
|
|
58
|
+
cssVariables: Record<string, unknown>;
|
|
59
|
+
regularStyles: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Merges multiple text styles with priority
|
|
63
|
+
* @param styles Array of text styles to merge
|
|
64
|
+
* @returns Merged text style
|
|
65
|
+
*/
|
|
66
|
+
export declare function mergeTextStyles(...styles: Partial<TextStyle>[]): Partial<TextStyle>;
|
|
67
|
+
/**
|
|
68
|
+
* Validates if a text style is complete
|
|
69
|
+
* @param style Text style to validate
|
|
70
|
+
* @returns true if all required properties are present
|
|
71
|
+
*/
|
|
72
|
+
export declare function isCompleteTextStyle(style: Partial<TextStyle>): style is TextStyle;
|
|
73
|
+
/**
|
|
74
|
+
* Converts text style to CSS style object
|
|
75
|
+
* @param textStyle Text style object
|
|
76
|
+
* @returns CSS style object
|
|
77
|
+
*/
|
|
78
|
+
export declare function textStyleToCSSStyle(textStyle: Partial<TextStyle>): React.CSSProperties;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { DEFAULT_TEXT_STYLE, LINK_TEXT_COLOR } from '../constants';
|
|
2
|
+
import { uniqBy } from 'lodash';
|
|
3
|
+
import tinycolor from 'tinycolor2';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts text style from element's computed style
|
|
6
|
+
* @param style CSSStyleDeclaration from element
|
|
7
|
+
* @returns Partial TextStyle object
|
|
8
|
+
*/
|
|
9
|
+
export const textStyleFromElStyle = (style) => ({
|
|
10
|
+
color: style.color || DEFAULT_TEXT_STYLE.color,
|
|
11
|
+
fontFamily: style.fontFamily || DEFAULT_TEXT_STYLE.fontFamily,
|
|
12
|
+
fontSize: style.fontSize || DEFAULT_TEXT_STYLE.fontSize,
|
|
13
|
+
backgroundColor: style.backgroundColor,
|
|
14
|
+
lineHeight: style.lineHeight || DEFAULT_TEXT_STYLE.lineHeight,
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Applies text style to HTML element
|
|
18
|
+
* @param el HTML element to apply styles to
|
|
19
|
+
* @param style TextStyle object
|
|
20
|
+
*/
|
|
21
|
+
export const appendTextStyleToEl = (el, style) => {
|
|
22
|
+
if (style.color) {
|
|
23
|
+
el.style.color = style.color;
|
|
24
|
+
}
|
|
25
|
+
if (style.fontSize) {
|
|
26
|
+
el.style.fontSize = style.fontSize;
|
|
27
|
+
}
|
|
28
|
+
if (style.fontFamily) {
|
|
29
|
+
el.style.fontFamily = style.fontFamily;
|
|
30
|
+
}
|
|
31
|
+
if (style.backgroundColor) {
|
|
32
|
+
el.style.backgroundColor = style.backgroundColor;
|
|
33
|
+
}
|
|
34
|
+
if (style.lineHeight) {
|
|
35
|
+
el.style.lineHeight = style.lineHeight;
|
|
36
|
+
}
|
|
37
|
+
if (style.fontWeight) {
|
|
38
|
+
el.style.fontWeight = style.fontWeight;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Converts a style object to a CSS string representation
|
|
43
|
+
* @param styleObj The style object to convert
|
|
44
|
+
* @returns The CSS string representation
|
|
45
|
+
* @example
|
|
46
|
+
* styleObjectToString({ color: 'red', fontSize: '16px' })
|
|
47
|
+
* // returns "color: red; font-size: 16px"
|
|
48
|
+
*/
|
|
49
|
+
export function styleObjectToString(styleObj) {
|
|
50
|
+
return Object.entries(styleObj)
|
|
51
|
+
.map(([key, value]) => {
|
|
52
|
+
// Nếu key đã là kebab-case hoặc bắt đầu bằng dấu '-', giữ nguyên
|
|
53
|
+
const isPrefixed = key.startsWith('-');
|
|
54
|
+
const kebabKey = isPrefixed ? key : key.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
|
|
55
|
+
return `${kebabKey}: ${value}`;
|
|
56
|
+
})
|
|
57
|
+
.join('; ');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Normalizes a font-family string by adding quotes when needed
|
|
61
|
+
* @param fontFamily The font-family string to normalize
|
|
62
|
+
* @returns The normalized font-family string
|
|
63
|
+
* @description
|
|
64
|
+
* - Preserves existing quoted names
|
|
65
|
+
* - Doesn't quote generic families (e.g. sans-serif)
|
|
66
|
+
* - Quotes names containing spaces or special characters
|
|
67
|
+
* @example
|
|
68
|
+
* normalizeFontFamily('Arial, Helvetica, sans-serif')
|
|
69
|
+
* // returns 'Arial, Helvetica, sans-serif'
|
|
70
|
+
*
|
|
71
|
+
* normalizeFontFamily('Times New Roman, serif')
|
|
72
|
+
* // returns '"Times New Roman", serif'
|
|
73
|
+
*/
|
|
74
|
+
export function normalizeFontFamily(fontFamily) {
|
|
75
|
+
if (!fontFamily || typeof fontFamily !== 'string')
|
|
76
|
+
return '';
|
|
77
|
+
const genericFamilies = new Set([
|
|
78
|
+
'serif',
|
|
79
|
+
'sans-serif',
|
|
80
|
+
'monospace',
|
|
81
|
+
'cursive',
|
|
82
|
+
'fantasy',
|
|
83
|
+
'system-ui',
|
|
84
|
+
'ui-serif',
|
|
85
|
+
'ui-sans-serif',
|
|
86
|
+
'ui-monospace',
|
|
87
|
+
'ui-rounded',
|
|
88
|
+
'math',
|
|
89
|
+
'emoji',
|
|
90
|
+
'fangsong',
|
|
91
|
+
]);
|
|
92
|
+
return uniqBy(fontFamily.split(','), name => name.trim())
|
|
93
|
+
.map(name => {
|
|
94
|
+
const trimmed = name.trim();
|
|
95
|
+
// Preserve already quoted names
|
|
96
|
+
const isQuoted = (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
97
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'"));
|
|
98
|
+
if (isQuoted)
|
|
99
|
+
return trimmed;
|
|
100
|
+
// Do not quote generic family names
|
|
101
|
+
if (genericFamilies.has(trimmed))
|
|
102
|
+
return trimmed;
|
|
103
|
+
// Quote if contains whitespace or special characters
|
|
104
|
+
const needsQuotes = /[^\w-]/.test(trimmed);
|
|
105
|
+
return needsQuotes ? `"${trimmed}"` : trimmed;
|
|
106
|
+
})
|
|
107
|
+
.join(', ');
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Creates font-family string with fallback
|
|
111
|
+
* @param fontFamily Primary font family
|
|
112
|
+
* @param defaultFont Default fallback font
|
|
113
|
+
* @returns Normalized font-family string with fallback
|
|
114
|
+
*/
|
|
115
|
+
export const fontWithFallback = (fontFamily, defaultFont = DEFAULT_TEXT_STYLE.fontFamily) => normalizeFontFamily(fontFamily ? `${fontFamily}, ${defaultFont}` : defaultFont);
|
|
116
|
+
/**
|
|
117
|
+
* Checks if a color matches the link color
|
|
118
|
+
* @param color Color to check
|
|
119
|
+
* @returns true if color matches link color
|
|
120
|
+
*/
|
|
121
|
+
export const isLinkColor = (color) => tinycolor.equals(color, LINK_TEXT_COLOR);
|
|
122
|
+
/**
|
|
123
|
+
* Extracts CSS variables from a style object
|
|
124
|
+
* @param styleObj Style object that may contain CSS variables
|
|
125
|
+
* @returns Object with CSS variables and regular styles separated
|
|
126
|
+
*/
|
|
127
|
+
export function extractCSSVariables(styleObj) {
|
|
128
|
+
const cssVariables = {};
|
|
129
|
+
const regularStyles = {};
|
|
130
|
+
Object.entries(styleObj).forEach(([key, value]) => {
|
|
131
|
+
if (key.startsWith('--')) {
|
|
132
|
+
cssVariables[key] = value;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
regularStyles[key] = value;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return { cssVariables, regularStyles };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Merges multiple text styles with priority
|
|
142
|
+
* @param styles Array of text styles to merge
|
|
143
|
+
* @returns Merged text style
|
|
144
|
+
*/
|
|
145
|
+
export function mergeTextStyles(...styles) {
|
|
146
|
+
return styles.reduce((merged, style) => ({
|
|
147
|
+
...merged,
|
|
148
|
+
...Object.fromEntries(Object.entries(style).filter(([_, value]) => value !== undefined && value !== null)),
|
|
149
|
+
}), {});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Validates if a text style is complete
|
|
153
|
+
* @param style Text style to validate
|
|
154
|
+
* @returns true if all required properties are present
|
|
155
|
+
*/
|
|
156
|
+
export function isCompleteTextStyle(style) {
|
|
157
|
+
const requiredProps = [
|
|
158
|
+
'fontFamily',
|
|
159
|
+
'fontSize',
|
|
160
|
+
'color',
|
|
161
|
+
'backgroundColor',
|
|
162
|
+
'lineHeight',
|
|
163
|
+
'fontWeight',
|
|
164
|
+
];
|
|
165
|
+
return requiredProps.every(prop => style[prop] !== undefined);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Converts text style to CSS style object
|
|
169
|
+
* @param textStyle Text style object
|
|
170
|
+
* @returns CSS style object
|
|
171
|
+
*/
|
|
172
|
+
export function textStyleToCSSStyle(textStyle) {
|
|
173
|
+
const cssStyle = {};
|
|
174
|
+
if (textStyle.fontFamily) {
|
|
175
|
+
cssStyle.fontFamily = textStyle.fontFamily;
|
|
176
|
+
}
|
|
177
|
+
if (textStyle.fontSize) {
|
|
178
|
+
cssStyle.fontSize = textStyle.fontSize;
|
|
179
|
+
}
|
|
180
|
+
if (textStyle.color) {
|
|
181
|
+
cssStyle.color = textStyle.color;
|
|
182
|
+
}
|
|
183
|
+
if (textStyle.backgroundColor) {
|
|
184
|
+
cssStyle.backgroundColor = textStyle.backgroundColor;
|
|
185
|
+
}
|
|
186
|
+
if (textStyle.lineHeight) {
|
|
187
|
+
cssStyle.lineHeight = textStyle.lineHeight;
|
|
188
|
+
}
|
|
189
|
+
if (textStyle.fontWeight) {
|
|
190
|
+
cssStyle.fontWeight = textStyle.fontWeight;
|
|
191
|
+
}
|
|
192
|
+
return cssStyle;
|
|
193
|
+
}
|
|
@@ -11,6 +11,8 @@ import Service from './Service';
|
|
|
11
11
|
import { MESSAGE_TYPE, TICKET_CUSTOM_MESSAGE_KEY } from './constant';
|
|
12
12
|
import { WrapperContent, WrapperContentInput, WrapperEditor, WrapperIconEditor, WrapperInputFile, WrapperLable, WrapperLeftContent, WrapperLinkItemFiles, WrapperMessageContent, WrapperRightContent, WrapperTextEdit, WrapperTextInput, DrawerHeader, } from './styled';
|
|
13
13
|
import { formatAccountId, formatDatarender, formatParams, handleValidateContent, postCustomEvent, } from './util';
|
|
14
|
+
import { TCallBack } from '../../molecules/QuillEditor/QuillEditor';
|
|
15
|
+
import { isBoolean } from 'lodash';
|
|
14
16
|
const initValueInput = {
|
|
15
17
|
originTitle: 'Create new ticket',
|
|
16
18
|
title: '',
|
|
@@ -50,23 +52,6 @@ const Content = ({ portalId, token, action, ticketId, listUsers, domainTicket, d
|
|
|
50
52
|
const isUpdate = action === 'edit' && ticketId;
|
|
51
53
|
const valueInputRef = useRef(valueInput);
|
|
52
54
|
valueInputRef.current = valueInput;
|
|
53
|
-
// const isRulesEdit = useMemo(() => {
|
|
54
|
-
// const { title, feature, ticketType, priority, category, ownerId, followers, message, files, referenceUrl } = valueInput
|
|
55
|
-
// if (
|
|
56
|
-
// !title?.length && referenceUrl === window.location.href
|
|
57
|
-
// && Object.keys(feature)?.length <= 2
|
|
58
|
-
// && Object.keys(ticketType)?.length <= 2 && (!Object.keys(priority)?.length || Object.values(priority)[0] === '-')
|
|
59
|
-
// && Object.keys(category)?.length <= 2 && ((!ownerId?.length && accountEdit === 4 && isAllAccount) || (ownerId[0]?.userId === Number(initOwnerId || userId)))
|
|
60
|
-
// && followers?.length === accountManage?.length
|
|
61
|
-
// && !message?.length && !files.length && !isUpdate
|
|
62
|
-
// ) {
|
|
63
|
-
// return false
|
|
64
|
-
// }else if(isUpdate && compareArrays(valueInput.followers, ticketDetails.followers)
|
|
65
|
-
// && !valueInput?.message?.length && !valueInput?.files?.length) {
|
|
66
|
-
// return false
|
|
67
|
-
// }
|
|
68
|
-
// return true
|
|
69
|
-
// }, [valueInput])
|
|
70
55
|
const updateValueInput = value => {
|
|
71
56
|
setValueInput(prev => ({
|
|
72
57
|
...prev,
|
|
@@ -248,7 +233,7 @@ const Content = ({ portalId, token, action, ticketId, listUsers, domainTicket, d
|
|
|
248
233
|
const handleEditorChange = content => {
|
|
249
234
|
setTextValue(content);
|
|
250
235
|
updateValueInput({ message: content });
|
|
251
|
-
setIsLoadingUpload(content.includes('<img src="data:image/png;base64'));
|
|
236
|
+
// setIsLoadingUpload(content.includes('<img src="data:image/png;base64'));
|
|
252
237
|
};
|
|
253
238
|
const handleUpdateFollowers = arrFolowers => {
|
|
254
239
|
const params = {
|
|
@@ -331,12 +316,17 @@ const Content = ({ portalId, token, action, ticketId, listUsers, domainTicket, d
|
|
|
331
316
|
};
|
|
332
317
|
}, [isOpenToast]);
|
|
333
318
|
const handleOnchangeFile = e => {
|
|
334
|
-
const
|
|
335
|
-
|
|
319
|
+
const file = e.target?.files[0];
|
|
320
|
+
if (!file)
|
|
321
|
+
return;
|
|
322
|
+
const sizeFile = file.size;
|
|
323
|
+
const fileType = file.type;
|
|
324
|
+
const isImage = fileType.startsWith('image/');
|
|
325
|
+
const limitSize = isImage ? 10 * 1024 * 1024 : 50 * 1024 * 1024;
|
|
336
326
|
if (sizeFile >= limitSize) {
|
|
337
327
|
setErrFile({
|
|
338
328
|
isError: true,
|
|
339
|
-
message:
|
|
329
|
+
message: `Maximum file size is reached (10MB for image & 50MB for other types).`,
|
|
340
330
|
});
|
|
341
331
|
}
|
|
342
332
|
else {
|
|
@@ -363,34 +353,58 @@ const Content = ({ portalId, token, action, ticketId, listUsers, domainTicket, d
|
|
|
363
353
|
});
|
|
364
354
|
setFileInputKey(prev => prev + 1);
|
|
365
355
|
};
|
|
356
|
+
const callbackEditor = (type, value) => {
|
|
357
|
+
switch (type) {
|
|
358
|
+
case TCallBack.LOADING_UPLOAD:
|
|
359
|
+
if (isBoolean(value)) {
|
|
360
|
+
setIsLoadingUpload(value);
|
|
361
|
+
}
|
|
362
|
+
break;
|
|
363
|
+
case TCallBack.ERROR: {
|
|
364
|
+
switch (value) {
|
|
365
|
+
case 'FILE_TOO_LARGE':
|
|
366
|
+
setErrFile({
|
|
367
|
+
isError: true,
|
|
368
|
+
message: '*Maximum upload file size: 10MB',
|
|
369
|
+
});
|
|
370
|
+
break;
|
|
371
|
+
case 'RESET':
|
|
372
|
+
setErrFile({
|
|
373
|
+
isError: false,
|
|
374
|
+
message: '',
|
|
375
|
+
});
|
|
376
|
+
break;
|
|
377
|
+
default:
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
default:
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
366
386
|
return (_jsxs("div", { style: { height: '100%' }, children: [_jsxs(Helmet, { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("title", { children: browserTitle })] }), _jsxs(Spin, { style: { height: '100vh' }, spinning: isLoading ||
|
|
367
387
|
isLoadingDetails ||
|
|
368
388
|
isLoadingDataSouce ||
|
|
369
389
|
isLoadingFollower ||
|
|
370
390
|
isLoadingSelectedAccount, children: [_jsxs(DrawerHeader, { children: [_jsx(EditableName, { value: valueInput.title, onChange: handleOnchangeTitle, readonly: isUpdate, error: isEmptyField && (!valueInput.title || !valueInput.title.trim())
|
|
371
391
|
? "Title can't be empty"
|
|
372
|
-
: '' }), _jsx("div", { id: "header-journey-right", className: "right-content", children: !isUpdate && (_jsx(Button, { type: "primary", onClick: handleSubmit, children: "Save" })) })] }), _jsxs(WrapperContent, { style: { height: '100%' }, children: [_jsxs(WrapperLeftContent, { children: [_jsxs(WrapperContentInput, { style: { alignItems: 'flex-start' }, children: [_jsxs(WrapperLable, { children: ["Owner", _jsx("span", { style: { color: '#ff0000' }, children: "*" })] }), _jsxs("div", { children: [_jsx(SelectAccount, { type: "default", initData: (valueInput?.ownerId || []).map((item) => item.userId), nameKey: "userName", userIdKey: "userId", users: listUsers, isViewMode: isUpdate || !isAllAccount || accountEdit !== 4, onChange: (_, users) => updateValueInput({ ownerId: users }), onlyOne: true }), isEmptyField && !valueInput?.ownerId?.length && (_jsx("div", { className: "error-message", children: "*This field can't be empty" }))] })] }), _jsxs(WrapperContentInput, { style: { marginTop: '15px', alignItems: 'flex-start' }, children: [_jsx(WrapperLable, { children: "Follower(s)" }), _jsx(SelectAccount, { type: "default", initData: [
|
|
392
|
+
: '' }), _jsx("div", { id: "header-journey-right", className: "right-content", children: !isUpdate && (_jsx(Button, { disabled: isLoadingUpload, type: "primary", onClick: handleSubmit, children: "Save" })) })] }), _jsxs(WrapperContent, { style: { height: '100%' }, children: [_jsxs(WrapperLeftContent, { children: [_jsxs(WrapperContentInput, { style: { alignItems: 'flex-start' }, children: [_jsxs(WrapperLable, { children: ["Owner", _jsx("span", { style: { color: '#ff0000' }, children: "*" })] }), _jsxs("div", { children: [_jsx(SelectAccount, { type: "default", initData: (valueInput?.ownerId || []).map((item) => item.userId), nameKey: "userName", userIdKey: "userId", users: listUsers, isViewMode: isUpdate || !isAllAccount || accountEdit !== 4, onChange: (_, users) => updateValueInput({ ownerId: users }), onlyOne: true }), isEmptyField && !valueInput?.ownerId?.length && (_jsx("div", { className: "error-message", children: "*This field can't be empty" }))] })] }), _jsxs(WrapperContentInput, { style: { marginTop: '15px', alignItems: 'flex-start' }, children: [_jsx(WrapperLable, { children: "Follower(s)" }), _jsx(SelectAccount, { type: "default", initData: [
|
|
373
393
|
...accountManage,
|
|
374
394
|
...(valueInput?.followers || []).map((item) => item.userId),
|
|
375
|
-
], nameKey: "userName", userIdKey: "userId", users: listUsers, disabledAccount: accountManage, onChange: (_, followers) => updateValueInput({ followers }) })] }), dataSelects?.map((data) => (
|
|
376
|
-
// eslint-disable-next-line react/jsx-key
|
|
377
|
-
_jsxs(WrapperContentInput, { style: { marginTop: '15px' }, children: [_jsx(WrapperLable, { children: data.title }), _jsx("div", { style: { flex: 1 }, children: isUpdate ? (_jsx(WrapperTextEdit, { children: !valueInput[data?.value]?.name?.length
|
|
395
|
+
], nameKey: "userName", userIdKey: "userId", users: listUsers, disabledAccount: accountManage, onChange: (_, followers) => updateValueInput({ followers }) })] }), dataSelects?.map((data) => (_jsxs(WrapperContentInput, { style: { marginTop: '15px' }, children: [_jsx(WrapperLable, { children: data.title }), _jsx("div", { style: { flex: 1 }, children: isUpdate ? (_jsx(WrapperTextEdit, { children: !valueInput[data?.value]?.name?.length
|
|
378
396
|
? '--'
|
|
379
|
-
: valueInput[data?.value]?.name })) : (_jsx(DropdownComponent, { data: data.field_options, setValueInput: updateValueInput, valueInput: valueInput, type: data.value, isUpdate: isUpdate, title: data.title })) })] }, data.id))), _jsxs(WrapperContentInput, { style: { marginTop: '15px' }, children: [_jsx(WrapperLable, { htmlFor: "referenceUrl", children: "Reference URL" }), isUpdate ? (valueInput.referenceUrl ? (_jsx(Tooltip, { title: valueInput.referenceUrl, placement: "top", children: _jsx(WrapperTextEdit, { color: "#005fb8", href: valueInput.referenceUrl, target: "_blank", children: valueInput.referenceUrl }) })) : (_jsx(WrapperTextEdit, { color: "#005fb8", href: valueInput.referenceUrl, target: "_blank", children: valueInput.referenceUrl }))) : (_jsx(WrapperTextInput, { placeholder: "Reference URL", id: "referenceUrl",
|
|
380
|
-
// width="300px"
|
|
381
|
-
onChange: handleOnchangeInput, name: "referenceUrl", value: valueInput.referenceUrl }))] })] }), _jsxs(WrapperRightContent, { children: [_jsxs(WrapperEditor, { children: [_jsxs("div", { children: [_jsx(QuillEditor, { value: textValue, uploadService: Service.tickets.callApi.uploadImg({
|
|
397
|
+
: valueInput[data?.value]?.name })) : (_jsx(DropdownComponent, { data: data.field_options, setValueInput: updateValueInput, valueInput: valueInput, type: data.value, isUpdate: isUpdate, title: data.title })) })] }, data.id))), _jsxs(WrapperContentInput, { style: { marginTop: '15px' }, children: [_jsx(WrapperLable, { htmlFor: "referenceUrl", children: "Reference URL" }), isUpdate ? (valueInput.referenceUrl ? (_jsx(Tooltip, { title: valueInput.referenceUrl, placement: "top", children: _jsx(WrapperTextEdit, { color: "#005fb8", href: valueInput.referenceUrl, target: "_blank", children: valueInput.referenceUrl }) })) : (_jsx(WrapperTextEdit, { color: "#005fb8", href: valueInput.referenceUrl, target: "_blank", children: valueInput.referenceUrl }))) : (_jsx(WrapperTextInput, { placeholder: "Reference URL", id: "referenceUrl", onChange: handleOnchangeInput, name: "referenceUrl", value: valueInput.referenceUrl }))] })] }), _jsxs(WrapperRightContent, { children: [_jsxs(WrapperEditor, { children: [_jsxs("div", { children: [_jsx(QuillEditor, { value: textValue, uploadService: Service.tickets.callApi.uploadImg({
|
|
382
398
|
domain: domainUpload,
|
|
383
399
|
token,
|
|
384
400
|
userId,
|
|
385
|
-
}), onChange: handleEditorChange, placeholder: "Enter your comment...", height: 195 }), _jsxs("div", { children: [valueInput.files?.length > 0 && (_jsx(WrapperLinkItemFiles, { children: valueInput.files?.map((file, index) => (_jsxs("div", { className: "file-item", children: [_jsxs("div", { className: "file-name-group", children: [_jsx(Icon, { className: "file-icon", type: "icon-ants-attachment" }), _jsx(Tooltip, { title: file?.file_name, children: _jsx("span", { className: "file-name", children: file?.file_name }) })] }), _jsx(Icon, { onClick: () => {
|
|
401
|
+
}), onChange: handleEditorChange, callback: callbackEditor, placeholder: "Enter your comment...", height: 195 }), _jsxs("div", { children: [valueInput.files?.length > 0 && (_jsx(WrapperLinkItemFiles, { children: valueInput.files?.map((file, index) => (_jsxs("div", { className: "file-item", children: [_jsxs("div", { className: "file-name-group", children: [_jsx(Icon, { className: "file-icon", type: "icon-ants-attachment" }), _jsx(Tooltip, { title: file?.file_name, children: _jsx("span", { className: "file-name", children: file?.file_name }) })] }), _jsx(Icon, { onClick: () => {
|
|
386
402
|
handleRemoveFileV2(index);
|
|
387
403
|
}, className: "remove-btn", type: "icon-ants-remove-slim" })] }, file?.file_name))) })), _jsxs(WrapperIconEditor, { borderTop: !!valueInput.files?.length, children: [_jsxs(WrapperInputFile, { children: [_jsx("label", { htmlFor: `fileImage-${fileInputKey}`, className: "upload-wrapper-label", children: _jsx(Icon, { type: "icon-ants-attachment", className: "upload-icon" }) }), _jsx("input", { type: "file", style: { position: 'absolute', top: 0, right: 0, display: 'none' }, name: `fileImage-${fileInputKey}`, id: `fileImage-${fileInputKey}`, onChange: handleOnchangeFile }, fileInputKey)] }), isUpdate && (_jsx(Button, { type: "primary", disabled: !handleValidateContent(textValue) || isLoadingUpload, className: "reply-btn", style: {
|
|
388
404
|
background: `${!handleValidateContent(textValue) || isLoadingUpload
|
|
389
405
|
? '#ccc'
|
|
390
406
|
: '#1f5fac'}`,
|
|
391
|
-
}, onClick: handleUpdateComment,
|
|
392
|
-
!valueInput?.message && (_jsx("div", { className: "error-message", children: "*This field can't be empty" })))] }), isUpdate && (_jsx(Spin, { spinning: isLoadingComment, children: _jsx(WrapperMessageContent, { children: listComment?.map(comment => (_jsx(MessageComponent, { toUser: comment?.toUser, fromUser: comment?.fromUser, followers: comment?.followers,
|
|
393
|
-
// mailFollower={comment?.mailFollower}
|
|
394
|
-
message: comment?.message, date: comment?.createdDate, attachments: comment?.attachments, timeZone: timeZone, submitterEmail: comment?.submitterEmail }, comment?.id))) }) }))] })] })] })] }));
|
|
407
|
+
}, onClick: handleUpdateComment, children: "Reply" }))] })] })] }), errFile.isError ? (_jsx("div", { className: "error-message", children: errFile.message })) : (isEmptyField &&
|
|
408
|
+
!valueInput?.message && (_jsx("div", { className: "error-message", children: "*This field can't be empty" })))] }), isUpdate && (_jsx(Spin, { spinning: isLoadingComment, children: _jsx(WrapperMessageContent, { children: listComment?.map(comment => (_jsx(MessageComponent, { toUser: comment?.toUser, fromUser: comment?.fromUser, followers: comment?.followers, message: comment?.message, date: comment?.createdDate, attachments: comment?.attachments, timeZone: timeZone, submitterEmail: comment?.submitterEmail }, comment?.id))) }) }))] })] })] })] }));
|
|
395
409
|
};
|
|
396
410
|
export default Content;
|
|
@@ -19,6 +19,7 @@ const MessageComponent = ({ toUser, fromUser, followers, attachments, message, d
|
|
|
19
19
|
if (refMesage.current) {
|
|
20
20
|
refMesage.current.querySelectorAll('img')?.forEach(img => {
|
|
21
21
|
img.style.cursor = 'pointer';
|
|
22
|
+
img.style.width = '100%';
|
|
22
23
|
img.addEventListener('click', () => {
|
|
23
24
|
setModalImg({
|
|
24
25
|
...modalImg,
|