@antscorp/antsomi-ui 2.0.92-text-editor-beta.6 → 2.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/assets/css/main.scss +2 -4
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -18
- package/es/components/icons/LazyIcon/LazyIcon.js +9 -18
- package/es/components/icons/index.d.ts +9 -18
- package/es/components/icons/index.js +9 -18
- package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
- package/es/components/molecules/EmojiCollections/types.d.ts +0 -1
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +0 -1
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +6 -10
- package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/TagifyInput/patternHandlers.js +12 -0
- package/es/components/molecules/TagifyInput/utils.d.ts +1 -0
- package/es/components/molecules/TagifyInput/utils.js +1 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +3 -6
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +982 -2594
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +11 -1
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +25 -53
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +0 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +2 -2
- package/es/components/molecules/VirtualizedMenu/styled.js +4 -23
- package/es/components/molecules/VirtualizedMenu/types.d.ts +10 -27
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/utils.js +18 -13
- package/es/components/molecules/index.d.ts +0 -1
- package/es/components/molecules/index.js +0 -1
- package/es/components/organism/index.d.ts +0 -1
- package/es/components/organism/index.js +0 -1
- package/es/constants/api.js +3 -3
- package/es/hooks/index.d.ts +0 -4
- package/es/hooks/index.js +0 -4
- package/es/locales/i18n.d.ts +1 -1
- package/es/utils/common.d.ts +9 -14
- package/es/utils/common.js +23 -60
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -1
- package/es/utils/web.d.ts +0 -15
- package/es/utils/web.js +0 -39
- package/package.json +4 -22
- package/es/components/atoms/Eyedropper/Eyedropper.d.ts +0 -2
- package/es/components/atoms/Eyedropper/Eyedropper.js +0 -53
- package/es/components/atoms/Eyedropper/index.d.ts +0 -0
- package/es/components/atoms/Eyedropper/index.js +0 -1
- package/es/components/atoms/Eyedropper/styled.d.ts +0 -9
- package/es/components/atoms/Eyedropper/styled.js +0 -45
- package/es/components/atoms/Eyedropper/types.d.ts +0 -5
- package/es/components/atoms/Eyedropper/types.js +0 -1
- package/es/components/icons/ALignRightIcon.d.ts +0 -3
- package/es/components/icons/ALignRightIcon.js +0 -7
- package/es/components/icons/AlignCenterIcon.d.ts +0 -3
- package/es/components/icons/AlignCenterIcon.js +0 -7
- package/es/components/icons/AlignJustifyIcon.d.ts +0 -3
- package/es/components/icons/AlignJustifyIcon.js +0 -7
- package/es/components/icons/AlignLeftIcon.d.ts +0 -3
- package/es/components/icons/AlignLeftIcon.js +0 -7
- package/es/components/icons/ArrowDropDownIcon.d.ts +0 -3
- package/es/components/icons/ArrowDropDownIcon.js +0 -7
- package/es/components/icons/ChevronRightIcon.d.ts +0 -3
- package/es/components/icons/ChevronRightIcon.js +0 -7
- package/es/components/icons/ColorizeIcon.d.ts +0 -3
- package/es/components/icons/ColorizeIcon.js +0 -7
- package/es/components/icons/LinkOffIcon.d.ts +0 -3
- package/es/components/icons/LinkOffIcon.js +0 -7
- package/es/components/icons/MinusIcon.d.ts +0 -3
- package/es/components/icons/MinusIcon.js +0 -7
- package/es/components/index.scss +0 -2
- package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +0 -11
- package/es/components/molecules/EyedropperButton/EyedropperButton.js +0 -34
- package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
- package/es/components/molecules/EyedropperButton/index.js +0 -1
- package/es/components/molecules/EyedropperButton/styled.d.ts +0 -7
- package/es/components/molecules/EyedropperButton/styled.js +0 -23
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +0 -134
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +0 -8
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +0 -14
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +0 -21
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +0 -19
- package/es/components/molecules/FontSizeInput/constants.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/constants.js +0 -5
- package/es/components/molecules/FontSizeInput/index.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/index.js +0 -1
- package/es/components/molecules/FontSizeInput/styled.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/styled.js +0 -40
- package/es/components/molecules/FontSizeInput/styles.scss +0 -15
- package/es/components/molecules/FontSizeInput/types.d.ts +0 -23
- package/es/components/molecules/FontSizeInput/types.js +0 -1
- package/es/components/molecules/FontSizeInput/utils.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/utils.js +0 -9
- package/es/components/molecules/index.scss +0 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +0 -1290
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +0 -3059
- package/es/components/organism/TextEditor/TextEditor.d.ts +0 -3
- package/es/components/organism/TextEditor/TextEditor.js +0 -264
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +0 -320
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +0 -1
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +0 -38
- package/es/components/organism/TextEditor/constants.d.ts +0 -177
- package/es/components/organism/TextEditor/constants.js +0 -323
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +0 -25
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +0 -46
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +0 -140
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +0 -366
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +0 -31
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +0 -2
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +0 -2
- package/es/components/organism/TextEditor/extensions/ClearFormatting.d.ts +0 -16
- package/es/components/organism/TextEditor/extensions/ClearFormatting.js +0 -26
- package/es/components/organism/TextEditor/extensions/Color.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Color.js +0 -34
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +0 -57
- package/es/components/organism/TextEditor/extensions/Emoji.js +0 -184
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/FontFamily.js +0 -36
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +0 -31
- package/es/components/organism/TextEditor/extensions/FontSize.js +0 -46
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +0 -23
- package/es/components/organism/TextEditor/extensions/FontWeight.js +0 -41
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +0 -21
- package/es/components/organism/TextEditor/extensions/Indent.js +0 -63
- package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +0 -32
- package/es/components/organism/TextEditor/extensions/LetterSpacing.js +0 -48
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +0 -20
- package/es/components/organism/TextEditor/extensions/LineHeight.js +0 -36
- package/es/components/organism/TextEditor/extensions/Link.d.ts +0 -29
- package/es/components/organism/TextEditor/extensions/Link.js +0 -187
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +0 -13
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +0 -174
- package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +0 -56
- package/es/components/organism/TextEditor/extensions/OrderedList.js +0 -187
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +0 -39
- package/es/components/organism/TextEditor/extensions/SmartTag.js +0 -167
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +0 -36
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +0 -163
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +0 -30
- package/es/components/organism/TextEditor/extensions/TextTransform.js +0 -36
- package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +0 -55
- package/es/components/organism/TextEditor/extensions/UnorderedList.js +0 -176
- package/es/components/organism/TextEditor/hooks/index.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/index.js +0 -6
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +0 -4
- package/es/components/organism/TextEditor/hooks/useColorSet.js +0 -22
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +0 -18
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +0 -42
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +0 -26
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +0 -68
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +0 -31
- package/es/components/organism/TextEditor/hooks/usePersistence.js +0 -169
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +0 -42
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +0 -34
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +0 -83
- package/es/components/organism/TextEditor/index.d.ts +0 -16
- package/es/components/organism/TextEditor/index.js +0 -8
- package/es/components/organism/TextEditor/index.scss +0 -61
- package/es/components/organism/TextEditor/provider.d.ts +0 -14
- package/es/components/organism/TextEditor/provider.js +0 -33
- package/es/components/organism/TextEditor/store.d.ts +0 -13
- package/es/components/organism/TextEditor/store.js +0 -20
- package/es/components/organism/TextEditor/styled.d.ts +0 -10
- package/es/components/organism/TextEditor/styled.js +0 -94
- package/es/components/organism/TextEditor/types.d.ts +0 -139
- package/es/components/organism/TextEditor/types.js +0 -5
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +0 -84
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Button/Button.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Button/Button.js +0 -31
- package/es/components/organism/TextEditor/ui/Button/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Button/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Button/types.d.ts +0 -10
- package/es/components/organism/TextEditor/ui/Button/types.js +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +0 -39
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +0 -131
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +0 -1
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +0 -17
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +0 -51
- package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/DropdownButton/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +0 -11
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +0 -66
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/index.js +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +0 -71
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +0 -12
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +0 -69
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +0 -22
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +0 -9
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Popover/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Select/Select.js +0 -7
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Select/index.js +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +0 -44
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +0 -1
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +0 -52
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +0 -19
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +0 -30
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +0 -77
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +0 -16
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -42
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +0 -93
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +0 -31
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +0 -28
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +0 -44
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +0 -21
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +0 -28
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +0 -67
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +0 -17
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +0 -10
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +0 -45
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +0 -26
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +0 -26
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +0 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +0 -29
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +0 -22
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +0 -36
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +0 -19
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +0 -24
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +0 -24
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +0 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +0 -57
- package/es/components/organism/TextEditor/utils/documentState.js +0 -100
- package/es/components/organism/TextEditor/utils/font.d.ts +0 -73
- package/es/components/organism/TextEditor/utils/font.js +0 -160
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +0 -75
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +0 -343
- package/es/components/organism/TextEditor/utils/indent.d.ts +0 -11
- package/es/components/organism/TextEditor/utils/indent.js +0 -56
- package/es/components/organism/TextEditor/utils/index.d.ts +0 -8
- package/es/components/organism/TextEditor/utils/index.js +0 -16
- package/es/components/organism/TextEditor/utils/link.d.ts +0 -108
- package/es/components/organism/TextEditor/utils/link.js +0 -151
- package/es/components/organism/TextEditor/utils/menu.d.ts +0 -134
- package/es/components/organism/TextEditor/utils/menu.js +0 -317
- package/es/components/organism/TextEditor/utils/selection.d.ts +0 -25
- package/es/components/organism/TextEditor/utils/selection.js +0 -57
- package/es/components/organism/TextEditor/utils/shared.d.ts +0 -1
- package/es/components/organism/TextEditor/utils/shared.js +0 -9
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +0 -49
- package/es/components/organism/TextEditor/utils/smartTag.js +0 -89
- package/es/components/organism/TextEditor/utils/style.d.ts +0 -78
- package/es/components/organism/TextEditor/utils/style.js +0 -193
- package/es/components/organism/index.scss +0 -1
- package/es/hooks/useBroadcastedLocalStorage.d.ts +0 -5
- package/es/hooks/useBroadcastedLocalStorage.js +0 -71
- package/es/hooks/useElementSize.d.ts +0 -7
- package/es/hooks/useElementSize.js +0 -56
- package/es/hooks/useEyedropper/attach.d.ts +0 -4
- package/es/hooks/useEyedropper/attach.js +0 -9
- package/es/hooks/useEyedropper/eyedropper.d.ts +0 -69
- package/es/hooks/useEyedropper/eyedropper.js +0 -205
- package/es/hooks/useEyedropper/index.d.ts +0 -2
- package/es/hooks/useEyedropper/index.js +0 -7
- package/es/hooks/useEyedropper/support.d.ts +0 -1
- package/es/hooks/useEyedropper/support.js +0 -3
- package/es/hooks/useEyedropper/types.d.ts +0 -9
- package/es/hooks/useEyedropper/types.js +0 -1
- package/es/hooks/useEyedropper/useEyedropper.d.ts +0 -8
- package/es/hooks/useEyedropper/useEyedropper.js +0 -50
- package/es/hooks/useEyedropper/utils.d.ts +0 -11
- package/es/hooks/useEyedropper/utils.js +0 -17
- package/es/hooks/useIsMounted.d.ts +0 -1
- package/es/hooks/useIsMounted.js +0 -11
- package/es/utils/tree.d.ts +0 -225
- package/es/utils/tree.js +0 -469
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Node, mergeAttributes } from '@tiptap/core';
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
export const EXTENSION_NAME = 'smartTag';
|
|
5
|
-
/**
|
|
6
|
-
* Creates decorations for all SmartTag nodes in the document
|
|
7
|
-
* @param doc - The ProseMirror document
|
|
8
|
-
* @param highlight - Whether to highlight the SmartTags
|
|
9
|
-
* @returns A DecorationSet containing decorations for all SmartTag nodes
|
|
10
|
-
*/
|
|
11
|
-
function createSmartTagDecorations(doc, highlight) {
|
|
12
|
-
const decorations = [];
|
|
13
|
-
if (!highlight) {
|
|
14
|
-
return DecorationSet.create(doc, decorations);
|
|
15
|
-
}
|
|
16
|
-
// Find all SmartTag nodes and create decorations for them
|
|
17
|
-
doc.descendants((node, pos) => {
|
|
18
|
-
if (node.type.name === EXTENSION_NAME) {
|
|
19
|
-
// Create a node decoration that adds the highlight class
|
|
20
|
-
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
21
|
-
class: 'highlight',
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return DecorationSet.create(doc, decorations);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Represents a dynamic tag node in the editor.
|
|
29
|
-
*/
|
|
30
|
-
export const SmartTag = Node.create({
|
|
31
|
-
name: EXTENSION_NAME,
|
|
32
|
-
group: 'inline',
|
|
33
|
-
atom: true,
|
|
34
|
-
inline: true,
|
|
35
|
-
selectable: true,
|
|
36
|
-
addStorage() {
|
|
37
|
-
return {
|
|
38
|
-
highlight: this.options.highlight,
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
addOptions() {
|
|
42
|
-
return {
|
|
43
|
-
HTMLAttributes: {},
|
|
44
|
-
highlight: true,
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
addAttributes() {
|
|
48
|
-
return {
|
|
49
|
-
id: {
|
|
50
|
-
default: '',
|
|
51
|
-
parseHTML: el => el.getAttribute('data-dynamic-id'),
|
|
52
|
-
},
|
|
53
|
-
content: {
|
|
54
|
-
default: '',
|
|
55
|
-
parseHTML: el => el.innerText,
|
|
56
|
-
},
|
|
57
|
-
tag: {
|
|
58
|
-
default: null,
|
|
59
|
-
parseHTML: el => el.getAttribute('tag'),
|
|
60
|
-
renderHTML: attrs => (attrs.tag ? { tag: attrs.tag } : null),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
parseHTML() {
|
|
65
|
-
return [
|
|
66
|
-
{
|
|
67
|
-
tag: 'span[data-dynamic="true"]',
|
|
68
|
-
priority: 1000,
|
|
69
|
-
getAttrs: node => node.getAttribute('data-dynamic') === 'true' && null,
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
},
|
|
73
|
-
renderHTML({ node }) {
|
|
74
|
-
return [
|
|
75
|
-
'span',
|
|
76
|
-
mergeAttributes(this.options.HTMLAttributes, {
|
|
77
|
-
'data-dynamic': 'true',
|
|
78
|
-
'data-dynamic-id': node.attrs.id,
|
|
79
|
-
class: 'smart-tag',
|
|
80
|
-
}),
|
|
81
|
-
node.attrs.content,
|
|
82
|
-
];
|
|
83
|
-
},
|
|
84
|
-
renderText({ node }) {
|
|
85
|
-
return node.attrs.content;
|
|
86
|
-
},
|
|
87
|
-
addCommands() {
|
|
88
|
-
return {
|
|
89
|
-
setSmartTag: attrs => ({ chain, state }) => {
|
|
90
|
-
const { selection, storedMarks } = state;
|
|
91
|
-
const { $from } = selection;
|
|
92
|
-
const marks = storedMarks || $from.marks();
|
|
93
|
-
const smartTagNode = this.type.create(attrs);
|
|
94
|
-
const nodeWithMarks = marks.length > 0 ? smartTagNode.mark(marks) : smartTagNode;
|
|
95
|
-
return chain()
|
|
96
|
-
.command(({ tr }) => {
|
|
97
|
-
tr.replaceSelectionWith(nodeWithMarks, false);
|
|
98
|
-
return true;
|
|
99
|
-
})
|
|
100
|
-
.run();
|
|
101
|
-
},
|
|
102
|
-
deleteSmartTagGlobally: predicate => ({ tr, state }) => {
|
|
103
|
-
let hasDeleted = false;
|
|
104
|
-
const { doc } = state;
|
|
105
|
-
doc.descendants((node, pos) => {
|
|
106
|
-
if (node.type.name === this.name && predicate(node.attrs)) {
|
|
107
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
108
|
-
hasDeleted = true;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return hasDeleted;
|
|
112
|
-
},
|
|
113
|
-
updateSmartTagAttrsGlobally: updateFn => ({ tr, state }) => {
|
|
114
|
-
let hasUpdated = false;
|
|
115
|
-
const { doc } = state;
|
|
116
|
-
doc.descendants((node, pos) => {
|
|
117
|
-
if (node.type.name === this.name) {
|
|
118
|
-
const updatedAttrs = updateFn(node.attrs);
|
|
119
|
-
if (updatedAttrs) {
|
|
120
|
-
tr.setNodeMarkup(pos, undefined, {
|
|
121
|
-
...node.attrs,
|
|
122
|
-
...updatedAttrs,
|
|
123
|
-
});
|
|
124
|
-
hasUpdated = true;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return hasUpdated;
|
|
129
|
-
},
|
|
130
|
-
updateSmartTagHighlight: (enabled) => ({ tr }) => {
|
|
131
|
-
// Update the storage value
|
|
132
|
-
this.storage.highlight = enabled;
|
|
133
|
-
// Set metadata on the transaction to trigger the plugin to update decorations
|
|
134
|
-
tr.setMeta('updateSmartTagHighlight', { highlight: enabled });
|
|
135
|
-
return true;
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
addProseMirrorPlugins() {
|
|
140
|
-
return [
|
|
141
|
-
new Plugin({
|
|
142
|
-
key: new PluginKey(`${EXTENSION_NAME}_highlight`),
|
|
143
|
-
// Initialize the plugin state with decorations based on the initial highlight value
|
|
144
|
-
state: {
|
|
145
|
-
init: (_, { doc }) => createSmartTagDecorations(doc, this.storage.highlight),
|
|
146
|
-
// Update the decorations when the document changes or when the highlight value changes
|
|
147
|
-
apply: (tr, oldDecorations) => {
|
|
148
|
-
// Check if the highlight value has changed
|
|
149
|
-
const highlightMeta = tr.getMeta('updateSmartTagHighlight');
|
|
150
|
-
// If the document has changed or the highlight value has changed, update the decorations
|
|
151
|
-
if (tr.docChanged || highlightMeta !== undefined) {
|
|
152
|
-
return createSmartTagDecorations(tr.doc, this.storage.highlight);
|
|
153
|
-
}
|
|
154
|
-
// Otherwise, map the old decorations through the transaction
|
|
155
|
-
return oldDecorations.map(tr.mapping, tr.doc);
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
// Provide the decorations to the editor view
|
|
159
|
-
props: {
|
|
160
|
-
decorations(state) {
|
|
161
|
-
return this.getState(state);
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
}),
|
|
165
|
-
];
|
|
166
|
-
},
|
|
167
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { Mark } from '@tiptap/pm/model';
|
|
3
|
-
import { DocumentStateConfig } from '../utils/documentState';
|
|
4
|
-
export interface StyleMemoryOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Marks to exclude from being stored
|
|
7
|
-
* @default ['link', 'smartTag']
|
|
8
|
-
*/
|
|
9
|
-
excludeMarks: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Configuration for document emptiness detection
|
|
12
|
-
*/
|
|
13
|
-
documentStateConfig?: DocumentStateConfig;
|
|
14
|
-
}
|
|
15
|
-
export interface StyleMemoryStorage {
|
|
16
|
-
storedMarks: Mark[];
|
|
17
|
-
}
|
|
18
|
-
declare module '@tiptap/core' {
|
|
19
|
-
interface Commands<ReturnType> {
|
|
20
|
-
styleMemory: {
|
|
21
|
-
/**
|
|
22
|
-
* Manually store current marks
|
|
23
|
-
*/
|
|
24
|
-
storeCurrentMarks: () => ReturnType;
|
|
25
|
-
/**
|
|
26
|
-
* Clear stored marks
|
|
27
|
-
*/
|
|
28
|
-
clearStoredMarks: () => ReturnType;
|
|
29
|
-
/**
|
|
30
|
-
* Apply stored marks to current selection
|
|
31
|
-
*/
|
|
32
|
-
applyStoredMarks: () => ReturnType;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export declare const StyleMemory: Extension<StyleMemoryOptions, StyleMemoryStorage>;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { isDocumentEmpty, DocumentStateTracker } from '../utils/documentState';
|
|
4
|
-
export const StyleMemory = Extension.create({
|
|
5
|
-
name: 'styleMemory',
|
|
6
|
-
addOptions() {
|
|
7
|
-
return {
|
|
8
|
-
excludeMarks: ['link', 'smartTag'],
|
|
9
|
-
documentStateConfig: {
|
|
10
|
-
ignoreWhitespace: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
addStorage() {
|
|
15
|
-
return {
|
|
16
|
-
storedMarks: [],
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
addCommands() {
|
|
20
|
-
return {
|
|
21
|
-
storeCurrentMarks: () => ({ state }) => {
|
|
22
|
-
const { selection, storedMarks } = state;
|
|
23
|
-
const { $from } = selection;
|
|
24
|
-
// Get marks from current position or stored marks
|
|
25
|
-
const currentMarks = storedMarks || $from.marks();
|
|
26
|
-
// Filter out excluded marks
|
|
27
|
-
const filteredMarks = currentMarks.filter(mark => !this.options.excludeMarks.includes(mark.type.name));
|
|
28
|
-
this.storage.storedMarks = filteredMarks;
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
|
-
clearStoredMarks: () => () => {
|
|
32
|
-
this.storage.storedMarks = [];
|
|
33
|
-
return true;
|
|
34
|
-
},
|
|
35
|
-
applyStoredMarks: () => ({ commands }) => {
|
|
36
|
-
if (this.storage.storedMarks.length === 0) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
// Apply each stored mark
|
|
40
|
-
this.storage.storedMarks.forEach(mark => {
|
|
41
|
-
commands.setMark(mark.type.name, mark.attrs);
|
|
42
|
-
});
|
|
43
|
-
return true;
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
addProseMirrorPlugins() {
|
|
48
|
-
const stateTracker = new DocumentStateTracker();
|
|
49
|
-
return [
|
|
50
|
-
new Plugin({
|
|
51
|
-
key: new PluginKey('styleMemory'),
|
|
52
|
-
state: {
|
|
53
|
-
init: (_, initialState) => {
|
|
54
|
-
const isEmpty = isDocumentEmpty(initialState, this.options.documentStateConfig);
|
|
55
|
-
return {
|
|
56
|
-
lastContentSize: initialState.doc.content.size,
|
|
57
|
-
wasEmpty: isEmpty,
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
apply: (tr, _oldState, _oldEditorState, newEditorState) => {
|
|
61
|
-
const changes = stateTracker.update(newEditorState);
|
|
62
|
-
const isEmpty = isDocumentEmpty(newEditorState, this.options.documentStateConfig);
|
|
63
|
-
const hasContent = !isEmpty;
|
|
64
|
-
// Store marks when content exists and user has selection with marks
|
|
65
|
-
if (hasContent && tr.selection && !tr.selection.empty) {
|
|
66
|
-
const { $from } = tr.selection;
|
|
67
|
-
const marks = tr.storedMarks || $from.marks();
|
|
68
|
-
if (marks.length > 0) {
|
|
69
|
-
const filteredMarks = marks.filter(mark => !this.options.excludeMarks.includes(mark.type.name));
|
|
70
|
-
if (filteredMarks.length > 0) {
|
|
71
|
-
this.storage.storedMarks = filteredMarks;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// Also store marks when selection changes and we have marks
|
|
76
|
-
if (hasContent && tr.selectionSet) {
|
|
77
|
-
const { $from } = tr.selection;
|
|
78
|
-
const marks = tr.storedMarks || $from.marks();
|
|
79
|
-
if (marks.length > 0) {
|
|
80
|
-
const filteredMarks = marks.filter(mark => !this.options.excludeMarks.includes(mark.type.name));
|
|
81
|
-
if (filteredMarks.length > 0) {
|
|
82
|
-
this.storage.storedMarks = filteredMarks;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
// Apply stored marks when transitioning from empty to non-empty
|
|
87
|
-
if (changes.becameNonEmpty && this.storage.storedMarks.length > 0) {
|
|
88
|
-
// Set stored marks for the next input
|
|
89
|
-
tr.setStoredMarks(this.storage.storedMarks);
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
lastContentSize: newEditorState.doc.content.size,
|
|
93
|
-
wasEmpty: isEmpty,
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
appendTransaction: (transactions, oldState, newState) => {
|
|
98
|
-
const wasEmpty = isDocumentEmpty(oldState, this.options.documentStateConfig);
|
|
99
|
-
const hasContent = !isDocumentEmpty(newState, this.options.documentStateConfig);
|
|
100
|
-
// Check if we need to restore marks after content was added to empty editor
|
|
101
|
-
if (wasEmpty && hasContent && this.storage.storedMarks.length > 0) {
|
|
102
|
-
const { tr } = newState;
|
|
103
|
-
let hasChanges = false;
|
|
104
|
-
// Find the newly added content
|
|
105
|
-
let newContentStart = -1;
|
|
106
|
-
let newContentEnd = -1;
|
|
107
|
-
for (const transaction of transactions) {
|
|
108
|
-
if (transaction.docChanged) {
|
|
109
|
-
transaction.steps.forEach(step => {
|
|
110
|
-
if ('from' in step &&
|
|
111
|
-
'to' in step &&
|
|
112
|
-
typeof step.from === 'number' &&
|
|
113
|
-
typeof step.to === 'number') {
|
|
114
|
-
if (newContentStart === -1 || step.from < newContentStart) {
|
|
115
|
-
newContentStart = step.from;
|
|
116
|
-
}
|
|
117
|
-
if (newContentEnd === -1 || step.to > newContentEnd) {
|
|
118
|
-
newContentEnd = step.to;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Apply stored marks to the new content if we found the range
|
|
125
|
-
if (newContentStart !== -1 && newContentEnd !== -1) {
|
|
126
|
-
this.storage.storedMarks.forEach(mark => {
|
|
127
|
-
tr.addMark(newContentStart, newContentEnd, mark);
|
|
128
|
-
hasChanges = true;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
// Also set stored marks for future typing
|
|
132
|
-
if (this.storage.storedMarks.length > 0) {
|
|
133
|
-
tr.setStoredMarks(this.storage.storedMarks);
|
|
134
|
-
hasChanges = true;
|
|
135
|
-
}
|
|
136
|
-
if (hasChanges) {
|
|
137
|
-
return tr;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
},
|
|
142
|
-
// Handle view updates for better mark application
|
|
143
|
-
view: () => ({
|
|
144
|
-
update: (view, prevState) => {
|
|
145
|
-
const prevEmpty = isDocumentEmpty(prevState, this.options.documentStateConfig);
|
|
146
|
-
const currentEmpty = isDocumentEmpty(view.state, this.options.documentStateConfig);
|
|
147
|
-
// When transitioning from empty to non-empty, ensure stored marks are applied
|
|
148
|
-
if (prevEmpty && !currentEmpty && this.storage.storedMarks.length > 0) {
|
|
149
|
-
// Use setTimeout to ensure this runs after the current transaction
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
const { state, dispatch } = view;
|
|
152
|
-
const { tr } = state;
|
|
153
|
-
// Set stored marks for the current position
|
|
154
|
-
tr.setStoredMarks(this.storage.storedMarks);
|
|
155
|
-
dispatch(tr);
|
|
156
|
-
}, 0);
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
}),
|
|
160
|
-
}),
|
|
161
|
-
];
|
|
162
|
-
},
|
|
163
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export type TextTransformOptions = {
|
|
3
|
-
/**
|
|
4
|
-
* A list of node names where the text transform can be applied.
|
|
5
|
-
* @default ['textStyle']
|
|
6
|
-
* @example ['heading', 'paragraph']
|
|
7
|
-
*/
|
|
8
|
-
types: string[];
|
|
9
|
-
};
|
|
10
|
-
declare module '@tiptap/core' {
|
|
11
|
-
interface Commands<ReturnType> {
|
|
12
|
-
textTransform: {
|
|
13
|
-
/**
|
|
14
|
-
* Set the text transform
|
|
15
|
-
* @param textTransform The text transform
|
|
16
|
-
* @example editor.commands.setTextTransform('uppercase')
|
|
17
|
-
*/
|
|
18
|
-
setTextTransform: (textTransform: string | null) => ReturnType;
|
|
19
|
-
/**
|
|
20
|
-
* Unset the text transform
|
|
21
|
-
* @example editor.commands.unsetTextTransform()
|
|
22
|
-
*/
|
|
23
|
-
unsetTextTransform: () => ReturnType;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This extension allows you to set a text transform for text.
|
|
29
|
-
*/
|
|
30
|
-
export declare const TextTransform: Extension<TextTransformOptions, any>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* This extension allows you to set a text transform for text.
|
|
4
|
-
*/
|
|
5
|
-
export const TextTransform = Extension.create({
|
|
6
|
-
name: 'textTransform',
|
|
7
|
-
addOptions() {
|
|
8
|
-
return {
|
|
9
|
-
types: ['textStyle'],
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
addGlobalAttributes() {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
types: this.options.types,
|
|
16
|
-
attributes: {
|
|
17
|
-
textTransform: {
|
|
18
|
-
default: null,
|
|
19
|
-
renderHTML: attrs => attrs.textTransform
|
|
20
|
-
? {
|
|
21
|
-
style: `text-transform: ${attrs.textTransform}`,
|
|
22
|
-
}
|
|
23
|
-
: {},
|
|
24
|
-
parseHTML: element => element.style.textTransform,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
},
|
|
30
|
-
addCommands() {
|
|
31
|
-
return {
|
|
32
|
-
setTextTransform: textTransform => ({ chain }) => chain().setMark('textStyle', { textTransform }).run(),
|
|
33
|
-
unsetTextTransform: () => ({ chain }) => chain().setMark('textStyle', { textTransform: 'none' }).removeEmptyTextStyle().run(),
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Node } from '@tiptap/core';
|
|
2
|
-
import { type UnorderedListStyleType } from '../types';
|
|
3
|
-
type ListStyleType = UnorderedListStyleType;
|
|
4
|
-
export interface CustomUnorderedListOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The node name for the list items
|
|
7
|
-
* @default 'listItem'
|
|
8
|
-
*/
|
|
9
|
-
itemTypeName: string;
|
|
10
|
-
/**
|
|
11
|
-
* HTML attributes to add to the unordered list element
|
|
12
|
-
* @default {}
|
|
13
|
-
*/
|
|
14
|
-
HTMLAttributes: Record<string, any>;
|
|
15
|
-
/**
|
|
16
|
-
* Keep the marks when splitting the list
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
keepMarks: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Keep the attributes when splitting the list
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
keepAttributes: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Default list style type
|
|
27
|
-
* @default 'disc'
|
|
28
|
-
*/
|
|
29
|
-
defaultListStyleType: ListStyleType;
|
|
30
|
-
}
|
|
31
|
-
declare module '@tiptap/core' {
|
|
32
|
-
interface Commands<ReturnType> {
|
|
33
|
-
customUnorderedList: {
|
|
34
|
-
/**
|
|
35
|
-
* Toggle a custom unordered list
|
|
36
|
-
*/
|
|
37
|
-
toggleCustomUnorderedList: (options?: {
|
|
38
|
-
listStyleType?: ListStyleType;
|
|
39
|
-
customBulletChar?: string;
|
|
40
|
-
}) => ReturnType;
|
|
41
|
-
/**
|
|
42
|
-
* Set list style type for current unordered list
|
|
43
|
-
*/
|
|
44
|
-
setUnorderedListStyle: (options: {
|
|
45
|
-
listStyleType?: ListStyleType;
|
|
46
|
-
customBulletChar?: string;
|
|
47
|
-
}) => ReturnType;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* This extension allows you to create unordered lists with custom bullet styles.
|
|
53
|
-
*/
|
|
54
|
-
export declare const CustomUnorderedList: Node<CustomUnorderedListOptions, any>;
|
|
55
|
-
export {};
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core';
|
|
2
|
-
import { UNORDERED_LIST_STYLE_TYPE } from '../constants';
|
|
3
|
-
const ListItemName = 'listItem';
|
|
4
|
-
const TextStyleName = 'textStyle';
|
|
5
|
-
/**
|
|
6
|
-
* Input regex patterns for different bullet styles
|
|
7
|
-
*/
|
|
8
|
-
const inputRegexPatterns = {
|
|
9
|
-
disc: /^\s*([-*•])\s$/,
|
|
10
|
-
circle: /^\s*([○◯])\s$/,
|
|
11
|
-
square: /^\s*([▪■])\s$/,
|
|
12
|
-
plus: /^\s*([+])\s$/,
|
|
13
|
-
arrow: /^\s*([→➤])\s$/,
|
|
14
|
-
star: /^\s*([★☆])\s$/,
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Map input characters to bullet style types
|
|
18
|
-
*/
|
|
19
|
-
const charToBulletStyle = {
|
|
20
|
-
'-': UNORDERED_LIST_STYLE_TYPE.disc,
|
|
21
|
-
'*': UNORDERED_LIST_STYLE_TYPE.disc,
|
|
22
|
-
'•': UNORDERED_LIST_STYLE_TYPE.disc,
|
|
23
|
-
'○': UNORDERED_LIST_STYLE_TYPE.circle,
|
|
24
|
-
'◯': UNORDERED_LIST_STYLE_TYPE.circle,
|
|
25
|
-
'▪': UNORDERED_LIST_STYLE_TYPE.square,
|
|
26
|
-
'■': UNORDERED_LIST_STYLE_TYPE.square,
|
|
27
|
-
'+': UNORDERED_LIST_STYLE_TYPE.custom,
|
|
28
|
-
'→': UNORDERED_LIST_STYLE_TYPE.custom,
|
|
29
|
-
'➤': UNORDERED_LIST_STYLE_TYPE.custom,
|
|
30
|
-
'★': UNORDERED_LIST_STYLE_TYPE.custom,
|
|
31
|
-
'☆': UNORDERED_LIST_STYLE_TYPE.custom,
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* This extension allows you to create unordered lists with custom bullet styles.
|
|
35
|
-
*/
|
|
36
|
-
export const CustomUnorderedList = Node.create({
|
|
37
|
-
name: 'customUnorderedList',
|
|
38
|
-
addOptions() {
|
|
39
|
-
return {
|
|
40
|
-
itemTypeName: ListItemName,
|
|
41
|
-
HTMLAttributes: {
|
|
42
|
-
style: 'margin:0.5em 0;padding-inline-start:1.2em',
|
|
43
|
-
},
|
|
44
|
-
keepMarks: false,
|
|
45
|
-
keepAttributes: false,
|
|
46
|
-
defaultListStyleType: UNORDERED_LIST_STYLE_TYPE.disc,
|
|
47
|
-
customBulletChar: '→',
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
group: 'block list',
|
|
51
|
-
content() {
|
|
52
|
-
return `${this.options.itemTypeName}+`;
|
|
53
|
-
},
|
|
54
|
-
addAttributes() {
|
|
55
|
-
return {
|
|
56
|
-
listStyleType: {
|
|
57
|
-
default: this.options.defaultListStyleType,
|
|
58
|
-
parseHTML: element => {
|
|
59
|
-
if (element.dataset.bulletChar) {
|
|
60
|
-
return UNORDERED_LIST_STYLE_TYPE.custom;
|
|
61
|
-
}
|
|
62
|
-
const style = element.getAttribute('style');
|
|
63
|
-
const listStyleType = style?.match(/list-style-type:\s*([^;]+)/)?.[1]?.trim();
|
|
64
|
-
return listStyleType || this.options.defaultListStyleType;
|
|
65
|
-
},
|
|
66
|
-
renderHTML: attributes => {
|
|
67
|
-
if (attributes.listStyleType === UNORDERED_LIST_STYLE_TYPE.custom) {
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
style: `list-style-type: ${attributes.listStyleType}`,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
customBulletChar: {
|
|
76
|
-
default: null,
|
|
77
|
-
parseHTML: element => element.getAttribute('data-bullet-char'),
|
|
78
|
-
renderHTML: attributes => {
|
|
79
|
-
if (attributes.listStyleType === UNORDERED_LIST_STYLE_TYPE.custom) {
|
|
80
|
-
return {
|
|
81
|
-
'data-bullet-char': attributes.customBulletChar,
|
|
82
|
-
style: `list-style-type: '${attributes.customBulletChar} '`,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return {};
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
parseHTML() {
|
|
91
|
-
return [{ tag: 'ul' }];
|
|
92
|
-
},
|
|
93
|
-
renderHTML({ HTMLAttributes }) {
|
|
94
|
-
return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
95
|
-
},
|
|
96
|
-
addCommands() {
|
|
97
|
-
return {
|
|
98
|
-
toggleCustomUnorderedList: (options = {}) => ({ chain }) => {
|
|
99
|
-
const { listStyleType = this.options.defaultListStyleType, customBulletChar } = options;
|
|
100
|
-
if (this.options.keepAttributes) {
|
|
101
|
-
return chain()
|
|
102
|
-
.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
103
|
-
.updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName))
|
|
104
|
-
.updateAttributes(this.name, {
|
|
105
|
-
listStyleType,
|
|
106
|
-
customBulletChar,
|
|
107
|
-
})
|
|
108
|
-
.run();
|
|
109
|
-
}
|
|
110
|
-
return chain()
|
|
111
|
-
.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
112
|
-
.updateAttributes(this.name, {
|
|
113
|
-
listStyleType,
|
|
114
|
-
customBulletChar,
|
|
115
|
-
})
|
|
116
|
-
.run();
|
|
117
|
-
},
|
|
118
|
-
setUnorderedListStyle: (options = {}) => ({ commands }) => {
|
|
119
|
-
const { listStyleType, customBulletChar } = options;
|
|
120
|
-
return commands.updateAttributes(this.name, {
|
|
121
|
-
listStyleType,
|
|
122
|
-
customBulletChar,
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
addKeyboardShortcuts() {
|
|
128
|
-
return {
|
|
129
|
-
'Mod-Shift-8': () => this.editor.commands.toggleCustomUnorderedList(),
|
|
130
|
-
};
|
|
131
|
-
},
|
|
132
|
-
addInputRules() {
|
|
133
|
-
const inputRules = [];
|
|
134
|
-
Object.values(inputRegexPatterns).forEach(regex => {
|
|
135
|
-
let inputRule = wrappingInputRule({
|
|
136
|
-
find: regex,
|
|
137
|
-
type: this.type,
|
|
138
|
-
getAttributes: match => {
|
|
139
|
-
const char = match[1];
|
|
140
|
-
const listStyleType = charToBulletStyle[char] || UNORDERED_LIST_STYLE_TYPE.disc;
|
|
141
|
-
if (listStyleType === UNORDERED_LIST_STYLE_TYPE.custom) {
|
|
142
|
-
return {
|
|
143
|
-
listStyleType: UNORDERED_LIST_STYLE_TYPE.custom,
|
|
144
|
-
customBulletChar: char,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return { listStyleType };
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
151
|
-
inputRule = wrappingInputRule({
|
|
152
|
-
find: regex,
|
|
153
|
-
type: this.type,
|
|
154
|
-
keepMarks: this.options.keepMarks,
|
|
155
|
-
keepAttributes: this.options.keepAttributes,
|
|
156
|
-
getAttributes: match => {
|
|
157
|
-
const char = match[1];
|
|
158
|
-
const listStyleType = charToBulletStyle[char] || UNORDERED_LIST_STYLE_TYPE.disc;
|
|
159
|
-
const baseAttributes = this.editor.getAttributes(TextStyleName);
|
|
160
|
-
if (listStyleType === UNORDERED_LIST_STYLE_TYPE.custom) {
|
|
161
|
-
return {
|
|
162
|
-
...baseAttributes,
|
|
163
|
-
listStyleType: UNORDERED_LIST_STYLE_TYPE.custom,
|
|
164
|
-
customBulletChar: char,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return { ...baseAttributes, listStyleType };
|
|
168
|
-
},
|
|
169
|
-
editor: this.editor,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
inputRules.push(inputRule);
|
|
173
|
-
});
|
|
174
|
-
return inputRules;
|
|
175
|
-
},
|
|
176
|
-
});
|