@cgboiler/biz-basic 1.0.52 → 1.0.54
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/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/es/rich-text-editor/RichTextEditor.js +76 -196
- package/es/rich-text-editor/_atomic.css +2 -1
- package/es/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/es/rich-text-editor/extensions/ConsumedTrigger.js +22 -0
- package/es/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/es/rich-text-editor/extensions/CustomContent.js +103 -0
- package/es/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/es/rich-text-editor/extensions/HashTag.js +133 -0
- package/es/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/es/rich-text-editor/extensions/HorizontalRule.js +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.js +30 -0
- package/es/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/es/rich-text-editor/extensions/ImageUpload.js +80 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.js +35 -0
- package/es/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/es/rich-text-editor/extensions/MediaInputRules.js +47 -0
- package/es/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/es/rich-text-editor/extensions/MentionExtension.js +60 -0
- package/es/rich-text-editor/extensions/index.d.ts +16 -0
- package/es/rich-text-editor/extensions/index.js +20 -0
- package/es/rich-text-editor/hooks/index.d.ts +6 -0
- package/es/rich-text-editor/hooks/index.js +4 -0
- package/es/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/es/rich-text-editor/hooks/useEditorHistory.js +87 -0
- package/es/rich-text-editor/index copy 2.css +1 -0
- package/es/rich-text-editor/index copy 2.less +598 -0
- package/es/rich-text-editor/index copy.css +1 -0
- package/es/rich-text-editor/index copy.less +356 -0
- package/es/rich-text-editor/index.css +1 -1
- package/es/rich-text-editor/index.less +444 -254
- package/es/rich-text-editor/lib/utils.d.ts +123 -0
- package/es/rich-text-editor/lib/utils.js +244 -0
- package/es/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.js +102 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.js +99 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.js +102 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.js +42 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.js +71 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.js +299 -0
- package/es/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/link-popover.js +127 -0
- package/es/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/list-button.js +69 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.js +97 -0
- package/es/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/mark-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.js +77 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.js +132 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.js +135 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +70 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.js +103 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.js +62 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +121 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.js +191 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.js +109 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.js +134 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.js +20 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.js +113 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.js +45 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.js +96 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.js +74 -0
- package/es/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/es/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/es/rich-text-editor/menu-system/icons/index.js +487 -0
- package/es/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/es/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/es/rich-text-editor/menu-system/primitives/button.js +107 -0
- package/es/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/es/rich-text-editor/menu-system/primitives/card.js +116 -0
- package/es/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/es/rich-text-editor/menu-system/primitives/input.js +55 -0
- package/es/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/es/rich-text-editor/menu-system/primitives/separator.js +42 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.js +149 -0
- package/es/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/es/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/es/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/es/rich-text-editor/menu-system/styles/button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button.less +322 -0
- package/es/rich-text-editor/menu-system/styles/card.css +1 -0
- package/es/rich-text-editor/menu-system/styles/card.less +78 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/es/rich-text-editor/menu-system/styles/input.css +1 -0
- package/es/rich-text-editor/menu-system/styles/input.less +53 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/es/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/es/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.less +88 -0
- package/es/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/es/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.js +243 -0
- package/es/rich-text-editor/types.d.ts +4 -0
- package/es/rich-text-editor/types.js +4 -0
- package/es/rich-text-editor/useExtensions.d.ts +3 -3
- package/es/rich-text-editor/useExtensions.js +63 -391
- package/es/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/es/rich-text-editor/utils/eventHandlers.js +103 -0
- package/es/rich-text-editor/utils/index.d.ts +6 -0
- package/es/rich-text-editor/utils/index.js +19 -0
- package/es/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/es/rich-text-editor/utils/triggerHelpers.js +46 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/lib/rich-text-editor/RichTextEditor.js +76 -206
- package/lib/rich-text-editor/_atomic.css +2 -1
- package/lib/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/lib/rich-text-editor/extensions/ConsumedTrigger.js +41 -0
- package/lib/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/lib/rich-text-editor/extensions/CustomContent.js +132 -0
- package/lib/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/lib/rich-text-editor/extensions/HashTag.js +157 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.js +45 -0
- package/lib/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/lib/rich-text-editor/extensions/IMEComposition.js +49 -0
- package/lib/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/lib/rich-text-editor/extensions/ImageUpload.js +99 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.js +54 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.js +66 -0
- package/lib/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MentionExtension.js +89 -0
- package/lib/rich-text-editor/extensions/index.d.ts +16 -0
- package/lib/rich-text-editor/extensions/index.js +49 -0
- package/lib/rich-text-editor/hooks/index.d.ts +6 -0
- package/lib/rich-text-editor/hooks/index.js +23 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.js +116 -0
- package/lib/rich-text-editor/index copy 2.css +1 -0
- package/lib/rich-text-editor/index copy 2.less +598 -0
- package/lib/rich-text-editor/index copy.css +1 -0
- package/lib/rich-text-editor/index copy.less +356 -0
- package/lib/rich-text-editor/index.css +1 -1
- package/lib/rich-text-editor/index.less +444 -254
- package/lib/rich-text-editor/lib/utils.d.ts +123 -0
- package/lib/rich-text-editor/lib/utils.js +263 -0
- package/lib/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.js +119 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.js +118 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.js +131 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.js +61 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.js +90 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.js +316 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.js +146 -0
- package/lib/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/list-button.js +88 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.js +116 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.js +96 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.js +185 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +65 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.js +149 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +84 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.js +190 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.js +122 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.js +81 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +140 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.js +205 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.js +138 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.js +153 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.js +39 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.js +132 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.js +64 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.js +115 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.js +93 -0
- package/lib/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/lib/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/lib/rich-text-editor/menu-system/icons/index.js +506 -0
- package/lib/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/lib/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/lib/rich-text-editor/menu-system/primitives/button.js +126 -0
- package/lib/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/lib/rich-text-editor/menu-system/primitives/card.js +135 -0
- package/lib/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/lib/rich-text-editor/menu-system/primitives/input.js +74 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.js +61 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.js +168 -0
- package/lib/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/lib/rich-text-editor/menu-system/styles/button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button.less +322 -0
- package/lib/rich-text-editor/menu-system/styles/card.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/card.less +78 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/lib/rich-text-editor/menu-system/styles/input.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/input.less +53 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/lib/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.less +88 -0
- package/lib/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.js +262 -0
- package/lib/rich-text-editor/types.d.ts +4 -0
- package/lib/rich-text-editor/types.js +4 -0
- package/lib/rich-text-editor/useExtensions.d.ts +3 -3
- package/lib/rich-text-editor/useExtensions.js +64 -392
- package/lib/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/lib/rich-text-editor/utils/eventHandlers.js +132 -0
- package/lib/rich-text-editor/utils/index.d.ts +6 -0
- package/lib/rich-text-editor/utils/index.js +32 -0
- package/lib/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/lib/rich-text-editor/utils/triggerHelpers.js +65 -0
- package/package.json +13 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export declare const IMAGE_UPLOAD_SHORTCUT_KEY = "mod+shift+i";
|
|
3
|
+
export interface UseImageUploadConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
hideWhenUnavailable?: boolean;
|
|
6
|
+
onInserted?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function canInsertImage(editor: Editor | null): boolean;
|
|
9
|
+
export declare function isImageActive(editor: Editor | null): boolean;
|
|
10
|
+
export declare function insertImage(editor: Editor | null): boolean;
|
|
11
|
+
export declare function shouldShowButton(props: {
|
|
12
|
+
editor: Editor | null;
|
|
13
|
+
hideWhenUnavailable: boolean;
|
|
14
|
+
}): boolean;
|
|
15
|
+
export declare function useImageUpload(config: UseImageUploadConfig): {
|
|
16
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
isActive: import("vue").Ref<boolean, boolean>;
|
|
18
|
+
handleImage: () => void;
|
|
19
|
+
canInsert: import("vue").Ref<boolean, boolean>;
|
|
20
|
+
label: string;
|
|
21
|
+
shortcutKeys: string;
|
|
22
|
+
Icon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
23
|
+
className: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
className: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
}>> & Readonly<{}>, {
|
|
33
|
+
className: string;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
import { isExtensionAvailable, isNodeTypeSelected } from "../utils/tiptap-utils";
|
|
3
|
+
import { PlusSquareIcon } from "../icons";
|
|
4
|
+
const IMAGE_UPLOAD_SHORTCUT_KEY = "mod+shift+i";
|
|
5
|
+
function canInsertImage(editor) {
|
|
6
|
+
if (!editor || !editor.isEditable)
|
|
7
|
+
return false;
|
|
8
|
+
const extensionName = isExtensionAvailable(editor, "imageUpload") ? "imageUpload" : "image";
|
|
9
|
+
if (!isExtensionAvailable(editor, extensionName) || isNodeTypeSelected(editor, ["image"]))
|
|
10
|
+
return false;
|
|
11
|
+
return editor.can().insertContent({ type: extensionName });
|
|
12
|
+
}
|
|
13
|
+
function isImageActive(editor) {
|
|
14
|
+
if (!editor || !editor.isEditable)
|
|
15
|
+
return false;
|
|
16
|
+
return editor.isActive("imageUpload") || editor.isActive("image");
|
|
17
|
+
}
|
|
18
|
+
function insertImage(editor) {
|
|
19
|
+
if (!editor || !editor.isEditable)
|
|
20
|
+
return false;
|
|
21
|
+
if (!canInsertImage(editor))
|
|
22
|
+
return false;
|
|
23
|
+
const extensionName = isExtensionAvailable(editor, "imageUpload") ? "imageUpload" : "image";
|
|
24
|
+
try {
|
|
25
|
+
return editor.chain().focus().insertContent({
|
|
26
|
+
type: extensionName
|
|
27
|
+
}).run();
|
|
28
|
+
} catch (e) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function shouldShowButton(props) {
|
|
33
|
+
const { editor, hideWhenUnavailable } = props;
|
|
34
|
+
if (!editor || !editor.isEditable)
|
|
35
|
+
return false;
|
|
36
|
+
const hasExtension = isExtensionAvailable(editor, "imageUpload") || isExtensionAvailable(editor, "image");
|
|
37
|
+
if (!hasExtension)
|
|
38
|
+
return false;
|
|
39
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
40
|
+
return canInsertImage(editor);
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
function useImageUpload(config) {
|
|
45
|
+
const { hideWhenUnavailable = false, onInserted } = config;
|
|
46
|
+
const isVisible = ref(true);
|
|
47
|
+
const isActive = ref(false);
|
|
48
|
+
const canInsert = ref(false);
|
|
49
|
+
const getEditor = () => {
|
|
50
|
+
const editor = config.editor;
|
|
51
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
52
|
+
};
|
|
53
|
+
const updateState = () => {
|
|
54
|
+
const editor = getEditor();
|
|
55
|
+
if (!editor || !editor.isEditable) {
|
|
56
|
+
isVisible.value = false;
|
|
57
|
+
isActive.value = false;
|
|
58
|
+
canInsert.value = false;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
isActive.value = isImageActive(editor);
|
|
62
|
+
canInsert.value = canInsertImage(editor);
|
|
63
|
+
isVisible.value = shouldShowButton({ editor, hideWhenUnavailable });
|
|
64
|
+
};
|
|
65
|
+
watch(
|
|
66
|
+
() => getEditor(),
|
|
67
|
+
(editor) => {
|
|
68
|
+
if (!editor)
|
|
69
|
+
return;
|
|
70
|
+
updateState();
|
|
71
|
+
editor.on("selectionUpdate", updateState);
|
|
72
|
+
editor.on("transaction", updateState);
|
|
73
|
+
onBeforeUnmount(() => {
|
|
74
|
+
editor.off("selectionUpdate", updateState);
|
|
75
|
+
editor.off("transaction", updateState);
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
{ immediate: true }
|
|
79
|
+
);
|
|
80
|
+
const handleImage = () => {
|
|
81
|
+
const editor = getEditor();
|
|
82
|
+
if (insertImage(editor)) {
|
|
83
|
+
onInserted == null ? void 0 : onInserted();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
isVisible,
|
|
88
|
+
isActive,
|
|
89
|
+
handleImage,
|
|
90
|
+
canInsert,
|
|
91
|
+
label: "Add image",
|
|
92
|
+
shortcutKeys: IMAGE_UPLOAD_SHORTCUT_KEY,
|
|
93
|
+
Icon: PlusSquareIcon
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
IMAGE_UPLOAD_SHORTCUT_KEY,
|
|
98
|
+
canInsertImage,
|
|
99
|
+
insertImage,
|
|
100
|
+
isImageActive,
|
|
101
|
+
shouldShowButton,
|
|
102
|
+
useImageUpload
|
|
103
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UseLinkPopoverConfig {
|
|
2
|
+
editor: any;
|
|
3
|
+
onLinkAdded?: (url: string, inNewTab: boolean) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function useLinkPopover(config: UseLinkPopoverConfig): {
|
|
6
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
7
|
+
linkUrl: import("vue").Ref<string, string>;
|
|
8
|
+
inNewTab: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
handleSetLink: (url: string, newTab: boolean) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
function useLinkPopover(config) {
|
|
3
|
+
const isVisible = ref(false);
|
|
4
|
+
const linkUrl = ref("");
|
|
5
|
+
const inNewTab = ref(false);
|
|
6
|
+
const getEditor = () => {
|
|
7
|
+
const editor = config.editor;
|
|
8
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
9
|
+
};
|
|
10
|
+
const updateState = () => {
|
|
11
|
+
const editor = getEditor();
|
|
12
|
+
if (!editor || !editor.isEditable) {
|
|
13
|
+
isVisible.value = false;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
isVisible.value = editor.can().setLink({ href: "" }) || editor.isActive("link");
|
|
17
|
+
if (editor.isActive("link")) {
|
|
18
|
+
const attrs = editor.getAttributes("link");
|
|
19
|
+
linkUrl.value = attrs.href || "";
|
|
20
|
+
inNewTab.value = attrs.target === "_blank";
|
|
21
|
+
} else {
|
|
22
|
+
linkUrl.value = "";
|
|
23
|
+
inNewTab.value = false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
watch(
|
|
27
|
+
() => getEditor(),
|
|
28
|
+
(editor) => {
|
|
29
|
+
if (!editor)
|
|
30
|
+
return;
|
|
31
|
+
updateState();
|
|
32
|
+
editor.on("selectionUpdate", updateState);
|
|
33
|
+
editor.on("transaction", updateState);
|
|
34
|
+
onBeforeUnmount(() => {
|
|
35
|
+
editor.off("selectionUpdate", updateState);
|
|
36
|
+
editor.off("transaction", updateState);
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
{ immediate: true }
|
|
40
|
+
);
|
|
41
|
+
const handleSetLink = (url, newTab) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const editor = getEditor();
|
|
44
|
+
if (!editor)
|
|
45
|
+
return;
|
|
46
|
+
if (url === "") {
|
|
47
|
+
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
48
|
+
} else {
|
|
49
|
+
editor.chain().focus().extendMarkRange("link").setLink({ href: url, target: newTab ? "_blank" : null }).run();
|
|
50
|
+
}
|
|
51
|
+
(_a = config.onLinkAdded) == null ? void 0 : _a.call(config, url, newTab);
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
isVisible,
|
|
55
|
+
linkUrl,
|
|
56
|
+
inNewTab,
|
|
57
|
+
handleSetLink
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
useLinkPopover
|
|
62
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import { type ListType } from './use-list';
|
|
3
|
+
export interface UseListDropdownMenuConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
types?: ListType[];
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ListOption {
|
|
9
|
+
label: string;
|
|
10
|
+
type: ListType;
|
|
11
|
+
icon: any;
|
|
12
|
+
}
|
|
13
|
+
export declare const listOptions: ListOption[];
|
|
14
|
+
export declare function canToggleAnyList(editor: Editor | null, listTypes: ListType[]): boolean;
|
|
15
|
+
export declare function isAnyListActive(editor: Editor | null, listTypes: ListType[]): boolean;
|
|
16
|
+
export declare function getFilteredListOptions(availableTypes: ListType[]): typeof listOptions;
|
|
17
|
+
export declare function shouldShowListDropdown(params: {
|
|
18
|
+
editor: Editor | null;
|
|
19
|
+
listTypes: ListType[];
|
|
20
|
+
hideWhenUnavailable: boolean;
|
|
21
|
+
listInSchema: boolean;
|
|
22
|
+
canToggleAny: boolean;
|
|
23
|
+
}): boolean;
|
|
24
|
+
export declare function getActiveListType(editor: Editor | null, availableTypes: ListType[]): ListType | undefined;
|
|
25
|
+
export declare function useListDropdownMenu(config: UseListDropdownMenuConfig): {
|
|
26
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
27
|
+
activeType: import("vue").Ref<ListType | undefined, ListType | undefined>;
|
|
28
|
+
isActive: import("vue").Ref<boolean, boolean>;
|
|
29
|
+
canToggle: import("vue").Ref<boolean, boolean>;
|
|
30
|
+
types: ListType[];
|
|
31
|
+
filteredLists: ListOption[];
|
|
32
|
+
label: string;
|
|
33
|
+
Icon: import("vue").ComputedRef<any>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount, computed } from "vue";
|
|
2
|
+
import { isNodeInSchema } from "../utils/tiptap-utils";
|
|
3
|
+
import { canToggleList, isListActive, listIcons } from "./use-list";
|
|
4
|
+
import { ListIcon, ListOrderedIcon } from "../icons";
|
|
5
|
+
const listOptions = [
|
|
6
|
+
{
|
|
7
|
+
label: "Bullet List",
|
|
8
|
+
type: "bulletList",
|
|
9
|
+
icon: ListIcon
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "Ordered List",
|
|
13
|
+
type: "orderedList",
|
|
14
|
+
icon: ListOrderedIcon
|
|
15
|
+
}
|
|
16
|
+
// {
|
|
17
|
+
// label: 'Task List',
|
|
18
|
+
// type: 'taskList',
|
|
19
|
+
// icon: ListTodoIcon,
|
|
20
|
+
// },
|
|
21
|
+
];
|
|
22
|
+
function canToggleAnyList(editor, listTypes) {
|
|
23
|
+
if (!editor || !editor.isEditable)
|
|
24
|
+
return false;
|
|
25
|
+
return listTypes.some((type) => canToggleList(editor, type));
|
|
26
|
+
}
|
|
27
|
+
function isAnyListActive(editor, listTypes) {
|
|
28
|
+
if (!editor || !editor.isEditable)
|
|
29
|
+
return false;
|
|
30
|
+
return listTypes.some((type) => isListActive(editor, type));
|
|
31
|
+
}
|
|
32
|
+
function getFilteredListOptions(availableTypes) {
|
|
33
|
+
return listOptions.filter((option) => availableTypes.includes(option.type));
|
|
34
|
+
}
|
|
35
|
+
function shouldShowListDropdown(params) {
|
|
36
|
+
const { editor, hideWhenUnavailable, listInSchema, canToggleAny } = params;
|
|
37
|
+
if (!listInSchema || !editor) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
41
|
+
return canToggleAny;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
function getActiveListType(editor, availableTypes) {
|
|
46
|
+
if (!editor || !editor.isEditable)
|
|
47
|
+
return void 0;
|
|
48
|
+
return availableTypes.find((type) => isListActive(editor, type));
|
|
49
|
+
}
|
|
50
|
+
function useListDropdownMenu(config) {
|
|
51
|
+
const { types = ["bulletList", "orderedList", "taskList"], hideWhenUnavailable = false } = config;
|
|
52
|
+
const isVisible = ref(false);
|
|
53
|
+
const isActive = ref(false);
|
|
54
|
+
const canToggleState = ref(false);
|
|
55
|
+
const activeType = ref();
|
|
56
|
+
const getEditor = () => {
|
|
57
|
+
const editor = config.editor;
|
|
58
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
59
|
+
};
|
|
60
|
+
const listInSchema = computed(() => {
|
|
61
|
+
const editor = getEditor();
|
|
62
|
+
return types.some((type) => isNodeInSchema(type, editor));
|
|
63
|
+
});
|
|
64
|
+
const filteredLists = getFilteredListOptions(types);
|
|
65
|
+
const updateState = () => {
|
|
66
|
+
const editor = getEditor();
|
|
67
|
+
if (!editor || !editor.isEditable) {
|
|
68
|
+
isVisible.value = false;
|
|
69
|
+
isActive.value = false;
|
|
70
|
+
canToggleState.value = false;
|
|
71
|
+
activeType.value = void 0;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
canToggleState.value = canToggleAnyList(editor, types);
|
|
75
|
+
isActive.value = isAnyListActive(editor, types);
|
|
76
|
+
activeType.value = getActiveListType(editor, types);
|
|
77
|
+
isVisible.value = shouldShowListDropdown({
|
|
78
|
+
editor,
|
|
79
|
+
listTypes: types,
|
|
80
|
+
hideWhenUnavailable,
|
|
81
|
+
listInSchema: listInSchema.value,
|
|
82
|
+
canToggleAny: canToggleState.value
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
watch(
|
|
86
|
+
() => getEditor(),
|
|
87
|
+
(editor) => {
|
|
88
|
+
if (!editor)
|
|
89
|
+
return;
|
|
90
|
+
updateState();
|
|
91
|
+
editor.on("selectionUpdate", updateState);
|
|
92
|
+
editor.on("transaction", updateState);
|
|
93
|
+
onBeforeUnmount(() => {
|
|
94
|
+
editor.off("selectionUpdate", updateState);
|
|
95
|
+
editor.off("transaction", updateState);
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
{ immediate: true }
|
|
99
|
+
);
|
|
100
|
+
const activeOption = computed(() => filteredLists.find((opt) => opt.type === activeType.value));
|
|
101
|
+
const Icon = computed(() => activeOption.value ? listIcons[activeOption.value.type] : ListIcon);
|
|
102
|
+
return {
|
|
103
|
+
isVisible,
|
|
104
|
+
activeType,
|
|
105
|
+
isActive,
|
|
106
|
+
canToggle: canToggleState,
|
|
107
|
+
types,
|
|
108
|
+
filteredLists,
|
|
109
|
+
label: "List",
|
|
110
|
+
Icon
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
canToggleAnyList,
|
|
115
|
+
getActiveListType,
|
|
116
|
+
getFilteredListOptions,
|
|
117
|
+
isAnyListActive,
|
|
118
|
+
listOptions,
|
|
119
|
+
shouldShowListDropdown,
|
|
120
|
+
useListDropdownMenu
|
|
121
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export type ListType = 'bulletList' | 'orderedList' | 'taskList';
|
|
3
|
+
export interface UseListConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
type: ListType;
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
onToggled?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const listIcons: any;
|
|
10
|
+
export declare const listLabels: Record<ListType, string>;
|
|
11
|
+
export declare const LIST_SHORTCUT_KEYS: Record<ListType, string>;
|
|
12
|
+
export declare function canToggleList(editor: Editor | null, type: ListType, turnInto?: boolean): boolean;
|
|
13
|
+
export declare function isListActive(editor: Editor | null, type: ListType): boolean;
|
|
14
|
+
export declare function toggleList(editor: Editor | null, type: ListType): boolean;
|
|
15
|
+
export declare function shouldShowButton(props: {
|
|
16
|
+
editor: Editor | null;
|
|
17
|
+
type: ListType;
|
|
18
|
+
hideWhenUnavailable: boolean;
|
|
19
|
+
}): boolean;
|
|
20
|
+
export declare function useList(config: UseListConfig): {
|
|
21
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
22
|
+
isActive: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
handleToggle: () => void;
|
|
24
|
+
canToggle: import("vue").Ref<boolean, boolean>;
|
|
25
|
+
label: string;
|
|
26
|
+
shortcutKeys: string;
|
|
27
|
+
Icon: any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
import { NodeSelection, TextSelection } from "@tiptap/pm/state";
|
|
3
|
+
import {
|
|
4
|
+
findNodePosition,
|
|
5
|
+
isNodeInSchema,
|
|
6
|
+
isNodeTypeSelected,
|
|
7
|
+
isValidPosition
|
|
8
|
+
} from "../utils/tiptap-utils";
|
|
9
|
+
import { ListIcon, ListOrderedIcon, ListTodoIcon } from "../icons";
|
|
10
|
+
const listIcons = {
|
|
11
|
+
bulletList: ListIcon,
|
|
12
|
+
orderedList: ListOrderedIcon,
|
|
13
|
+
taskList: ListTodoIcon
|
|
14
|
+
};
|
|
15
|
+
const listLabels = {
|
|
16
|
+
bulletList: "Bullet List",
|
|
17
|
+
orderedList: "Ordered List",
|
|
18
|
+
taskList: "Task List"
|
|
19
|
+
};
|
|
20
|
+
const LIST_SHORTCUT_KEYS = {
|
|
21
|
+
bulletList: "mod+shift+8",
|
|
22
|
+
orderedList: "mod+shift+7",
|
|
23
|
+
taskList: "mod+shift+9"
|
|
24
|
+
};
|
|
25
|
+
function canToggleList(editor, type, turnInto = true) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!editor || !editor.isEditable)
|
|
28
|
+
return false;
|
|
29
|
+
if (!isNodeInSchema(type, editor) || isNodeTypeSelected(editor, ["image"]))
|
|
30
|
+
return false;
|
|
31
|
+
if (!turnInto) {
|
|
32
|
+
switch (type) {
|
|
33
|
+
case "bulletList":
|
|
34
|
+
return editor.can().toggleBulletList();
|
|
35
|
+
case "orderedList":
|
|
36
|
+
return editor.can().toggleOrderedList();
|
|
37
|
+
case "taskList":
|
|
38
|
+
return editor.can().toggleList("taskList", "taskItem");
|
|
39
|
+
default:
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const view = editor.view;
|
|
45
|
+
const state = view.state;
|
|
46
|
+
const selection = state.selection;
|
|
47
|
+
if (selection.empty || selection instanceof TextSelection) {
|
|
48
|
+
const pos = (_a = findNodePosition({
|
|
49
|
+
editor,
|
|
50
|
+
node: state.selection.$anchor.node(1)
|
|
51
|
+
})) == null ? void 0 : _a.pos;
|
|
52
|
+
if (!isValidPosition(pos))
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function isListActive(editor, type) {
|
|
61
|
+
if (!editor || !editor.isEditable)
|
|
62
|
+
return false;
|
|
63
|
+
switch (type) {
|
|
64
|
+
case "bulletList":
|
|
65
|
+
return editor.isActive("bulletList");
|
|
66
|
+
case "orderedList":
|
|
67
|
+
return editor.isActive("orderedList");
|
|
68
|
+
case "taskList":
|
|
69
|
+
return editor.isActive("taskList");
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function toggleList(editor, type) {
|
|
75
|
+
var _a;
|
|
76
|
+
if (!editor || !editor.isEditable)
|
|
77
|
+
return false;
|
|
78
|
+
if (!canToggleList(editor, type))
|
|
79
|
+
return false;
|
|
80
|
+
try {
|
|
81
|
+
const view = editor.view;
|
|
82
|
+
let state = view.state;
|
|
83
|
+
let tr = state.tr;
|
|
84
|
+
if (state.selection.empty || state.selection instanceof TextSelection) {
|
|
85
|
+
const pos = (_a = findNodePosition({
|
|
86
|
+
editor,
|
|
87
|
+
node: state.selection.$anchor.node(1)
|
|
88
|
+
})) == null ? void 0 : _a.pos;
|
|
89
|
+
if (!isValidPosition(pos))
|
|
90
|
+
return false;
|
|
91
|
+
tr = tr.setSelection(NodeSelection.create(state.doc, pos));
|
|
92
|
+
view.dispatch(tr);
|
|
93
|
+
state = view.state;
|
|
94
|
+
}
|
|
95
|
+
const selection = state.selection;
|
|
96
|
+
let chain = editor.chain().focus();
|
|
97
|
+
if (selection instanceof NodeSelection) {
|
|
98
|
+
chain = chain.clearNodes();
|
|
99
|
+
}
|
|
100
|
+
if (editor.isActive(type)) {
|
|
101
|
+
chain.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();
|
|
102
|
+
} else {
|
|
103
|
+
const toggleMap = {
|
|
104
|
+
bulletList: () => chain.toggleBulletList(),
|
|
105
|
+
orderedList: () => chain.toggleOrderedList(),
|
|
106
|
+
taskList: () => chain.toggleList("taskList", "taskItem")
|
|
107
|
+
};
|
|
108
|
+
const toggle = toggleMap[type];
|
|
109
|
+
if (!toggle)
|
|
110
|
+
return false;
|
|
111
|
+
toggle().run();
|
|
112
|
+
}
|
|
113
|
+
editor.chain().focus().selectTextblockEnd().run();
|
|
114
|
+
return true;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function shouldShowButton(props) {
|
|
120
|
+
const { editor, type, hideWhenUnavailable } = props;
|
|
121
|
+
if (!editor || !editor.isEditable)
|
|
122
|
+
return false;
|
|
123
|
+
if (!isNodeInSchema(type, editor))
|
|
124
|
+
return false;
|
|
125
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
126
|
+
return canToggleList(editor, type);
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
function useList(config) {
|
|
131
|
+
const { type, hideWhenUnavailable = false, onToggled } = config;
|
|
132
|
+
const isVisible = ref(true);
|
|
133
|
+
const isActive = ref(false);
|
|
134
|
+
const canToggleState = ref(false);
|
|
135
|
+
const getEditor = () => {
|
|
136
|
+
const editor = config.editor;
|
|
137
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
138
|
+
};
|
|
139
|
+
const updateState = () => {
|
|
140
|
+
const editor = getEditor();
|
|
141
|
+
if (!editor || !editor.isEditable) {
|
|
142
|
+
isVisible.value = false;
|
|
143
|
+
isActive.value = false;
|
|
144
|
+
canToggleState.value = false;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
isActive.value = isListActive(editor, type);
|
|
148
|
+
canToggleState.value = canToggleList(editor, type);
|
|
149
|
+
isVisible.value = shouldShowButton({ editor, type, hideWhenUnavailable });
|
|
150
|
+
};
|
|
151
|
+
watch(
|
|
152
|
+
() => getEditor(),
|
|
153
|
+
(editor) => {
|
|
154
|
+
if (!editor)
|
|
155
|
+
return;
|
|
156
|
+
updateState();
|
|
157
|
+
editor.on("selectionUpdate", updateState);
|
|
158
|
+
editor.on("transaction", updateState);
|
|
159
|
+
onBeforeUnmount(() => {
|
|
160
|
+
editor.off("selectionUpdate", updateState);
|
|
161
|
+
editor.off("transaction", updateState);
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
{ immediate: true }
|
|
165
|
+
);
|
|
166
|
+
const handleToggle = () => {
|
|
167
|
+
const editor = getEditor();
|
|
168
|
+
if (toggleList(editor, type)) {
|
|
169
|
+
onToggled == null ? void 0 : onToggled();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
isVisible,
|
|
174
|
+
isActive,
|
|
175
|
+
handleToggle,
|
|
176
|
+
canToggle: canToggleState,
|
|
177
|
+
label: listLabels[type],
|
|
178
|
+
shortcutKeys: LIST_SHORTCUT_KEYS[type],
|
|
179
|
+
Icon: listIcons[type]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
LIST_SHORTCUT_KEYS,
|
|
184
|
+
canToggleList,
|
|
185
|
+
isListActive,
|
|
186
|
+
listIcons,
|
|
187
|
+
listLabels,
|
|
188
|
+
shouldShowButton,
|
|
189
|
+
toggleList,
|
|
190
|
+
useList
|
|
191
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export type Mark = 'bold' | 'italic' | 'strike' | 'code' | 'underline' | 'superscript' | 'subscript';
|
|
3
|
+
export interface UseMarkConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
type: Mark;
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
onToggled?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const markIcons: any;
|
|
10
|
+
export declare const MARK_SHORTCUT_KEYS: Record<Mark, string>;
|
|
11
|
+
export declare function canToggleMark(editor: Editor | null, type: Mark): boolean;
|
|
12
|
+
export declare function isMarkActive(editor: Editor | null, type: Mark): boolean;
|
|
13
|
+
export declare function toggleMark(editor: Editor | null, type: Mark): boolean;
|
|
14
|
+
export declare function useMark(config: UseMarkConfig): {
|
|
15
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
16
|
+
isActive: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
handleMark: () => boolean;
|
|
18
|
+
canToggle: import("vue").Ref<boolean, boolean>;
|
|
19
|
+
label: string;
|
|
20
|
+
shortcutKeys: string;
|
|
21
|
+
Icon: any;
|
|
22
|
+
};
|