@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,398 @@
|
|
|
1
|
+
import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
|
|
2
|
+
import { formatHotkey } from '@antscorp/antsomi-ui/es/utils';
|
|
3
|
+
const COLOR_GIRD = [
|
|
4
|
+
// Dòng đầu: màu chuẩn
|
|
5
|
+
[
|
|
6
|
+
'#000000',
|
|
7
|
+
'#434343',
|
|
8
|
+
'#666666',
|
|
9
|
+
'#999999',
|
|
10
|
+
'#B7B7B7',
|
|
11
|
+
'#CCCCCC',
|
|
12
|
+
'#D9D9D9',
|
|
13
|
+
'#EFEFEF',
|
|
14
|
+
'#F3F3F3',
|
|
15
|
+
'#FFFFFF',
|
|
16
|
+
],
|
|
17
|
+
// Dòng 2: màu cơ bản
|
|
18
|
+
[
|
|
19
|
+
'#980000',
|
|
20
|
+
'#FF0000',
|
|
21
|
+
'#FF9900',
|
|
22
|
+
'#FFFF00',
|
|
23
|
+
'#00FF00',
|
|
24
|
+
'#00FFFF',
|
|
25
|
+
'#4A86E8',
|
|
26
|
+
'#0000FF',
|
|
27
|
+
'#9900FF',
|
|
28
|
+
'#FF00FF',
|
|
29
|
+
],
|
|
30
|
+
// Dòng 3+
|
|
31
|
+
[
|
|
32
|
+
'#E6B8AF',
|
|
33
|
+
'#F4CCCC',
|
|
34
|
+
'#FCE5CD',
|
|
35
|
+
'#FFF2CC',
|
|
36
|
+
'#D9EAD3',
|
|
37
|
+
'#D0E0E3',
|
|
38
|
+
'#C9DAF8',
|
|
39
|
+
'#CFE2F3',
|
|
40
|
+
'#D9D2E9',
|
|
41
|
+
'#EAD1DC',
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
'#DD7E6B',
|
|
45
|
+
'#EA9999',
|
|
46
|
+
'#F9CB9C',
|
|
47
|
+
'#FFE599',
|
|
48
|
+
'#B6D7A8',
|
|
49
|
+
'#A2C4C9',
|
|
50
|
+
'#A4C2F4',
|
|
51
|
+
'#9FC5E8',
|
|
52
|
+
'#B4A7D6',
|
|
53
|
+
'#D5A6BD',
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
'#CC4125',
|
|
57
|
+
'#E06666',
|
|
58
|
+
'#F6B26B',
|
|
59
|
+
'#FFD966',
|
|
60
|
+
'#93C47D',
|
|
61
|
+
'#76A5AF',
|
|
62
|
+
'#6D9EEB',
|
|
63
|
+
'#6FA8DC',
|
|
64
|
+
'#8E7CC3',
|
|
65
|
+
'#C27BA0',
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
'#A61C00',
|
|
69
|
+
'#CC0000',
|
|
70
|
+
'#E69138',
|
|
71
|
+
'#F1C232',
|
|
72
|
+
'#6AA84F',
|
|
73
|
+
'#45818E',
|
|
74
|
+
'#3C78D8',
|
|
75
|
+
'#3D85C6',
|
|
76
|
+
'#674EA7',
|
|
77
|
+
'#A64D79',
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
'#85200C',
|
|
81
|
+
'#990000',
|
|
82
|
+
'#B45F06',
|
|
83
|
+
'#BF9000',
|
|
84
|
+
'#38761D',
|
|
85
|
+
'#134F5C',
|
|
86
|
+
'#1155CC',
|
|
87
|
+
'#0B5394',
|
|
88
|
+
'#351C75',
|
|
89
|
+
'#741B47',
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
'#5B0F00',
|
|
93
|
+
'#660000',
|
|
94
|
+
'#783F04',
|
|
95
|
+
'#7F6000',
|
|
96
|
+
'#274E13',
|
|
97
|
+
'#0C343D',
|
|
98
|
+
'#1C4587',
|
|
99
|
+
'#073763',
|
|
100
|
+
'#20124D',
|
|
101
|
+
'#4C1130',
|
|
102
|
+
],
|
|
103
|
+
];
|
|
104
|
+
// TextAlignSelect component
|
|
105
|
+
const TEXT_ALIGN = {
|
|
106
|
+
TITLE: 'Text Align',
|
|
107
|
+
OPTIONS: {
|
|
108
|
+
LEFT: {
|
|
109
|
+
LABEL: 'Left',
|
|
110
|
+
VALUE: 'left',
|
|
111
|
+
},
|
|
112
|
+
CENTER: {
|
|
113
|
+
LABEL: 'Center',
|
|
114
|
+
VALUE: 'center',
|
|
115
|
+
},
|
|
116
|
+
RIGHT: {
|
|
117
|
+
LABEL: 'Right',
|
|
118
|
+
VALUE: 'right',
|
|
119
|
+
},
|
|
120
|
+
JUSTIFY: {
|
|
121
|
+
LABEL: 'Justify',
|
|
122
|
+
VALUE: 'justify',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
TOOLTIP: 'Align',
|
|
126
|
+
};
|
|
127
|
+
// TextTransformAction component
|
|
128
|
+
const TEXT_TRANSFORM = {
|
|
129
|
+
PLACEHOLDER: 'Text Transform',
|
|
130
|
+
OPTIONS: {
|
|
131
|
+
UPPERCASE: {
|
|
132
|
+
LABEL: 'UPPERCASE',
|
|
133
|
+
VALUE: 'uppercase',
|
|
134
|
+
},
|
|
135
|
+
LOWERCASE: {
|
|
136
|
+
LABEL: 'lowercase',
|
|
137
|
+
VALUE: 'lowercase',
|
|
138
|
+
},
|
|
139
|
+
CAPITALIZE: {
|
|
140
|
+
LABEL: 'Capitalize',
|
|
141
|
+
VALUE: 'capitalize',
|
|
142
|
+
},
|
|
143
|
+
NONE: {
|
|
144
|
+
LABEL: 'none',
|
|
145
|
+
VALUE: 'none',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
const TOOLTIPS = {
|
|
150
|
+
BOLD: {
|
|
151
|
+
TITLE: 'Bold',
|
|
152
|
+
SHORTCUT: formatHotkey('B'),
|
|
153
|
+
},
|
|
154
|
+
ITALIC: {
|
|
155
|
+
TITLE: 'Italic',
|
|
156
|
+
SHORTCUT: formatHotkey('I'),
|
|
157
|
+
},
|
|
158
|
+
UNDERLINE: {
|
|
159
|
+
TITLE: 'Underline',
|
|
160
|
+
SHORTCUT: formatHotkey('U'),
|
|
161
|
+
},
|
|
162
|
+
STRIKE: {
|
|
163
|
+
TITLE: 'Strike',
|
|
164
|
+
SHORTCUT: formatHotkey('S'),
|
|
165
|
+
},
|
|
166
|
+
BULLET_LIST: {
|
|
167
|
+
TITLE: 'Unordered List',
|
|
168
|
+
SHORTCUT: formatHotkey('8'),
|
|
169
|
+
},
|
|
170
|
+
ORDERED_LIST: {
|
|
171
|
+
TITLE: 'Ordered List',
|
|
172
|
+
SHORTCUT: formatHotkey('7'),
|
|
173
|
+
},
|
|
174
|
+
CLEAR_FORMATTING: {
|
|
175
|
+
TITLE: 'Clear Formatting',
|
|
176
|
+
SHORTCUT: formatHotkey('\\'),
|
|
177
|
+
},
|
|
178
|
+
FONT_FAMILY: {
|
|
179
|
+
PLACEHOLDER: 'Font Family',
|
|
180
|
+
},
|
|
181
|
+
FONT_SIZE: {
|
|
182
|
+
PLACEHOLDER: 'Font Size',
|
|
183
|
+
},
|
|
184
|
+
HIGHLIGHT: {
|
|
185
|
+
TITLE: 'Text Background',
|
|
186
|
+
},
|
|
187
|
+
INDENT: {
|
|
188
|
+
TITLE: 'Indent',
|
|
189
|
+
SHORTCUT: 'Tab',
|
|
190
|
+
},
|
|
191
|
+
OUTDENT: {
|
|
192
|
+
TITLE: 'Outdent',
|
|
193
|
+
SHORTCUT: 'Shift+Tab',
|
|
194
|
+
},
|
|
195
|
+
LINK: {
|
|
196
|
+
TITLE: 'Link',
|
|
197
|
+
},
|
|
198
|
+
SMART_TAG: {
|
|
199
|
+
TITLE: 'Smart Tag',
|
|
200
|
+
},
|
|
201
|
+
SUPERSCRIPT: {
|
|
202
|
+
TITLE: 'Superscript',
|
|
203
|
+
SHORTCUT: formatHotkey('.'),
|
|
204
|
+
},
|
|
205
|
+
SUBSCRIPT: {
|
|
206
|
+
TITLE: 'Subscript',
|
|
207
|
+
SHORTCUT: formatHotkey(','),
|
|
208
|
+
},
|
|
209
|
+
TEXT_COLOR: {
|
|
210
|
+
TITLE: 'Text Color',
|
|
211
|
+
},
|
|
212
|
+
UNDO: {
|
|
213
|
+
TITLE: 'Undo',
|
|
214
|
+
SHORTCUT: formatHotkey('Z'),
|
|
215
|
+
},
|
|
216
|
+
REDO: {
|
|
217
|
+
TITLE: 'Redo',
|
|
218
|
+
SHORTCUT: formatHotkey('Y'),
|
|
219
|
+
},
|
|
220
|
+
LETTER_SPACING: {
|
|
221
|
+
TITLE: 'Letter Spacing',
|
|
222
|
+
},
|
|
223
|
+
LINE_SPACING: {
|
|
224
|
+
TITLE: 'Line Spacing',
|
|
225
|
+
},
|
|
226
|
+
EMOJI: {
|
|
227
|
+
TITLE: 'Emoji',
|
|
228
|
+
},
|
|
229
|
+
TEXT_TRANSFORM: {
|
|
230
|
+
TITLE: 'Text Transform',
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
export const DEFAULT_TEXT_STYLE = {
|
|
234
|
+
fontSize: '22px',
|
|
235
|
+
color: '#000',
|
|
236
|
+
fontFamily: 'inherit',
|
|
237
|
+
backgroundColor: 'inherit',
|
|
238
|
+
lineHeight: '1.15',
|
|
239
|
+
fontWeight: 'inherit',
|
|
240
|
+
letterSpacing: '0px',
|
|
241
|
+
};
|
|
242
|
+
export const FONT_WEIGHT_LABELS = {
|
|
243
|
+
thin: 'Thin',
|
|
244
|
+
extraLight: 'Extra Light',
|
|
245
|
+
light: 'Light',
|
|
246
|
+
normal: 'Normal',
|
|
247
|
+
medium: 'Medium',
|
|
248
|
+
semiBold: 'Semi Bold',
|
|
249
|
+
bold: 'Bold',
|
|
250
|
+
extraBold: 'Extra Bold',
|
|
251
|
+
black: 'Black',
|
|
252
|
+
};
|
|
253
|
+
export const FONT_WEIGHT_MAP = {
|
|
254
|
+
100: FONT_WEIGHT_LABELS.thin,
|
|
255
|
+
200: FONT_WEIGHT_LABELS.extraLight,
|
|
256
|
+
300: FONT_WEIGHT_LABELS.light,
|
|
257
|
+
400: FONT_WEIGHT_LABELS.normal,
|
|
258
|
+
500: FONT_WEIGHT_LABELS.medium,
|
|
259
|
+
600: FONT_WEIGHT_LABELS.semiBold,
|
|
260
|
+
700: FONT_WEIGHT_LABELS.bold,
|
|
261
|
+
800: FONT_WEIGHT_LABELS.extraBold,
|
|
262
|
+
900: FONT_WEIGHT_LABELS.black,
|
|
263
|
+
};
|
|
264
|
+
export const DEFAULT_FONT_CONFIGS = [
|
|
265
|
+
{
|
|
266
|
+
fontFamily: { name: 'Arial', fallback: ['Helvetica', 'sans-serif'] },
|
|
267
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
fontFamily: { name: 'Roboto', fallback: ['Helvetica', 'sans-serif'] }, // Google Font, not inherently system-wide
|
|
271
|
+
fontWeight: [100, 300, 400, 500, 700, 900],
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
fontFamily: { name: 'Georgia', fallback: ['serif'] },
|
|
275
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
fontFamily: { name: 'Helvetica', fallback: ['Arial', 'sans-serif'] },
|
|
279
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
fontFamily: { name: 'Lucida Grande', fallback: ['Lucida Sans Unicode', 'sans-serif'] },
|
|
283
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
fontFamily: { name: 'Tahoma', fallback: ['Helvetica', 'sans-serif'] },
|
|
287
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
fontFamily: { name: 'Times New Roman', fallback: ['Times', 'serif'] },
|
|
291
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
fontFamily: { name: 'Verdana', fallback: ['Helvetica', 'sans-serif'] },
|
|
295
|
+
fontWeight: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
export const LINK_TEXT_COLOR = 'rgb(0, 102, 204)';
|
|
299
|
+
export const COMPONENT_CLS = `${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor`;
|
|
300
|
+
export const TEXT_EDITOR_CONSTANTS = {
|
|
301
|
+
COLOR_GIRD,
|
|
302
|
+
TEXT_ALIGN,
|
|
303
|
+
TEXT_TRANSFORM,
|
|
304
|
+
TOOLTIPS,
|
|
305
|
+
LINK_TEXT_COLOR,
|
|
306
|
+
};
|
|
307
|
+
export const ORDERED_LIST_STYLE_TYPE = {
|
|
308
|
+
decimal: 'decimal', // 1, 2, 3, ...
|
|
309
|
+
lowerAlpha: 'lower-alpha', // a, b, c, ...
|
|
310
|
+
upperAlpha: 'upper-alpha', // A, B, C, ...
|
|
311
|
+
lowerRoman: 'lower-roman', // i, ii, iii, ...
|
|
312
|
+
upperRoman: 'upper-roman', // I, II, III, ...
|
|
313
|
+
lowerGreek: 'lower-greek', // α, β, γ, ...
|
|
314
|
+
decimalLeadingZero: 'decimal-leading-zero', // 01, 02, 03, ...
|
|
315
|
+
};
|
|
316
|
+
export const UNORDERED_LIST_STYLE_TYPE = {
|
|
317
|
+
disc: 'disc', // •
|
|
318
|
+
circle: 'circle', // ○
|
|
319
|
+
square: 'square', // ■
|
|
320
|
+
custom: 'custom',
|
|
321
|
+
};
|
|
322
|
+
export const CUSTOM_LINK_EXTENSION_NAME = 'custom_link';
|
|
323
|
+
export const DEFAULT_FONT_GROUPING = {
|
|
324
|
+
standard: {
|
|
325
|
+
key: 'web_safe_fonts',
|
|
326
|
+
label: 'Standard',
|
|
327
|
+
},
|
|
328
|
+
nonStandard: {
|
|
329
|
+
key: 'custom_fonts',
|
|
330
|
+
label: 'Non-standard',
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* All available toolbar actions in default order
|
|
335
|
+
*/
|
|
336
|
+
export const ALL_TOOLBAR_ACTIONS = [
|
|
337
|
+
// Row 1: Text formatting and styling
|
|
338
|
+
'fontFamily',
|
|
339
|
+
'fontSize',
|
|
340
|
+
'bold',
|
|
341
|
+
'italic',
|
|
342
|
+
'underline',
|
|
343
|
+
'link',
|
|
344
|
+
'strike',
|
|
345
|
+
'superscript',
|
|
346
|
+
'subscript',
|
|
347
|
+
'textTransform',
|
|
348
|
+
'textColor',
|
|
349
|
+
'backgroundColor',
|
|
350
|
+
'emoji',
|
|
351
|
+
'smartTag',
|
|
352
|
+
// Row 2: Lists, alignment, and utilities
|
|
353
|
+
'bulletList',
|
|
354
|
+
'orderedList',
|
|
355
|
+
'textAlign',
|
|
356
|
+
'lineSpacing',
|
|
357
|
+
'letterSpacing',
|
|
358
|
+
'indent',
|
|
359
|
+
'outdent',
|
|
360
|
+
'history',
|
|
361
|
+
'clearFormatting',
|
|
362
|
+
];
|
|
363
|
+
/**
|
|
364
|
+
* Default grouping of toolbar actions into rows
|
|
365
|
+
*/
|
|
366
|
+
export const DEFAULT_TOOLBAR_GROUPING = [
|
|
367
|
+
// Row 1
|
|
368
|
+
[
|
|
369
|
+
'fontFamily',
|
|
370
|
+
'fontSize',
|
|
371
|
+
'bold',
|
|
372
|
+
'italic',
|
|
373
|
+
'underline',
|
|
374
|
+
'link',
|
|
375
|
+
'strike',
|
|
376
|
+
'superscript',
|
|
377
|
+
'subscript',
|
|
378
|
+
'textTransform',
|
|
379
|
+
'textColor',
|
|
380
|
+
'backgroundColor',
|
|
381
|
+
'emoji',
|
|
382
|
+
'smartTag',
|
|
383
|
+
],
|
|
384
|
+
// Row 2
|
|
385
|
+
[
|
|
386
|
+
'bulletList',
|
|
387
|
+
'orderedList',
|
|
388
|
+
'textAlign',
|
|
389
|
+
'lineSpacing',
|
|
390
|
+
'letterSpacing',
|
|
391
|
+
'indent',
|
|
392
|
+
'outdent',
|
|
393
|
+
'history',
|
|
394
|
+
'clearFormatting',
|
|
395
|
+
],
|
|
396
|
+
];
|
|
397
|
+
// eslint-disable-next-line no-control-regex
|
|
398
|
+
export const ATTR_WHITESPACE = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export type BackgroundColorOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* The types where the color can be applied
|
|
5
|
+
* @default ['textStyle']
|
|
6
|
+
* @example ['heading', 'paragraph']
|
|
7
|
+
*/
|
|
8
|
+
types: string[];
|
|
9
|
+
defaultBackgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
backgroundColor: {
|
|
14
|
+
/**
|
|
15
|
+
* Set the background color
|
|
16
|
+
*/
|
|
17
|
+
setBackgroundColor: (color: string) => ReturnType;
|
|
18
|
+
/**
|
|
19
|
+
* Unset the background color
|
|
20
|
+
*/
|
|
21
|
+
unsetBackgroundColor: () => ReturnType;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export declare const BackgroundColor: Extension<BackgroundColorOptions, any>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { DEFAULT_TEXT_STYLE } from '../constants';
|
|
3
|
+
import tinycolor from 'tinycolor2';
|
|
4
|
+
export const BackgroundColor = Extension.create({
|
|
5
|
+
name: 'backgroundColor',
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
types: ['textStyle'],
|
|
9
|
+
defaultBackgroundColor: DEFAULT_TEXT_STYLE.backgroundColor,
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
addGlobalAttributes() {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
types: this.options.types,
|
|
16
|
+
attributes: {
|
|
17
|
+
backgroundColor: {
|
|
18
|
+
default: this.options.defaultBackgroundColor,
|
|
19
|
+
parseHTML: element => element.style.backgroundColor?.replace(/['"]+/g, ''),
|
|
20
|
+
renderHTML: attributes => {
|
|
21
|
+
if (!tinycolor(attributes.backgroundColor).isValid()) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const { backgroundColor } = attributes;
|
|
25
|
+
return {
|
|
26
|
+
style: `--text-style-bg-color: ${backgroundColor}; background-color: ${backgroundColor};`,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
},
|
|
34
|
+
addCommands() {
|
|
35
|
+
return {
|
|
36
|
+
setBackgroundColor: color => ({ chain }) => chain().setMark('textStyle', { backgroundColor: color }).run(),
|
|
37
|
+
unsetBackgroundColor: () => ({ chain }) => chain()
|
|
38
|
+
.setMark('textStyle', { backgroundColor: this.options.defaultBackgroundColor || null })
|
|
39
|
+
.removeEmptyTextStyle()
|
|
40
|
+
.run(),
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EditorState } from '@tiptap/pm/state';
|
|
2
|
+
import { BubbleMenuView as TiptapBubbleMenuView } from '@tiptap/extension-bubble-menu';
|
|
3
|
+
import { Plugin } from '@tiptap/pm/state';
|
|
4
|
+
import type { EditorView } from '@tiptap/pm/view';
|
|
5
|
+
import type { BubbleMenuPluginProps, BubbleMenuViewProps } from '@tiptap/extension-bubble-menu';
|
|
6
|
+
export declare class BubbleMenuView extends TiptapBubbleMenuView {
|
|
7
|
+
private resizeObserver;
|
|
8
|
+
constructor(props: BubbleMenuViewProps);
|
|
9
|
+
/**
|
|
10
|
+
* Sets up ResizeObserver to watch for bubble menu element size changes.
|
|
11
|
+
* This ensures the bubble menu position is updated when the element resizes
|
|
12
|
+
* due to React component rendering different children, not just when the window resizes.
|
|
13
|
+
*/
|
|
14
|
+
setupResizeObserver: () => void;
|
|
15
|
+
updateHandler: (view: EditorView, selectionChanged: boolean, docChanged: boolean, oldState?: EditorState) => void;
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const BubbleMenuPlugin: (options: BubbleMenuPluginProps) => Plugin<any>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BubbleMenuView as TiptapBubbleMenuView } from '@tiptap/extension-bubble-menu';
|
|
2
|
+
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
export class BubbleMenuView extends TiptapBubbleMenuView {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
/**
|
|
7
|
+
* Sets up ResizeObserver to watch for bubble menu element size changes.
|
|
8
|
+
* This ensures the bubble menu position is updated when the element resizes
|
|
9
|
+
* due to React component rendering different children, not just when the window resizes.
|
|
10
|
+
*/
|
|
11
|
+
this.setupResizeObserver = () => {
|
|
12
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
13
|
+
// ResizeObserver is not supported in this environment
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Timer for debouncing the visibility restoration after resize
|
|
17
|
+
let resizeTimer = null;
|
|
18
|
+
// Time to wait before showing the element again after resize stops
|
|
19
|
+
const DEBOUNCE_TIME = this.resizeDelay + 50;
|
|
20
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
// Only handle resize events for the bubble menu element itself
|
|
23
|
+
if (entry.target === this.element) {
|
|
24
|
+
// Temporarily hide the element to prevent visual glitches during resize
|
|
25
|
+
// This prevents the bubble menu from "jumping" or flickering while repositioning
|
|
26
|
+
this.element.style.visibility = 'hidden';
|
|
27
|
+
this.element.style.opacity = '0';
|
|
28
|
+
// Clear any existing timer to reset the debounce period
|
|
29
|
+
if (resizeTimer) {
|
|
30
|
+
clearTimeout(resizeTimer);
|
|
31
|
+
}
|
|
32
|
+
// Immediately update the position with no delay for responsive positioning
|
|
33
|
+
this.resizeHandler();
|
|
34
|
+
// Set up a debounced timer to restore visibility after resize activity stops
|
|
35
|
+
resizeTimer = setTimeout(() => {
|
|
36
|
+
// Use requestAnimationFrame to ensure the position update is complete
|
|
37
|
+
// before making the element visible again
|
|
38
|
+
requestAnimationFrame(() => {
|
|
39
|
+
this.element.style.visibility = 'visible';
|
|
40
|
+
this.element.style.opacity = '1';
|
|
41
|
+
resizeTimer = null;
|
|
42
|
+
});
|
|
43
|
+
}, DEBOUNCE_TIME);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// Observe the bubble menu element itself - this is where React components are rendered
|
|
48
|
+
// When React renders different children, the element size may change
|
|
49
|
+
this.resizeObserver.observe(this.element);
|
|
50
|
+
// Also observe the editor view DOM element for editor size changes
|
|
51
|
+
this.resizeObserver.observe(this.view.dom);
|
|
52
|
+
};
|
|
53
|
+
this.updateHandler = (view, selectionChanged, docChanged, oldState) => {
|
|
54
|
+
const { composing } = view;
|
|
55
|
+
const isSame = !selectionChanged && !docChanged;
|
|
56
|
+
if (composing || isSame) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const shouldShow = this.getShouldShow(oldState);
|
|
60
|
+
if (!shouldShow) {
|
|
61
|
+
this.hide();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.show();
|
|
65
|
+
this.updatePosition();
|
|
66
|
+
};
|
|
67
|
+
this.setupResizeObserver();
|
|
68
|
+
}
|
|
69
|
+
destroy() {
|
|
70
|
+
super.destroy();
|
|
71
|
+
// Cleanup ResizeObserver
|
|
72
|
+
if (this.resizeObserver) {
|
|
73
|
+
this.resizeObserver.disconnect();
|
|
74
|
+
this.resizeObserver = undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const BubbleMenuPlugin = (options) => new Plugin({
|
|
79
|
+
key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey,
|
|
80
|
+
view: view => new BubbleMenuView({ view, ...options }),
|
|
81
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { type BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
3
|
+
export type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The DOM element that contains your menu.
|
|
6
|
+
* @type {HTMLElement}
|
|
7
|
+
* @default null
|
|
8
|
+
*/
|
|
9
|
+
element: HTMLElement | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* This extension allows you to create a bubble menu.
|
|
13
|
+
* @see https://tiptap.dev/api/extensions/bubble-menu
|
|
14
|
+
*/
|
|
15
|
+
export declare const BubbleMenu: Extension<BubbleMenuOptions, any>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { BubbleMenuPlugin } from './bubble-menu-plugin';
|
|
3
|
+
/**
|
|
4
|
+
* This extension allows you to create a bubble menu.
|
|
5
|
+
* @see https://tiptap.dev/api/extensions/bubble-menu
|
|
6
|
+
*/
|
|
7
|
+
export const BubbleMenu = Extension.create({
|
|
8
|
+
name: 'bubbleMenu',
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
element: null,
|
|
12
|
+
pluginKey: 'bubbleMenu',
|
|
13
|
+
updateDelay: undefined,
|
|
14
|
+
appendTo: undefined,
|
|
15
|
+
shouldShow: null,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
addProseMirrorPlugins() {
|
|
19
|
+
if (!this.options.element) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return [
|
|
23
|
+
BubbleMenuPlugin({
|
|
24
|
+
pluginKey: this.options.pluginKey,
|
|
25
|
+
editor: this.editor,
|
|
26
|
+
element: this.options.element,
|
|
27
|
+
updateDelay: this.options.updateDelay,
|
|
28
|
+
options: this.options.options,
|
|
29
|
+
appendTo: this.options.appendTo,
|
|
30
|
+
getReferencedVirtualElement: this.options.getReferencedVirtualElement,
|
|
31
|
+
shouldShow: this.options.shouldShow,
|
|
32
|
+
}),
|
|
33
|
+
];
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { TextStyle } from '../types';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
clearFormatting: {
|
|
6
|
+
/**
|
|
7
|
+
* Clear all formatting
|
|
8
|
+
*/
|
|
9
|
+
clearFormatting: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export type ClearFormattingOptions = {
|
|
14
|
+
defaultTextStyle?: TextStyle;
|
|
15
|
+
};
|
|
16
|
+
export declare const ClearFormatting: Extension<any, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { DEFAULT_TEXT_STYLE } from '../constants';
|
|
3
|
+
import { isEntireParagraphSelected } from '../utils';
|
|
4
|
+
export const ClearFormatting = Extension.create({
|
|
5
|
+
name: 'clearFormatting',
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
defaultTextStyle: DEFAULT_TEXT_STYLE,
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
addCommands() {
|
|
12
|
+
return {
|
|
13
|
+
clearFormatting: () => ({ editor, chain }) => {
|
|
14
|
+
const command = chain()
|
|
15
|
+
.unsetAllMarks()
|
|
16
|
+
.unsetTextTransform()
|
|
17
|
+
.updateAttributes('textStyle', this.options.defaultTextStyle);
|
|
18
|
+
if (isEntireParagraphSelected(editor)) {
|
|
19
|
+
command.unsetTextAlign();
|
|
20
|
+
}
|
|
21
|
+
return command.run();
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
addKeyboardShortcuts() {
|
|
26
|
+
return {
|
|
27
|
+
'Mod-\\': () => this.editor.commands.clearFormatting(),
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
});
|