@antscorp/antsomi-ui 2.0.90 → 2.0.91-text-editor-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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/index.js +24 -16
- 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 +24 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TEXT_EDITOR_CONSTANTS, UNORDERED_LIST_STYLE_TYPE } from '../../../constants';
|
|
3
|
+
import { isUnorderedListStyleType } from '../../../types';
|
|
4
|
+
import { CustomUnorderedList } from '../../../extensions/UnorderedList';
|
|
5
|
+
import { SplitButtonDropdown } from '../../SplitButtonDropdown';
|
|
6
|
+
import { useEditorState } from '@tiptap/react';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
9
|
+
const UnorderListIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M3.57895 11C2.73684 11 2 11.7 2 12.5C2 13.3 2.73684 14 3.57895 14C4.42105 14 5.15789 13.3 5.15789 12.5C5.15789 11.7 4.42105 11 3.57895 11ZM3.57895 6C2.73684 6 2 6.7 2 7.5C2 8.3 2.73684 9 3.57895 9C4.42105 9 5.15789 8.3 5.15789 7.5C5.15789 6.7 4.42105 6 3.57895 6ZM3.57895 16C2.73684 16 2 16.7 2 17.5C2 18.3 2.73684 19 3.57895 19C4.42105 19 5.15789 18.3 5.15789 17.5C5.15789 16.7 4.42105 16 3.57895 16ZM7.26316 6.5V8.5H22V6.5H7.26316ZM7.26316 18.5H22V16.5H7.26316V18.5ZM7.26316 13.5H22V11.5H7.26316V13.5Z", fill: "currentColor" }) }));
|
|
10
|
+
const CUSTOM_BULLET_OPTIONS = [
|
|
11
|
+
{
|
|
12
|
+
label: '+',
|
|
13
|
+
value: `${UNORDERED_LIST_STYLE_TYPE.custom}_+`,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: '→',
|
|
17
|
+
value: `${UNORDERED_LIST_STYLE_TYPE.custom}_→`,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: '➤',
|
|
21
|
+
value: `${UNORDERED_LIST_STYLE_TYPE.custom}_➤`,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: '★',
|
|
25
|
+
value: `${UNORDERED_LIST_STYLE_TYPE.custom}_★`,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: '☆',
|
|
29
|
+
value: `${UNORDERED_LIST_STYLE_TYPE.custom}_☆`,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
const OPTIONS = [
|
|
33
|
+
{
|
|
34
|
+
label: '•',
|
|
35
|
+
value: UNORDERED_LIST_STYLE_TYPE.disc,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: '○',
|
|
39
|
+
value: UNORDERED_LIST_STYLE_TYPE.circle,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: '■',
|
|
43
|
+
value: UNORDERED_LIST_STYLE_TYPE.square,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
export const BulletListAction = ({ editor, useCustomBullet = false }) => {
|
|
47
|
+
const { value, disabled, isSelected } = useEditorState({
|
|
48
|
+
editor,
|
|
49
|
+
selector: ({ editor: editorInstance }) => ({
|
|
50
|
+
disabled: !editorInstance.can().chain().focus().toggleCustomUnorderedList().run(),
|
|
51
|
+
value: editorInstance.getAttributes(CustomUnorderedList.name).listStyleType,
|
|
52
|
+
isSelected: editorInstance.isActive(CustomUnorderedList.name),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
const options = useMemo(() => (useCustomBullet ? [...OPTIONS, ...CUSTOM_BULLET_OPTIONS] : OPTIONS), [useCustomBullet]);
|
|
56
|
+
return (_jsx(SplitButtonDropdown, { disabled: disabled, value: value, options: options, onClickOption: v => {
|
|
57
|
+
const [listStyleType, customBulletChar] = v.split('_');
|
|
58
|
+
if (!isUnorderedListStyleType(listStyleType))
|
|
59
|
+
return;
|
|
60
|
+
if (isSelected) {
|
|
61
|
+
editor
|
|
62
|
+
.chain()
|
|
63
|
+
.focus()
|
|
64
|
+
.setUnorderedListStyle({
|
|
65
|
+
listStyleType,
|
|
66
|
+
customBulletChar,
|
|
67
|
+
})
|
|
68
|
+
.run();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
editor
|
|
72
|
+
.chain()
|
|
73
|
+
.focus()
|
|
74
|
+
.toggleCustomUnorderedList({
|
|
75
|
+
listStyleType,
|
|
76
|
+
customBulletChar,
|
|
77
|
+
})
|
|
78
|
+
.run();
|
|
79
|
+
}, onClick: () => {
|
|
80
|
+
editor.chain().focus().toggleCustomUnorderedList().run();
|
|
81
|
+
}, tooltipProps: {
|
|
82
|
+
title: `${TOOLTIPS.BULLET_LIST.TITLE} (${TOOLTIPS.BULLET_LIST.SHORTCUT})`,
|
|
83
|
+
}, children: _jsx(UnorderListIcon, { size: 18 }) }));
|
|
84
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { DEFAULT_TEXT_STYLE, TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const RemoveFormattingIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M3.41111 3L2 4.42875L9.74445 12.27L7 18.75H10.3333L12.0778 14.6325L18.3667 21L19.7778 19.5712L3.72222 3.30375L3.41111 3ZM6.44444 3V3.2025L9.57778 6.375H12.2444L11.4444 8.265L13.7778 10.6275L15.5667 6.375H22V3H6.44444Z", fill: "currentColor" }) }));
|
|
7
|
+
export const ClearFormattingAction = ({ editor }) => {
|
|
8
|
+
const { disabled } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
disabled: !editorInstance.can().chain().focus().run(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
const clearFormatting = () => {
|
|
15
|
+
editor
|
|
16
|
+
?.chain()
|
|
17
|
+
.updateAttributes('textStyle', DEFAULT_TEXT_STYLE)
|
|
18
|
+
.unsetAllMarks()
|
|
19
|
+
.clearNodes()
|
|
20
|
+
.unsetTextAlign()
|
|
21
|
+
.unsetTextTransform()
|
|
22
|
+
.run();
|
|
23
|
+
};
|
|
24
|
+
return (_jsx(TextEditorButton, { onClick: clearFormatting, disabled: disabled, icon: _jsx(RemoveFormattingIcon, { size: 18 }), tooltipProps: {
|
|
25
|
+
title: TOOLTIPS.CLEAR_FORMATTING.TITLE,
|
|
26
|
+
} }));
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { EmojiSmileIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
4
|
+
import { EMOJI_COLLECTIONS, EmojiPopover } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
5
|
+
import { TextEditorButton } from '../../Button';
|
|
6
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
7
|
+
import { useTextEditorStore } from '../../../provider';
|
|
8
|
+
import { useEditorState } from '@tiptap/react';
|
|
9
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
10
|
+
export const EmoijiAction = ({ editor }) => {
|
|
11
|
+
const bubbleMenuContainer = useTextEditorStore(state => state.bubbleMenuContainer);
|
|
12
|
+
const { disabled } = useEditorState({
|
|
13
|
+
editor: editor,
|
|
14
|
+
selector: ({ editor: editorInstance }) => ({
|
|
15
|
+
disabled: !editorInstance.can().chain().focus().run(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
const getPopupContainer = useCallback(() => bubbleMenuContainer || document.body, [bubbleMenuContainer]);
|
|
19
|
+
return (_jsx(EmojiPopover, { collections: [
|
|
20
|
+
{
|
|
21
|
+
key: EMOJI_COLLECTIONS.COMMON,
|
|
22
|
+
label: _jsx(EmojiSmileIcon, {}),
|
|
23
|
+
},
|
|
24
|
+
], onEmojiClick: emoji => {
|
|
25
|
+
if (typeof emoji !== 'string')
|
|
26
|
+
return;
|
|
27
|
+
editor?.chain().insertEmoji(emoji);
|
|
28
|
+
}, getPopupContainer: getPopupContainer, children: _jsx(TextEditorButton, { disabled: disabled, tooltipProps: {
|
|
29
|
+
title: TOOLTIPS.EMOJI.TITLE,
|
|
30
|
+
}, icon: _jsx(EmojiSmileIcon, { size: 18 }) }) }));
|
|
31
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { FontConfig } from '../../../types';
|
|
3
|
+
export interface FontFamilyActionProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
fonts?: FontConfig[];
|
|
6
|
+
}
|
|
7
|
+
export declare const FontFamilyAction: (props: FontFamilyActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { toString } from 'lodash';
|
|
3
|
+
import { DEFAULT_FONT_CONFIGS } from '../../../constants';
|
|
4
|
+
import { FontPopover } from '../../FontPopover/FontPopover';
|
|
5
|
+
import { useEditorState } from '@tiptap/react';
|
|
6
|
+
export const FontFamilyAction = (props) => {
|
|
7
|
+
const { editor, fonts = DEFAULT_FONT_CONFIGS } = props;
|
|
8
|
+
const { fontValue, fontWeight } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => {
|
|
11
|
+
const { fontWeight, fontFamily } = editorInstance.getAttributes('textStyle') || {};
|
|
12
|
+
let fontValue = toString(fontFamily);
|
|
13
|
+
if (fontValue.split(',').length > 0) {
|
|
14
|
+
[fontValue] = fontValue.split(',');
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
fontValue,
|
|
18
|
+
fontWeight: Number(fontWeight),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return (_jsx(FontPopover, { fonts: fonts, value: {
|
|
23
|
+
font: fonts.find(font => font.fontFamily.name === fontValue) || fonts[0],
|
|
24
|
+
weight: fontWeight,
|
|
25
|
+
}, onChange: (font, weight) => {
|
|
26
|
+
editor.chain().focus().setFontFamily(font.fontFamily.name).setFontWeight(weight).run();
|
|
27
|
+
} }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
3
|
+
export interface FontSizeActionProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
throttled?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const FontSizeAction: import("react").MemoExoticComponent<({ editor, throttled }: FontSizeActionProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTextEditorStore } from '../../../provider';
|
|
3
|
+
import { FontSizeInput, } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { useThrottledCallback } from 'use-debounce';
|
|
7
|
+
import { DEFAULT_TEXT_STYLE } from '../../../constants';
|
|
8
|
+
import { useEditorState } from '@tiptap/react';
|
|
9
|
+
const StyledFontSizeInput = styled(FontSizeInput) `
|
|
10
|
+
&.antsomi-input-number {
|
|
11
|
+
width: 36px;
|
|
12
|
+
|
|
13
|
+
input.antsomi-input-number-input {
|
|
14
|
+
text-align: center;
|
|
15
|
+
height: 30px;
|
|
16
|
+
padding-inline: 0;
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
export const FontSizeAction = memo(({ editor, throttled = 100 }) => {
|
|
22
|
+
const inputRef = useRef(null);
|
|
23
|
+
const bubbleMenuContainer = useTextEditorStore(state => state.bubbleMenuContainer);
|
|
24
|
+
const { numberFontSize } = useEditorState({
|
|
25
|
+
editor,
|
|
26
|
+
selector: ({ editor: editorInstance }) => {
|
|
27
|
+
const fontSize = editorInstance.getAttributes('textStyle').fontSize || DEFAULT_TEXT_STYLE.fontSize;
|
|
28
|
+
return {
|
|
29
|
+
numberFontSize: fontSize.replace('px', ''),
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const [currentFontSize, setCurrentFontSize] = useState(numberFontSize);
|
|
34
|
+
const updateEditorFontSize = useThrottledCallback((v) => {
|
|
35
|
+
if (v === numberFontSize)
|
|
36
|
+
return;
|
|
37
|
+
editor.chain().focus().setFontSize(`${v}px`).run();
|
|
38
|
+
}, throttled);
|
|
39
|
+
const handleFontSizeChange = useCallback((value) => {
|
|
40
|
+
setCurrentFontSize(+value);
|
|
41
|
+
updateEditorFontSize(+value);
|
|
42
|
+
}, [updateEditorFontSize]);
|
|
43
|
+
const dropdownProps = useMemo(() => ({
|
|
44
|
+
getPopupContainer: () => bubbleMenuContainer,
|
|
45
|
+
}), [bubbleMenuContainer]);
|
|
46
|
+
return (_jsx(StyledFontSizeInput, { ref: inputRef, placeholder: "Font Size", value: currentFontSize, onChange: handleFontSizeChange, dropdownProps: dropdownProps }));
|
|
47
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const UndoIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M10.1768 9.02857C8.29834 9.37143 6.64088 10.0571 5.09392 11.3143L2 8V16H9.73481L6.75138 12.9143C10.8398 9.94286 16.4751 10.8571 19.4586 15.0857C19.6796 15.4286 19.9006 15.6571 20.011 16L22 14.9714C19.5691 10.6286 14.9282 8.22857 10.1768 9.02857Z", fill: "currentColor" }) }));
|
|
7
|
+
const RedoIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M13.8232 9.02857C15.7017 9.37143 17.3591 10.0571 18.9061 11.3143L22 8V16H14.2652L17.2486 12.9143C13.1602 9.94286 7.52486 10.8571 4.54144 15.0857C4.32044 15.4286 4.09945 15.6571 3.98895 16L2 14.9714C4.43094 10.6286 9.07182 8.22857 13.8232 9.02857Z", fill: "currentColor" }) }));
|
|
8
|
+
export const HistoryAction = ({ editor }) => {
|
|
9
|
+
const { disabledUndo, disabledRedo } = useEditorState({
|
|
10
|
+
editor,
|
|
11
|
+
selector: ({ editor: editorInstance }) => ({
|
|
12
|
+
disabledUndo: !editorInstance.can().chain().focus().undo().run(),
|
|
13
|
+
disabledRedo: !editorInstance.can().chain().focus().redo().run(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(TextEditorButton, { disabled: disabledUndo, onClick: () => editor.chain().focus().undo().run(), icon: _jsx(UndoIcon, { size: 18 }), tooltipProps: {
|
|
17
|
+
title: `${TOOLTIPS.UNDO.TITLE} (${TOOLTIPS.UNDO.SHORTCUT})`,
|
|
18
|
+
} }), _jsx(TextEditorButton, { disabled: disabledRedo, onClick: () => editor.chain().focus().redo().run(), icon: _jsx(RedoIcon, { size: 18 }), tooltipProps: {
|
|
19
|
+
title: `${TOOLTIPS.REDO.TITLE} (${TOOLTIPS.REDO.SHORTCUT})`,
|
|
20
|
+
} })] }));
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const IndentIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M2 22H22V19.7778H2V22ZM2 7.55556V16.4444L6.44444 12L2 7.55556ZM10.8889 17.5556H22V15.3333H10.8889V17.5556ZM2 2V4.22222H22V2H2ZM10.8889 8.66667H22V6.44444H10.8889V8.66667ZM10.8889 13.1111H22V10.8889H10.8889V13.1111Z", fill: "currentColor" }) }));
|
|
7
|
+
export const IndentAction = ({ editor }) => {
|
|
8
|
+
const { disabled } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
disabled: !editorInstance.can().chain().focus().indent().run(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
return (_jsx(TextEditorButton, { disabled: disabled, icon: _jsx(IndentIcon, { size: 18 }), onClick: () => editor.chain().focus().indent().run(), tooltipProps: {
|
|
15
|
+
title: `${TOOLTIPS.INDENT.TITLE} (${TOOLTIPS.INDENT.SHORTCUT})`,
|
|
16
|
+
} }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
3
|
+
import { TextEditorButton } from '../../Button';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const ItalicIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M3 22V18.4286H8.84615L13.2308 5.57143H7.38462V2H22V5.57143H16.8846L12.5 18.4286H17.6154V22H3Z", fill: "currentColor" }) }));
|
|
7
|
+
export const ItalicAction = ({ editor }) => {
|
|
8
|
+
const { isItalic, disabled } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
isItalic: editorInstance.isActive('italic'),
|
|
12
|
+
disabled: !editorInstance.can().chain().focus().toggleItalic().run(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
return (_jsx(TextEditorButton, { onClick: () => editor.chain().focus().toggleItalic().run(), disabled: disabled, isActive: isItalic, icon: _jsx(ItalicIcon, { size: 18 }), tooltipProps: {
|
|
16
|
+
title: `${TOOLTIPS.ITALIC.TITLE} (${TOOLTIPS.ITALIC.SHORTCUT})`,
|
|
17
|
+
} }));
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SplitButtonDropdown } from '../../SplitButtonDropdown';
|
|
3
|
+
import { range } from 'lodash';
|
|
4
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
5
|
+
import { useEditorState } from '@tiptap/react';
|
|
6
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
7
|
+
const LetterSpacingIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M14.4 10.1053H18.5L16.5 4.42105L14.4 10.1053ZM15.6 2H17.3L22 14.6316H20.1L19.1 11.8947H13.7L12.7 14.6316H10.8L15.6 2ZM11.2 2H13.1L8.4 14.6316H6.7L2 2H3.9L7.5 12.2105M19 22V19.8947H5V22L2 18.8421L5 15.6842V17.7895H19V15.6842L22 18.8421L19 22Z", fill: "currentColor" }) }));
|
|
8
|
+
const LETTER_SPACING_VALUES = range(-10, 11);
|
|
9
|
+
export const LetterSpacingAction = ({ editor }) => {
|
|
10
|
+
const { letterSpacing } = useEditorState({
|
|
11
|
+
editor,
|
|
12
|
+
selector: ({ editor: editorInstance }) => ({
|
|
13
|
+
letterSpacing: editorInstance.getAttributes('textStyle').letterSpacing,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
return (_jsx(SplitButtonDropdown, { tooltipProps: {
|
|
17
|
+
title: TOOLTIPS.LETTER_SPACING.TITLE,
|
|
18
|
+
}, value: letterSpacing, options: LETTER_SPACING_VALUES.map(value => ({
|
|
19
|
+
value: `${value}px`,
|
|
20
|
+
label: `${value} px`,
|
|
21
|
+
})), onClickOption: v => {
|
|
22
|
+
editor.chain().focus().setLetterSpacing(v).run();
|
|
23
|
+
}, onClick: (_, isSelected) => {
|
|
24
|
+
if (isSelected) {
|
|
25
|
+
editor.chain().focus().unsetLetterSpacing().run();
|
|
26
|
+
}
|
|
27
|
+
}, children: _jsx(LetterSpacingIcon, { size: 18 }) }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
3
|
+
import { TextEditorButton } from '../../Button';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const LinkIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", height: size, width: size, viewBox: "0 -960 960 960", fill: "currentColor", children: _jsx("path", { d: "M680-160v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm560-40h-80q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480Z" }) }));
|
|
7
|
+
export const LinkAction = ({ editor, onClick }) => {
|
|
8
|
+
const { isActive } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
isActive: editorInstance.isActive('link'),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
return (_jsx(TextEditorButton, { isActive: isActive, icon: _jsx(LinkIcon, { size: 18 }), onClick: () => onClick?.(), tooltipProps: {
|
|
15
|
+
title: TOOLTIPS.LINK.TITLE,
|
|
16
|
+
} }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ORDERED_LIST_STYLE_TYPE, TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
3
|
+
import { SplitButtonDropdown } from '../../SplitButtonDropdown';
|
|
4
|
+
import { CustomOrderedList } from '../../../extensions/OrderedList';
|
|
5
|
+
import { isOrderedListStyleType } from '../../../types';
|
|
6
|
+
import { useEditorState } from '@tiptap/react';
|
|
7
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
8
|
+
const ListOrderedIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M2 16.7857H4.10526V17.3214H3.05263V18.3929H4.10526V18.9286H2V20H5.15789V15.7143H2V16.7857ZM3.05263 9.28571H4.10526V5H2V6.07143H3.05263V9.28571ZM2 11.4286H3.89474L2 13.6786V14.6429H5.15789V13.5714H3.26316L5.15789 11.3214V10.3571H2V11.4286ZM7.26316 6.07143V8.21429H22V6.07143H7.26316ZM7.26316 18.9286H22V16.7857H7.26316V18.9286ZM7.26316 13.5714H22V11.4286H7.26316V13.5714Z", fill: "currentColor" }) }));
|
|
9
|
+
const OPTIONS = [
|
|
10
|
+
{
|
|
11
|
+
label: '1, 2, 3, ...',
|
|
12
|
+
value: ORDERED_LIST_STYLE_TYPE.decimal,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'a, b, c, ...',
|
|
16
|
+
value: ORDERED_LIST_STYLE_TYPE.lowerAlpha,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'A, B, C, ...',
|
|
20
|
+
value: ORDERED_LIST_STYLE_TYPE.upperAlpha,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'i, ii, iii, ...',
|
|
24
|
+
value: ORDERED_LIST_STYLE_TYPE.lowerRoman,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'I, II, III, ...',
|
|
28
|
+
value: ORDERED_LIST_STYLE_TYPE.upperRoman,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'α, β, γ, ...',
|
|
32
|
+
value: ORDERED_LIST_STYLE_TYPE.lowerGreek,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: '01, 02, 03, ...',
|
|
36
|
+
value: ORDERED_LIST_STYLE_TYPE.decimalLeadingZero,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
export const OrderedListAction = ({ editor }) => {
|
|
40
|
+
const { value, disabled, isSelected } = useEditorState({
|
|
41
|
+
editor,
|
|
42
|
+
selector: ({ editor: editorInstance }) => ({
|
|
43
|
+
disabled: !editorInstance.can().chain().focus().toggleCustomOrderedList().run(),
|
|
44
|
+
value: editorInstance.getAttributes(CustomOrderedList.name).listStyleType,
|
|
45
|
+
isSelected: editorInstance.isActive(CustomOrderedList.name),
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
return (_jsx(SplitButtonDropdown, { disabled: disabled, value: value, options: OPTIONS, onClickOption: v => {
|
|
49
|
+
if (!isOrderedListStyleType(v))
|
|
50
|
+
return;
|
|
51
|
+
if (isSelected) {
|
|
52
|
+
editor.chain().focus().setOrderedListStyleType(v).run();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
editor
|
|
56
|
+
.chain()
|
|
57
|
+
.focus()
|
|
58
|
+
.toggleCustomOrderedList({
|
|
59
|
+
listStyleType: v,
|
|
60
|
+
})
|
|
61
|
+
.run();
|
|
62
|
+
}, onClick: () => {
|
|
63
|
+
editor.chain().focus().toggleCustomOrderedList().run();
|
|
64
|
+
}, tooltipProps: {
|
|
65
|
+
title: `${TOOLTIPS.ORDERED_LIST.TITLE} (${TOOLTIPS.ORDERED_LIST.SHORTCUT})`,
|
|
66
|
+
}, children: _jsx(ListOrderedIcon, { size: 18 }) }));
|
|
67
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const OutdentIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M10.8889 17.5556H22V15.3333H10.8889V17.5556ZM2 12L6.44444 16.4444V7.55556L2 12ZM2 22H22V19.7778H2V22ZM2 2V4.22222H22V2H2ZM10.8889 8.66667H22V6.44444H10.8889V8.66667ZM10.8889 13.1111H22V10.8889H10.8889V13.1111Z", fill: "currentColor" }) }));
|
|
7
|
+
export const OutdentAction = ({ editor }) => {
|
|
8
|
+
const { disabled } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
disabled: !editorInstance.can().chain().focus().outdent().run(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
return (_jsx(TextEditorButton, { disabled: disabled, icon: _jsx(OutdentIcon, { size: 18 }), onClick: () => editor.chain().focus().outdent().run(), tooltipProps: {
|
|
15
|
+
title: `${TOOLTIPS.OUTDENT.TITLE} (${TOOLTIPS.OUTDENT.SHORTCUT})`,
|
|
16
|
+
} }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
3
|
+
export interface SmartTagActionProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const SmartTagAction: (props: SmartTagActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const BracesIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M8.33488 22C7.24726 21.7935 6.27276 21.1962 5.59506 20.3208C4.91737 19.4454 4.58329 18.3524 4.65581 17.2477V15.2244C4.65581 13.8484 4.10388 13.1605 3 13.1605V10.8349C4.10388 10.8349 4.65581 10.1434 4.65581 8.76047V6.61395C4.62732 5.54392 4.96584 4.49636 5.61512 3.64535C6.33032 2.82782 7.28199 2.25284 8.33837 2L8.98256 3.79884C8.12442 4.12597 7.67829 5.04225 7.64419 6.54767V8.76512C7.69096 9.43175 7.53511 10.0969 7.19707 10.6734C6.85903 11.2499 6.35461 11.7107 5.75 11.9953C6.35481 12.282 6.85892 12.7447 7.19629 13.3228C7.53366 13.9008 7.68856 14.5673 7.6407 15.2349V17.4442C7.67481 18.9496 8.12093 19.8659 8.97907 20.193L8.33488 22ZM15.0186 20.1907C15.8767 19.8636 16.3229 18.9473 16.357 17.4419V15.2244C16.309 14.5567 16.4653 13.8903 16.8051 13.3135C17.1448 12.7367 17.652 12.277 18.2593 11.9953C17.6523 11.7135 17.1453 11.2537 16.8057 10.677C16.4662 10.1002 16.3101 9.43383 16.3581 8.76628V6.54884C16.324 5.04341 15.8779 4.12713 15.0198 3.8L15.664 2.00116C16.7345 2.24964 17.6974 2.83439 18.4116 3.66977C19.0587 4.54795 19.3868 5.62058 19.3419 6.71047V8.76512C19.3419 10.1481 19.8938 10.8395 20.9977 10.8395V13.1651C19.8938 13.1651 19.3419 13.85 19.3419 15.2198V17.3907C19.382 18.4722 19.0328 19.5322 18.3577 20.3781C17.6825 21.2239 16.7263 21.7994 15.6628 22L15.0186 20.1907Z", fill: "currentColor" }) }));
|
|
7
|
+
export const SmartTagAction = (props) => {
|
|
8
|
+
const { editor, onClick } = props;
|
|
9
|
+
const { isActive } = useEditorState({
|
|
10
|
+
editor,
|
|
11
|
+
selector: ({ editor: editorInstance }) => ({
|
|
12
|
+
isActive: editorInstance.isActive('smartTag'),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
return (_jsx(TextEditorButton, { onClick: onClick, isActive: isActive, icon: _jsx(BracesIcon, { size: 18 }), tooltipProps: {
|
|
16
|
+
title: TOOLTIPS.SMART_TAG.TITLE,
|
|
17
|
+
} }));
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
interface SpacingActionProps {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SpacingIcon: (props: React.SVGProps<SVGSVGElement> & {
|
|
7
|
+
size?: number;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const SpacingAction: (props: SpacingActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_TEXT_STYLE, TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
3
|
+
import { DropdownButton } from '../../DropdownButton';
|
|
4
|
+
import { LineHeight } from '../../../extensions/LineHeight';
|
|
5
|
+
import { range, round } from 'lodash';
|
|
6
|
+
import { Tooltip } from 'antd';
|
|
7
|
+
import { useEditorState } from '@tiptap/react';
|
|
8
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
9
|
+
export const SpacingIcon = (props) => {
|
|
10
|
+
const { size = 24, ...restProps } = props;
|
|
11
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...restProps, children: _jsx("path", { d: "M21 10H13M21 6H13M21 14H13M21 18H13M6 20L6 4M6 20L3 17M6 20L9 17M6 4L3 7M6 4L9 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
12
|
+
};
|
|
13
|
+
const OPTIONS = [
|
|
14
|
+
{ value: '1', label: 'Single' },
|
|
15
|
+
{ value: '2', label: 'Double' },
|
|
16
|
+
...range(1.1, 3.1, 0.1).map(spacing => {
|
|
17
|
+
const roundValue = round(spacing, 1);
|
|
18
|
+
return {
|
|
19
|
+
value: `${roundValue}`,
|
|
20
|
+
label: `${roundValue}`,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
24
|
+
export const SpacingAction = (props) => {
|
|
25
|
+
const { editor, defaultValue = DEFAULT_TEXT_STYLE.lineHeight } = props;
|
|
26
|
+
const { selectedLineHeight } = useEditorState({
|
|
27
|
+
editor,
|
|
28
|
+
selector: ({ editor: editorInstance }) => ({
|
|
29
|
+
selectedLineHeight: OPTIONS.map(i => i.value).find(lineHeight => editorInstance?.isActive({
|
|
30
|
+
[LineHeight.name]: lineHeight,
|
|
31
|
+
})),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
return (_jsx(DropdownButton, { value: selectedLineHeight, options: [
|
|
35
|
+
{
|
|
36
|
+
label: (_jsx(Tooltip, { mouseEnterDelay: 0.4, title: defaultValue, arrow: false, children: "Default" })),
|
|
37
|
+
value: defaultValue,
|
|
38
|
+
},
|
|
39
|
+
...OPTIONS,
|
|
40
|
+
], onClickOption: value => {
|
|
41
|
+
editor.chain().focus().setLineHeight(value).run();
|
|
42
|
+
}, tooltipProps: {
|
|
43
|
+
title: TOOLTIPS.LINE_SPACING.TITLE,
|
|
44
|
+
}, children: _jsx(SpacingIcon, { size: 18 }) }));
|
|
45
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextEditorButton } from '../../Button';
|
|
3
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
4
|
+
import { useEditorState } from '@tiptap/react';
|
|
5
|
+
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
+
const StrikethroughIcon = ({ size }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M9.77778 21H14.2222V17.6H9.77778V21ZM4.22222 4V7.4H9.77778V10.8H14.2222V7.4H19.7778V4H4.22222ZM2 15.3333H22V13.0667H2V15.3333Z", fill: "currentColor" }) }));
|
|
7
|
+
export const StrikeAction = ({ editor }) => {
|
|
8
|
+
const { isStrike, disabled } = useEditorState({
|
|
9
|
+
editor,
|
|
10
|
+
selector: ({ editor: editorInstance }) => ({
|
|
11
|
+
isStrike: editorInstance.isActive('strike'),
|
|
12
|
+
disabled: !editorInstance.can().chain().focus().toggleStrike().run(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
return (_jsx(TextEditorButton, { icon: _jsx(StrikethroughIcon, { size: 18 }), disabled: disabled, isActive: isStrike, onClick: () => editor.chain().focus().toggleStrike().run(), tooltipProps: {
|
|
16
|
+
title: `${TOOLTIPS.STRIKE.TITLE} (${TOOLTIPS.STRIKE.SHORTCUT})`,
|
|
17
|
+
} }));
|
|
18
|
+
};
|