@antscorp/antsomi-ui 2.0.92-text-editor-beta.6 → 2.0.93
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 -4
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -18
- package/es/components/icons/LazyIcon/LazyIcon.js +9 -18
- package/es/components/icons/index.d.ts +9 -18
- package/es/components/icons/index.js +9 -18
- package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
- package/es/components/molecules/EmojiCollections/types.d.ts +0 -1
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +0 -1
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +6 -10
- package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/TagifyInput/patternHandlers.js +12 -0
- package/es/components/molecules/TagifyInput/utils.d.ts +1 -0
- package/es/components/molecules/TagifyInput/utils.js +1 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +3 -6
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +982 -2594
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +11 -1
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +25 -53
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +0 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +2 -2
- package/es/components/molecules/VirtualizedMenu/styled.js +4 -23
- package/es/components/molecules/VirtualizedMenu/types.d.ts +10 -27
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/utils.js +18 -13
- package/es/components/molecules/index.d.ts +0 -1
- package/es/components/molecules/index.js +0 -1
- package/es/components/organism/index.d.ts +0 -1
- package/es/components/organism/index.js +0 -1
- package/es/constants/api.js +3 -3
- package/es/hooks/index.d.ts +0 -4
- package/es/hooks/index.js +0 -4
- package/es/locales/i18n.d.ts +1 -1
- package/es/utils/common.d.ts +9 -14
- package/es/utils/common.js +23 -60
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -1
- package/es/utils/web.d.ts +0 -15
- package/es/utils/web.js +0 -39
- package/package.json +4 -22
- package/es/components/atoms/Eyedropper/Eyedropper.d.ts +0 -2
- package/es/components/atoms/Eyedropper/Eyedropper.js +0 -53
- package/es/components/atoms/Eyedropper/index.d.ts +0 -0
- package/es/components/atoms/Eyedropper/index.js +0 -1
- package/es/components/atoms/Eyedropper/styled.d.ts +0 -9
- package/es/components/atoms/Eyedropper/styled.js +0 -45
- package/es/components/atoms/Eyedropper/types.d.ts +0 -5
- package/es/components/atoms/Eyedropper/types.js +0 -1
- package/es/components/icons/ALignRightIcon.d.ts +0 -3
- package/es/components/icons/ALignRightIcon.js +0 -7
- package/es/components/icons/AlignCenterIcon.d.ts +0 -3
- package/es/components/icons/AlignCenterIcon.js +0 -7
- package/es/components/icons/AlignJustifyIcon.d.ts +0 -3
- package/es/components/icons/AlignJustifyIcon.js +0 -7
- package/es/components/icons/AlignLeftIcon.d.ts +0 -3
- package/es/components/icons/AlignLeftIcon.js +0 -7
- package/es/components/icons/ArrowDropDownIcon.d.ts +0 -3
- package/es/components/icons/ArrowDropDownIcon.js +0 -7
- package/es/components/icons/ChevronRightIcon.d.ts +0 -3
- package/es/components/icons/ChevronRightIcon.js +0 -7
- package/es/components/icons/ColorizeIcon.d.ts +0 -3
- package/es/components/icons/ColorizeIcon.js +0 -7
- package/es/components/icons/LinkOffIcon.d.ts +0 -3
- package/es/components/icons/LinkOffIcon.js +0 -7
- package/es/components/icons/MinusIcon.d.ts +0 -3
- package/es/components/icons/MinusIcon.js +0 -7
- package/es/components/index.scss +0 -2
- package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +0 -11
- package/es/components/molecules/EyedropperButton/EyedropperButton.js +0 -34
- package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
- package/es/components/molecules/EyedropperButton/index.js +0 -1
- package/es/components/molecules/EyedropperButton/styled.d.ts +0 -7
- package/es/components/molecules/EyedropperButton/styled.js +0 -23
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +0 -134
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +0 -8
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +0 -14
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +0 -21
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +0 -19
- package/es/components/molecules/FontSizeInput/constants.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/constants.js +0 -5
- package/es/components/molecules/FontSizeInput/index.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/index.js +0 -1
- package/es/components/molecules/FontSizeInput/styled.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/styled.js +0 -40
- package/es/components/molecules/FontSizeInput/styles.scss +0 -15
- package/es/components/molecules/FontSizeInput/types.d.ts +0 -23
- package/es/components/molecules/FontSizeInput/types.js +0 -1
- package/es/components/molecules/FontSizeInput/utils.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/utils.js +0 -9
- package/es/components/molecules/index.scss +0 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +0 -1290
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +0 -3059
- package/es/components/organism/TextEditor/TextEditor.d.ts +0 -3
- package/es/components/organism/TextEditor/TextEditor.js +0 -264
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +0 -320
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +0 -1
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +0 -38
- package/es/components/organism/TextEditor/constants.d.ts +0 -177
- package/es/components/organism/TextEditor/constants.js +0 -323
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +0 -25
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +0 -46
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +0 -140
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +0 -366
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +0 -31
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +0 -2
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +0 -2
- package/es/components/organism/TextEditor/extensions/ClearFormatting.d.ts +0 -16
- package/es/components/organism/TextEditor/extensions/ClearFormatting.js +0 -26
- package/es/components/organism/TextEditor/extensions/Color.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Color.js +0 -34
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +0 -57
- package/es/components/organism/TextEditor/extensions/Emoji.js +0 -184
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/FontFamily.js +0 -36
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +0 -31
- package/es/components/organism/TextEditor/extensions/FontSize.js +0 -46
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +0 -23
- package/es/components/organism/TextEditor/extensions/FontWeight.js +0 -41
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +0 -21
- package/es/components/organism/TextEditor/extensions/Indent.js +0 -63
- package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +0 -32
- package/es/components/organism/TextEditor/extensions/LetterSpacing.js +0 -48
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +0 -20
- package/es/components/organism/TextEditor/extensions/LineHeight.js +0 -36
- package/es/components/organism/TextEditor/extensions/Link.d.ts +0 -29
- package/es/components/organism/TextEditor/extensions/Link.js +0 -187
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +0 -13
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +0 -174
- package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +0 -56
- package/es/components/organism/TextEditor/extensions/OrderedList.js +0 -187
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +0 -39
- package/es/components/organism/TextEditor/extensions/SmartTag.js +0 -167
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +0 -36
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +0 -163
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +0 -30
- package/es/components/organism/TextEditor/extensions/TextTransform.js +0 -36
- package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +0 -55
- package/es/components/organism/TextEditor/extensions/UnorderedList.js +0 -176
- package/es/components/organism/TextEditor/hooks/index.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/index.js +0 -6
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +0 -4
- package/es/components/organism/TextEditor/hooks/useColorSet.js +0 -22
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +0 -18
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +0 -42
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +0 -26
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +0 -68
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +0 -31
- package/es/components/organism/TextEditor/hooks/usePersistence.js +0 -169
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +0 -42
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +0 -34
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +0 -83
- package/es/components/organism/TextEditor/index.d.ts +0 -16
- package/es/components/organism/TextEditor/index.js +0 -8
- package/es/components/organism/TextEditor/index.scss +0 -61
- package/es/components/organism/TextEditor/provider.d.ts +0 -14
- package/es/components/organism/TextEditor/provider.js +0 -33
- package/es/components/organism/TextEditor/store.d.ts +0 -13
- package/es/components/organism/TextEditor/store.js +0 -20
- package/es/components/organism/TextEditor/styled.d.ts +0 -10
- package/es/components/organism/TextEditor/styled.js +0 -94
- package/es/components/organism/TextEditor/types.d.ts +0 -139
- package/es/components/organism/TextEditor/types.js +0 -5
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +0 -84
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Button/Button.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Button/Button.js +0 -31
- package/es/components/organism/TextEditor/ui/Button/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Button/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Button/types.d.ts +0 -10
- package/es/components/organism/TextEditor/ui/Button/types.js +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +0 -39
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +0 -131
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +0 -1
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +0 -17
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +0 -51
- package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/DropdownButton/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +0 -11
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +0 -66
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/index.js +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +0 -71
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +0 -12
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +0 -69
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +0 -22
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +0 -9
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Popover/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Select/Select.js +0 -7
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Select/index.js +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +0 -44
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +0 -52
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +0 -19
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +0 -30
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +0 -77
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +0 -16
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -42
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +0 -93
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +0 -31
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +0 -28
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +0 -44
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +0 -21
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +0 -28
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +0 -67
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +0 -10
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +0 -45
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +0 -26
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +0 -26
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +0 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +0 -29
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +0 -22
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +0 -36
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +0 -19
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +0 -24
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +0 -24
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +0 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +0 -57
- package/es/components/organism/TextEditor/utils/documentState.js +0 -100
- package/es/components/organism/TextEditor/utils/font.d.ts +0 -73
- package/es/components/organism/TextEditor/utils/font.js +0 -160
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +0 -75
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +0 -343
- package/es/components/organism/TextEditor/utils/indent.d.ts +0 -11
- package/es/components/organism/TextEditor/utils/indent.js +0 -56
- package/es/components/organism/TextEditor/utils/index.d.ts +0 -8
- package/es/components/organism/TextEditor/utils/index.js +0 -16
- package/es/components/organism/TextEditor/utils/link.d.ts +0 -108
- package/es/components/organism/TextEditor/utils/link.js +0 -151
- package/es/components/organism/TextEditor/utils/menu.d.ts +0 -134
- package/es/components/organism/TextEditor/utils/menu.js +0 -317
- package/es/components/organism/TextEditor/utils/selection.d.ts +0 -25
- package/es/components/organism/TextEditor/utils/selection.js +0 -57
- package/es/components/organism/TextEditor/utils/shared.d.ts +0 -1
- package/es/components/organism/TextEditor/utils/shared.js +0 -9
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +0 -49
- package/es/components/organism/TextEditor/utils/smartTag.js +0 -89
- package/es/components/organism/TextEditor/utils/style.d.ts +0 -78
- package/es/components/organism/TextEditor/utils/style.js +0 -193
- package/es/components/organism/index.scss +0 -1
- package/es/hooks/useBroadcastedLocalStorage.d.ts +0 -5
- package/es/hooks/useBroadcastedLocalStorage.js +0 -71
- package/es/hooks/useElementSize.d.ts +0 -7
- package/es/hooks/useElementSize.js +0 -56
- package/es/hooks/useEyedropper/attach.d.ts +0 -4
- package/es/hooks/useEyedropper/attach.js +0 -9
- package/es/hooks/useEyedropper/eyedropper.d.ts +0 -69
- package/es/hooks/useEyedropper/eyedropper.js +0 -205
- package/es/hooks/useEyedropper/index.d.ts +0 -2
- package/es/hooks/useEyedropper/index.js +0 -7
- package/es/hooks/useEyedropper/support.d.ts +0 -1
- package/es/hooks/useEyedropper/support.js +0 -3
- package/es/hooks/useEyedropper/types.d.ts +0 -9
- package/es/hooks/useEyedropper/types.js +0 -1
- package/es/hooks/useEyedropper/useEyedropper.d.ts +0 -8
- package/es/hooks/useEyedropper/useEyedropper.js +0 -50
- package/es/hooks/useEyedropper/utils.d.ts +0 -11
- package/es/hooks/useEyedropper/utils.js +0 -17
- package/es/hooks/useIsMounted.d.ts +0 -1
- package/es/hooks/useIsMounted.js +0 -11
- package/es/utils/tree.d.ts +0 -225
- package/es/utils/tree.js +0 -469
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Libraries
|
|
3
|
-
import { createContext, forwardRef, useContext, useEffect, useImperativeHandle, useRef, } from 'react';
|
|
4
|
-
import { useStore } from 'zustand';
|
|
5
|
-
// Store
|
|
6
|
-
import { createTextEditorStore } from './store';
|
|
7
|
-
export const TextEditorStoreContext = createContext(null);
|
|
8
|
-
export const TextEditorProvider = forwardRef(({ children, onChangeColors }, ref) => {
|
|
9
|
-
const storeRef = useRef();
|
|
10
|
-
if (!storeRef.current) {
|
|
11
|
-
storeRef.current = createTextEditorStore();
|
|
12
|
-
}
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
storeRef.current?.setState({
|
|
15
|
-
setColors: colors => {
|
|
16
|
-
storeRef.current?.getInitialState().setColors(colors);
|
|
17
|
-
onChangeColors?.(colors);
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}, [onChangeColors]);
|
|
21
|
-
useImperativeHandle(ref, () => ({
|
|
22
|
-
updateColors: colors => {
|
|
23
|
-
storeRef.current?.getState().setColors(colors);
|
|
24
|
-
},
|
|
25
|
-
}));
|
|
26
|
-
return (_jsx(TextEditorStoreContext.Provider, { value: storeRef.current, children: typeof children === 'function' ? children(storeRef.current) : children }));
|
|
27
|
-
});
|
|
28
|
-
export const useTextEditorStore = (selector) => {
|
|
29
|
-
const store = useContext(TextEditorStoreContext);
|
|
30
|
-
if (!store)
|
|
31
|
-
throw new Error('Missing TextEditorStoreContext.Provider in the tree');
|
|
32
|
-
return useStore(store, selector);
|
|
33
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type TextEditorState = {
|
|
2
|
-
bubbleMenuContainer: HTMLDivElement | null;
|
|
3
|
-
isShowBubbleMenu: boolean;
|
|
4
|
-
colors?: string[];
|
|
5
|
-
};
|
|
6
|
-
export type TextEditorActions = {
|
|
7
|
-
setBubbleMenuContainer: (container: HTMLDivElement | null) => void;
|
|
8
|
-
setIsShowBubbleMenu: (isShow: boolean) => void;
|
|
9
|
-
setColors: (newColorSet: string[]) => void;
|
|
10
|
-
};
|
|
11
|
-
export type TextEditorStore = TextEditorState & TextEditorActions;
|
|
12
|
-
export declare const defaultTextEditorState: TextEditorState;
|
|
13
|
-
export declare const createTextEditorStore: (initState?: Partial<TextEditorState>) => import("zustand").StoreApi<TextEditorStore>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Libraries
|
|
2
|
-
import isEqual from 'react-fast-compare';
|
|
3
|
-
import { createStore } from 'zustand';
|
|
4
|
-
export const defaultTextEditorState = {
|
|
5
|
-
bubbleMenuContainer: null,
|
|
6
|
-
isShowBubbleMenu: false,
|
|
7
|
-
};
|
|
8
|
-
export const createTextEditorStore = (initState = {}) => createStore()((set, get) => ({
|
|
9
|
-
...defaultTextEditorState,
|
|
10
|
-
...initState,
|
|
11
|
-
setBubbleMenuContainer: container => set(() => ({ bubbleMenuContainer: container })),
|
|
12
|
-
setIsShowBubbleMenu: isShow => set(() => ({ isShowBubbleMenu: isShow })),
|
|
13
|
-
setColors: newColors => {
|
|
14
|
-
const currentColors = get().colors;
|
|
15
|
-
if (isEqual(currentColors, newColors)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
set(() => ({ colors: newColors }));
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TextStyle } from './types';
|
|
3
|
-
export declare const StyledBubbleMenu: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<Partial<Omit<Pick<Partial<import("./extensions/BubbleMenu").BubbleMenuPluginProps>, "pluginKey"> & Omit<import("./extensions/BubbleMenu").BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Pick<Partial<import("./extensions/BubbleMenu").BubbleMenuPluginProps>, "pluginKey"> & Omit<import("./extensions/BubbleMenu").BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
4
|
-
export declare const StyledEditorContent: import("styled-components").StyledComponent<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@tiptap/react").EditorContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>>, any, {
|
|
5
|
-
$textStyle: TextStyle;
|
|
6
|
-
}, never>;
|
|
7
|
-
export declare const ColorBox: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
-
$color?: string | undefined;
|
|
9
|
-
}, never>;
|
|
10
|
-
export declare const ToolbarWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { EditorContent } from '@tiptap/react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
import { BubbleMenu } from './ui/BubbleMenu';
|
|
4
|
-
import { SMART_TAG_HIGHLIGHT_BG } from './constants';
|
|
5
|
-
import { Flex } from 'antd';
|
|
6
|
-
import tinycolor from 'tinycolor2';
|
|
7
|
-
export const StyledBubbleMenu = styled(BubbleMenu) `
|
|
8
|
-
background-color: white;
|
|
9
|
-
border-radius: 5px;
|
|
10
|
-
padding: 8px;
|
|
11
|
-
box-shadow: var(--antsomi-box-shadow-secondary);
|
|
12
|
-
`;
|
|
13
|
-
const dynContentStyles = css `
|
|
14
|
-
background-color: ${SMART_TAG_HIGHLIGHT_BG};
|
|
15
|
-
background-color: color-mix(
|
|
16
|
-
in lab,
|
|
17
|
-
var(--text-style-bg-color, transparent),
|
|
18
|
-
${SMART_TAG_HIGHLIGHT_BG}
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
background-color: ${SMART_TAG_HIGHLIGHT_BG};
|
|
23
|
-
background-color: color-mix(
|
|
24
|
-
in lab,
|
|
25
|
-
var(--text-style-bg-color, transparent),
|
|
26
|
-
${SMART_TAG_HIGHLIGHT_BG} 80%
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
export const StyledEditorContent = styled(EditorContent) `
|
|
31
|
-
.tiptap {
|
|
32
|
-
outline: none;
|
|
33
|
-
|
|
34
|
-
p {
|
|
35
|
-
margin: 0;
|
|
36
|
-
padding: 0;
|
|
37
|
-
|
|
38
|
-
// Some apps have global p styles, so we need to override it
|
|
39
|
-
line-height: ${p => p.$textStyle.lineHeight};
|
|
40
|
-
font-family: ${p => p.$textStyle.fontFamily};
|
|
41
|
-
color: ${p => p.$textStyle.color};
|
|
42
|
-
letter-spacing: ${p => p.$textStyle.letterSpacing};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:not([contenteditable='false']) {
|
|
46
|
-
p {
|
|
47
|
-
cursor: text;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.selection {
|
|
51
|
-
background-color: #d7cac9;
|
|
52
|
-
background-color: color-mix(in lab, var(--text-style-bg-color, transparent), #d7cac9);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.smart-tag {
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
|
|
58
|
-
&.highlight {
|
|
59
|
-
${dynContentStyles}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.link {
|
|
64
|
-
&.highlight > span {
|
|
65
|
-
${dynContentStyles}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
export const ColorBox = styled.div `
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
width: 20px;
|
|
74
|
-
height: 20px;
|
|
75
|
-
border-radius: 50%;
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
padding: 2px;
|
|
80
|
-
transition: box-shadow 0.3s ease-in-out;
|
|
81
|
-
border: 1px solid #d9d9d9;
|
|
82
|
-
background-color: ${p => p.$color};
|
|
83
|
-
|
|
84
|
-
&:hover {
|
|
85
|
-
box-shadow: 0 0 5px ${p => tinycolor(p.$color).setAlpha(0.45).toRgbString()};
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
export const ToolbarWrapper = styled(Flex) `
|
|
90
|
-
.antsomi-divider.toolbar-separator {
|
|
91
|
-
height: 28px;
|
|
92
|
-
margin: 2px;
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { JSONContent, Editor, MarkRange } from '@tiptap/core';
|
|
3
|
-
import type { Mark } from '@tiptap/pm/model';
|
|
4
|
-
import type { SmartTagAttrs } from './extensions/SmartTag';
|
|
5
|
-
import { ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE } from './constants';
|
|
6
|
-
import type { OverrideProperties } from 'type-fest';
|
|
7
|
-
export type HandleSmartTagRef = {
|
|
8
|
-
setSmartTag: (attrs: SmartTagAttrs) => void;
|
|
9
|
-
deleteSmartTag: (id: string) => void;
|
|
10
|
-
updateSmartTagAttrs: (id: string, updatedAttrs: Omit<SmartTagAttrs, 'id'>) => void;
|
|
11
|
-
};
|
|
12
|
-
export type HandleLinkRef = {
|
|
13
|
-
setLink: (params: {
|
|
14
|
-
attrs: LinkAttrs;
|
|
15
|
-
content?: string;
|
|
16
|
-
}) => void;
|
|
17
|
-
deleteLink: (predicate: (attrs: LinkAttrs) => boolean) => void;
|
|
18
|
-
updateLinkAttrs: (predicate: (currentAttrs: LinkAttrs) => boolean, updateFn: (params: {
|
|
19
|
-
currentAttrs: LinkAttrs;
|
|
20
|
-
currentContent: string;
|
|
21
|
-
}) => {
|
|
22
|
-
attrs?: LinkAttrs;
|
|
23
|
-
content?: string;
|
|
24
|
-
} | false) => void;
|
|
25
|
-
};
|
|
26
|
-
export type TextEditorRef = HandleSmartTagRef & HandleLinkRef & {
|
|
27
|
-
blur: (perserveSelection?: boolean) => void;
|
|
28
|
-
style?: CSSStyleDeclaration;
|
|
29
|
-
readonly editor: Editor | null;
|
|
30
|
-
};
|
|
31
|
-
export type SmartTagHandler = Partial<{
|
|
32
|
-
edit: (id: string, event: React.MouseEvent) => void;
|
|
33
|
-
setNew: (args: {
|
|
34
|
-
selectionText: string;
|
|
35
|
-
}) => void;
|
|
36
|
-
}>;
|
|
37
|
-
export type LinkHandler = Partial<{
|
|
38
|
-
setNew: (args: {
|
|
39
|
-
selectionText: string;
|
|
40
|
-
}) => void;
|
|
41
|
-
edit: (args: {
|
|
42
|
-
attrs: LinkAttrs;
|
|
43
|
-
selectionText: string;
|
|
44
|
-
}) => void;
|
|
45
|
-
}>;
|
|
46
|
-
export type FontConfig = {
|
|
47
|
-
fontFamily: {
|
|
48
|
-
name: string;
|
|
49
|
-
fallback?: string[];
|
|
50
|
-
};
|
|
51
|
-
fontWeight: number[];
|
|
52
|
-
};
|
|
53
|
-
export type Config = Partial<{
|
|
54
|
-
SmartTag: Partial<{
|
|
55
|
-
highlight: boolean;
|
|
56
|
-
}>;
|
|
57
|
-
Link: Partial<{
|
|
58
|
-
highlightDynamic: boolean;
|
|
59
|
-
}>;
|
|
60
|
-
FontFamily: {
|
|
61
|
-
fonts: FontConfig[];
|
|
62
|
-
};
|
|
63
|
-
UnorderedList: {
|
|
64
|
-
useCustomBullet?: boolean;
|
|
65
|
-
};
|
|
66
|
-
}>;
|
|
67
|
-
export type TextStyle = {
|
|
68
|
-
fontFamily: string;
|
|
69
|
-
fontSize: string;
|
|
70
|
-
color: string;
|
|
71
|
-
backgroundColor: string;
|
|
72
|
-
lineHeight: string;
|
|
73
|
-
fontWeight: string;
|
|
74
|
-
letterSpacing: string;
|
|
75
|
-
};
|
|
76
|
-
export type TextEditorComponentsRender = {
|
|
77
|
-
renderLinkToolbar: (linkAttrs: LinkAttrs, defaultNode: React.ReactNode, defaultToolNodes: {
|
|
78
|
-
gotoLink: React.ReactNode;
|
|
79
|
-
copy: React.ReactNode;
|
|
80
|
-
edit: React.ReactNode;
|
|
81
|
-
unlink: React.ReactNode;
|
|
82
|
-
}) => React.ReactNode;
|
|
83
|
-
};
|
|
84
|
-
export type TextEditorProps = {
|
|
85
|
-
id?: string;
|
|
86
|
-
className?: string;
|
|
87
|
-
style?: React.CSSProperties;
|
|
88
|
-
initialContent?: string;
|
|
89
|
-
config?: Config;
|
|
90
|
-
smartTagHandler?: SmartTagHandler;
|
|
91
|
-
linkHandler?: LinkHandler;
|
|
92
|
-
editable?: boolean;
|
|
93
|
-
bubbleMenuProps?: {
|
|
94
|
-
container?: HTMLElement | null;
|
|
95
|
-
};
|
|
96
|
-
defaultTextStyle?: Partial<TextStyle>;
|
|
97
|
-
dataAttributes?: Record<`data-${string}`, unknown>;
|
|
98
|
-
onUpdateDebounced?: number;
|
|
99
|
-
render?: Partial<TextEditorComponentsRender>;
|
|
100
|
-
onFocus?: (event: FocusEvent) => void;
|
|
101
|
-
onUpdate?: (args: {
|
|
102
|
-
html: string;
|
|
103
|
-
text: string;
|
|
104
|
-
json: JSONContent;
|
|
105
|
-
}) => void;
|
|
106
|
-
};
|
|
107
|
-
export type OrderedListStyleType = (typeof ORDERED_LIST_STYLE_TYPE)[keyof typeof ORDERED_LIST_STYLE_TYPE];
|
|
108
|
-
export type UnorderedListStyleType = (typeof UNORDERED_LIST_STYLE_TYPE)[keyof typeof UNORDERED_LIST_STYLE_TYPE];
|
|
109
|
-
export declare const isOrderedListStyleType: (value: unknown) => value is OrderedListStyleType;
|
|
110
|
-
export declare const isUnorderedListStyleType: (value: unknown) => value is UnorderedListStyleType;
|
|
111
|
-
export type LinkAttrs = {
|
|
112
|
-
href: string;
|
|
113
|
-
} & Partial<{
|
|
114
|
-
target: string | null;
|
|
115
|
-
rel: string | null;
|
|
116
|
-
class: string | null;
|
|
117
|
-
title: string | null;
|
|
118
|
-
data: DOMStringMap;
|
|
119
|
-
}>;
|
|
120
|
-
export type LinkMark = OverrideProperties<Mark, {
|
|
121
|
-
attrs: LinkAttrs;
|
|
122
|
-
}>;
|
|
123
|
-
export type LinkMarkRange = OverrideProperties<MarkRange, {
|
|
124
|
-
mark: LinkMark;
|
|
125
|
-
}>;
|
|
126
|
-
export declare const isLinkMark: (mark: Mark) => mark is {
|
|
127
|
-
readonly type: import("prosemirror-model").MarkType;
|
|
128
|
-
addToSet: (set: readonly Mark[]) => readonly Mark[];
|
|
129
|
-
removeFromSet: (set: readonly Mark[]) => readonly Mark[];
|
|
130
|
-
isInSet: (set: readonly Mark[]) => boolean;
|
|
131
|
-
eq: (other: Mark) => boolean;
|
|
132
|
-
toJSON: () => any;
|
|
133
|
-
attrs: LinkAttrs;
|
|
134
|
-
};
|
|
135
|
-
export declare const isLinkMarkRange: (markRange: MarkRange) => markRange is {
|
|
136
|
-
from: number;
|
|
137
|
-
to: number;
|
|
138
|
-
mark: LinkMark;
|
|
139
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CUSTOM_LINK_EXTENSION_NAME, ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE, } from './constants';
|
|
2
|
-
export const isOrderedListStyleType = (value) => typeof value === 'string' && Object.values(ORDERED_LIST_STYLE_TYPE).some(v => v === value);
|
|
3
|
-
export const isUnorderedListStyleType = (value) => typeof value === 'string' && Object.values(UNORDERED_LIST_STYLE_TYPE).some(v => v === value);
|
|
4
|
-
export const isLinkMark = (mark) => mark.type.name === CUSTOM_LINK_EXTENSION_NAME;
|
|
5
|
-
export const isLinkMarkRange = (markRange) => isLinkMark(markRange.mark);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BubbleMenuPluginProps } from '../../extensions/BubbleMenu';
|
|
3
|
-
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
4
|
-
export type BubbleMenuProps = Optional<Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'>, 'editor'> & React.HTMLAttributes<HTMLDivElement>;
|
|
5
|
-
export declare const BubbleMenu: React.ForwardRefExoticComponent<Pick<Partial<Omit<Optional<BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Optional<BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
import { useCurrentEditor } from '@tiptap/react';
|
|
4
|
-
import { forwardRef, useRef } from 'react';
|
|
5
|
-
import { createPortal } from 'react-dom';
|
|
6
|
-
import { BubbleMenuPlugin } from '../../extensions/BubbleMenu';
|
|
7
|
-
import { useDeepCompareEffect, useIsMounted } from '@antscorp/antsomi-ui/es/hooks';
|
|
8
|
-
import { useTextEditorStore } from '../../provider';
|
|
9
|
-
import clsx from 'clsx';
|
|
10
|
-
import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
|
|
11
|
-
export const BubbleMenu = forwardRef(({ pluginKey = 'bubbleMenu', editor, updateDelay, resizeDelay, shouldShow = null, options, children, container, className, ...restProps }, ref) => {
|
|
12
|
-
const menuEl = useRef(document.createElement('div'));
|
|
13
|
-
const isMounted = useIsMounted();
|
|
14
|
-
const setIsShowBubbleMenu = useTextEditorStore(state => state.setIsShowBubbleMenu);
|
|
15
|
-
if (typeof ref === 'function') {
|
|
16
|
-
ref(menuEl.current);
|
|
17
|
-
}
|
|
18
|
-
else if (ref) {
|
|
19
|
-
ref.current = menuEl.current;
|
|
20
|
-
}
|
|
21
|
-
const { editor: currentEditor } = useCurrentEditor();
|
|
22
|
-
useDeepCompareEffect(() => {
|
|
23
|
-
const bubbleMenuElement = menuEl.current;
|
|
24
|
-
bubbleMenuElement.className = clsx(className, `${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor-bubble-menu`);
|
|
25
|
-
if (editor?.isDestroyed || currentEditor?.isDestroyed) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const attachToEditor = editor || currentEditor;
|
|
29
|
-
if (!attachToEditor) {
|
|
30
|
-
console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const plugin = BubbleMenuPlugin({
|
|
34
|
-
updateDelay,
|
|
35
|
-
resizeDelay,
|
|
36
|
-
editor: attachToEditor,
|
|
37
|
-
element: bubbleMenuElement,
|
|
38
|
-
container,
|
|
39
|
-
pluginKey,
|
|
40
|
-
options: {
|
|
41
|
-
...options,
|
|
42
|
-
strategy: options?.strategy || 'absolute',
|
|
43
|
-
placement: options?.placement || 'top-start',
|
|
44
|
-
offset: options?.offset || {
|
|
45
|
-
alignmentAxis: -20,
|
|
46
|
-
mainAxis: 10,
|
|
47
|
-
},
|
|
48
|
-
onShow: () => {
|
|
49
|
-
if (isMounted()) {
|
|
50
|
-
setIsShowBubbleMenu(true);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
onHide: () => {
|
|
54
|
-
if (isMounted()) {
|
|
55
|
-
setIsShowBubbleMenu(false);
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
shouldShow,
|
|
60
|
-
});
|
|
61
|
-
attachToEditor.registerPlugin(plugin);
|
|
62
|
-
return () => {
|
|
63
|
-
attachToEditor.unregisterPlugin(pluginKey);
|
|
64
|
-
window.requestAnimationFrame(() => {
|
|
65
|
-
if (bubbleMenuElement.parentNode) {
|
|
66
|
-
bubbleMenuElement.parentNode.removeChild(bubbleMenuElement);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
}, [
|
|
71
|
-
editor,
|
|
72
|
-
container,
|
|
73
|
-
updateDelay,
|
|
74
|
-
resizeDelay,
|
|
75
|
-
pluginKey,
|
|
76
|
-
options,
|
|
77
|
-
className,
|
|
78
|
-
currentEditor,
|
|
79
|
-
isMounted,
|
|
80
|
-
shouldShow,
|
|
81
|
-
setIsShowBubbleMenu,
|
|
82
|
-
]);
|
|
83
|
-
return createPortal(_jsx("div", { ...restProps, children: children }), menuEl.current);
|
|
84
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BubbleMenu, type BubbleMenuProps } from './BubbleMenu';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BubbleMenu } from './BubbleMenu';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const BubbleToolbar: () => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const BubbleToolbar = () => { };
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
const StyledButton = styled(Button) `
|
|
6
|
-
&.antsomi-btn.antsomi-btn-text {
|
|
7
|
-
height: 36px;
|
|
8
|
-
width: 36px;
|
|
9
|
-
padding: 0;
|
|
10
|
-
flex-shrink: 0;
|
|
11
|
-
border-radius: 4px;
|
|
12
|
-
|
|
13
|
-
&.is-active {
|
|
14
|
-
background-color: #e0ebf7;
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
17
|
-
background-color: #e0ebf7;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:hover:not(:disabled, .is-active) {
|
|
22
|
-
background-color: #ebebeb;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
export const TextEditorButton = (props) => {
|
|
27
|
-
const { children, isActive, tooltipProps, className, disabled, ...restProps } = props;
|
|
28
|
-
return (_jsx(Tooltip, { mouseEnterDelay: 0.4, placement: "top", ...tooltipProps, open: disabled ? false : tooltipProps?.open, children: _jsx(StyledButton, { ...restProps, disabled: disabled, type: "text", className: clsx(className, {
|
|
29
|
-
'is-active': isActive,
|
|
30
|
-
}), children: children }) }));
|
|
31
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TextEditorButton } from './Button';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from 'antd';
|
|
3
|
-
export type TextEditorButtonProps = {
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
tooltipProps?: {
|
|
7
|
-
title?: string;
|
|
8
|
-
open?: boolean;
|
|
9
|
-
};
|
|
10
|
-
} & Pick<ButtonProps, 'icon' | 'onClick' | 'className' | 'disabled' | 'className'>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PopoverProps } from 'antd/lib';
|
|
3
|
-
export interface ColorPickerProps {
|
|
4
|
-
value?: string;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
onChange?: (value: string) => void;
|
|
7
|
-
popoverProps?: Omit<PopoverProps, 'content'> & {
|
|
8
|
-
content?: ((args: {
|
|
9
|
-
colorGrid: React.ReactNode;
|
|
10
|
-
usedColors: React.ReactNode;
|
|
11
|
-
customColorPicker: React.ReactNode;
|
|
12
|
-
}) => React.ReactNode) | React.ReactNode;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface ColorPickerRef {
|
|
16
|
-
setOpen: (open: boolean) => void;
|
|
17
|
-
}
|
|
18
|
-
export interface UsedColorsProps {
|
|
19
|
-
value?: string;
|
|
20
|
-
onChange?: (value: string) => void;
|
|
21
|
-
}
|
|
22
|
-
export interface GridColorProps {
|
|
23
|
-
value?: string;
|
|
24
|
-
colorGrid?: string[][];
|
|
25
|
-
onChange?: (value: string) => void;
|
|
26
|
-
}
|
|
27
|
-
export interface UseUsedColorsParams {
|
|
28
|
-
numberOfColors?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface BoxColorProps {
|
|
31
|
-
color?: string;
|
|
32
|
-
isActive?: boolean;
|
|
33
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
34
|
-
}
|
|
35
|
-
export interface CustomColorPickerProps {
|
|
36
|
-
currentColor: string;
|
|
37
|
-
onApply?: (value: string) => void;
|
|
38
|
-
}
|
|
39
|
-
export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<ColorPickerRef>>;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/no-array-index-key */
|
|
3
|
-
import { ColorPicker as AntdColorPicker, Button, Col, Flex, Row, Typography } from 'antd';
|
|
4
|
-
import tinycolor from 'tinycolor2';
|
|
5
|
-
import { chunk } from 'lodash';
|
|
6
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../constants';
|
|
7
|
-
import clsx from 'clsx';
|
|
8
|
-
import { forwardRef, useEffect, useState, useImperativeHandle } from 'react';
|
|
9
|
-
import { useDebouncedCallback } from 'use-debounce';
|
|
10
|
-
import { useTextEditorStore } from '../../provider';
|
|
11
|
-
import { ColorBox } from '../../styled';
|
|
12
|
-
import { TextEditorPopover } from '../Popover';
|
|
13
|
-
import { useColorSet } from '../../hooks';
|
|
14
|
-
import { CheckSlimIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
15
|
-
const { COLOR_GIRD } = TEXT_EDITOR_CONSTANTS;
|
|
16
|
-
const useUsedColors = (params) => {
|
|
17
|
-
const { numberOfColors = 10 } = params || {};
|
|
18
|
-
const { colors: usedColors, setColors: updateColor } = useColorSet();
|
|
19
|
-
const addColor = (color) => {
|
|
20
|
-
const updatedColors = [...usedColors];
|
|
21
|
-
if (!usedColors.includes(color)) {
|
|
22
|
-
updatedColors.push(color);
|
|
23
|
-
if (usedColors.length >= numberOfColors) {
|
|
24
|
-
updatedColors.shift();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
updateColor(updatedColors);
|
|
28
|
-
};
|
|
29
|
-
return { usedColors, addColor };
|
|
30
|
-
};
|
|
31
|
-
const CustomColorPicker = (props) => {
|
|
32
|
-
const { onApply, currentColor } = props;
|
|
33
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
34
|
-
const [color, setColor] = useState(currentColor || tinycolor('red').toHex());
|
|
35
|
-
const { addColor: addUsedColor } = useUsedColors();
|
|
36
|
-
const bubbleMenuContainer = useTextEditorStore(state => state.bubbleMenuContainer);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (tinycolor(currentColor).isValid()) {
|
|
39
|
-
setColor(currentColor);
|
|
40
|
-
}
|
|
41
|
-
}, [currentColor]);
|
|
42
|
-
const handleChangeColor = useDebouncedCallback((newColor) => {
|
|
43
|
-
setColor(newColor);
|
|
44
|
-
}, 50);
|
|
45
|
-
const handleClose = () => {
|
|
46
|
-
if (tinycolor(currentColor).isValid()) {
|
|
47
|
-
setColor(currentColor);
|
|
48
|
-
}
|
|
49
|
-
setIsOpen(false);
|
|
50
|
-
};
|
|
51
|
-
const handleOpenChange = (visible) => {
|
|
52
|
-
if (visible)
|
|
53
|
-
return setIsOpen(true);
|
|
54
|
-
handleClose();
|
|
55
|
-
};
|
|
56
|
-
const handleApply = () => {
|
|
57
|
-
addUsedColor(color);
|
|
58
|
-
onApply?.(color);
|
|
59
|
-
handleClose();
|
|
60
|
-
};
|
|
61
|
-
return (_jsx(AntdColorPicker, { getPopupContainer: () => bubbleMenuContainer || document.body, open: isOpen, value: color, placement: "bottomRight", panelRender: panel => (_jsxs(_Fragment, { children: [panel, _jsxs(Flex, { justify: "end", gap: 8, style: { marginTop: 10 }, children: [_jsx(Button, { type: "text", onClick: handleClose, children: "Cancel" }), _jsx(Button, { type: "primary", onClick: handleApply, children: "Apply" })] })] })), onChange: newColor => {
|
|
62
|
-
handleChangeColor(newColor.toRgbString());
|
|
63
|
-
}, onOpenChange: handleOpenChange, children: _jsx(Button, { children: "Customize" }) }));
|
|
64
|
-
};
|
|
65
|
-
const ColorSwatch = (props) => {
|
|
66
|
-
const { color, isActive, onClick } = props;
|
|
67
|
-
const handleClick = (e) => {
|
|
68
|
-
e.stopPropagation();
|
|
69
|
-
onClick?.(e);
|
|
70
|
-
};
|
|
71
|
-
return (_jsx(ColorBox, { "$color": color, className: clsx({
|
|
72
|
-
'is-active': isActive,
|
|
73
|
-
}), onClick: handleClick, children: isActive ? _jsx(CheckSlimIcon, { color: tinycolor(color).isDark() ? 'white' : 'black' }) : null }));
|
|
74
|
-
};
|
|
75
|
-
const UsedColors = (props) => {
|
|
76
|
-
const { onChange, value } = props;
|
|
77
|
-
const { usedColors, addColor: addUsedColor } = useUsedColors();
|
|
78
|
-
const rowColorSize = COLOR_GIRD[0].length;
|
|
79
|
-
const handleClick = (color) => {
|
|
80
|
-
addUsedColor(color);
|
|
81
|
-
onChange?.(color);
|
|
82
|
-
};
|
|
83
|
-
if (usedColors.length === 0) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
return (_jsxs(Flex, { vertical: true, gap: 2, children: [_jsx(Typography.Text, { children: "Recently used" }), chunk(usedColors, rowColorSize).map((row, rowIndex) => (_jsx(Row, { gutter: [2, 2], children: row.map((color, colIndex) => (_jsx(Col, { span: 24 / rowColorSize, children: _jsx(ColorSwatch, { color: color, isActive: color === value, onClick: () => handleClick(color) }) }, `${rowIndex}-${colIndex}`))) }, rowIndex)))] }));
|
|
87
|
-
};
|
|
88
|
-
const GridColor = (props) => {
|
|
89
|
-
const { onChange, value, colorGrid = COLOR_GIRD } = props;
|
|
90
|
-
const rowColorSize = colorGrid[0].length;
|
|
91
|
-
const { addColor: addUsedColor } = useUsedColors();
|
|
92
|
-
const handleClick = (color) => {
|
|
93
|
-
addUsedColor(color);
|
|
94
|
-
onChange?.(color);
|
|
95
|
-
};
|
|
96
|
-
return (_jsx(Flex, { vertical: true, gap: 2, children: colorGrid.map((row, rowIndex) => (_jsx(Row, { gutter: [2, 2], wrap: false, children: row.map((color, colIndex) => (_jsx(Col, { span: 24 / rowColorSize, children: _jsx(ColorSwatch, { color: color, isActive: tinycolor.equals(color, value), onClick: () => handleClick(color) }) }, `${rowIndex}-${colIndex}`))) }, rowIndex))) }));
|
|
97
|
-
};
|
|
98
|
-
export const ColorPicker = forwardRef((props, ref) => {
|
|
99
|
-
const { value = '', onChange, children, popoverProps } = props;
|
|
100
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (popoverProps?.open !== undefined) {
|
|
103
|
-
setIsOpen(popoverProps.open);
|
|
104
|
-
}
|
|
105
|
-
}, [popoverProps?.open]);
|
|
106
|
-
const handleChangeOpen = (open) => {
|
|
107
|
-
setIsOpen(open);
|
|
108
|
-
if (popoverProps?.onOpenChange) {
|
|
109
|
-
popoverProps.onOpenChange(open);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const handleOnChange = (color) => {
|
|
113
|
-
onChange?.(color);
|
|
114
|
-
handleChangeOpen(false);
|
|
115
|
-
};
|
|
116
|
-
useImperativeHandle(ref, () => ({
|
|
117
|
-
setOpen: handleChangeOpen,
|
|
118
|
-
}));
|
|
119
|
-
const colorGrid = _jsx(GridColor, { onChange: handleOnChange, value: value });
|
|
120
|
-
const usedColors = _jsx(UsedColors, { onChange: handleOnChange, value: value });
|
|
121
|
-
const customColorPicker = _jsx(CustomColorPicker, { currentColor: value, onApply: handleOnChange });
|
|
122
|
-
let content = (_jsxs(Flex, { vertical: true, gap: 8, children: [colorGrid, usedColors, customColorPicker] }));
|
|
123
|
-
if (typeof popoverProps?.content === 'function') {
|
|
124
|
-
content = popoverProps.content({
|
|
125
|
-
colorGrid,
|
|
126
|
-
usedColors,
|
|
127
|
-
customColorPicker,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return (_jsx(TextEditorPopover, { placement: "bottomLeft", ...popoverProps, open: isOpen, content: content, onOpenChange: handleChangeOpen, children: children }));
|
|
131
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ColorPicker } from './ColorPicker';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ColorPicker } from './ColorPicker';
|