@cgboiler/biz-basic 1.0.53 → 1.0.55
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 +87 -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 -428
- 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 +87 -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 -429
- 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,109 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
import { isMarkInSchema, isNodeTypeSelected } from "../utils/tiptap-utils";
|
|
3
|
+
import * as Icons from "../icons";
|
|
4
|
+
const markIcons = {
|
|
5
|
+
bold: Icons.BoldIcon,
|
|
6
|
+
italic: Icons.ItalicIcon,
|
|
7
|
+
underline: Icons.UnderlineIcon,
|
|
8
|
+
strike: Icons.StrikeIcon,
|
|
9
|
+
code: Icons.Code2Icon,
|
|
10
|
+
superscript: Icons.SuperscriptIcon,
|
|
11
|
+
subscript: Icons.SubscriptIcon
|
|
12
|
+
};
|
|
13
|
+
const MARK_SHORTCUT_KEYS = {
|
|
14
|
+
bold: "mod+b",
|
|
15
|
+
italic: "mod+i",
|
|
16
|
+
underline: "mod+u",
|
|
17
|
+
strike: "mod+shift+s",
|
|
18
|
+
code: "mod+e",
|
|
19
|
+
superscript: "mod+.",
|
|
20
|
+
subscript: "mod+,"
|
|
21
|
+
};
|
|
22
|
+
function canToggleMark(editor, type) {
|
|
23
|
+
if (!editor || !editor.isEditable)
|
|
24
|
+
return false;
|
|
25
|
+
if (!isMarkInSchema(type, editor) || isNodeTypeSelected(editor, ["image"]))
|
|
26
|
+
return false;
|
|
27
|
+
return editor.can().toggleMark(type);
|
|
28
|
+
}
|
|
29
|
+
function isMarkActive(editor, type) {
|
|
30
|
+
if (!editor || !editor.isEditable)
|
|
31
|
+
return false;
|
|
32
|
+
return editor.isActive(type);
|
|
33
|
+
}
|
|
34
|
+
function toggleMark(editor, type) {
|
|
35
|
+
if (!editor || !editor.isEditable)
|
|
36
|
+
return false;
|
|
37
|
+
if (!canToggleMark(editor, type))
|
|
38
|
+
return false;
|
|
39
|
+
return editor.chain().focus().toggleMark(type).run();
|
|
40
|
+
}
|
|
41
|
+
function useMark(config) {
|
|
42
|
+
const { type, hideWhenUnavailable = false, onToggled } = config;
|
|
43
|
+
const isVisible = ref(true);
|
|
44
|
+
const isActive = ref(false);
|
|
45
|
+
const canToggle = ref(false);
|
|
46
|
+
const getEditor = () => {
|
|
47
|
+
const editor = config.editor;
|
|
48
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
49
|
+
};
|
|
50
|
+
const updateState = () => {
|
|
51
|
+
const editor = getEditor();
|
|
52
|
+
if (!editor || !editor.isEditable) {
|
|
53
|
+
isVisible.value = false;
|
|
54
|
+
isActive.value = false;
|
|
55
|
+
canToggle.value = false;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
isActive.value = isMarkActive(editor, type);
|
|
59
|
+
canToggle.value = canToggleMark(editor, type);
|
|
60
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
61
|
+
isVisible.value = canToggle.value;
|
|
62
|
+
} else {
|
|
63
|
+
isVisible.value = isMarkInSchema(type, editor);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleMark = () => {
|
|
67
|
+
const editor = getEditor();
|
|
68
|
+
if (!editor)
|
|
69
|
+
return false;
|
|
70
|
+
const success = toggleMark(editor, type);
|
|
71
|
+
if (success) {
|
|
72
|
+
onToggled == null ? void 0 : onToggled();
|
|
73
|
+
}
|
|
74
|
+
return success;
|
|
75
|
+
};
|
|
76
|
+
watch(
|
|
77
|
+
() => getEditor(),
|
|
78
|
+
(editor) => {
|
|
79
|
+
if (!editor)
|
|
80
|
+
return;
|
|
81
|
+
updateState();
|
|
82
|
+
editor.on("selectionUpdate", updateState);
|
|
83
|
+
editor.on("transaction", updateState);
|
|
84
|
+
onBeforeUnmount(() => {
|
|
85
|
+
editor.off("selectionUpdate", updateState);
|
|
86
|
+
editor.off("transaction", updateState);
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
{ immediate: true }
|
|
90
|
+
);
|
|
91
|
+
return {
|
|
92
|
+
isVisible,
|
|
93
|
+
isActive,
|
|
94
|
+
handleMark,
|
|
95
|
+
canToggle,
|
|
96
|
+
label: type.charAt(0).toUpperCase() + type.slice(1),
|
|
97
|
+
shortcutKeys: MARK_SHORTCUT_KEYS[type],
|
|
98
|
+
Icon: markIcons[type] || Icons.BoldIcon
|
|
99
|
+
// fallback
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
MARK_SHORTCUT_KEYS,
|
|
104
|
+
canToggleMark,
|
|
105
|
+
isMarkActive,
|
|
106
|
+
markIcons,
|
|
107
|
+
toggleMark,
|
|
108
|
+
useMark
|
|
109
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
type Orientation = 'horizontal' | 'vertical' | 'both';
|
|
3
|
+
interface MenuNavigationOptions<T> {
|
|
4
|
+
editor?: Editor | null;
|
|
5
|
+
containerRef?: any;
|
|
6
|
+
query?: string;
|
|
7
|
+
items: T[];
|
|
8
|
+
onSelect?: (item: T) => void;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
orientation?: Orientation;
|
|
11
|
+
autoSelectFirstItem?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function useMenuNavigation<T>({ editor, containerRef, query, items, onSelect, onClose, orientation, autoSelectFirstItem, }: MenuNavigationOptions<T>): {
|
|
14
|
+
selectedIndex: import("vue").Ref<number, number>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
function useMenuNavigation({
|
|
3
|
+
editor,
|
|
4
|
+
containerRef,
|
|
5
|
+
query,
|
|
6
|
+
items,
|
|
7
|
+
onSelect,
|
|
8
|
+
onClose,
|
|
9
|
+
orientation = "vertical",
|
|
10
|
+
autoSelectFirstItem = true
|
|
11
|
+
}) {
|
|
12
|
+
const selectedIndex = ref(autoSelectFirstItem ? 0 : -1);
|
|
13
|
+
const handleKeyboardNavigation = (event) => {
|
|
14
|
+
if (!items.length)
|
|
15
|
+
return false;
|
|
16
|
+
const moveNext = () => {
|
|
17
|
+
if (selectedIndex.value === -1) {
|
|
18
|
+
selectedIndex.value = 0;
|
|
19
|
+
} else {
|
|
20
|
+
selectedIndex.value = (selectedIndex.value + 1) % items.length;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const movePrev = () => {
|
|
24
|
+
if (selectedIndex.value === -1) {
|
|
25
|
+
selectedIndex.value = items.length - 1;
|
|
26
|
+
} else {
|
|
27
|
+
selectedIndex.value = (selectedIndex.value - 1 + items.length) % items.length;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
switch (event.key) {
|
|
31
|
+
case "ArrowUp": {
|
|
32
|
+
if (orientation === "horizontal")
|
|
33
|
+
return false;
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
movePrev();
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
case "ArrowDown": {
|
|
39
|
+
if (orientation === "horizontal")
|
|
40
|
+
return false;
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
moveNext();
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
case "ArrowLeft": {
|
|
46
|
+
if (orientation === "vertical")
|
|
47
|
+
return false;
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
movePrev();
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
case "ArrowRight": {
|
|
53
|
+
if (orientation === "vertical")
|
|
54
|
+
return false;
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
moveNext();
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
case "Tab": {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
if (event.shiftKey) {
|
|
62
|
+
movePrev();
|
|
63
|
+
} else {
|
|
64
|
+
moveNext();
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
case "Home": {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
selectedIndex.value = 0;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
case "End": {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
selectedIndex.value = items.length - 1;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
case "Enter": {
|
|
79
|
+
if (event.isComposing)
|
|
80
|
+
return false;
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
if (selectedIndex.value !== -1 && items[selectedIndex.value]) {
|
|
83
|
+
onSelect == null ? void 0 : onSelect(items[selectedIndex.value]);
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
case "Escape": {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
onClose == null ? void 0 : onClose();
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const bindEvents = () => {
|
|
97
|
+
let targetElement = null;
|
|
98
|
+
if (editor) {
|
|
99
|
+
targetElement = editor.view.dom;
|
|
100
|
+
} else if (containerRef == null ? void 0 : containerRef.value) {
|
|
101
|
+
targetElement = containerRef.value;
|
|
102
|
+
}
|
|
103
|
+
if (targetElement) {
|
|
104
|
+
targetElement.addEventListener("keydown", handleKeyboardNavigation, true);
|
|
105
|
+
}
|
|
106
|
+
return targetElement;
|
|
107
|
+
};
|
|
108
|
+
const unbindEvents = (element) => {
|
|
109
|
+
if (element) {
|
|
110
|
+
element.removeEventListener("keydown", handleKeyboardNavigation, true);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
let mountedElement = null;
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
mountedElement = bindEvents();
|
|
116
|
+
});
|
|
117
|
+
onBeforeUnmount(() => {
|
|
118
|
+
unbindEvents(mountedElement);
|
|
119
|
+
});
|
|
120
|
+
watch(
|
|
121
|
+
() => query,
|
|
122
|
+
() => {
|
|
123
|
+
if (query) {
|
|
124
|
+
selectedIndex.value = autoSelectFirstItem ? 0 : -1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
return {
|
|
129
|
+
selectedIndex
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
useMenuNavigation
|
|
134
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(breakpoint?: number): import("vue").Ref<boolean, boolean>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
function useIsMobile(breakpoint = 768) {
|
|
3
|
+
const isMobile = ref(false);
|
|
4
|
+
const checkMobile = () => {
|
|
5
|
+
isMobile.value = window.innerWidth < breakpoint;
|
|
6
|
+
};
|
|
7
|
+
onMounted(() => {
|
|
8
|
+
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
9
|
+
mql.addEventListener("change", checkMobile);
|
|
10
|
+
checkMobile();
|
|
11
|
+
});
|
|
12
|
+
onBeforeUnmount(() => {
|
|
13
|
+
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
14
|
+
mql.removeEventListener("change", checkMobile);
|
|
15
|
+
});
|
|
16
|
+
return isMobile;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
useIsMobile
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
3
|
+
export interface UseTextAlignConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
align: TextAlign;
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
onAligned?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TEXT_ALIGN_SHORTCUT_KEYS: Record<TextAlign, string>;
|
|
10
|
+
export declare const textAlignIcons: any;
|
|
11
|
+
export declare const textAlignLabels: Record<TextAlign, string>;
|
|
12
|
+
export declare function canSetTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
13
|
+
export declare function isTextAlignActive(editor: Editor | null, align: TextAlign): boolean;
|
|
14
|
+
export declare function setTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
15
|
+
export declare function shouldShowButton(props: {
|
|
16
|
+
editor: Editor | null;
|
|
17
|
+
hideWhenUnavailable: boolean;
|
|
18
|
+
align: TextAlign;
|
|
19
|
+
}): boolean;
|
|
20
|
+
export declare function useTextAlign(config: UseTextAlignConfig): {
|
|
21
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
22
|
+
isActive: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
handleTextAlign: () => void;
|
|
24
|
+
canAlign: import("vue").Ref<boolean, boolean>;
|
|
25
|
+
label: string;
|
|
26
|
+
shortcutKeys: string;
|
|
27
|
+
Icon: any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
import { isExtensionAvailable, isNodeTypeSelected } from "../utils/tiptap-utils";
|
|
3
|
+
import { AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifyIcon } from "../icons";
|
|
4
|
+
const TEXT_ALIGN_SHORTCUT_KEYS = {
|
|
5
|
+
left: "mod+shift+l",
|
|
6
|
+
center: "mod+shift+e",
|
|
7
|
+
right: "mod+shift+r",
|
|
8
|
+
justify: "mod+shift+j"
|
|
9
|
+
};
|
|
10
|
+
const textAlignIcons = {
|
|
11
|
+
left: AlignLeftIcon,
|
|
12
|
+
center: AlignCenterIcon,
|
|
13
|
+
right: AlignRightIcon,
|
|
14
|
+
justify: AlignJustifyIcon
|
|
15
|
+
};
|
|
16
|
+
const textAlignLabels = {
|
|
17
|
+
left: "Align left",
|
|
18
|
+
center: "Align center",
|
|
19
|
+
right: "Align right",
|
|
20
|
+
justify: "Align justify"
|
|
21
|
+
};
|
|
22
|
+
function canSetTextAlign(editor, align) {
|
|
23
|
+
if (!editor || !editor.isEditable)
|
|
24
|
+
return false;
|
|
25
|
+
if (!isExtensionAvailable(editor, "textAlign") || isNodeTypeSelected(editor, ["image", "horizontalRule"]))
|
|
26
|
+
return false;
|
|
27
|
+
return editor.can().setTextAlign(align);
|
|
28
|
+
}
|
|
29
|
+
function isTextAlignActive(editor, align) {
|
|
30
|
+
if (!editor || !editor.isEditable)
|
|
31
|
+
return false;
|
|
32
|
+
return editor.isActive({ textAlign: align });
|
|
33
|
+
}
|
|
34
|
+
function setTextAlign(editor, align) {
|
|
35
|
+
if (!editor || !editor.isEditable)
|
|
36
|
+
return false;
|
|
37
|
+
if (!canSetTextAlign(editor, align))
|
|
38
|
+
return false;
|
|
39
|
+
return editor.chain().focus().setTextAlign(align).run();
|
|
40
|
+
}
|
|
41
|
+
function shouldShowButton(props) {
|
|
42
|
+
const { editor, hideWhenUnavailable, align } = props;
|
|
43
|
+
if (!editor || !editor.isEditable)
|
|
44
|
+
return false;
|
|
45
|
+
if (!isExtensionAvailable(editor, "textAlign"))
|
|
46
|
+
return false;
|
|
47
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
48
|
+
return canSetTextAlign(editor, align);
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function useTextAlign(config) {
|
|
53
|
+
const { align, hideWhenUnavailable = false, onAligned } = config;
|
|
54
|
+
const isVisible = ref(true);
|
|
55
|
+
const isActive = ref(false);
|
|
56
|
+
const canAlign = ref(false);
|
|
57
|
+
const getEditor = () => {
|
|
58
|
+
const editor = config.editor;
|
|
59
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
60
|
+
};
|
|
61
|
+
const updateState = () => {
|
|
62
|
+
const editor = getEditor();
|
|
63
|
+
if (!editor || !editor.isEditable) {
|
|
64
|
+
isVisible.value = false;
|
|
65
|
+
isActive.value = false;
|
|
66
|
+
canAlign.value = false;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
isActive.value = isTextAlignActive(editor, align);
|
|
70
|
+
canAlign.value = canSetTextAlign(editor, align);
|
|
71
|
+
isVisible.value = shouldShowButton({ editor, align, hideWhenUnavailable });
|
|
72
|
+
};
|
|
73
|
+
watch(
|
|
74
|
+
() => getEditor(),
|
|
75
|
+
(editor) => {
|
|
76
|
+
if (!editor)
|
|
77
|
+
return;
|
|
78
|
+
updateState();
|
|
79
|
+
editor.on("selectionUpdate", updateState);
|
|
80
|
+
editor.on("transaction", updateState);
|
|
81
|
+
onBeforeUnmount(() => {
|
|
82
|
+
editor.off("selectionUpdate", updateState);
|
|
83
|
+
editor.off("transaction", updateState);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
{ immediate: true }
|
|
87
|
+
);
|
|
88
|
+
const handleTextAlign = () => {
|
|
89
|
+
const editor = getEditor();
|
|
90
|
+
if (setTextAlign(editor, align)) {
|
|
91
|
+
onAligned == null ? void 0 : onAligned();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
isVisible,
|
|
96
|
+
isActive,
|
|
97
|
+
handleTextAlign,
|
|
98
|
+
canAlign,
|
|
99
|
+
label: textAlignLabels[align],
|
|
100
|
+
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
101
|
+
Icon: textAlignIcons[align]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
TEXT_ALIGN_SHORTCUT_KEYS,
|
|
106
|
+
canSetTextAlign,
|
|
107
|
+
isTextAlignActive,
|
|
108
|
+
setTextAlign,
|
|
109
|
+
shouldShowButton,
|
|
110
|
+
textAlignIcons,
|
|
111
|
+
textAlignLabels,
|
|
112
|
+
useTextAlign
|
|
113
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { onBeforeUnmount } from "vue";
|
|
2
|
+
const throttle = (fn, wait, options = { leading: false, trailing: true }) => {
|
|
3
|
+
let timeout = null;
|
|
4
|
+
let previous = 0;
|
|
5
|
+
const throttled = function(...args) {
|
|
6
|
+
const now = Date.now();
|
|
7
|
+
if (!previous && options.leading === false)
|
|
8
|
+
previous = now;
|
|
9
|
+
const remaining = wait - (now - previous);
|
|
10
|
+
if (remaining <= 0 || remaining > wait) {
|
|
11
|
+
if (timeout) {
|
|
12
|
+
clearTimeout(timeout);
|
|
13
|
+
timeout = null;
|
|
14
|
+
}
|
|
15
|
+
previous = now;
|
|
16
|
+
fn.apply(this, args);
|
|
17
|
+
} else if (!timeout && options.trailing !== false) {
|
|
18
|
+
timeout = setTimeout(() => {
|
|
19
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
20
|
+
timeout = null;
|
|
21
|
+
fn.apply(this, args);
|
|
22
|
+
}, remaining);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
throttled.cancel = () => {
|
|
26
|
+
if (timeout) {
|
|
27
|
+
clearTimeout(timeout);
|
|
28
|
+
timeout = null;
|
|
29
|
+
}
|
|
30
|
+
previous = 0;
|
|
31
|
+
};
|
|
32
|
+
return throttled;
|
|
33
|
+
};
|
|
34
|
+
function useThrottledCallback(fn, wait = 250, options = { leading: false, trailing: true }) {
|
|
35
|
+
const throttled = throttle(fn, wait, options);
|
|
36
|
+
onBeforeUnmount(() => {
|
|
37
|
+
throttled.cancel();
|
|
38
|
+
});
|
|
39
|
+
return throttled;
|
|
40
|
+
}
|
|
41
|
+
var stdin_default = useThrottledCallback;
|
|
42
|
+
export {
|
|
43
|
+
stdin_default as default,
|
|
44
|
+
useThrottledCallback
|
|
45
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export type UndoRedoAction = 'undo' | 'redo';
|
|
3
|
+
export interface UseUndoRedoConfig {
|
|
4
|
+
editor: any;
|
|
5
|
+
action: UndoRedoAction;
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
onExecuted?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const UNDO_REDO_SHORTCUT_KEYS: Record<UndoRedoAction, string>;
|
|
10
|
+
export declare const historyActionLabels: Record<UndoRedoAction, string>;
|
|
11
|
+
export declare const historyIcons: {
|
|
12
|
+
undo: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
className: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
className: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>> & Readonly<{}>, {
|
|
23
|
+
className: string;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
redo: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
26
|
+
className: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
className: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
}>> & Readonly<{}>, {
|
|
36
|
+
className: string;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
};
|
|
39
|
+
export declare function canExecuteUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
40
|
+
export declare function executeUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
41
|
+
export declare function useUndoRedo(config: UseUndoRedoConfig): {
|
|
42
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
43
|
+
handleAction: () => boolean;
|
|
44
|
+
canExecute: import("vue").Ref<boolean, boolean>;
|
|
45
|
+
label: string;
|
|
46
|
+
shortcutKeys: string;
|
|
47
|
+
Icon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
48
|
+
className: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
className: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
}>> & Readonly<{}>, {
|
|
58
|
+
className: string;
|
|
59
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
60
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ref, watch, onBeforeUnmount } from "vue";
|
|
2
|
+
import { isNodeTypeSelected } from "../utils/tiptap-utils";
|
|
3
|
+
import { Undo2Icon, Redo2Icon } from "../icons";
|
|
4
|
+
const UNDO_REDO_SHORTCUT_KEYS = {
|
|
5
|
+
undo: "mod+z",
|
|
6
|
+
redo: "mod+shift+z"
|
|
7
|
+
};
|
|
8
|
+
const historyActionLabels = {
|
|
9
|
+
undo: "Undo",
|
|
10
|
+
redo: "Redo"
|
|
11
|
+
};
|
|
12
|
+
const historyIcons = {
|
|
13
|
+
undo: Undo2Icon,
|
|
14
|
+
redo: Redo2Icon
|
|
15
|
+
};
|
|
16
|
+
function canExecuteUndoRedoAction(editor, action) {
|
|
17
|
+
if (!editor || !editor.isEditable)
|
|
18
|
+
return false;
|
|
19
|
+
if (isNodeTypeSelected(editor, ["image"]))
|
|
20
|
+
return false;
|
|
21
|
+
return action === "undo" ? editor.can().undo() : editor.can().redo();
|
|
22
|
+
}
|
|
23
|
+
function executeUndoRedoAction(editor, action) {
|
|
24
|
+
if (!editor || !editor.isEditable)
|
|
25
|
+
return false;
|
|
26
|
+
if (!canExecuteUndoRedoAction(editor, action))
|
|
27
|
+
return false;
|
|
28
|
+
const chain = editor.chain().focus();
|
|
29
|
+
return action === "undo" ? chain.undo().run() : chain.redo().run();
|
|
30
|
+
}
|
|
31
|
+
function useUndoRedo(config) {
|
|
32
|
+
const { action, hideWhenUnavailable = false, onExecuted } = config;
|
|
33
|
+
const isVisible = ref(true);
|
|
34
|
+
const getEditor = () => {
|
|
35
|
+
const editor = config.editor;
|
|
36
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
37
|
+
};
|
|
38
|
+
const handleUpdate = () => {
|
|
39
|
+
const editor = getEditor();
|
|
40
|
+
if (!editor || !editor.isEditable) {
|
|
41
|
+
isVisible.value = false;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
45
|
+
isVisible.value = canExecuteUndoRedoAction(editor, action);
|
|
46
|
+
} else {
|
|
47
|
+
isVisible.value = true;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const handleAction = () => {
|
|
51
|
+
const editor = getEditor();
|
|
52
|
+
if (!editor)
|
|
53
|
+
return false;
|
|
54
|
+
const success = executeUndoRedoAction(editor, action);
|
|
55
|
+
if (success) {
|
|
56
|
+
onExecuted == null ? void 0 : onExecuted();
|
|
57
|
+
}
|
|
58
|
+
return success;
|
|
59
|
+
};
|
|
60
|
+
const canExecute = ref(false);
|
|
61
|
+
const updateCanExecute = () => {
|
|
62
|
+
canExecute.value = canExecuteUndoRedoAction(getEditor(), action);
|
|
63
|
+
};
|
|
64
|
+
watch(
|
|
65
|
+
() => getEditor(),
|
|
66
|
+
(editor) => {
|
|
67
|
+
if (!editor)
|
|
68
|
+
return;
|
|
69
|
+
handleUpdate();
|
|
70
|
+
updateCanExecute();
|
|
71
|
+
editor.on("transaction", handleUpdate);
|
|
72
|
+
editor.on("transaction", updateCanExecute);
|
|
73
|
+
onBeforeUnmount(() => {
|
|
74
|
+
editor.off("transaction", handleUpdate);
|
|
75
|
+
editor.off("transaction", updateCanExecute);
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
{ immediate: true }
|
|
79
|
+
);
|
|
80
|
+
return {
|
|
81
|
+
isVisible,
|
|
82
|
+
handleAction,
|
|
83
|
+
canExecute,
|
|
84
|
+
label: historyActionLabels[action],
|
|
85
|
+
shortcutKeys: UNDO_REDO_SHORTCUT_KEYS[action],
|
|
86
|
+
Icon: historyIcons[action]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
UNDO_REDO_SHORTCUT_KEYS,
|
|
91
|
+
canExecuteUndoRedoAction,
|
|
92
|
+
executeUndoRedoAction,
|
|
93
|
+
historyActionLabels,
|
|
94
|
+
historyIcons,
|
|
95
|
+
useUndoRedo
|
|
96
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface WindowSizeState {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
offsetTop: number;
|
|
5
|
+
offsetLeft: number;
|
|
6
|
+
scale: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function useWindowSize(): WindowSizeState;
|
|
9
|
+
export declare function useWindowSizeStore(): import("vue").Ref<{
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
offsetTop: number;
|
|
13
|
+
offsetLeft: number;
|
|
14
|
+
scale: number;
|
|
15
|
+
}, WindowSizeState | {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
offsetTop: number;
|
|
19
|
+
offsetLeft: number;
|
|
20
|
+
scale: number;
|
|
21
|
+
}>;
|