@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,388 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
|
|
3
|
+
import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
4
|
+
import SubScript from '@tiptap/extension-subscript';
|
|
5
|
+
import Superscript from '@tiptap/extension-superscript';
|
|
6
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
7
|
+
import { TextStyleKit } from '@tiptap/extension-text-style';
|
|
8
|
+
import { Selection, Focus } from '@tiptap/extensions';
|
|
9
|
+
import { useEditor } from '@tiptap/react';
|
|
10
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
import { isBoolean } from 'lodash';
|
|
13
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, } from 'react';
|
|
14
|
+
import { useDebouncedCallback } from 'use-debounce';
|
|
15
|
+
import { DEFAULT_TEXT_STYLE } from './constants';
|
|
16
|
+
import { BackgroundColor } from './extensions/BackgroundColor';
|
|
17
|
+
import { Color } from './extensions/Color';
|
|
18
|
+
import { Emoji } from './extensions/Emoji';
|
|
19
|
+
import { FontFamily } from './extensions/FontFamily';
|
|
20
|
+
import { FontSize } from './extensions/FontSize';
|
|
21
|
+
import { FontWeight } from './extensions/FontWeight';
|
|
22
|
+
import { Indent } from './extensions/Indent';
|
|
23
|
+
import { LetterSpacing } from './extensions/LetterSpacing';
|
|
24
|
+
import { LineHeight } from './extensions/LineHeight';
|
|
25
|
+
import { CustomLink } from './extensions/Link';
|
|
26
|
+
import { CustomListItem } from './extensions/ListItem';
|
|
27
|
+
import { CustomOrderedList } from './extensions/OrderedList';
|
|
28
|
+
import { SmartTag } from './extensions/SmartTag';
|
|
29
|
+
import { TextTransform } from './extensions/TextTransform';
|
|
30
|
+
import { CustomUnorderedList } from './extensions/UnorderedList';
|
|
31
|
+
import { ClearFormatting } from './extensions/ClearFormatting';
|
|
32
|
+
import { TextEditorProvider, useTextEditorStore, } from './provider';
|
|
33
|
+
import { StyledEditorContent } from './styled';
|
|
34
|
+
import { isSmartTagNode, } from './types';
|
|
35
|
+
import { emojiSuggestion } from './ui/Emoji';
|
|
36
|
+
import { LinkPreviewToolbar, FormattingToolbar } from './ui/Toolbar';
|
|
37
|
+
import { analyzeFont, defaultShouldShowBubbleMenu, getAllFullLinkGroups, handleLinkAction, handleSmartTagAction, isShowLinkToolbar, safeParseHTMLContent, htmlSerializerForOutput, } from './utils';
|
|
38
|
+
import { BubbleMenu } from './ui/BubbleMenu';
|
|
39
|
+
import { LinkPopover } from './ui/LinkPopover';
|
|
40
|
+
const TextEditorInternal = memo(forwardRef((props, ref) => {
|
|
41
|
+
const { id, className, config, editable = true, initialContent = '', dataAttributes, onUpdateDebounced = 300, defaultTextStyle: defaultTextStyleProp, linkHandler: outerLinkHandler, smartTagHandler: outerSmartTagHandler, bubbleMenuProps, style, render, onUpdate, onFocus, onChangeFont, } = props;
|
|
42
|
+
// Initialize bubbleMenuContainer with default value (document.body)
|
|
43
|
+
// This ensures BubbleMenu receives a valid appendTo prop on first render
|
|
44
|
+
const bubbleMenuContainer = useRef((() => {
|
|
45
|
+
const appendTo = bubbleMenuProps?.appendTo;
|
|
46
|
+
if (!appendTo)
|
|
47
|
+
return document.body;
|
|
48
|
+
return typeof appendTo === 'function' ? appendTo() : appendTo;
|
|
49
|
+
})());
|
|
50
|
+
const linkFormVisible = useTextEditorStore(state => state.linkFormState?.isVisible);
|
|
51
|
+
const setBubbleMenuContainer = useTextEditorStore(state => state.setBubbleMenuContainer);
|
|
52
|
+
const showLinkForm = useTextEditorStore(state => state.showLinkForm);
|
|
53
|
+
const defaultTextStyle = useDeepCompareMemo(() => ({
|
|
54
|
+
...DEFAULT_TEXT_STYLE,
|
|
55
|
+
...defaultTextStyleProp,
|
|
56
|
+
}), [defaultTextStyleProp]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const bubbleMenuAppendTo = bubbleMenuProps?.appendTo;
|
|
59
|
+
// Default to document.body when no appendTo is provided
|
|
60
|
+
// This prevents bubble menu from being clipped by overflow containers
|
|
61
|
+
const el = bubbleMenuAppendTo
|
|
62
|
+
? typeof bubbleMenuAppendTo === 'function'
|
|
63
|
+
? bubbleMenuAppendTo()
|
|
64
|
+
: bubbleMenuAppendTo
|
|
65
|
+
: document.body;
|
|
66
|
+
setBubbleMenuContainer(el);
|
|
67
|
+
bubbleMenuContainer.current = el;
|
|
68
|
+
}, [bubbleMenuProps?.appendTo, setBubbleMenuContainer]);
|
|
69
|
+
const handleOnUpdateDebounce = useDebouncedCallback((editor) => {
|
|
70
|
+
const text = editor.getText();
|
|
71
|
+
const json = editor.getJSON();
|
|
72
|
+
const html = editor.getHTML();
|
|
73
|
+
onUpdate?.({
|
|
74
|
+
html: htmlSerializerForOutput(html),
|
|
75
|
+
text,
|
|
76
|
+
json,
|
|
77
|
+
});
|
|
78
|
+
}, onUpdateDebounced);
|
|
79
|
+
const contentRef = useRef(null);
|
|
80
|
+
// Compose linkHandler: merge outerLinkHandler with default handlers
|
|
81
|
+
// Allows partial override - user can provide only setNew or only edit
|
|
82
|
+
const linkHandler = useMemo(() => {
|
|
83
|
+
const defaultSetNew = ({ selectionText }) => {
|
|
84
|
+
showLinkForm('insert', {
|
|
85
|
+
url: '',
|
|
86
|
+
text: selectionText,
|
|
87
|
+
openInNewTab: false,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const defaultEdit = ({ attrs, selectionText, }) => {
|
|
91
|
+
showLinkForm('edit', {
|
|
92
|
+
url: attrs.href || '',
|
|
93
|
+
text: selectionText,
|
|
94
|
+
openInNewTab: attrs.target === '_blank',
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
setNew: outerLinkHandler?.setNew || defaultSetNew,
|
|
99
|
+
edit: outerLinkHandler?.edit || defaultEdit,
|
|
100
|
+
};
|
|
101
|
+
}, [outerLinkHandler, showLinkForm]);
|
|
102
|
+
const editor = useEditor({
|
|
103
|
+
extensions: [
|
|
104
|
+
StarterKit.configure({
|
|
105
|
+
link: false,
|
|
106
|
+
bulletList: false,
|
|
107
|
+
orderedList: false,
|
|
108
|
+
listItem: false,
|
|
109
|
+
undoRedo: {
|
|
110
|
+
depth: 100,
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
CustomListItem,
|
|
114
|
+
CustomUnorderedList,
|
|
115
|
+
CustomOrderedList,
|
|
116
|
+
FontWeight.configure({
|
|
117
|
+
defaultWeight: defaultTextStyle.fontWeight,
|
|
118
|
+
}),
|
|
119
|
+
LineHeight.configure({
|
|
120
|
+
defaultHeight: defaultTextStyle.lineHeight,
|
|
121
|
+
}),
|
|
122
|
+
FontFamily.configure({
|
|
123
|
+
defaultFontFamily: defaultTextStyle.fontFamily,
|
|
124
|
+
}),
|
|
125
|
+
FontSize.configure({
|
|
126
|
+
defaultFontSize: defaultTextStyle.fontSize,
|
|
127
|
+
}),
|
|
128
|
+
LetterSpacing.configure({
|
|
129
|
+
defaultLetterSpacing: defaultTextStyle.letterSpacing,
|
|
130
|
+
}),
|
|
131
|
+
Color.configure({
|
|
132
|
+
defaultColor: defaultTextStyle.color,
|
|
133
|
+
}),
|
|
134
|
+
BackgroundColor.configure({
|
|
135
|
+
defaultBackgroundColor: defaultTextStyle.backgroundColor,
|
|
136
|
+
}),
|
|
137
|
+
TextStyleKit.configure({
|
|
138
|
+
fontFamily: false,
|
|
139
|
+
fontSize: false,
|
|
140
|
+
backgroundColor: false,
|
|
141
|
+
color: false,
|
|
142
|
+
lineHeight: false,
|
|
143
|
+
textStyle: {
|
|
144
|
+
mergeNestedSpanStyles: true,
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
TextTransform,
|
|
148
|
+
Superscript,
|
|
149
|
+
SubScript,
|
|
150
|
+
Selection.configure({
|
|
151
|
+
className: 'selection',
|
|
152
|
+
}),
|
|
153
|
+
Focus.configure({
|
|
154
|
+
className: 'has-focused',
|
|
155
|
+
}),
|
|
156
|
+
SmartTag,
|
|
157
|
+
TextAlign.configure({
|
|
158
|
+
types: ['heading', 'paragraph'],
|
|
159
|
+
}),
|
|
160
|
+
CustomLink.configure({
|
|
161
|
+
openOnClick: false,
|
|
162
|
+
HTMLAttributes: {
|
|
163
|
+
style: 'text-decoration:inherit;color:inherit;',
|
|
164
|
+
rel: undefined,
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
Indent,
|
|
168
|
+
Emoji.configure({
|
|
169
|
+
suggestion: emojiSuggestion({
|
|
170
|
+
container: bubbleMenuContainer.current,
|
|
171
|
+
}),
|
|
172
|
+
}),
|
|
173
|
+
ClearFormatting.configure({
|
|
174
|
+
defaultTextStyle,
|
|
175
|
+
}),
|
|
176
|
+
],
|
|
177
|
+
content: initialContent,
|
|
178
|
+
onCreate: ({ editor }) => {
|
|
179
|
+
if (!contentRef.current?.parentElement) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const safeParseContent = safeParseHTMLContent({
|
|
183
|
+
html: initialContent,
|
|
184
|
+
wrapperElement: contentRef.current.parentElement,
|
|
185
|
+
defaultStyle: defaultTextStyle,
|
|
186
|
+
});
|
|
187
|
+
if (safeParseContent !== initialContent) {
|
|
188
|
+
editor.commands.setContent(safeParseContent);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
onUpdate: ({ editor }) => {
|
|
192
|
+
handleOnUpdateDebounce(editor);
|
|
193
|
+
},
|
|
194
|
+
onFocus: ({ event }) => {
|
|
195
|
+
onFocus?.(event);
|
|
196
|
+
},
|
|
197
|
+
editorProps: {
|
|
198
|
+
attributes: { spellcheck: 'false' },
|
|
199
|
+
handleKeyDown(view, event) {
|
|
200
|
+
if (event.ctrlKey && event.key === 'k') {
|
|
201
|
+
// Add this line to prevent browser's default behavior.
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
handleLinkAction(view, linkHandler);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (editable === undefined) {
|
|
210
|
+
editor?.setEditable(true);
|
|
211
|
+
}
|
|
212
|
+
else if (isBoolean(editable)) {
|
|
213
|
+
editor?.setEditable(editable);
|
|
214
|
+
}
|
|
215
|
+
}, [editor, editable]);
|
|
216
|
+
const handleSetSmartTag = useCallback(({ id, content }) => {
|
|
217
|
+
editor?.chain().focus().setSmartTag({ id, content }).run();
|
|
218
|
+
}, [editor]);
|
|
219
|
+
const handleDeleteSmartTag = useCallback(id => {
|
|
220
|
+
editor
|
|
221
|
+
?.chain()
|
|
222
|
+
.deleteSmartTagGlobally(attrs => attrs.id === id)
|
|
223
|
+
.run();
|
|
224
|
+
}, [editor]);
|
|
225
|
+
const handleUpdateSmartTagAttrs = useCallback((id, updatedAttrs) => editor
|
|
226
|
+
?.chain()
|
|
227
|
+
.updateSmartTagAttrsGlobally(attrs => {
|
|
228
|
+
if (attrs.id === id)
|
|
229
|
+
return updatedAttrs;
|
|
230
|
+
})
|
|
231
|
+
.run(), [editor]);
|
|
232
|
+
const shouldShowLinkPreview = useCallback((params) => {
|
|
233
|
+
const { state } = params;
|
|
234
|
+
return isShowLinkToolbar(state);
|
|
235
|
+
}, []);
|
|
236
|
+
const shouldShowFormattingToolbar = useCallback((params) => {
|
|
237
|
+
const { state, view, element } = params;
|
|
238
|
+
// Don't show if link preview is visible
|
|
239
|
+
if (isShowLinkToolbar(state)) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return defaultShouldShowBubbleMenu({
|
|
243
|
+
state,
|
|
244
|
+
view,
|
|
245
|
+
element,
|
|
246
|
+
editor: params.editor,
|
|
247
|
+
});
|
|
248
|
+
}, []);
|
|
249
|
+
const handleBlur = useCallback((perserveSelection) => {
|
|
250
|
+
if (perserveSelection) {
|
|
251
|
+
editor?.chain().blur().run();
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
editor?.chain().blur().setTextSelection({ from: 0, to: 0 }).run();
|
|
255
|
+
}
|
|
256
|
+
}, [editor]);
|
|
257
|
+
const handleEachLinkGroup = useCallback(callback => {
|
|
258
|
+
if (!editor)
|
|
259
|
+
return;
|
|
260
|
+
const linkGroups = getAllFullLinkGroups(editor.state);
|
|
261
|
+
linkGroups.forEach(callback);
|
|
262
|
+
}, [editor]);
|
|
263
|
+
const handleEachSmartag = useCallback(callback => {
|
|
264
|
+
if (!editor)
|
|
265
|
+
return;
|
|
266
|
+
const { state } = editor;
|
|
267
|
+
const { doc } = state;
|
|
268
|
+
doc.descendants(node => {
|
|
269
|
+
if (isSmartTagNode(node)) {
|
|
270
|
+
callback(node.attrs);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}, [editor]);
|
|
274
|
+
useImperativeHandle(ref, () => ({
|
|
275
|
+
setLink: params => {
|
|
276
|
+
editor?.chain().setCustomLink(params).run();
|
|
277
|
+
},
|
|
278
|
+
deleteLink: predicate => {
|
|
279
|
+
editor?.chain().deleteCustomLink(predicate).run();
|
|
280
|
+
},
|
|
281
|
+
updateLinkAttrs: (predicate, updateFn) => {
|
|
282
|
+
editor.chain().updateCustomLinkAttrsGlobally(predicate, updateFn).run();
|
|
283
|
+
},
|
|
284
|
+
updateLinkText: ({ predicate, updated, mergeAdjacentEqualFn }) => {
|
|
285
|
+
editor
|
|
286
|
+
.chain()
|
|
287
|
+
.updateCustomLinkText({
|
|
288
|
+
predicate,
|
|
289
|
+
updated,
|
|
290
|
+
mergeAdjacentEqualFn,
|
|
291
|
+
})
|
|
292
|
+
.run();
|
|
293
|
+
},
|
|
294
|
+
eachLinkGroup: handleEachLinkGroup,
|
|
295
|
+
eachSmartag: handleEachSmartag,
|
|
296
|
+
setSmartTag: handleSetSmartTag,
|
|
297
|
+
deleteSmartTag: handleDeleteSmartTag,
|
|
298
|
+
updateSmartTagAttrs: handleUpdateSmartTagAttrs,
|
|
299
|
+
blur: handleBlur,
|
|
300
|
+
style: contentRef.current?.style,
|
|
301
|
+
editor,
|
|
302
|
+
}));
|
|
303
|
+
if (!editor) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledEditorContent, { className: clsx(`${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor`, className), "$textStyle": defaultTextStyle, style: {
|
|
307
|
+
// Inline styles apply to inner html elements (support email client)
|
|
308
|
+
...defaultTextStyle,
|
|
309
|
+
...style,
|
|
310
|
+
}, id: id, ref: contentRef, editor: editor, ...dataAttributes }), _jsx(LinkPopover, { editor: editor }), !linkFormVisible && (_jsxs(_Fragment, { children: [_jsx(BubbleMenu, { pluginKey: "linkPreviewBubbleMenu", ...bubbleMenuProps, appendTo: bubbleMenuContainer.current, editor: editor, shouldShow: shouldShowLinkPreview, children: _jsx(LinkPreviewToolbar, { editor: editor, linkHanlder: {
|
|
311
|
+
onUpsert: () => {
|
|
312
|
+
handleLinkAction(editor.view, linkHandler);
|
|
313
|
+
},
|
|
314
|
+
}, render: render }) }), _jsx(BubbleMenu, { pluginKey: "formattingBubbleMenu", ...bubbleMenuProps, appendTo: bubbleMenuContainer.current, editor: editor, shouldShow: shouldShowFormattingToolbar, children: _jsx(FormattingToolbar, { config: config, editor: editor, defaultTextStyle: defaultTextStyle, linkHanlder: {
|
|
315
|
+
onUpsert: () => {
|
|
316
|
+
handleLinkAction(editor.view, linkHandler);
|
|
317
|
+
},
|
|
318
|
+
}, smartTagHandler: {
|
|
319
|
+
onUpsert: (event) => {
|
|
320
|
+
handleSmartTagAction(event, editor.view, outerSmartTagHandler);
|
|
321
|
+
},
|
|
322
|
+
}, onChangeFont: ({ font, weight }) => {
|
|
323
|
+
onChangeFont?.({
|
|
324
|
+
font,
|
|
325
|
+
weight,
|
|
326
|
+
analysis: analyzeFont(font),
|
|
327
|
+
});
|
|
328
|
+
} }) })] }))] }));
|
|
329
|
+
}));
|
|
330
|
+
TextEditorInternal.displayName = 'TextEditorInternal';
|
|
331
|
+
const TextEditorWithProvider = forwardRef((props, ref) => {
|
|
332
|
+
const { colors, onChangeColors, ...editorProps } = props;
|
|
333
|
+
const providerRef = useRef(null);
|
|
334
|
+
const editorRef = useRef(null);
|
|
335
|
+
// Sync external colors to internal store
|
|
336
|
+
useDeepCompareEffect(() => {
|
|
337
|
+
if (colors !== undefined) {
|
|
338
|
+
providerRef.current?.updateColors?.(colors);
|
|
339
|
+
}
|
|
340
|
+
}, [colors]);
|
|
341
|
+
useImperativeHandle(ref, () => ({
|
|
342
|
+
// Forward TextEditorRef methods - accessed at call time
|
|
343
|
+
get style() {
|
|
344
|
+
return editorRef.current?.style;
|
|
345
|
+
},
|
|
346
|
+
get editor() {
|
|
347
|
+
return editorRef.current?.editor ?? null;
|
|
348
|
+
},
|
|
349
|
+
get setLink() {
|
|
350
|
+
return editorRef.current.setLink;
|
|
351
|
+
},
|
|
352
|
+
get deleteLink() {
|
|
353
|
+
return editorRef.current.deleteLink;
|
|
354
|
+
},
|
|
355
|
+
get updateLinkAttrs() {
|
|
356
|
+
return editorRef.current.updateLinkAttrs;
|
|
357
|
+
},
|
|
358
|
+
get updateLinkText() {
|
|
359
|
+
return editorRef.current.updateLinkText;
|
|
360
|
+
},
|
|
361
|
+
get eachLinkGroup() {
|
|
362
|
+
return editorRef.current.eachLinkGroup;
|
|
363
|
+
},
|
|
364
|
+
get eachSmartag() {
|
|
365
|
+
return editorRef.current.eachSmartag;
|
|
366
|
+
},
|
|
367
|
+
get setSmartTag() {
|
|
368
|
+
return editorRef.current.setSmartTag;
|
|
369
|
+
},
|
|
370
|
+
get deleteSmartTag() {
|
|
371
|
+
return editorRef.current.deleteSmartTag;
|
|
372
|
+
},
|
|
373
|
+
get updateSmartTagAttrs() {
|
|
374
|
+
return editorRef.current.updateSmartTagAttrs;
|
|
375
|
+
},
|
|
376
|
+
get blur() {
|
|
377
|
+
return editorRef.current.blur;
|
|
378
|
+
},
|
|
379
|
+
// Forward TextEditorProviderRefHandler methods
|
|
380
|
+
updateColors: colors => providerRef.current?.updateColors?.(colors),
|
|
381
|
+
}), []);
|
|
382
|
+
return (_jsx(TextEditorProvider, { ref: providerRef, colors: colors, onChangeColors: onChangeColors, children: _jsx(TextEditorInternal, { ...editorProps, ref: editorRef }) }));
|
|
383
|
+
});
|
|
384
|
+
TextEditorWithProvider.displayName = 'TextEditorWithProvider';
|
|
385
|
+
export const TextEditor = Object.assign(TextEditorWithProvider, {
|
|
386
|
+
Provider: TextEditorProvider,
|
|
387
|
+
Internal: TextEditorInternal,
|
|
388
|
+
});
|