@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,140 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
canToggleAnyList: () => canToggleAnyList,
|
|
21
|
+
getActiveListType: () => getActiveListType,
|
|
22
|
+
getFilteredListOptions: () => getFilteredListOptions,
|
|
23
|
+
isAnyListActive: () => isAnyListActive,
|
|
24
|
+
listOptions: () => listOptions,
|
|
25
|
+
shouldShowListDropdown: () => shouldShowListDropdown,
|
|
26
|
+
useListDropdownMenu: () => useListDropdownMenu
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
29
|
+
var import_vue = require("vue");
|
|
30
|
+
var import_tiptap_utils = require("../utils/tiptap-utils");
|
|
31
|
+
var import_use_list = require("./use-list");
|
|
32
|
+
var import_icons = require("../icons");
|
|
33
|
+
const listOptions = [
|
|
34
|
+
{
|
|
35
|
+
label: "Bullet List",
|
|
36
|
+
type: "bulletList",
|
|
37
|
+
icon: import_icons.ListIcon
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Ordered List",
|
|
41
|
+
type: "orderedList",
|
|
42
|
+
icon: import_icons.ListOrderedIcon
|
|
43
|
+
}
|
|
44
|
+
// {
|
|
45
|
+
// label: 'Task List',
|
|
46
|
+
// type: 'taskList',
|
|
47
|
+
// icon: ListTodoIcon,
|
|
48
|
+
// },
|
|
49
|
+
];
|
|
50
|
+
function canToggleAnyList(editor, listTypes) {
|
|
51
|
+
if (!editor || !editor.isEditable)
|
|
52
|
+
return false;
|
|
53
|
+
return listTypes.some((type) => (0, import_use_list.canToggleList)(editor, type));
|
|
54
|
+
}
|
|
55
|
+
function isAnyListActive(editor, listTypes) {
|
|
56
|
+
if (!editor || !editor.isEditable)
|
|
57
|
+
return false;
|
|
58
|
+
return listTypes.some((type) => (0, import_use_list.isListActive)(editor, type));
|
|
59
|
+
}
|
|
60
|
+
function getFilteredListOptions(availableTypes) {
|
|
61
|
+
return listOptions.filter((option) => availableTypes.includes(option.type));
|
|
62
|
+
}
|
|
63
|
+
function shouldShowListDropdown(params) {
|
|
64
|
+
const { editor, hideWhenUnavailable, listInSchema, canToggleAny } = params;
|
|
65
|
+
if (!listInSchema || !editor) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
69
|
+
return canToggleAny;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
function getActiveListType(editor, availableTypes) {
|
|
74
|
+
if (!editor || !editor.isEditable)
|
|
75
|
+
return void 0;
|
|
76
|
+
return availableTypes.find((type) => (0, import_use_list.isListActive)(editor, type));
|
|
77
|
+
}
|
|
78
|
+
function useListDropdownMenu(config) {
|
|
79
|
+
const { types = ["bulletList", "orderedList", "taskList"], hideWhenUnavailable = false } = config;
|
|
80
|
+
const isVisible = (0, import_vue.ref)(false);
|
|
81
|
+
const isActive = (0, import_vue.ref)(false);
|
|
82
|
+
const canToggleState = (0, import_vue.ref)(false);
|
|
83
|
+
const activeType = (0, import_vue.ref)();
|
|
84
|
+
const getEditor = () => {
|
|
85
|
+
const editor = config.editor;
|
|
86
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
87
|
+
};
|
|
88
|
+
const listInSchema = (0, import_vue.computed)(() => {
|
|
89
|
+
const editor = getEditor();
|
|
90
|
+
return types.some((type) => (0, import_tiptap_utils.isNodeInSchema)(type, editor));
|
|
91
|
+
});
|
|
92
|
+
const filteredLists = getFilteredListOptions(types);
|
|
93
|
+
const updateState = () => {
|
|
94
|
+
const editor = getEditor();
|
|
95
|
+
if (!editor || !editor.isEditable) {
|
|
96
|
+
isVisible.value = false;
|
|
97
|
+
isActive.value = false;
|
|
98
|
+
canToggleState.value = false;
|
|
99
|
+
activeType.value = void 0;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
canToggleState.value = canToggleAnyList(editor, types);
|
|
103
|
+
isActive.value = isAnyListActive(editor, types);
|
|
104
|
+
activeType.value = getActiveListType(editor, types);
|
|
105
|
+
isVisible.value = shouldShowListDropdown({
|
|
106
|
+
editor,
|
|
107
|
+
listTypes: types,
|
|
108
|
+
hideWhenUnavailable,
|
|
109
|
+
listInSchema: listInSchema.value,
|
|
110
|
+
canToggleAny: canToggleState.value
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
(0, import_vue.watch)(
|
|
114
|
+
() => getEditor(),
|
|
115
|
+
(editor) => {
|
|
116
|
+
if (!editor)
|
|
117
|
+
return;
|
|
118
|
+
updateState();
|
|
119
|
+
editor.on("selectionUpdate", updateState);
|
|
120
|
+
editor.on("transaction", updateState);
|
|
121
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
122
|
+
editor.off("selectionUpdate", updateState);
|
|
123
|
+
editor.off("transaction", updateState);
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
{ immediate: true }
|
|
127
|
+
);
|
|
128
|
+
const activeOption = (0, import_vue.computed)(() => filteredLists.find((opt) => opt.type === activeType.value));
|
|
129
|
+
const Icon = (0, import_vue.computed)(() => activeOption.value ? import_use_list.listIcons[activeOption.value.type] : import_icons.ListIcon);
|
|
130
|
+
return {
|
|
131
|
+
isVisible,
|
|
132
|
+
activeType,
|
|
133
|
+
isActive,
|
|
134
|
+
canToggle: canToggleState,
|
|
135
|
+
types,
|
|
136
|
+
filteredLists,
|
|
137
|
+
label: "List",
|
|
138
|
+
Icon
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -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,205 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
LIST_SHORTCUT_KEYS: () => LIST_SHORTCUT_KEYS,
|
|
21
|
+
canToggleList: () => canToggleList,
|
|
22
|
+
isListActive: () => isListActive,
|
|
23
|
+
listIcons: () => listIcons,
|
|
24
|
+
listLabels: () => listLabels,
|
|
25
|
+
shouldShowButton: () => shouldShowButton,
|
|
26
|
+
toggleList: () => toggleList,
|
|
27
|
+
useList: () => useList
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
30
|
+
var import_vue = require("vue");
|
|
31
|
+
var import_state = require("@tiptap/pm/state");
|
|
32
|
+
var import_tiptap_utils = require("../utils/tiptap-utils");
|
|
33
|
+
var import_icons = require("../icons");
|
|
34
|
+
const listIcons = {
|
|
35
|
+
bulletList: import_icons.ListIcon,
|
|
36
|
+
orderedList: import_icons.ListOrderedIcon,
|
|
37
|
+
taskList: import_icons.ListTodoIcon
|
|
38
|
+
};
|
|
39
|
+
const listLabels = {
|
|
40
|
+
bulletList: "Bullet List",
|
|
41
|
+
orderedList: "Ordered List",
|
|
42
|
+
taskList: "Task List"
|
|
43
|
+
};
|
|
44
|
+
const LIST_SHORTCUT_KEYS = {
|
|
45
|
+
bulletList: "mod+shift+8",
|
|
46
|
+
orderedList: "mod+shift+7",
|
|
47
|
+
taskList: "mod+shift+9"
|
|
48
|
+
};
|
|
49
|
+
function canToggleList(editor, type, turnInto = true) {
|
|
50
|
+
var _a;
|
|
51
|
+
if (!editor || !editor.isEditable)
|
|
52
|
+
return false;
|
|
53
|
+
if (!(0, import_tiptap_utils.isNodeInSchema)(type, editor) || (0, import_tiptap_utils.isNodeTypeSelected)(editor, ["image"]))
|
|
54
|
+
return false;
|
|
55
|
+
if (!turnInto) {
|
|
56
|
+
switch (type) {
|
|
57
|
+
case "bulletList":
|
|
58
|
+
return editor.can().toggleBulletList();
|
|
59
|
+
case "orderedList":
|
|
60
|
+
return editor.can().toggleOrderedList();
|
|
61
|
+
case "taskList":
|
|
62
|
+
return editor.can().toggleList("taskList", "taskItem");
|
|
63
|
+
default:
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const view = editor.view;
|
|
69
|
+
const state = view.state;
|
|
70
|
+
const selection = state.selection;
|
|
71
|
+
if (selection.empty || selection instanceof import_state.TextSelection) {
|
|
72
|
+
const pos = (_a = (0, import_tiptap_utils.findNodePosition)({
|
|
73
|
+
editor,
|
|
74
|
+
node: state.selection.$anchor.node(1)
|
|
75
|
+
})) == null ? void 0 : _a.pos;
|
|
76
|
+
if (!(0, import_tiptap_utils.isValidPosition)(pos))
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function isListActive(editor, type) {
|
|
85
|
+
if (!editor || !editor.isEditable)
|
|
86
|
+
return false;
|
|
87
|
+
switch (type) {
|
|
88
|
+
case "bulletList":
|
|
89
|
+
return editor.isActive("bulletList");
|
|
90
|
+
case "orderedList":
|
|
91
|
+
return editor.isActive("orderedList");
|
|
92
|
+
case "taskList":
|
|
93
|
+
return editor.isActive("taskList");
|
|
94
|
+
default:
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function toggleList(editor, type) {
|
|
99
|
+
var _a;
|
|
100
|
+
if (!editor || !editor.isEditable)
|
|
101
|
+
return false;
|
|
102
|
+
if (!canToggleList(editor, type))
|
|
103
|
+
return false;
|
|
104
|
+
try {
|
|
105
|
+
const view = editor.view;
|
|
106
|
+
let state = view.state;
|
|
107
|
+
let tr = state.tr;
|
|
108
|
+
if (state.selection.empty || state.selection instanceof import_state.TextSelection) {
|
|
109
|
+
const pos = (_a = (0, import_tiptap_utils.findNodePosition)({
|
|
110
|
+
editor,
|
|
111
|
+
node: state.selection.$anchor.node(1)
|
|
112
|
+
})) == null ? void 0 : _a.pos;
|
|
113
|
+
if (!(0, import_tiptap_utils.isValidPosition)(pos))
|
|
114
|
+
return false;
|
|
115
|
+
tr = tr.setSelection(import_state.NodeSelection.create(state.doc, pos));
|
|
116
|
+
view.dispatch(tr);
|
|
117
|
+
state = view.state;
|
|
118
|
+
}
|
|
119
|
+
const selection = state.selection;
|
|
120
|
+
let chain = editor.chain().focus();
|
|
121
|
+
if (selection instanceof import_state.NodeSelection) {
|
|
122
|
+
chain = chain.clearNodes();
|
|
123
|
+
}
|
|
124
|
+
if (editor.isActive(type)) {
|
|
125
|
+
chain.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();
|
|
126
|
+
} else {
|
|
127
|
+
const toggleMap = {
|
|
128
|
+
bulletList: () => chain.toggleBulletList(),
|
|
129
|
+
orderedList: () => chain.toggleOrderedList(),
|
|
130
|
+
taskList: () => chain.toggleList("taskList", "taskItem")
|
|
131
|
+
};
|
|
132
|
+
const toggle = toggleMap[type];
|
|
133
|
+
if (!toggle)
|
|
134
|
+
return false;
|
|
135
|
+
toggle().run();
|
|
136
|
+
}
|
|
137
|
+
editor.chain().focus().selectTextblockEnd().run();
|
|
138
|
+
return true;
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function shouldShowButton(props) {
|
|
144
|
+
const { editor, type, hideWhenUnavailable } = props;
|
|
145
|
+
if (!editor || !editor.isEditable)
|
|
146
|
+
return false;
|
|
147
|
+
if (!(0, import_tiptap_utils.isNodeInSchema)(type, editor))
|
|
148
|
+
return false;
|
|
149
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
150
|
+
return canToggleList(editor, type);
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
function useList(config) {
|
|
155
|
+
const { type, hideWhenUnavailable = false, onToggled } = config;
|
|
156
|
+
const isVisible = (0, import_vue.ref)(true);
|
|
157
|
+
const isActive = (0, import_vue.ref)(false);
|
|
158
|
+
const canToggleState = (0, import_vue.ref)(false);
|
|
159
|
+
const getEditor = () => {
|
|
160
|
+
const editor = config.editor;
|
|
161
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
162
|
+
};
|
|
163
|
+
const updateState = () => {
|
|
164
|
+
const editor = getEditor();
|
|
165
|
+
if (!editor || !editor.isEditable) {
|
|
166
|
+
isVisible.value = false;
|
|
167
|
+
isActive.value = false;
|
|
168
|
+
canToggleState.value = false;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
isActive.value = isListActive(editor, type);
|
|
172
|
+
canToggleState.value = canToggleList(editor, type);
|
|
173
|
+
isVisible.value = shouldShowButton({ editor, type, hideWhenUnavailable });
|
|
174
|
+
};
|
|
175
|
+
(0, import_vue.watch)(
|
|
176
|
+
() => getEditor(),
|
|
177
|
+
(editor) => {
|
|
178
|
+
if (!editor)
|
|
179
|
+
return;
|
|
180
|
+
updateState();
|
|
181
|
+
editor.on("selectionUpdate", updateState);
|
|
182
|
+
editor.on("transaction", updateState);
|
|
183
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
184
|
+
editor.off("selectionUpdate", updateState);
|
|
185
|
+
editor.off("transaction", updateState);
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
{ immediate: true }
|
|
189
|
+
);
|
|
190
|
+
const handleToggle = () => {
|
|
191
|
+
const editor = getEditor();
|
|
192
|
+
if (toggleList(editor, type)) {
|
|
193
|
+
onToggled == null ? void 0 : onToggled();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
isVisible,
|
|
198
|
+
isActive,
|
|
199
|
+
handleToggle,
|
|
200
|
+
canToggle: canToggleState,
|
|
201
|
+
label: listLabels[type],
|
|
202
|
+
shortcutKeys: LIST_SHORTCUT_KEYS[type],
|
|
203
|
+
Icon: listIcons[type]
|
|
204
|
+
};
|
|
205
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var stdin_exports = {};
|
|
29
|
+
__export(stdin_exports, {
|
|
30
|
+
MARK_SHORTCUT_KEYS: () => MARK_SHORTCUT_KEYS,
|
|
31
|
+
canToggleMark: () => canToggleMark,
|
|
32
|
+
isMarkActive: () => isMarkActive,
|
|
33
|
+
markIcons: () => markIcons,
|
|
34
|
+
toggleMark: () => toggleMark,
|
|
35
|
+
useMark: () => useMark
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
38
|
+
var import_vue = require("vue");
|
|
39
|
+
var import_tiptap_utils = require("../utils/tiptap-utils");
|
|
40
|
+
var Icons = __toESM(require("../icons"));
|
|
41
|
+
const markIcons = {
|
|
42
|
+
bold: Icons.BoldIcon,
|
|
43
|
+
italic: Icons.ItalicIcon,
|
|
44
|
+
underline: Icons.UnderlineIcon,
|
|
45
|
+
strike: Icons.StrikeIcon,
|
|
46
|
+
code: Icons.Code2Icon,
|
|
47
|
+
superscript: Icons.SuperscriptIcon,
|
|
48
|
+
subscript: Icons.SubscriptIcon
|
|
49
|
+
};
|
|
50
|
+
const MARK_SHORTCUT_KEYS = {
|
|
51
|
+
bold: "mod+b",
|
|
52
|
+
italic: "mod+i",
|
|
53
|
+
underline: "mod+u",
|
|
54
|
+
strike: "mod+shift+s",
|
|
55
|
+
code: "mod+e",
|
|
56
|
+
superscript: "mod+.",
|
|
57
|
+
subscript: "mod+,"
|
|
58
|
+
};
|
|
59
|
+
function canToggleMark(editor, type) {
|
|
60
|
+
if (!editor || !editor.isEditable)
|
|
61
|
+
return false;
|
|
62
|
+
if (!(0, import_tiptap_utils.isMarkInSchema)(type, editor) || (0, import_tiptap_utils.isNodeTypeSelected)(editor, ["image"]))
|
|
63
|
+
return false;
|
|
64
|
+
return editor.can().toggleMark(type);
|
|
65
|
+
}
|
|
66
|
+
function isMarkActive(editor, type) {
|
|
67
|
+
if (!editor || !editor.isEditable)
|
|
68
|
+
return false;
|
|
69
|
+
return editor.isActive(type);
|
|
70
|
+
}
|
|
71
|
+
function toggleMark(editor, type) {
|
|
72
|
+
if (!editor || !editor.isEditable)
|
|
73
|
+
return false;
|
|
74
|
+
if (!canToggleMark(editor, type))
|
|
75
|
+
return false;
|
|
76
|
+
return editor.chain().focus().toggleMark(type).run();
|
|
77
|
+
}
|
|
78
|
+
function useMark(config) {
|
|
79
|
+
const { type, hideWhenUnavailable = false, onToggled } = config;
|
|
80
|
+
const isVisible = (0, import_vue.ref)(true);
|
|
81
|
+
const isActive = (0, import_vue.ref)(false);
|
|
82
|
+
const canToggle = (0, import_vue.ref)(false);
|
|
83
|
+
const getEditor = () => {
|
|
84
|
+
const editor = config.editor;
|
|
85
|
+
return editor && "value" in editor ? editor.value : editor;
|
|
86
|
+
};
|
|
87
|
+
const updateState = () => {
|
|
88
|
+
const editor = getEditor();
|
|
89
|
+
if (!editor || !editor.isEditable) {
|
|
90
|
+
isVisible.value = false;
|
|
91
|
+
isActive.value = false;
|
|
92
|
+
canToggle.value = false;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
isActive.value = isMarkActive(editor, type);
|
|
96
|
+
canToggle.value = canToggleMark(editor, type);
|
|
97
|
+
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
98
|
+
isVisible.value = canToggle.value;
|
|
99
|
+
} else {
|
|
100
|
+
isVisible.value = (0, import_tiptap_utils.isMarkInSchema)(type, editor);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const handleMark = () => {
|
|
104
|
+
const editor = getEditor();
|
|
105
|
+
if (!editor)
|
|
106
|
+
return false;
|
|
107
|
+
const success = toggleMark(editor, type);
|
|
108
|
+
if (success) {
|
|
109
|
+
onToggled == null ? void 0 : onToggled();
|
|
110
|
+
}
|
|
111
|
+
return success;
|
|
112
|
+
};
|
|
113
|
+
(0, import_vue.watch)(
|
|
114
|
+
() => getEditor(),
|
|
115
|
+
(editor) => {
|
|
116
|
+
if (!editor)
|
|
117
|
+
return;
|
|
118
|
+
updateState();
|
|
119
|
+
editor.on("selectionUpdate", updateState);
|
|
120
|
+
editor.on("transaction", updateState);
|
|
121
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
122
|
+
editor.off("selectionUpdate", updateState);
|
|
123
|
+
editor.off("transaction", updateState);
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
{ immediate: true }
|
|
127
|
+
);
|
|
128
|
+
return {
|
|
129
|
+
isVisible,
|
|
130
|
+
isActive,
|
|
131
|
+
handleMark,
|
|
132
|
+
canToggle,
|
|
133
|
+
label: type.charAt(0).toUpperCase() + type.slice(1),
|
|
134
|
+
shortcutKeys: MARK_SHORTCUT_KEYS[type],
|
|
135
|
+
Icon: markIcons[type] || Icons.BoldIcon
|
|
136
|
+
// fallback
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -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,153 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
useMenuNavigation: () => useMenuNavigation
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
var import_vue = require("vue");
|
|
24
|
+
function useMenuNavigation({
|
|
25
|
+
editor,
|
|
26
|
+
containerRef,
|
|
27
|
+
query,
|
|
28
|
+
items,
|
|
29
|
+
onSelect,
|
|
30
|
+
onClose,
|
|
31
|
+
orientation = "vertical",
|
|
32
|
+
autoSelectFirstItem = true
|
|
33
|
+
}) {
|
|
34
|
+
const selectedIndex = (0, import_vue.ref)(autoSelectFirstItem ? 0 : -1);
|
|
35
|
+
const handleKeyboardNavigation = (event) => {
|
|
36
|
+
if (!items.length)
|
|
37
|
+
return false;
|
|
38
|
+
const moveNext = () => {
|
|
39
|
+
if (selectedIndex.value === -1) {
|
|
40
|
+
selectedIndex.value = 0;
|
|
41
|
+
} else {
|
|
42
|
+
selectedIndex.value = (selectedIndex.value + 1) % items.length;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const movePrev = () => {
|
|
46
|
+
if (selectedIndex.value === -1) {
|
|
47
|
+
selectedIndex.value = items.length - 1;
|
|
48
|
+
} else {
|
|
49
|
+
selectedIndex.value = (selectedIndex.value - 1 + items.length) % items.length;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
switch (event.key) {
|
|
53
|
+
case "ArrowUp": {
|
|
54
|
+
if (orientation === "horizontal")
|
|
55
|
+
return false;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
movePrev();
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
case "ArrowDown": {
|
|
61
|
+
if (orientation === "horizontal")
|
|
62
|
+
return false;
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
moveNext();
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
case "ArrowLeft": {
|
|
68
|
+
if (orientation === "vertical")
|
|
69
|
+
return false;
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
movePrev();
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
case "ArrowRight": {
|
|
75
|
+
if (orientation === "vertical")
|
|
76
|
+
return false;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
moveNext();
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
case "Tab": {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
if (event.shiftKey) {
|
|
84
|
+
movePrev();
|
|
85
|
+
} else {
|
|
86
|
+
moveNext();
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
case "Home": {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
selectedIndex.value = 0;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
case "End": {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
selectedIndex.value = items.length - 1;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
case "Enter": {
|
|
101
|
+
if (event.isComposing)
|
|
102
|
+
return false;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
if (selectedIndex.value !== -1 && items[selectedIndex.value]) {
|
|
105
|
+
onSelect == null ? void 0 : onSelect(items[selectedIndex.value]);
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
case "Escape": {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
onClose == null ? void 0 : onClose();
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
default:
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const bindEvents = () => {
|
|
119
|
+
let targetElement = null;
|
|
120
|
+
if (editor) {
|
|
121
|
+
targetElement = editor.view.dom;
|
|
122
|
+
} else if (containerRef == null ? void 0 : containerRef.value) {
|
|
123
|
+
targetElement = containerRef.value;
|
|
124
|
+
}
|
|
125
|
+
if (targetElement) {
|
|
126
|
+
targetElement.addEventListener("keydown", handleKeyboardNavigation, true);
|
|
127
|
+
}
|
|
128
|
+
return targetElement;
|
|
129
|
+
};
|
|
130
|
+
const unbindEvents = (element) => {
|
|
131
|
+
if (element) {
|
|
132
|
+
element.removeEventListener("keydown", handleKeyboardNavigation, true);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
let mountedElement = null;
|
|
136
|
+
(0, import_vue.onMounted)(() => {
|
|
137
|
+
mountedElement = bindEvents();
|
|
138
|
+
});
|
|
139
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
140
|
+
unbindEvents(mountedElement);
|
|
141
|
+
});
|
|
142
|
+
(0, import_vue.watch)(
|
|
143
|
+
() => query,
|
|
144
|
+
() => {
|
|
145
|
+
if (query) {
|
|
146
|
+
selectedIndex.value = autoSelectFirstItem ? 0 : -1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
return {
|
|
151
|
+
selectedIndex
|
|
152
|
+
};
|
|
153
|
+
}
|