@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,133 @@
|
|
|
1
|
+
import Mention from "@tiptap/extension-mention";
|
|
2
|
+
import {
|
|
3
|
+
checkConsumed,
|
|
4
|
+
markAsConsumed,
|
|
5
|
+
isSpaceKey,
|
|
6
|
+
checkLastCharIsSpace
|
|
7
|
+
} from "../utils/triggerHelpers";
|
|
8
|
+
const createHashTagExtension = (options) => {
|
|
9
|
+
const { emit, imeState, editorRef } = options;
|
|
10
|
+
return Mention.extend({
|
|
11
|
+
name: "hashTag",
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [{ tag: 'span[data-type="hashTag"]' }];
|
|
14
|
+
},
|
|
15
|
+
addAttributes() {
|
|
16
|
+
return {
|
|
17
|
+
id: {
|
|
18
|
+
default: null,
|
|
19
|
+
parseHTML: (element) => element.getAttribute("data-id"),
|
|
20
|
+
renderHTML: (attributes) => {
|
|
21
|
+
if (!attributes.id)
|
|
22
|
+
return {};
|
|
23
|
+
return { "data-id": attributes.id };
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
label: {
|
|
27
|
+
default: null,
|
|
28
|
+
parseHTML: (element) => element.getAttribute("data-label"),
|
|
29
|
+
renderHTML: (attributes) => {
|
|
30
|
+
if (!attributes.label)
|
|
31
|
+
return {};
|
|
32
|
+
return { "data-label": attributes.label };
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
default: null,
|
|
37
|
+
parseHTML: (element) => element.getAttribute("data-tag-type"),
|
|
38
|
+
renderHTML: (attributes) => {
|
|
39
|
+
if (!attributes.type)
|
|
40
|
+
return {};
|
|
41
|
+
return { "data-tag-type": attributes.type };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
renderHTML({ node }) {
|
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
|
+
const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
|
|
49
|
+
const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
|
|
50
|
+
const type = (_f = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.type) != null ? _f : "";
|
|
51
|
+
return [
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
class: "hash-tag",
|
|
55
|
+
"data-type": "hashTag",
|
|
56
|
+
"data-id": id,
|
|
57
|
+
"data-label": label,
|
|
58
|
+
"data-tag-type": type,
|
|
59
|
+
"data-hash-tag": "#",
|
|
60
|
+
contenteditable: "false"
|
|
61
|
+
},
|
|
62
|
+
`#${label}`
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
}).configure({
|
|
66
|
+
deleteTriggerWithBackspace: true,
|
|
67
|
+
suggestion: {
|
|
68
|
+
char: "#",
|
|
69
|
+
allowedPrefixes: null,
|
|
70
|
+
allowSpaces: false,
|
|
71
|
+
/**
|
|
72
|
+
* allow - 判断是否允许触发建议态
|
|
73
|
+
*/
|
|
74
|
+
allow: ({ state, range }) => {
|
|
75
|
+
if (imeState.isComposing)
|
|
76
|
+
return true;
|
|
77
|
+
return !checkConsumed(state, range);
|
|
78
|
+
},
|
|
79
|
+
render() {
|
|
80
|
+
let activeRange = null;
|
|
81
|
+
let exitCause = "unknown";
|
|
82
|
+
return {
|
|
83
|
+
onStart({ editor, range, command, query }) {
|
|
84
|
+
activeRange = range;
|
|
85
|
+
editorRef.current = editor;
|
|
86
|
+
exitCause = "unknown";
|
|
87
|
+
emit("hashTag-triggered", (data) => {
|
|
88
|
+
try {
|
|
89
|
+
(editorRef.current || editor).chain().focus().deleteRange(activeRange || range).insertContentAt((activeRange || range).from, {
|
|
90
|
+
type: "hashTag",
|
|
91
|
+
attrs: { id: data.hashTagId, label: data.name, type: data.type }
|
|
92
|
+
}).setTextSelection((activeRange || range).from + 1).insertContent(" ").run();
|
|
93
|
+
} catch (e) {
|
|
94
|
+
command({ id: data.hashTagId, label: data.name, type: data.type });
|
|
95
|
+
(editorRef.current || editor).chain().focus().insertContent(" ").run();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
emit("hashTag-input", query != null ? query : "");
|
|
99
|
+
},
|
|
100
|
+
onUpdate({ query, range, editor }) {
|
|
101
|
+
activeRange = range || activeRange;
|
|
102
|
+
editorRef.current = editor || editorRef.current;
|
|
103
|
+
emit("hashTag-input", query != null ? query : "");
|
|
104
|
+
},
|
|
105
|
+
onKeyDown({ event }) {
|
|
106
|
+
if (isSpaceKey(event)) {
|
|
107
|
+
exitCause = "space";
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
},
|
|
111
|
+
onExit({ editor, range }) {
|
|
112
|
+
if (imeState.isComposing) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (checkLastCharIsSpace(editor)) {
|
|
116
|
+
exitCause = "space";
|
|
117
|
+
}
|
|
118
|
+
markAsConsumed(editor, range, "#");
|
|
119
|
+
activeRange = null;
|
|
120
|
+
editorRef.current = null;
|
|
121
|
+
emit("hashTag-exit", {
|
|
122
|
+
reason: exitCause,
|
|
123
|
+
nonContiguous: exitCause === "space"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
createHashTagExtension
|
|
133
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import TiptapHorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
3
|
+
const HorizontalRule = TiptapHorizontalRule.extend({
|
|
4
|
+
renderHTML() {
|
|
5
|
+
return [
|
|
6
|
+
"div",
|
|
7
|
+
mergeAttributes(this.options.HTMLAttributes, { "data-type": this.name }),
|
|
8
|
+
["hr"]
|
|
9
|
+
];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var stdin_default = HorizontalRule;
|
|
13
|
+
export {
|
|
14
|
+
HorizontalRule,
|
|
15
|
+
stdin_default as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - IME Composition 状态跟踪扩展
|
|
4
|
+
* - 功能:跟踪当前是否处于 IME 输入法组合输入状态(如中文拼音输入)
|
|
5
|
+
* - 作用:防止在 composition 期间误判为输入结束,导致建议提示框过早关闭
|
|
6
|
+
*/
|
|
7
|
+
import { Extension } from '@tiptap/core';
|
|
8
|
+
export interface IMECompositionState {
|
|
9
|
+
isComposing: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 创建 IME Composition 跟踪扩展
|
|
13
|
+
* @param state - 共享状态对象
|
|
14
|
+
* @returns TipTap Extension
|
|
15
|
+
*/
|
|
16
|
+
export declare const createIMECompositionExtension: (state: IMECompositionState) => Extension<any, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { Plugin } from "@tiptap/pm/state";
|
|
3
|
+
const createIMECompositionExtension = (state) => {
|
|
4
|
+
return Extension.create({
|
|
5
|
+
name: "imeCompositionTracker",
|
|
6
|
+
addProseMirrorPlugins() {
|
|
7
|
+
return [
|
|
8
|
+
new Plugin({
|
|
9
|
+
props: {
|
|
10
|
+
handleDOMEvents: {
|
|
11
|
+
compositionstart: () => {
|
|
12
|
+
state.isComposing = true;
|
|
13
|
+
return false;
|
|
14
|
+
},
|
|
15
|
+
compositionend: () => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
state.isComposing = false;
|
|
18
|
+
}, 10);
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
createIMECompositionExtension
|
|
30
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Node } from '@tiptap/vue-3';
|
|
2
|
+
import type { NodeType } from '@tiptap/pm/model';
|
|
3
|
+
export type UploadFunction = (file: File, onProgress?: (event: {
|
|
4
|
+
progress: number;
|
|
5
|
+
}) => void, abortSignal?: AbortSignal) => Promise<string>;
|
|
6
|
+
export interface ImageUploadNodeOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The type of the node.
|
|
9
|
+
* @default 'image'
|
|
10
|
+
*/
|
|
11
|
+
type?: string | NodeType | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Acceptable file types for upload.
|
|
14
|
+
* @default 'image/*'
|
|
15
|
+
*/
|
|
16
|
+
accept?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum number of files that can be uploaded.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
|
+
limit?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum file size in bytes (0 for unlimited).
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
maxSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Function to handle the upload process.
|
|
29
|
+
*/
|
|
30
|
+
upload?: UploadFunction;
|
|
31
|
+
/**
|
|
32
|
+
* Callback for upload errors.
|
|
33
|
+
*/
|
|
34
|
+
onError?: (error: Error) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback for successful uploads.
|
|
37
|
+
*/
|
|
38
|
+
onSuccess?: (url: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* HTML attributes to add to the image element.
|
|
41
|
+
* @default {}
|
|
42
|
+
*/
|
|
43
|
+
HTMLAttributes: Record<string, any>;
|
|
44
|
+
}
|
|
45
|
+
declare module '@tiptap/core' {
|
|
46
|
+
interface Commands<ReturnType> {
|
|
47
|
+
imageUpload: {
|
|
48
|
+
setImageUploadNode: (options?: Partial<ImageUploadNodeOptions>) => ReturnType;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A Tiptap node extension that creates an image upload component.
|
|
54
|
+
*/
|
|
55
|
+
export declare const ImageUpload: Node<ImageUploadNodeOptions, any>;
|
|
56
|
+
export default ImageUpload;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { mergeAttributes, Node, VueNodeViewRenderer } from "@tiptap/vue-3";
|
|
2
|
+
import { ImageUploadNodeView } from "../menu-system/components/image-upload-node";
|
|
3
|
+
const ImageUpload = Node.create({
|
|
4
|
+
name: "imageUpload",
|
|
5
|
+
group: "block",
|
|
6
|
+
draggable: true,
|
|
7
|
+
selectable: true,
|
|
8
|
+
atom: true,
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
type: "image",
|
|
12
|
+
accept: "image/*",
|
|
13
|
+
limit: 1,
|
|
14
|
+
maxSize: 0,
|
|
15
|
+
upload: void 0,
|
|
16
|
+
onError: void 0,
|
|
17
|
+
onSuccess: void 0,
|
|
18
|
+
HTMLAttributes: {}
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
addAttributes() {
|
|
22
|
+
return {
|
|
23
|
+
accept: {
|
|
24
|
+
default: this.options.accept
|
|
25
|
+
},
|
|
26
|
+
limit: {
|
|
27
|
+
default: this.options.limit
|
|
28
|
+
},
|
|
29
|
+
maxSize: {
|
|
30
|
+
default: this.options.maxSize
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
parseHTML() {
|
|
35
|
+
return [{ tag: 'div[data-type="image-upload"]' }];
|
|
36
|
+
},
|
|
37
|
+
renderHTML({ HTMLAttributes }) {
|
|
38
|
+
return ["div", mergeAttributes({ "data-type": "image-upload" }, HTMLAttributes)];
|
|
39
|
+
},
|
|
40
|
+
addNodeView() {
|
|
41
|
+
return VueNodeViewRenderer(ImageUploadNodeView);
|
|
42
|
+
},
|
|
43
|
+
addCommands() {
|
|
44
|
+
return {
|
|
45
|
+
setImageUploadNode: (options) => ({ commands }) => {
|
|
46
|
+
return commands.insertContent({
|
|
47
|
+
type: this.name,
|
|
48
|
+
attrs: options
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Adds Enter key handler to trigger the upload component when it's selected.
|
|
55
|
+
*/
|
|
56
|
+
addKeyboardShortcuts() {
|
|
57
|
+
return {
|
|
58
|
+
Enter: ({ editor }) => {
|
|
59
|
+
const { selection } = editor.state;
|
|
60
|
+
const { nodeAfter } = selection.$from;
|
|
61
|
+
if (nodeAfter && nodeAfter.type.name === "imageUpload" && editor.isActive("imageUpload")) {
|
|
62
|
+
const nodeEl = editor.view.nodeDOM(selection.$from.pos);
|
|
63
|
+
if (nodeEl && nodeEl instanceof HTMLElement) {
|
|
64
|
+
const firstChild = nodeEl.firstChild;
|
|
65
|
+
if (firstChild && firstChild instanceof HTMLElement) {
|
|
66
|
+
firstChild.click();
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var stdin_default = ImageUpload;
|
|
77
|
+
export {
|
|
78
|
+
ImageUpload,
|
|
79
|
+
stdin_default as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - Markdown 相关扩展
|
|
4
|
+
* - 包括 Markdown 解析器和链接输入规则
|
|
5
|
+
*/
|
|
6
|
+
import { Extension } from '@tiptap/core';
|
|
7
|
+
/**
|
|
8
|
+
* Markdown 解析器配置
|
|
9
|
+
*/
|
|
10
|
+
export declare const MarkdownExtension: Extension<import("tiptap-markdown").MarkdownOptions, import("tiptap-markdown").MarkdownStorage>;
|
|
11
|
+
/**
|
|
12
|
+
* Markdown 链接输入规则扩展
|
|
13
|
+
* 语法:[text](url) + 空格
|
|
14
|
+
*/
|
|
15
|
+
export declare const MarkdownLinkInputRule: Extension<any, any>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Extension, InputRule } from "@tiptap/core";
|
|
2
|
+
import { Markdown } from "tiptap-markdown";
|
|
3
|
+
const MarkdownExtension = Markdown.configure({
|
|
4
|
+
html: true,
|
|
5
|
+
tightLists: true,
|
|
6
|
+
tightListClass: "tight",
|
|
7
|
+
bulletListMarker: "-",
|
|
8
|
+
linkify: true,
|
|
9
|
+
breaks: false,
|
|
10
|
+
transformPastedText: true,
|
|
11
|
+
transformCopiedText: true
|
|
12
|
+
});
|
|
13
|
+
const MarkdownLinkInputRule = Extension.create({
|
|
14
|
+
name: "markdownLinkInputRule",
|
|
15
|
+
addInputRules() {
|
|
16
|
+
return [
|
|
17
|
+
new InputRule({
|
|
18
|
+
find: /\[([^\]]+)\]\(([^\)]+)\)\s/,
|
|
19
|
+
handler: ({ range, match, commands }) => {
|
|
20
|
+
const [, text, href] = match;
|
|
21
|
+
commands.deleteRange({ from: range.from, to: range.to });
|
|
22
|
+
commands.insertContent({
|
|
23
|
+
type: "text",
|
|
24
|
+
text,
|
|
25
|
+
marks: [{ type: "link", attrs: { href } }]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
MarkdownExtension,
|
|
34
|
+
MarkdownLinkInputRule
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - 媒体输入规则扩展(视频和音频)
|
|
4
|
+
* - 支持通过特定语法快速插入视频和音频元素
|
|
5
|
+
* - 语法:!video(url) 和 !audio(url)
|
|
6
|
+
*/
|
|
7
|
+
import { Extension } from '@tiptap/core';
|
|
8
|
+
/**
|
|
9
|
+
* 视频输入规则扩展
|
|
10
|
+
* 语法:!video(url) + 空格
|
|
11
|
+
*/
|
|
12
|
+
export declare const VideoInputRule: Extension<any, any>;
|
|
13
|
+
/**
|
|
14
|
+
* 音频输入规则扩展
|
|
15
|
+
* 语法:!audio(url) + 空格
|
|
16
|
+
*/
|
|
17
|
+
export declare const AudioInputRule: Extension<any, any>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Extension, InputRule } from "@tiptap/core";
|
|
2
|
+
const VideoInputRule = Extension.create({
|
|
3
|
+
name: "videoInputRule",
|
|
4
|
+
addInputRules() {
|
|
5
|
+
return [
|
|
6
|
+
new InputRule({
|
|
7
|
+
find: /!video\(([^)]+)\)\s/,
|
|
8
|
+
handler: ({ range, match, commands }) => {
|
|
9
|
+
const [, url] = match;
|
|
10
|
+
if (url) {
|
|
11
|
+
const html = `<video src="${url}" autoplay="" loop="" muted="" controls="" playsinline=""></video>`;
|
|
12
|
+
commands.deleteRange(range);
|
|
13
|
+
commands.insertContent({
|
|
14
|
+
type: "htmlBlock",
|
|
15
|
+
attrs: { html }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const AudioInputRule = Extension.create({
|
|
24
|
+
name: "audioInputRule",
|
|
25
|
+
addInputRules() {
|
|
26
|
+
return [
|
|
27
|
+
new InputRule({
|
|
28
|
+
find: /!audio\(([^)]+)\)\s/,
|
|
29
|
+
handler: ({ range, match, commands }) => {
|
|
30
|
+
const [, url] = match;
|
|
31
|
+
if (url) {
|
|
32
|
+
const html = `<audio src="${url}" controls="" playsinline=""></audio>`;
|
|
33
|
+
commands.deleteRange(range);
|
|
34
|
+
commands.insertContent({
|
|
35
|
+
type: "htmlBlock",
|
|
36
|
+
attrs: { html }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
AudioInputRule,
|
|
46
|
+
VideoInputRule
|
|
47
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface MentionExtensionOptions {
|
|
2
|
+
emit: any;
|
|
3
|
+
imeState: {
|
|
4
|
+
isComposing: boolean;
|
|
5
|
+
};
|
|
6
|
+
editorRef: {
|
|
7
|
+
current: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 创建 Mention 扩展
|
|
12
|
+
* @param options - 配置选项
|
|
13
|
+
* @returns TipTap Extension
|
|
14
|
+
*/
|
|
15
|
+
export declare const createMentionExtension: (options: MentionExtensionOptions) => import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Mention from "@tiptap/extension-mention";
|
|
2
|
+
import { checkConsumed, markAsConsumed } from "../utils/triggerHelpers";
|
|
3
|
+
const createMentionExtension = (options) => {
|
|
4
|
+
const { emit, imeState, editorRef } = options;
|
|
5
|
+
return Mention.configure({
|
|
6
|
+
HTMLAttributes: {
|
|
7
|
+
class: "mention"
|
|
8
|
+
},
|
|
9
|
+
deleteTriggerWithBackspace: true,
|
|
10
|
+
suggestion: {
|
|
11
|
+
char: "@",
|
|
12
|
+
allowedPrefixes: null,
|
|
13
|
+
allowSpaces: false,
|
|
14
|
+
allow: ({ state, range }) => {
|
|
15
|
+
if (imeState.isComposing)
|
|
16
|
+
return true;
|
|
17
|
+
if (checkConsumed(state, range))
|
|
18
|
+
return false;
|
|
19
|
+
const doc = state.doc;
|
|
20
|
+
const $from = doc.resolve(range.from);
|
|
21
|
+
const isAtStart = range.from === $from.start();
|
|
22
|
+
const prevChar = isAtStart ? "" : doc.textBetween(range.from - 1, range.from);
|
|
23
|
+
if (/[a-zA-Z0-9]/.test(prevChar))
|
|
24
|
+
return false;
|
|
25
|
+
const query = doc.textBetween(range.from + 1, range.to);
|
|
26
|
+
if (/[0-9]/.test(query))
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
return {
|
|
32
|
+
onStart({ editor, command, query }) {
|
|
33
|
+
editorRef.current = editor;
|
|
34
|
+
emit("mention-triggered", (data) => {
|
|
35
|
+
command({
|
|
36
|
+
id: data.userId,
|
|
37
|
+
label: data.name
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
emit("mention-input", query != null ? query : "");
|
|
41
|
+
},
|
|
42
|
+
onUpdate({ query, editor }) {
|
|
43
|
+
editorRef.current = editor;
|
|
44
|
+
emit("mention-input", query != null ? query : "");
|
|
45
|
+
},
|
|
46
|
+
onExit({ editor, range }) {
|
|
47
|
+
if (imeState.isComposing) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
markAsConsumed(editor, range, "@");
|
|
51
|
+
emit("mention-exit");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
createMentionExtension
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - 扩展模块统一导出入口
|
|
4
|
+
* - 方便外部引用和管理
|
|
5
|
+
*/
|
|
6
|
+
export { ConsumedTrigger } from './ConsumedTrigger';
|
|
7
|
+
export { createIMECompositionExtension } from './IMEComposition';
|
|
8
|
+
export type { IMECompositionState } from './IMEComposition';
|
|
9
|
+
export { VideoInputRule, AudioInputRule } from './MediaInputRules';
|
|
10
|
+
export { MarkdownExtension, MarkdownLinkInputRule } from './MarkdownExtensions';
|
|
11
|
+
export { createHashTagExtension } from './HashTag';
|
|
12
|
+
export type { HashTagOptions } from './HashTag';
|
|
13
|
+
export { createMentionExtension } from './MentionExtension';
|
|
14
|
+
export type { MentionExtensionOptions } from './MentionExtension';
|
|
15
|
+
export { createCustomContentExtension } from './CustomContent';
|
|
16
|
+
export { default as HtmlBlock } from './HtmlBlock';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ConsumedTrigger } from "./ConsumedTrigger";
|
|
2
|
+
import { createIMECompositionExtension } from "./IMEComposition";
|
|
3
|
+
import { VideoInputRule, AudioInputRule } from "./MediaInputRules";
|
|
4
|
+
import { MarkdownExtension, MarkdownLinkInputRule } from "./MarkdownExtensions";
|
|
5
|
+
import { createHashTagExtension } from "./HashTag";
|
|
6
|
+
import { createMentionExtension } from "./MentionExtension";
|
|
7
|
+
import { createCustomContentExtension } from "./CustomContent";
|
|
8
|
+
import { default as default2 } from "./HtmlBlock";
|
|
9
|
+
export {
|
|
10
|
+
AudioInputRule,
|
|
11
|
+
ConsumedTrigger,
|
|
12
|
+
default2 as HtmlBlock,
|
|
13
|
+
MarkdownExtension,
|
|
14
|
+
MarkdownLinkInputRule,
|
|
15
|
+
VideoInputRule,
|
|
16
|
+
createCustomContentExtension,
|
|
17
|
+
createHashTagExtension,
|
|
18
|
+
createIMECompositionExtension,
|
|
19
|
+
createMentionExtension
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
export interface UseEditorHistoryOptions {
|
|
3
|
+
editor: () => Editor | undefined;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
saveInterval?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 编辑器历史记录管理 Hook
|
|
9
|
+
* @param options - 配置选项
|
|
10
|
+
* @returns 历史记录相关方法和状态
|
|
11
|
+
*/
|
|
12
|
+
export declare const useEditorHistory: (options: UseEditorHistoryOptions) => {
|
|
13
|
+
noteId: import("vue").Ref<string, string>;
|
|
14
|
+
historyStore: LocalForage;
|
|
15
|
+
startAutoSave: () => void;
|
|
16
|
+
stopAutoSave: () => void;
|
|
17
|
+
};
|