@antscorp/antsomi-ui 2.0.110 → 2.0.112
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 +403 -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 +197 -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 +33 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +194 -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 +324 -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 +19 -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,149 @@
|
|
|
1
|
+
import { LIST_EMOJI } from '../extensions/Emoji';
|
|
2
|
+
/**
|
|
3
|
+
* Default configuration for document state detection
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_CONFIG = {
|
|
6
|
+
minContentSize: 4, // Standard ProseMirror empty doc size
|
|
7
|
+
ignoreWhitespace: true,
|
|
8
|
+
customValidator: () => false,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Calculates the minimum size of an empty document based on schema
|
|
12
|
+
*/
|
|
13
|
+
export function calculateEmptyDocumentSize(state) {
|
|
14
|
+
// Create a minimal document with the same schema
|
|
15
|
+
const emptyDoc = state.schema.topNodeType.createAndFill();
|
|
16
|
+
return emptyDoc?.nodeSize ?? 4;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Checks if document is effectively empty
|
|
20
|
+
*/
|
|
21
|
+
export function isDocumentEmpty(state, config = {}) {
|
|
22
|
+
const { minContentSize, ignoreWhitespace, customValidator } = {
|
|
23
|
+
...DEFAULT_CONFIG,
|
|
24
|
+
...config,
|
|
25
|
+
};
|
|
26
|
+
const { doc } = state;
|
|
27
|
+
// Use custom validator if provided
|
|
28
|
+
if (customValidator(doc)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
// Check document size
|
|
32
|
+
const calculatedMinSize = calculateEmptyDocumentSize(state);
|
|
33
|
+
const effectiveMinSize = minContentSize === 4 ? calculatedMinSize : minContentSize;
|
|
34
|
+
if (doc.nodeSize <= effectiveMinSize) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Check if content is only whitespace
|
|
38
|
+
if (ignoreWhitespace) {
|
|
39
|
+
const textContent = doc.textContent.trim();
|
|
40
|
+
return textContent.length === 0;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Checks if document has meaningful content
|
|
46
|
+
*/
|
|
47
|
+
export function hasDocumentContent(state, config = {}) {
|
|
48
|
+
return !isDocumentEmpty(state, config);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets document content statistics
|
|
52
|
+
*/
|
|
53
|
+
export function getDocumentStats(state) {
|
|
54
|
+
const { doc } = state;
|
|
55
|
+
return {
|
|
56
|
+
nodeSize: doc.nodeSize,
|
|
57
|
+
textLength: doc.textContent.length,
|
|
58
|
+
trimmedTextLength: doc.textContent.trim().length,
|
|
59
|
+
nodeCount: doc.nodesBetween(0, doc.nodeSize, () => true),
|
|
60
|
+
isEmpty: isDocumentEmpty(state),
|
|
61
|
+
emptyDocumentSize: calculateEmptyDocumentSize(state),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Document state change detector
|
|
66
|
+
*/
|
|
67
|
+
export class DocumentStateTracker {
|
|
68
|
+
constructor() {
|
|
69
|
+
this.previousState = null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Updates tracker with new state and returns changes
|
|
73
|
+
*/
|
|
74
|
+
update(state) {
|
|
75
|
+
const isEmpty = isDocumentEmpty(state);
|
|
76
|
+
const { nodeSize } = state.doc;
|
|
77
|
+
const textLength = state.doc.textContent.length;
|
|
78
|
+
const result = {
|
|
79
|
+
isEmpty,
|
|
80
|
+
wasEmpty: this.previousState?.isEmpty ?? true,
|
|
81
|
+
becameEmpty: false,
|
|
82
|
+
becameNonEmpty: false,
|
|
83
|
+
sizeChanged: false,
|
|
84
|
+
textLengthChanged: false,
|
|
85
|
+
};
|
|
86
|
+
if (this.previousState) {
|
|
87
|
+
result.becameEmpty = !this.previousState.isEmpty && isEmpty;
|
|
88
|
+
result.becameNonEmpty = this.previousState.isEmpty && !isEmpty;
|
|
89
|
+
result.sizeChanged = this.previousState.nodeSize !== nodeSize;
|
|
90
|
+
result.textLengthChanged = this.previousState.textLength !== textLength;
|
|
91
|
+
}
|
|
92
|
+
this.previousState = { isEmpty, nodeSize, textLength };
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resets the tracker
|
|
97
|
+
*/
|
|
98
|
+
reset() {
|
|
99
|
+
this.previousState = null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export function isEntireParagraphSelected(editor) {
|
|
103
|
+
const { state } = editor;
|
|
104
|
+
const { selection } = state;
|
|
105
|
+
const { from, to } = selection;
|
|
106
|
+
// Nếu không có selection hoặc selection rỗng
|
|
107
|
+
if (from === to) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
// Tìm node paragraph chứa selection
|
|
111
|
+
const $from = state.doc.resolve(from);
|
|
112
|
+
const $to = state.doc.resolve(to);
|
|
113
|
+
// Kiểm tra xem from và to có cùng trong một paragraph không
|
|
114
|
+
const fromParagraph = $from.node($from.depth);
|
|
115
|
+
const toParagraph = $to.node($to.depth);
|
|
116
|
+
// Nếu không cùng paragraph, return false
|
|
117
|
+
if (fromParagraph !== toParagraph || fromParagraph.type.name !== 'paragraph') {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
// Lấy vị trí bắt đầu và kết thúc của paragraph
|
|
121
|
+
const paragraphStart = $from.start($from.depth);
|
|
122
|
+
const paragraphEnd = $from.end($from.depth);
|
|
123
|
+
// Kiểm tra xem selection có bao phủ toàn bộ nội dung của paragraph không
|
|
124
|
+
return from === paragraphStart && to === paragraphEnd;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Helper function to extract text from atom nodes (emoji, smartTag)
|
|
128
|
+
* Used as leafText callback for doc.textBetween()
|
|
129
|
+
*/
|
|
130
|
+
export const getTextFromAtomNode = (node) => {
|
|
131
|
+
if (node.type.name === 'emoji') {
|
|
132
|
+
// Find emoji character from name
|
|
133
|
+
const emojiChar = LIST_EMOJI.find(i => i.name === node.attrs.name)?.emoji;
|
|
134
|
+
return emojiChar || node.attrs.name || '*';
|
|
135
|
+
}
|
|
136
|
+
if (node.type.name === 'smartTag') {
|
|
137
|
+
return node.attrs.content || '*';
|
|
138
|
+
}
|
|
139
|
+
return '*';
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Wrapper for doc.textBetween that automatically handles atom nodes (emoji, smartTag)
|
|
143
|
+
* @param state EditorState
|
|
144
|
+
* @param from Start position
|
|
145
|
+
* @param to End position
|
|
146
|
+
* @param blockSeparator Optional separator between blocks (default: '')
|
|
147
|
+
* @returns Text content including atom nodes
|
|
148
|
+
*/
|
|
149
|
+
export const textBetween = (state, from, to, blockSeparator = '') => state.doc.textBetween(from, to, blockSeparator, getTextFromAtomNode);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { FontConfig, FontGroupingFunction, FontGroupResult, GroupOrderFunction } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the appropriate bold font weight for a given font family
|
|
4
|
+
* @param currentFontFamily The font family to find bold weight for
|
|
5
|
+
* @param fonts Array of available font configurations
|
|
6
|
+
* @param minBoldWeight Minimum weight considered bold (default 700)
|
|
7
|
+
* @returns The first available bold weight for the font family, or minBoldWeight if none found
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBoldFontWeight: (currentFontFamily: string, fonts: FontConfig[], minBoldWeight?: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a font weight is considered bold
|
|
12
|
+
* @param weight Font weight to check
|
|
13
|
+
* @param threshold Bold threshold (default 600)
|
|
14
|
+
* @returns true if weight is bold
|
|
15
|
+
*/
|
|
16
|
+
export declare function isBoldWeight(weight: string | number, threshold?: number): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Gets all available font weights for a font family
|
|
19
|
+
* @param fontFamily Font family name
|
|
20
|
+
* @param fonts Array of font configurations
|
|
21
|
+
* @returns Array of available weights
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFontWeights(fontFamily: string, fonts: FontConfig[]): number[];
|
|
24
|
+
/**
|
|
25
|
+
* Finds the closest available font weight
|
|
26
|
+
* @param targetWeight Desired font weight
|
|
27
|
+
* @param availableWeights Array of available weights
|
|
28
|
+
* @returns Closest available weight
|
|
29
|
+
*/
|
|
30
|
+
export declare function getClosestFontWeight(targetWeight: number, availableWeights: number[]): number;
|
|
31
|
+
/**
|
|
32
|
+
* Validates font configuration
|
|
33
|
+
* @param fontConfig Font configuration to validate
|
|
34
|
+
* @returns true if configuration is valid
|
|
35
|
+
*/
|
|
36
|
+
export declare function isValidFontConfig(fontConfig: FontConfig): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Sorts font configurations alphabetically by name
|
|
39
|
+
* @param fonts Array of font configurations
|
|
40
|
+
* @returns Sorted array of font configurations
|
|
41
|
+
*/
|
|
42
|
+
export declare function sortFontsByName(fonts: FontConfig[]): FontConfig[];
|
|
43
|
+
/**
|
|
44
|
+
* Groups fonts by category (if category property exists)
|
|
45
|
+
* @param fonts Array of font configurations
|
|
46
|
+
* @returns Object with fonts grouped by category
|
|
47
|
+
*/
|
|
48
|
+
export declare function groupFontsByCategory(fonts: FontConfig[]): Record<string, FontConfig[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a font stack string from a font configuration
|
|
51
|
+
* @param font Font configuration
|
|
52
|
+
* @returns Font stack string
|
|
53
|
+
*/
|
|
54
|
+
export declare const getFontStack: (font: FontConfig) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Analyzes a font configuration for web safety
|
|
57
|
+
* @param font Font configuration
|
|
58
|
+
* @returns Analysis results
|
|
59
|
+
*/
|
|
60
|
+
export declare const analyzeFont: (font: FontConfig) => {
|
|
61
|
+
isFullyWebSafe: boolean;
|
|
62
|
+
isPrimaryFontWebSafe: boolean;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Groups fonts using a custom grouping function or default web-safe categorization
|
|
66
|
+
* @param fonts Array of font configurations to group
|
|
67
|
+
* @param fontGroupingFn Optional custom function to determine font groups
|
|
68
|
+
* @param groupOrder Optional array of group keys or function to define display order
|
|
69
|
+
* @returns Map with grouped fonts by category in specified order
|
|
70
|
+
*/
|
|
71
|
+
export declare const groupFonts: (fonts: FontConfig[], opts?: {
|
|
72
|
+
fontGroupingFn?: FontGroupingFunction;
|
|
73
|
+
groupOrder?: string[] | GroupOrderFunction;
|
|
74
|
+
}) => Map<string, FontGroupResult>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { analyzeFontFamily, isWebSafeFont } from '@antscorp/antsomi-ui/es/utils';
|
|
2
|
+
import { DEFAULT_FONT_GROUPING } from '../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the appropriate bold font weight for a given font family
|
|
5
|
+
* @param currentFontFamily The font family to find bold weight for
|
|
6
|
+
* @param fonts Array of available font configurations
|
|
7
|
+
* @param minBoldWeight Minimum weight considered bold (default 700)
|
|
8
|
+
* @returns The first available bold weight for the font family, or minBoldWeight if none found
|
|
9
|
+
*/
|
|
10
|
+
export const getBoldFontWeight = (currentFontFamily, fonts, minBoldWeight = 700) => {
|
|
11
|
+
if (!currentFontFamily || !fonts?.length)
|
|
12
|
+
return minBoldWeight;
|
|
13
|
+
const fontConfig = fonts.find(font => font.fontFamily.name === currentFontFamily);
|
|
14
|
+
return fontConfig?.fontWeight.find(weight => weight >= minBoldWeight) ?? minBoldWeight;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a font weight is considered bold
|
|
18
|
+
* @param weight Font weight to check
|
|
19
|
+
* @param threshold Bold threshold (default 600)
|
|
20
|
+
* @returns true if weight is bold
|
|
21
|
+
*/
|
|
22
|
+
export function isBoldWeight(weight, threshold = 600) {
|
|
23
|
+
const numericWeight = typeof weight === 'string' ? parseInt(weight, 10) : weight;
|
|
24
|
+
return !isNaN(numericWeight) && numericWeight >= threshold;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets all available font weights for a font family
|
|
28
|
+
* @param fontFamily Font family name
|
|
29
|
+
* @param fonts Array of font configurations
|
|
30
|
+
* @returns Array of available weights
|
|
31
|
+
*/
|
|
32
|
+
export function getFontWeights(fontFamily, fonts) {
|
|
33
|
+
const fontConfig = fonts.find(font => font.fontFamily.name === fontFamily);
|
|
34
|
+
return fontConfig?.fontWeight || [400];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Finds the closest available font weight
|
|
38
|
+
* @param targetWeight Desired font weight
|
|
39
|
+
* @param availableWeights Array of available weights
|
|
40
|
+
* @returns Closest available weight
|
|
41
|
+
*/
|
|
42
|
+
export function getClosestFontWeight(targetWeight, availableWeights) {
|
|
43
|
+
if (availableWeights.includes(targetWeight)) {
|
|
44
|
+
return targetWeight;
|
|
45
|
+
}
|
|
46
|
+
return availableWeights.reduce((closest, weight) => Math.abs(weight - targetWeight) < Math.abs(closest - targetWeight) ? weight : closest);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validates font configuration
|
|
50
|
+
* @param fontConfig Font configuration to validate
|
|
51
|
+
* @returns true if configuration is valid
|
|
52
|
+
*/
|
|
53
|
+
export function isValidFontConfig(fontConfig) {
|
|
54
|
+
return !!(fontConfig.fontFamily?.name &&
|
|
55
|
+
fontConfig.fontWeight &&
|
|
56
|
+
Array.isArray(fontConfig.fontWeight) &&
|
|
57
|
+
fontConfig.fontWeight.length > 0 &&
|
|
58
|
+
fontConfig.fontWeight.every(weight => typeof weight === 'number' && weight > 0));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sorts font configurations alphabetically by name
|
|
62
|
+
* @param fonts Array of font configurations
|
|
63
|
+
* @returns Sorted array of font configurations
|
|
64
|
+
*/
|
|
65
|
+
export function sortFontsByName(fonts) {
|
|
66
|
+
return [...fonts].sort((a, b) => a.fontFamily.name.localeCompare(b.fontFamily.name));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Groups fonts by category (if category property exists)
|
|
70
|
+
* @param fonts Array of font configurations
|
|
71
|
+
* @returns Object with fonts grouped by category
|
|
72
|
+
*/
|
|
73
|
+
export function groupFontsByCategory(fonts) {
|
|
74
|
+
const grouped = {};
|
|
75
|
+
fonts.forEach(font => {
|
|
76
|
+
const category = font.category || 'Other';
|
|
77
|
+
if (!grouped[category]) {
|
|
78
|
+
grouped[category] = [];
|
|
79
|
+
}
|
|
80
|
+
grouped[category].push(font);
|
|
81
|
+
});
|
|
82
|
+
return grouped;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a font stack string from a font configuration
|
|
86
|
+
* @param font Font configuration
|
|
87
|
+
* @returns Font stack string
|
|
88
|
+
*/
|
|
89
|
+
export const getFontStack = (font) => [font.fontFamily.name, ...(font.fontFamily.fallback || [])].join(', ');
|
|
90
|
+
/**
|
|
91
|
+
* Analyzes a font configuration for web safety
|
|
92
|
+
* @param font Font configuration
|
|
93
|
+
* @returns Analysis results
|
|
94
|
+
*/
|
|
95
|
+
export const analyzeFont = (font) => {
|
|
96
|
+
const fontStack = getFontStack(font);
|
|
97
|
+
const { isFullyWebSafe, isPrimaryFontWebSafe } = analyzeFontFamily(fontStack);
|
|
98
|
+
return { isFullyWebSafe, isPrimaryFontWebSafe };
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Groups fonts using a custom grouping function or default web-safe categorization
|
|
102
|
+
* @param fonts Array of font configurations to group
|
|
103
|
+
* @param fontGroupingFn Optional custom function to determine font groups
|
|
104
|
+
* @param groupOrder Optional array of group keys or function to define display order
|
|
105
|
+
* @returns Map with grouped fonts by category in specified order
|
|
106
|
+
*/
|
|
107
|
+
export const groupFonts = (fonts, opts = {}) => {
|
|
108
|
+
const defaultGroupingFn = font => {
|
|
109
|
+
if (isWebSafeFont(font.fontFamily.name)) {
|
|
110
|
+
return DEFAULT_FONT_GROUPING.standard;
|
|
111
|
+
}
|
|
112
|
+
return DEFAULT_FONT_GROUPING.nonStandard;
|
|
113
|
+
};
|
|
114
|
+
const { fontGroupingFn = defaultGroupingFn, groupOrder = [DEFAULT_FONT_GROUPING.standard.key, DEFAULT_FONT_GROUPING.nonStandard.key], } = opts || {};
|
|
115
|
+
const tempGroups = new Map();
|
|
116
|
+
for (const font of fonts) {
|
|
117
|
+
const groupInfo = fontGroupingFn(font);
|
|
118
|
+
if (groupInfo) {
|
|
119
|
+
const { key, label } = groupInfo;
|
|
120
|
+
if (tempGroups.has(key)) {
|
|
121
|
+
tempGroups.get(key).fonts.push(font);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
tempGroups.set(key, { label, fonts: [font] });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const results = new Map();
|
|
129
|
+
let orderedGroupKeys = [];
|
|
130
|
+
if (typeof groupOrder === 'function') {
|
|
131
|
+
const availableGroupKeys = Array.from(tempGroups.keys());
|
|
132
|
+
orderedGroupKeys = groupOrder(availableGroupKeys);
|
|
133
|
+
}
|
|
134
|
+
else if (Array.isArray(groupOrder) && groupOrder.length > 0) {
|
|
135
|
+
orderedGroupKeys = groupOrder;
|
|
136
|
+
}
|
|
137
|
+
for (const groupKey of orderedGroupKeys) {
|
|
138
|
+
if (tempGroups.has(groupKey)) {
|
|
139
|
+
results.set(groupKey, tempGroups.get(groupKey));
|
|
140
|
+
tempGroups.delete(groupKey);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const [key, value] of tempGroups) {
|
|
144
|
+
results.set(key, value);
|
|
145
|
+
}
|
|
146
|
+
return results;
|
|
147
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { TextStyle } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Restructures dynamic tags from Froala editor format to be compatible with Tiptap editor.
|
|
4
|
+
* This function preserves styling and attributes of dynamic tags while cleaning up their structure.
|
|
5
|
+
*
|
|
6
|
+
* @param html - The HTML string containing dynamic tags
|
|
7
|
+
* @param options - Configuration options for the restructuring process
|
|
8
|
+
* @param wrapperElement - Optional wrapper element to use instead of document.body
|
|
9
|
+
* @returns The restructured HTML string
|
|
10
|
+
*/
|
|
11
|
+
export declare function restructureDynamicTagsWithOptions(params: {
|
|
12
|
+
html: string;
|
|
13
|
+
options?: {
|
|
14
|
+
attributesToClone: string[];
|
|
15
|
+
};
|
|
16
|
+
defaultStyle: TextStyle;
|
|
17
|
+
wrapperElement?: Element;
|
|
18
|
+
}): string;
|
|
19
|
+
/**
|
|
20
|
+
* Removes empty paragraphs and spans with only break lines.
|
|
21
|
+
* @param html - The HTML string to process
|
|
22
|
+
* @returns The processed HTML string
|
|
23
|
+
*/
|
|
24
|
+
export declare function cleanLineBreaks(html: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Safely parses and processes HTML content for editor use
|
|
27
|
+
* @param html - HTML string to process
|
|
28
|
+
* @param wrapperElement - Optional wrapper element to use instead of document.body for temporary DOM operations
|
|
29
|
+
* @returns Processed HTML string
|
|
30
|
+
*/
|
|
31
|
+
export declare function safeParseHTMLContent(params: {
|
|
32
|
+
html: string;
|
|
33
|
+
wrapperElement?: Element;
|
|
34
|
+
defaultStyle: TextStyle;
|
|
35
|
+
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* Sanitizes HTML by removing potentially dangerous elements and attributes
|
|
38
|
+
* @param html - HTML string to sanitize
|
|
39
|
+
* @returns Sanitized HTML string
|
|
40
|
+
*/
|
|
41
|
+
export declare function sanitizeHTML(html: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts text content from HTML
|
|
44
|
+
* @param html - HTML string
|
|
45
|
+
* @returns Plain text content
|
|
46
|
+
*/
|
|
47
|
+
export declare function extractTextFromHTML(html: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Counts words in HTML content
|
|
50
|
+
* @param html - HTML string
|
|
51
|
+
* @returns Word count
|
|
52
|
+
*/
|
|
53
|
+
export declare function countWordsInHTML(html: string): number;
|
|
54
|
+
/**
|
|
55
|
+
* Counts characters in HTML content
|
|
56
|
+
* @param html - HTML string
|
|
57
|
+
* @param includeSpaces - Whether to include spaces in count
|
|
58
|
+
* @returns Character count
|
|
59
|
+
*/
|
|
60
|
+
export declare function countCharactersInHTML(html: string, includeSpaces?: boolean): number;
|
|
61
|
+
/**
|
|
62
|
+
* Wraps text nodes with specified tag
|
|
63
|
+
* @param html - HTML string
|
|
64
|
+
* @param tagName - Tag name to wrap with
|
|
65
|
+
* @param className - Optional class name for wrapper
|
|
66
|
+
* @returns HTML with wrapped text nodes
|
|
67
|
+
*/
|
|
68
|
+
export declare function wrapTextNodes(html: string, tagName?: string, className?: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Removes empty elements from HTML
|
|
71
|
+
* @param html - HTML string
|
|
72
|
+
* @returns HTML with empty elements removed
|
|
73
|
+
*/
|
|
74
|
+
export declare function removeEmptyElements(html: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Normalizes whitespace in HTML
|
|
77
|
+
* @param html - HTML string
|
|
78
|
+
* @returns HTML with normalized whitespace
|
|
79
|
+
*/
|
|
80
|
+
export declare function normalizeWhitespace(html: string): string;
|
|
81
|
+
export declare const htmlMinifyForEmail: (htmlEditorContent: string) => string;
|
|
82
|
+
/**
|
|
83
|
+
* Serializes HTML for output
|
|
84
|
+
* @param htmlEditorContent - HTML string to serialize
|
|
85
|
+
* @returns Serialized HTML string
|
|
86
|
+
*/
|
|
87
|
+
export declare const htmlSerializerForOutput: (htmlEditorContent: string) => string;
|