@antscorp/antsomi-ui 2.0.110 → 2.0.111
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 +2 -0
- package/es/components/atoms/Eyedropper/Eyedropper.d.ts +2 -0
- package/es/components/atoms/Eyedropper/Eyedropper.js +53 -0
- package/es/components/atoms/Eyedropper/index.d.ts +0 -0
- package/es/components/atoms/Eyedropper/index.js +1 -0
- package/es/components/atoms/Eyedropper/styled.d.ts +9 -0
- package/es/components/atoms/Eyedropper/styled.js +45 -0
- package/es/components/atoms/Eyedropper/types.d.ts +5 -0
- package/es/components/atoms/Eyedropper/types.js +1 -0
- 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/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/ColorizeIcon.d.ts +3 -0
- package/es/components/icons/ColorizeIcon.js +7 -0
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +9 -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/index.d.ts +9 -0
- package/es/components/icons/index.js +9 -0
- package/es/components/index.scss +1 -0
- 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 +2 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +11 -0
- package/es/components/molecules/EyedropperButton/EyedropperButton.js +34 -0
- package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
- package/es/components/molecules/EyedropperButton/index.js +1 -0
- package/es/components/molecules/EyedropperButton/styled.d.ts +7 -0
- package/es/components/molecules/EyedropperButton/styled.js +23 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +134 -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 +21 -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 +39 -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/SearchPopover/SearchPopover.d.ts +2 -1
- package/es/components/molecules/SearchPopover/SearchPopover.js +3 -3
- package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
- package/es/components/molecules/SearchPopover/styled.js +1 -2
- package/es/components/molecules/SearchPopover/types.d.ts +4 -3
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +6 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +49 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
- package/es/components/molecules/VirtualizedMenu/styled.js +24 -3
- package/es/components/molecules/VirtualizedMenu/types.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/utils.js +2 -0
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/molecules/index.scss +1 -0
- package/es/components/organism/TextEditor/TextEditor.d.ts +10 -0
- package/es/components/organism/TextEditor/TextEditor.js +388 -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 +47 -0
- package/es/components/organism/TextEditor/constants.d.ts +196 -0
- package/es/components/organism/TextEditor/constants.js +398 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +43 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +18 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +81 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +35 -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/ClearFormatting.d.ts +16 -0
- package/es/components/organism/TextEditor/extensions/ClearFormatting.js +30 -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 +31 -0
- package/es/components/organism/TextEditor/extensions/FontSize.js +46 -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/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 +101 -0
- package/es/components/organism/TextEditor/extensions/Link.d.ts +22 -0
- package/es/components/organism/TextEditor/extensions/Link.js +178 -0
- package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
- package/es/components/organism/TextEditor/extensions/ListItem.js +93 -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 +28 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +103 -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 +30 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.js +36 -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 +6 -0
- package/es/components/organism/TextEditor/hooks/index.js +6 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.js +29 -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/useMarkTracking.d.ts +26 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +69 -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 +18 -0
- package/es/components/organism/TextEditor/index.js +8 -0
- package/es/components/organism/TextEditor/index.scss +65 -0
- package/es/components/organism/TextEditor/provider.d.ts +15 -0
- package/es/components/organism/TextEditor/provider.js +36 -0
- package/es/components/organism/TextEditor/store.d.ts +20 -0
- package/es/components/organism/TextEditor/store.js +40 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
- package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
- package/es/components/organism/TextEditor/stories/shared.js +57 -0
- package/es/components/organism/TextEditor/styled.d.ts +9 -0
- package/es/components/organism/TextEditor/styled.js +61 -0
- package/es/components/organism/TextEditor/types.d.ts +311 -0
- package/es/components/organism/TextEditor/types.js +6 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +3 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +114 -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/Button/Button.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/Button/Button.js +35 -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/FontItem.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontItem.js +27 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +102 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +36 -0
- package/es/components/organism/TextEditor/ui/FontPopover/types.d.ts +35 -0
- package/es/components/organism/TextEditor/ui/FontPopover/types.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -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 +58 -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 +75 -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/FormattingToolbar.d.ts +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +85 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +93 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +32 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +41 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +8 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +51 -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/LineSpacingAction.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.js +45 -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/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 +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +24 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +24 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -0
- package/es/components/organism/TextEditor/utils/documentState.d.ts +73 -0
- package/es/components/organism/TextEditor/utils/documentState.js +149 -0
- package/es/components/organism/TextEditor/utils/font.d.ts +74 -0
- package/es/components/organism/TextEditor/utils/font.js +147 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +87 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +460 -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 +116 -0
- package/es/components/organism/TextEditor/utils/link.js +304 -0
- package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
- package/es/components/organism/TextEditor/utils/menu.js +321 -0
- package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
- package/es/components/organism/TextEditor/utils/selection.js +58 -0
- package/es/components/organism/TextEditor/utils/shared.d.ts +13 -0
- package/es/components/organism/TextEditor/utils/shared.js +52 -0
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
- package/es/components/organism/TextEditor/utils/smartTag.js +90 -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/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.js +1 -0
- package/es/constants/web.d.ts +8 -0
- package/es/constants/web.js +57 -0
- package/es/hooks/index.d.ts +4 -0
- package/es/hooks/index.js +4 -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/useEyedropper/attach.d.ts +4 -0
- package/es/hooks/useEyedropper/attach.js +9 -0
- package/es/hooks/useEyedropper/eyedropper.d.ts +69 -0
- package/es/hooks/useEyedropper/eyedropper.js +205 -0
- package/es/hooks/useEyedropper/index.d.ts +2 -0
- package/es/hooks/useEyedropper/index.js +7 -0
- package/es/hooks/useEyedropper/support.d.ts +1 -0
- package/es/hooks/useEyedropper/support.js +3 -0
- package/es/hooks/useEyedropper/types.d.ts +9 -0
- package/es/hooks/useEyedropper/types.js +1 -0
- package/es/hooks/useEyedropper/useEyedropper.d.ts +8 -0
- package/es/hooks/useEyedropper/useEyedropper.js +50 -0
- package/es/hooks/useEyedropper/utils.d.ts +11 -0
- package/es/hooks/useEyedropper/utils.js +17 -0
- package/es/hooks/useIsMounted.d.ts +1 -0
- package/es/hooks/useIsMounted.js +11 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locales/i18n.d.ts +1 -1
- package/es/types/index.d.ts +9 -0
- package/es/utils/common.d.ts +15 -9
- package/es/utils/common.js +62 -24
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/web.d.ts +80 -0
- package/es/utils/web.js +226 -0
- package/package.json +26 -17
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Checkbox, Flex, Input } from 'antd';
|
|
3
|
+
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
4
|
+
export const LinkInsertForm = props => {
|
|
5
|
+
const { editor, mode, initialData, onSubmit, onCancel } = props;
|
|
6
|
+
const [url, setUrl] = useState(initialData.url);
|
|
7
|
+
const [text, setText] = useState(initialData.text);
|
|
8
|
+
const [openInNewTab, setOpenInNewTab] = useState(initialData.openInNewTab);
|
|
9
|
+
const urlInputRef = useRef(null);
|
|
10
|
+
// Auto-focus the URL input without scrolling
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
urlInputRef.current?.focus({
|
|
13
|
+
preventScroll: true,
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
const handleSubmit = useCallback(() => {
|
|
17
|
+
if (!url.trim()) {
|
|
18
|
+
// Don't submit if URL is empty
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// If text is different from initial, update the content
|
|
22
|
+
if (text !== initialData.text && text.trim()) {
|
|
23
|
+
editor
|
|
24
|
+
.chain()
|
|
25
|
+
.focus()
|
|
26
|
+
.setCustomLink({
|
|
27
|
+
attrs: {
|
|
28
|
+
href: url,
|
|
29
|
+
target: openInNewTab ? '_blank' : null,
|
|
30
|
+
},
|
|
31
|
+
content: text,
|
|
32
|
+
})
|
|
33
|
+
.run();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Just update the link attributes
|
|
37
|
+
editor
|
|
38
|
+
.chain()
|
|
39
|
+
.focus()
|
|
40
|
+
.setCustomLink({
|
|
41
|
+
attrs: {
|
|
42
|
+
href: url,
|
|
43
|
+
target: openInNewTab ? '_blank' : null,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
.run();
|
|
47
|
+
}
|
|
48
|
+
onSubmit();
|
|
49
|
+
}, [editor, url, text, initialData.text, openInNewTab, onSubmit]);
|
|
50
|
+
const handleKeyDown = useCallback((e) => {
|
|
51
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
handleSubmit();
|
|
54
|
+
}
|
|
55
|
+
else if (e.key === 'Escape') {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
onCancel();
|
|
58
|
+
}
|
|
59
|
+
}, [handleSubmit, onCancel]);
|
|
60
|
+
return (_jsxs(Flex, { vertical: true, gap: 8, children: [_jsxs(Flex, { gap: 8, vertical: true, children: [_jsx(Input, { ref: urlInputRef, placeholder: "URL", value: url, onChange: e => setUrl(e.target.value), onKeyDown: handleKeyDown }), _jsx(Input, { placeholder: "Text", value: text, onChange: e => setText(e.target.value), onKeyDown: handleKeyDown })] }), _jsx(Checkbox, { checked: openInNewTab, onChange: e => setOpenInNewTab(e.target.checked), children: "Open in new tab" }), _jsxs(Flex, { justify: "flex-end", gap: 8, children: [_jsx(Button, { onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "primary", onClick: handleSubmit, disabled: !url.trim(), children: mode === 'insert' ? 'Insert' : 'Update' })] })] }));
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LinkInsertForm } from './LinkInsertForm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type LinkPopoverProps = {
|
|
4
|
+
/** TipTap editor instance */
|
|
5
|
+
editor: Editor;
|
|
6
|
+
/** Optional container to append the popover to. Defaults to document.body */
|
|
7
|
+
container?: HTMLElement | (() => HTMLElement);
|
|
8
|
+
};
|
|
9
|
+
export declare const LinkPopover: React.FC<LinkPopoverProps>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { posToDOMRect } from '@tiptap/react';
|
|
3
|
+
import { useEffect, useRef, useCallback, useLayoutEffect } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { computePosition, flip, shift, offset } from '@floating-ui/dom';
|
|
6
|
+
import { useTextEditorStore } from '../../provider';
|
|
7
|
+
import { LinkInsertForm } from '../LinkInsertForm';
|
|
8
|
+
import { COMPONENT_CLS } from '../../constants';
|
|
9
|
+
const updatePosition = (editor, element) => {
|
|
10
|
+
const virtualElement = {
|
|
11
|
+
getBoundingClientRect: () => posToDOMRect(editor.view, editor.state.selection.from, editor.state.selection.to),
|
|
12
|
+
};
|
|
13
|
+
computePosition(virtualElement, element, {
|
|
14
|
+
placement: 'bottom-start',
|
|
15
|
+
strategy: 'fixed',
|
|
16
|
+
middleware: [offset(10), shift(), flip()],
|
|
17
|
+
}).then(({ x, y, strategy }) => {
|
|
18
|
+
element.style.position = strategy;
|
|
19
|
+
element.style.left = `${x}px`;
|
|
20
|
+
element.style.top = `${y}px`;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export const LinkPopover = props => {
|
|
24
|
+
const { editor, container } = props;
|
|
25
|
+
const popoverRef = useRef(null);
|
|
26
|
+
const savedSelectionRef = useRef(null);
|
|
27
|
+
// Get link form state and actions from store
|
|
28
|
+
const linkFormState = useTextEditorStore(state => state.linkFormState);
|
|
29
|
+
const hideLinkForm = useTextEditorStore(state => state.hideLinkForm);
|
|
30
|
+
const isVisible = linkFormState?.isVisible ?? false;
|
|
31
|
+
// Save initial selection when form becomes visible
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (isVisible) {
|
|
34
|
+
savedSelectionRef.current = {
|
|
35
|
+
from: editor.state.selection.from,
|
|
36
|
+
to: editor.state.selection.to,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
savedSelectionRef.current = null;
|
|
41
|
+
}
|
|
42
|
+
}, [editor, isVisible]);
|
|
43
|
+
// Update position whenever editor state changes or form becomes visible
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
|
+
if (!isVisible || !popoverRef.current)
|
|
46
|
+
return;
|
|
47
|
+
updatePosition(editor, popoverRef.current);
|
|
48
|
+
}, [editor, isVisible, linkFormState]);
|
|
49
|
+
// Effect 1: Close on selection change (only if selection actually changed from saved)
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!isVisible || !savedSelectionRef.current)
|
|
52
|
+
return;
|
|
53
|
+
const handleSelectionUpdate = () => {
|
|
54
|
+
const currentSelection = editor.state.selection;
|
|
55
|
+
const savedSelection = savedSelectionRef.current;
|
|
56
|
+
// Only close if selection moved to a different position
|
|
57
|
+
if (savedSelection &&
|
|
58
|
+
(currentSelection.from !== savedSelection.from || currentSelection.to !== savedSelection.to)) {
|
|
59
|
+
hideLinkForm();
|
|
60
|
+
// Editor already has focus when selection changes, no need to refocus
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
editor.on('selectionUpdate', handleSelectionUpdate);
|
|
64
|
+
return () => {
|
|
65
|
+
editor.off('selectionUpdate', handleSelectionUpdate);
|
|
66
|
+
};
|
|
67
|
+
}, [editor, isVisible, hideLinkForm]);
|
|
68
|
+
// Effect 2: Close on click outside
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!isVisible)
|
|
71
|
+
return;
|
|
72
|
+
const handleClickOutside = (event) => {
|
|
73
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
74
|
+
hideLinkForm();
|
|
75
|
+
// Check if click was on the editor
|
|
76
|
+
const editorElement = editor.view.dom;
|
|
77
|
+
const clickedOnEditor = editorElement.contains(event.target);
|
|
78
|
+
// If not clicked on editor, focus it after closing
|
|
79
|
+
if (!clickedOnEditor) {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
editor.commands.focus();
|
|
82
|
+
}, 0);
|
|
83
|
+
}
|
|
84
|
+
// If clicked on editor, it will auto-focus naturally
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
// Use mousedown to catch the event before it propagates
|
|
88
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
89
|
+
return () => {
|
|
90
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
91
|
+
};
|
|
92
|
+
}, [editor, isVisible, hideLinkForm]);
|
|
93
|
+
// Handle form submission
|
|
94
|
+
const handleSubmit = useCallback(() => {
|
|
95
|
+
hideLinkForm();
|
|
96
|
+
// Focus back to editor after closing form
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
editor.commands.focus();
|
|
99
|
+
}, 0);
|
|
100
|
+
}, [editor, hideLinkForm]);
|
|
101
|
+
// Handle form cancellation (also handles Escape key via LinkInsertForm)
|
|
102
|
+
const handleCancel = useCallback(() => {
|
|
103
|
+
hideLinkForm();
|
|
104
|
+
// Focus back to editor after closing form
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
editor.commands.focus();
|
|
107
|
+
}, 0);
|
|
108
|
+
}, [editor, hideLinkForm]);
|
|
109
|
+
// Don't render if not visible or no form state
|
|
110
|
+
if (!isVisible || !linkFormState) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const popoverElement = (_jsx("div", { ref: popoverRef, className: `${COMPONENT_CLS}-link-popover`, style: {
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
zIndex: 1000,
|
|
116
|
+
background: '#fff',
|
|
117
|
+
border: '1px solid #d9d9d9',
|
|
118
|
+
borderRadius: '8px',
|
|
119
|
+
padding: '16px',
|
|
120
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
|
|
121
|
+
minWidth: '300px',
|
|
122
|
+
}, children: _jsx(LinkInsertForm, { editor: editor, mode: linkFormState.mode, initialData: linkFormState.data, onSubmit: handleSubmit, onCancel: handleCancel }) }));
|
|
123
|
+
// Use portal to render into container or document.body
|
|
124
|
+
const containerElement = (typeof container === 'function' ? container() : container) || document.body;
|
|
125
|
+
return createPortal(popoverElement, containerElement);
|
|
126
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LinkPopover } from './LinkPopover';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type PopoverProps } from 'antd';
|
|
3
|
+
export interface TextEditorPopoverProps extends PopoverProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const TextEditorPopover: ({ children, ...restProps }: TextEditorPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Popover } from 'antd';
|
|
3
|
+
import { useTextEditorStore } from '../../provider';
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
export const TextEditorPopover = ({ children, ...restProps }) => {
|
|
6
|
+
const bubbleMenuContainer = useTextEditorStore(state => state.bubbleMenuContainer);
|
|
7
|
+
const getPopupContainer = useCallback(() => bubbleMenuContainer || document.body, [bubbleMenuContainer]);
|
|
8
|
+
return (_jsx(Popover, { destroyTooltipOnHide: true, trigger: ['click'], ...restProps, getPopupContainer: getPopupContainer, children: children }));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Popover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Popover';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from 'antd';
|
|
3
|
+
import { useTextEditorStore } from '../../provider';
|
|
4
|
+
export const TextEditorSelect = (props) => {
|
|
5
|
+
const bubbleMenuContainer = useTextEditorStore(state => state.bubbleMenuContainer);
|
|
6
|
+
return _jsx(Select, { ...props, getPopupContainer: () => bubbleMenuContainer || document.body });
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Select';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Select';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDropDownIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
3
|
+
import { StyledDropdownButton } from './styled';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { Tooltip } from 'antd';
|
|
7
|
+
export const SplitButtonDropdown = (props) => {
|
|
8
|
+
const { children, disabled, value, className = '', tooltipProps, options = [], onClickOption, onClick, } = props;
|
|
9
|
+
const selectedOpt = value ? options.filter(opt => opt.value === value) : [];
|
|
10
|
+
const isSelected = selectedOpt.length > 0;
|
|
11
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
+
const handleOpenChange = (visible) => {
|
|
13
|
+
if (disabled)
|
|
14
|
+
return;
|
|
15
|
+
setIsOpen(visible);
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(StyledDropdownButton, { disabled: disabled, trigger: ['click'], className: clsx(className, {
|
|
18
|
+
'is-active': isSelected,
|
|
19
|
+
'is-open': isOpen,
|
|
20
|
+
}), open: isOpen, onOpenChange: handleOpenChange, placement: "bottomLeft", menu: {
|
|
21
|
+
style: {
|
|
22
|
+
maxHeight: 240,
|
|
23
|
+
overflow: 'auto',
|
|
24
|
+
},
|
|
25
|
+
items: options.map(opt => ({
|
|
26
|
+
key: opt.value,
|
|
27
|
+
label: opt.label,
|
|
28
|
+
disabled: opt.disabled,
|
|
29
|
+
})),
|
|
30
|
+
selectedKeys: selectedOpt.map(opt => opt.value),
|
|
31
|
+
onClick: e => {
|
|
32
|
+
const { key } = e;
|
|
33
|
+
onClickOption?.(key);
|
|
34
|
+
},
|
|
35
|
+
}, onClick: e => {
|
|
36
|
+
onClick?.(e, isSelected);
|
|
37
|
+
}, icon: _jsx(ArrowDropDownIcon, { size: 16 }), type: "text", buttonsRender: buttons => {
|
|
38
|
+
const [fistButton, ...restButton] = buttons;
|
|
39
|
+
return [
|
|
40
|
+
_jsx(Tooltip, { placement: "top", mouseEnterDelay: 0.4, ...tooltipProps, open: disabled ? false : undefined, children: fistButton }),
|
|
41
|
+
...restButton,
|
|
42
|
+
];
|
|
43
|
+
}, children: children }));
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitButtonDropdown } from './SplitButtonDropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitButtonDropdown } from './SplitButtonDropdown';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
2
|
+
import { Dropdown } from 'antd';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
export const StyledDropdownButton = styled(Dropdown.Button) `
|
|
5
|
+
&.antsomi-dropdown-button {
|
|
6
|
+
width: fit-content;
|
|
7
|
+
|
|
8
|
+
.antsomi-btn {
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.antsomi-btn-compact-item:not(.antsomi-btn-compact-last-item).antsomi-btn-compact-first-item {
|
|
13
|
+
width: 24px;
|
|
14
|
+
height: 24px;
|
|
15
|
+
border-start-end-radius: 0;
|
|
16
|
+
border-end-end-radius: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
color: ${THEME.token?.bw8};
|
|
19
|
+
|
|
20
|
+
&:hover:not(:disabled, .is-active) {
|
|
21
|
+
background-color: #ebebeb;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.antsomi-btn-compact-item:not(.antsomi-btn-compact-first-item).antsomi-btn-compact-last-item {
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 24px;
|
|
28
|
+
border-start-start-radius: 0;
|
|
29
|
+
border-end-start-radius: 0;
|
|
30
|
+
padding: 0;
|
|
31
|
+
|
|
32
|
+
&:hover:not(:disabled),
|
|
33
|
+
&.antsomi-dropdown-open:not(:disabled) {
|
|
34
|
+
background-color: #ebebeb;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.is-active {
|
|
39
|
+
.antsomi-btn-compact-item:not(.antsomi-btn-compact-last-item).antsomi-btn-compact-first-item {
|
|
40
|
+
:not(:disabled) {
|
|
41
|
+
color: ${THEME.token?.colorPrimary};
|
|
42
|
+
background-color: #e0ebf7;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
color: ${THEME.token?.colorPrimary};
|
|
46
|
+
background-color: #e0ebf7;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.is-open {
|
|
53
|
+
.antsomi-btn-icon svg {
|
|
54
|
+
transform: rotate(180deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type SplitButtonDropdownProps = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
value?: string;
|
|
6
|
+
options?: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
className?: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
onClickOption?: (key: string) => void;
|
|
15
|
+
onClick?: (e: React.MouseEvent<HTMLElement>, isSelected: boolean) => void;
|
|
16
|
+
tooltipProps?: {
|
|
17
|
+
title?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
3
|
+
declare const textAlignOptions: readonly [{
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly shortcut: string;
|
|
7
|
+
readonly icon: import("react").ForwardRefExoticComponent<import("../../../../icons/types").IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
+
}, {
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly shortcut: string;
|
|
12
|
+
readonly icon: import("react").ForwardRefExoticComponent<import("../../../../icons/types").IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
13
|
+
}, {
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
readonly shortcut: string;
|
|
17
|
+
readonly icon: import("react").ForwardRefExoticComponent<import("../../../../icons/types").IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
18
|
+
}, {
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly value: string;
|
|
21
|
+
readonly shortcut: string;
|
|
22
|
+
readonly icon: import("react").ForwardRefExoticComponent<import("../../../../icons/types").IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
23
|
+
}];
|
|
24
|
+
type AlignType = (typeof textAlignOptions)[number]['value'];
|
|
25
|
+
interface TextAlignSelectProps {
|
|
26
|
+
editor?: Editor;
|
|
27
|
+
onChange?: (value: AlignType) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const TextAlignSelect: (props: TextAlignSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { formatHotkey } from '@antscorp/antsomi-ui/es/utils';
|
|
3
|
+
import { Flex } from 'antd';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { TEXT_EDITOR_CONSTANTS } from '../../constants';
|
|
6
|
+
import { TextEditorPopover } from '../Popover';
|
|
7
|
+
import { TextEditorButton } from '../Button';
|
|
8
|
+
import { ALignRightIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, ArrowDropDownIcon, } from '@antscorp/antsomi-ui/es/components/icons';
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { useEditorState } from '@tiptap/react';
|
|
11
|
+
const { TEXT_ALIGN } = TEXT_EDITOR_CONSTANTS;
|
|
12
|
+
const textAlignOptions = [
|
|
13
|
+
{
|
|
14
|
+
label: TEXT_ALIGN.OPTIONS.LEFT.LABEL,
|
|
15
|
+
value: TEXT_ALIGN.OPTIONS.LEFT.VALUE,
|
|
16
|
+
shortcut: formatHotkey('Shift+L'),
|
|
17
|
+
icon: AlignLeftIcon,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: TEXT_ALIGN.OPTIONS.CENTER.LABEL,
|
|
21
|
+
value: TEXT_ALIGN.OPTIONS.CENTER.VALUE,
|
|
22
|
+
shortcut: formatHotkey('Shift+E'),
|
|
23
|
+
icon: AlignCenterIcon,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: TEXT_ALIGN.OPTIONS.RIGHT.LABEL,
|
|
27
|
+
value: TEXT_ALIGN.OPTIONS.RIGHT.VALUE,
|
|
28
|
+
shortcut: formatHotkey('Shift+R'),
|
|
29
|
+
icon: ALignRightIcon,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: TEXT_ALIGN.OPTIONS.JUSTIFY.LABEL,
|
|
33
|
+
value: TEXT_ALIGN.OPTIONS.JUSTIFY.VALUE,
|
|
34
|
+
shortcut: formatHotkey('Shift+J'),
|
|
35
|
+
icon: AlignJustifyIcon,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
const StyledTriggerButton = styled(TextEditorButton) `
|
|
39
|
+
&.antsomi-btn.antsomi-btn-text {
|
|
40
|
+
width: 40px;
|
|
41
|
+
gap: 0;
|
|
42
|
+
|
|
43
|
+
&.is-active {
|
|
44
|
+
background-color: unset;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
export const TextAlignSelect = (props) => {
|
|
49
|
+
const { editor, onChange } = props;
|
|
50
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
51
|
+
const { currentAlignment } = useEditorState({
|
|
52
|
+
editor: editor,
|
|
53
|
+
selector: ({ editor: editorInstance }) => {
|
|
54
|
+
const alignment = ['left', 'center', 'right', 'justify'].find(alignment => editorInstance?.isActive({ textAlign: alignment }));
|
|
55
|
+
return { currentAlignment: alignment };
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const selectedOption = useMemo(() => textAlignOptions.find(option => option.value === currentAlignment), [currentAlignment]);
|
|
59
|
+
const handleClickOption = (align) => {
|
|
60
|
+
setIsOpen(false);
|
|
61
|
+
onChange?.(align);
|
|
62
|
+
};
|
|
63
|
+
let AlignIconComponent = textAlignOptions[0].icon;
|
|
64
|
+
if (selectedOption) {
|
|
65
|
+
AlignIconComponent = selectedOption.icon;
|
|
66
|
+
}
|
|
67
|
+
return (_jsx(TextEditorPopover, { destroyTooltipOnHide: true, open: isOpen, arrow: false, overlayInnerStyle: { padding: 8 }, content: _jsx(Flex, { gap: 8, children: textAlignOptions.map(option => (_jsx(TextEditorButton, { icon: _jsx(option.icon, { size: 16 }, option.value), onClick: () => handleClickOption(option.value), isActive: currentAlignment === option.value, tooltipProps: {
|
|
68
|
+
title: `${TEXT_ALIGN.TOOLTIP} ${option.label.toLowerCase()} (${option.shortcut})`,
|
|
69
|
+
} }, option.value))) }), trigger: ['click'], placement: "bottomLeft", onOpenChange: setOpen => setIsOpen(setOpen), children: _jsx(StyledTriggerButton, { icon: _jsx(AlignIconComponent, { size: 18 }), isActive: !!currentAlignment, tooltipProps: { title: TEXT_ALIGN.TITLE }, children: _jsx(ArrowDropDownIcon, { style: {
|
|
70
|
+
flexShrink: 0,
|
|
71
|
+
...(isOpen && {
|
|
72
|
+
transform: 'rotate(180deg)',
|
|
73
|
+
}),
|
|
74
|
+
}, size: 16 }) }) }));
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextAlignSelect } from './TextAlignSelect';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextAlignSelect } from './TextAlignSelect';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Config, FontConfig, TextStyle } from '../../types';
|
|
4
|
+
export type FormattingToolbarProps = {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
config?: Config;
|
|
7
|
+
defaultTextStyle?: TextStyle;
|
|
8
|
+
smartTagHandler?: {
|
|
9
|
+
onUpsert?: (event: React.MouseEvent) => void;
|
|
10
|
+
};
|
|
11
|
+
linkHanlder?: {
|
|
12
|
+
onUpsert?: () => void;
|
|
13
|
+
};
|
|
14
|
+
onChangeFont?: (args: {
|
|
15
|
+
font: FontConfig;
|
|
16
|
+
weight: number;
|
|
17
|
+
}) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const FormattingToolbar: (props: FormattingToolbarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from 'antd';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { ToolbarWrapper } from '../../styled';
|
|
5
|
+
import { BoldAction, BulletListAction, ClearFormattingAction, EmoijiAction, FontFamilyAction, FontSizeAction, HistoryAction, IndentAction, ItalicAction, LetterSpacingAction, LinkAction, OrderedListAction, OutdentAction, SmartTagAction, LineSpacingAction, StrikeAction, SubscriptAction, SuperscriptAction, TextAlignAction, TextBackColorAction, TextColorAction, TextTransformAction, UnderlineAction, } from './actions';
|
|
6
|
+
import { ALL_TOOLBAR_ACTIONS, DEFAULT_TEXT_STYLE, DEFAULT_TOOLBAR_GROUPING } from '../../constants';
|
|
7
|
+
import { useElementSize } from '@antscorp/antsomi-ui/es/hooks';
|
|
8
|
+
export const FormattingToolbar = (props) => {
|
|
9
|
+
const { editor, smartTagHandler, linkHanlder, config, defaultTextStyle = DEFAULT_TEXT_STYLE, onChangeFont, } = props;
|
|
10
|
+
const [ref] = useElementSize();
|
|
11
|
+
// Determine visible actions based on config
|
|
12
|
+
const visibleActions = useMemo(() => {
|
|
13
|
+
const toolbarConfig = config?.Toolbar;
|
|
14
|
+
// If items is false, hide toolbar entirely
|
|
15
|
+
if (toolbarConfig?.items === false) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
// If items is an array, use it (user-specified order)
|
|
19
|
+
if (Array.isArray(toolbarConfig?.items)) {
|
|
20
|
+
return toolbarConfig.items;
|
|
21
|
+
}
|
|
22
|
+
// Default: show all actions except excluded ones
|
|
23
|
+
const excludeSet = new Set(toolbarConfig?.exclude || []);
|
|
24
|
+
return ALL_TOOLBAR_ACTIONS.filter(action => !excludeSet.has(action));
|
|
25
|
+
}, [config?.Toolbar]);
|
|
26
|
+
// Map action names to React components
|
|
27
|
+
const actionComponentMap = useMemo(() => ({
|
|
28
|
+
fontFamily: (_jsx(FontFamilyAction, { editor: editor, fonts: config?.FontFamily?.fonts, onChange: (font, weight) => onChangeFont?.({ font, weight }), fontGroupingFn: config?.FontFamily?.fontGroupingFn, groupOrder: config?.FontFamily?.groupOrder }, "fontFamily")),
|
|
29
|
+
fontSize: (_jsx(FontSizeAction, { editor: editor, defaultFontSize: defaultTextStyle.fontSize }, "fontSize")),
|
|
30
|
+
bold: _jsx(BoldAction, { editor: editor }, "bold"),
|
|
31
|
+
italic: _jsx(ItalicAction, { editor: editor }, "italic"),
|
|
32
|
+
underline: _jsx(UnderlineAction, { editor: editor }, "underline"),
|
|
33
|
+
link: _jsx(LinkAction, { editor: editor, onClick: linkHanlder?.onUpsert }, "link"),
|
|
34
|
+
strike: _jsx(StrikeAction, { editor: editor }, "strike"),
|
|
35
|
+
superscript: _jsx(SuperscriptAction, { editor: editor }, "superscript"),
|
|
36
|
+
subscript: _jsx(SubscriptAction, { editor: editor }, "subscript"),
|
|
37
|
+
textTransform: _jsx(TextTransformAction, { editor: editor }, "textTransform"),
|
|
38
|
+
textColor: _jsx(TextColorAction, { editor: editor }, "textColor"),
|
|
39
|
+
backgroundColor: _jsx(TextBackColorAction, { editor: editor }, "backgroundColor"),
|
|
40
|
+
emoji: _jsx(EmoijiAction, { editor: editor }, "emoji"),
|
|
41
|
+
smartTag: (_jsx(SmartTagAction, { editor: editor, onClick: smartTagHandler?.onUpsert }, "smartTag")),
|
|
42
|
+
bulletList: (_jsx(BulletListAction, { editor: editor, useCustomBullet: config?.UnorderedList?.useCustomBullet }, "bulletList")),
|
|
43
|
+
orderedList: _jsx(OrderedListAction, { editor: editor }, "orderedList"),
|
|
44
|
+
textAlign: _jsx(TextAlignAction, { editor: editor }, "textAlign"),
|
|
45
|
+
lineSpacing: (_jsx(LineSpacingAction, { editor: editor, defaultValue: defaultTextStyle?.lineHeight }, "lineSpacing")),
|
|
46
|
+
letterSpacing: _jsx(LetterSpacingAction, { editor: editor }, "letterSpacing"),
|
|
47
|
+
indent: _jsx(IndentAction, { editor: editor }, "indent"),
|
|
48
|
+
outdent: _jsx(OutdentAction, { editor: editor }, "outdent"),
|
|
49
|
+
history: _jsx(HistoryAction, { editor: editor }, "history"),
|
|
50
|
+
clearFormatting: _jsx(ClearFormattingAction, { editor: editor }, "clearFormatting"),
|
|
51
|
+
}), [
|
|
52
|
+
editor,
|
|
53
|
+
config?.FontFamily,
|
|
54
|
+
config?.UnorderedList,
|
|
55
|
+
defaultTextStyle,
|
|
56
|
+
linkHanlder,
|
|
57
|
+
smartTagHandler,
|
|
58
|
+
onChangeFont,
|
|
59
|
+
]);
|
|
60
|
+
// Group actions into rows
|
|
61
|
+
const actionGroups = useMemo(() => {
|
|
62
|
+
if (visibleActions.length === 0) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
// Use default grouping to determine which row each action belongs to
|
|
66
|
+
const row1Actions = DEFAULT_TOOLBAR_GROUPING[0];
|
|
67
|
+
const row2Actions = DEFAULT_TOOLBAR_GROUPING[1];
|
|
68
|
+
const row1 = [];
|
|
69
|
+
const row2 = [];
|
|
70
|
+
visibleActions.forEach(action => {
|
|
71
|
+
if (row1Actions.includes(action)) {
|
|
72
|
+
row1.push(action);
|
|
73
|
+
}
|
|
74
|
+
else if (row2Actions.includes(action)) {
|
|
75
|
+
row2.push(action);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return [row1, row2].filter(row => row.length > 0);
|
|
79
|
+
}, [visibleActions]);
|
|
80
|
+
// If no visible actions, don't render toolbar
|
|
81
|
+
if (visibleActions.length === 0) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return (_jsx(ToolbarWrapper, { ref: ref, vertical: true, gap: 20, children: actionGroups.map((group, groupIdx) => (_jsx(Flex, { gap: 15, justify: "flex-start", align: "center", children: group.map(actionName => actionComponentMap[actionName]) }, groupIdx))) }));
|
|
85
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { TextEditorComponentsRender } from '../../types';
|
|
3
|
+
export type LinkPreviewToolbarProps = {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
linkHanlder?: {
|
|
6
|
+
onUpsert?: () => void;
|
|
7
|
+
};
|
|
8
|
+
render?: Partial<Pick<TextEditorComponentsRender, 'renderLinkToolbar'>>;
|
|
9
|
+
};
|
|
10
|
+
export declare const LinkPreviewToolbar: (props: LinkPreviewToolbarProps) => import("react/jsx-runtime").JSX.Element | null;
|