@cgboiler/biz-basic 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/es/rich-text-editor/RichTextEditor.js +76 -196
- package/es/rich-text-editor/_atomic.css +2 -1
- package/es/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/es/rich-text-editor/extensions/ConsumedTrigger.js +22 -0
- package/es/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/es/rich-text-editor/extensions/CustomContent.js +103 -0
- package/es/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/es/rich-text-editor/extensions/HashTag.js +133 -0
- package/es/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/es/rich-text-editor/extensions/HorizontalRule.js +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.js +30 -0
- package/es/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/es/rich-text-editor/extensions/ImageUpload.js +80 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.js +35 -0
- package/es/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/es/rich-text-editor/extensions/MediaInputRules.js +47 -0
- package/es/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/es/rich-text-editor/extensions/MentionExtension.js +60 -0
- package/es/rich-text-editor/extensions/index.d.ts +16 -0
- package/es/rich-text-editor/extensions/index.js +20 -0
- package/es/rich-text-editor/hooks/index.d.ts +6 -0
- package/es/rich-text-editor/hooks/index.js +4 -0
- package/es/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/es/rich-text-editor/hooks/useEditorHistory.js +87 -0
- package/es/rich-text-editor/index copy 2.css +1 -0
- package/es/rich-text-editor/index copy 2.less +598 -0
- package/es/rich-text-editor/index copy.css +1 -0
- package/es/rich-text-editor/index copy.less +356 -0
- package/es/rich-text-editor/index.css +1 -1
- package/es/rich-text-editor/index.less +444 -254
- package/es/rich-text-editor/lib/utils.d.ts +123 -0
- package/es/rich-text-editor/lib/utils.js +244 -0
- package/es/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.js +102 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.js +99 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.js +102 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.js +42 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.js +71 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.js +299 -0
- package/es/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/link-popover.js +127 -0
- package/es/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/list-button.js +69 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.js +97 -0
- package/es/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/mark-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.js +77 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.js +132 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.js +135 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +70 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.js +103 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.js +62 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +121 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.js +191 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.js +109 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.js +134 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.js +20 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.js +113 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.js +45 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.js +96 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.js +74 -0
- package/es/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/es/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/es/rich-text-editor/menu-system/icons/index.js +487 -0
- package/es/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/es/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/es/rich-text-editor/menu-system/primitives/button.js +107 -0
- package/es/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/es/rich-text-editor/menu-system/primitives/card.js +116 -0
- package/es/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/es/rich-text-editor/menu-system/primitives/input.js +55 -0
- package/es/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/es/rich-text-editor/menu-system/primitives/separator.js +42 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.js +149 -0
- package/es/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/es/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/es/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/es/rich-text-editor/menu-system/styles/button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button.less +322 -0
- package/es/rich-text-editor/menu-system/styles/card.css +1 -0
- package/es/rich-text-editor/menu-system/styles/card.less +78 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/es/rich-text-editor/menu-system/styles/input.css +1 -0
- package/es/rich-text-editor/menu-system/styles/input.less +53 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/es/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/es/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.less +88 -0
- package/es/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/es/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.js +243 -0
- package/es/rich-text-editor/types.d.ts +4 -0
- package/es/rich-text-editor/types.js +4 -0
- package/es/rich-text-editor/useExtensions.d.ts +3 -3
- package/es/rich-text-editor/useExtensions.js +63 -391
- package/es/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/es/rich-text-editor/utils/eventHandlers.js +103 -0
- package/es/rich-text-editor/utils/index.d.ts +6 -0
- package/es/rich-text-editor/utils/index.js +19 -0
- package/es/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/es/rich-text-editor/utils/triggerHelpers.js +46 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/lib/rich-text-editor/RichTextEditor.js +76 -206
- package/lib/rich-text-editor/_atomic.css +2 -1
- package/lib/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/lib/rich-text-editor/extensions/ConsumedTrigger.js +41 -0
- package/lib/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/lib/rich-text-editor/extensions/CustomContent.js +132 -0
- package/lib/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/lib/rich-text-editor/extensions/HashTag.js +157 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.js +45 -0
- package/lib/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/lib/rich-text-editor/extensions/IMEComposition.js +49 -0
- package/lib/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/lib/rich-text-editor/extensions/ImageUpload.js +99 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.js +54 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.js +66 -0
- package/lib/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MentionExtension.js +89 -0
- package/lib/rich-text-editor/extensions/index.d.ts +16 -0
- package/lib/rich-text-editor/extensions/index.js +49 -0
- package/lib/rich-text-editor/hooks/index.d.ts +6 -0
- package/lib/rich-text-editor/hooks/index.js +23 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.js +116 -0
- package/lib/rich-text-editor/index copy 2.css +1 -0
- package/lib/rich-text-editor/index copy 2.less +598 -0
- package/lib/rich-text-editor/index copy.css +1 -0
- package/lib/rich-text-editor/index copy.less +356 -0
- package/lib/rich-text-editor/index.css +1 -1
- package/lib/rich-text-editor/index.less +444 -254
- package/lib/rich-text-editor/lib/utils.d.ts +123 -0
- package/lib/rich-text-editor/lib/utils.js +263 -0
- package/lib/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.js +119 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.js +118 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.js +131 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.js +61 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.js +90 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.js +316 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.js +146 -0
- package/lib/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/list-button.js +88 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.js +116 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.js +96 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.js +185 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +65 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.js +149 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +84 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.js +190 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.js +122 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.js +81 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +140 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.js +205 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.js +138 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.js +153 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.js +39 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.js +132 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.js +64 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.js +115 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.js +93 -0
- package/lib/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/lib/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/lib/rich-text-editor/menu-system/icons/index.js +506 -0
- package/lib/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/lib/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/lib/rich-text-editor/menu-system/primitives/button.js +126 -0
- package/lib/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/lib/rich-text-editor/menu-system/primitives/card.js +135 -0
- package/lib/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/lib/rich-text-editor/menu-system/primitives/input.js +74 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.js +61 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.js +168 -0
- package/lib/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/lib/rich-text-editor/menu-system/styles/button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button.less +322 -0
- package/lib/rich-text-editor/menu-system/styles/card.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/card.less +78 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/lib/rich-text-editor/menu-system/styles/input.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/input.less +53 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/lib/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.less +88 -0
- package/lib/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.js +262 -0
- package/lib/rich-text-editor/types.d.ts +4 -0
- package/lib/rich-text-editor/types.js +4 -0
- package/lib/rich-text-editor/useExtensions.d.ts +3 -3
- package/lib/rich-text-editor/useExtensions.js +64 -392
- package/lib/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/lib/rich-text-editor/utils/eventHandlers.js +132 -0
- package/lib/rich-text-editor/utils/index.d.ts +6 -0
- package/lib/rich-text-editor/utils/index.js +32 -0
- package/lib/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/lib/rich-text-editor/utils/triggerHelpers.js +65 -0
- package/package.json +13 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Extension, Mark } from '@tiptap/core';
|
|
2
1
|
/**
|
|
3
2
|
* useExtensions
|
|
4
|
-
* - 功能:构建并返回 TipTap
|
|
3
|
+
* - 功能:构建并返回 TipTap 编辑器使用的扩展集合
|
|
4
|
+
* - 重构:采用模块化架构,各扩展独立管理
|
|
5
5
|
*/
|
|
6
|
-
export declare function useExtensions({ props, emit }: any): (import("@tiptap/core").Node<any, any> | Mark<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any> |
|
|
6
|
+
export declare function useExtensions({ props, emit }: any): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Extension<import("tiptap-markdown").MarkdownOptions, import("tiptap-markdown").MarkdownStorage> | import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any> | import("@tiptap/core").Node<import("@tiptap/extension-horizontal-rule").HorizontalRuleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-style").ColorOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-align").TextAlignOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-list").TaskListOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-list").TaskItemOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extensions").PlaceholderOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-list").ListKitOptions, any> | import("@tiptap/core").Node<import("./extensions/ImageUpload").ImageUploadNodeOptions, any>)[];
|
|
@@ -34,366 +34,81 @@ var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
|
|
|
34
34
|
var import_extension_table = require("@tiptap/extension-table");
|
|
35
35
|
var import_extension_list = require("@tiptap/extension-list");
|
|
36
36
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
37
|
-
var import_extension_mention = __toESM(require("@tiptap/extension-mention"));
|
|
38
37
|
var import_extension_text_style = require("@tiptap/extension-text-style");
|
|
39
38
|
var import_extension_color = require("@tiptap/extension-color");
|
|
40
|
-
var import_tiptap_markdown = require("tiptap-markdown");
|
|
41
|
-
var import_core = require("@tiptap/core");
|
|
42
|
-
var import_HtmlBlock = __toESM(require("./extensions/HtmlBlock"));
|
|
43
39
|
var import_extensions = require("@tiptap/extensions");
|
|
40
|
+
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
41
|
+
var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
|
|
42
|
+
var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
|
|
43
|
+
var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
|
|
44
|
+
var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"));
|
|
45
|
+
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
46
|
+
var import_extension_task_list = require("@tiptap/extension-task-list");
|
|
47
|
+
var import_extension_task_item = require("@tiptap/extension-task-item");
|
|
48
|
+
var import_extension_typography = __toESM(require("@tiptap/extension-typography"));
|
|
49
|
+
var import_HtmlBlock = __toESM(require("./extensions/HtmlBlock"));
|
|
50
|
+
var import_ConsumedTrigger = require("./extensions/ConsumedTrigger");
|
|
51
|
+
var import_IMEComposition = require("./extensions/IMEComposition");
|
|
52
|
+
var import_MediaInputRules = require("./extensions/MediaInputRules");
|
|
53
|
+
var import_MarkdownExtensions = require("./extensions/MarkdownExtensions");
|
|
54
|
+
var import_HashTag = require("./extensions/HashTag");
|
|
55
|
+
var import_MentionExtension = require("./extensions/MentionExtension");
|
|
56
|
+
var import_CustomContent = require("./extensions/CustomContent");
|
|
57
|
+
var import_HorizontalRule = __toESM(require("./extensions/HorizontalRule"));
|
|
58
|
+
var import_ImageUpload = __toESM(require("./extensions/ImageUpload"));
|
|
59
|
+
var import_tiptap_utils = require("./menu-system/utils/tiptap-utils");
|
|
44
60
|
function useExtensions({ props, emit }) {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
keepOnSplit: false,
|
|
49
|
-
// 保证在标记后继续输入时不延续标记
|
|
50
|
-
parseHTML() {
|
|
51
|
-
return [{ tag: "span[data-consumed-trigger]" }];
|
|
52
|
-
},
|
|
53
|
-
renderHTML({ HTMLAttributes }) {
|
|
54
|
-
return [
|
|
55
|
-
"span",
|
|
56
|
-
(0, import_core.mergeAttributes)(HTMLAttributes, {
|
|
57
|
-
"data-consumed-trigger": "true",
|
|
58
|
-
style: "color: inherit;"
|
|
59
|
-
}),
|
|
60
|
-
0
|
|
61
|
-
];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const checkConsumed = (state, range) => {
|
|
65
|
-
const { doc, schema } = state;
|
|
66
|
-
const markType = schema.marks.consumedTrigger;
|
|
67
|
-
if (!markType)
|
|
68
|
-
return false;
|
|
69
|
-
let isConsumed = false;
|
|
70
|
-
doc.nodesBetween(range.from, range.to, (node) => {
|
|
71
|
-
if (node.marks.some((m) => m.type === markType)) {
|
|
72
|
-
isConsumed = true;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return isConsumed;
|
|
76
|
-
};
|
|
77
|
-
const markAsConsumed = (editor, range, char) => {
|
|
78
|
-
if (!editor || !range || range.from === void 0)
|
|
79
|
-
return;
|
|
80
|
-
try {
|
|
81
|
-
const { doc } = editor.state;
|
|
82
|
-
const actualChar = doc.textBetween(range.from, range.from + 1);
|
|
83
|
-
if (actualChar === char) {
|
|
84
|
-
editor.chain().setMeta("addToHistory", false).setTextSelection({ from: range.from, to: range.from + 1 }).setMark("consumedTrigger").setTextSelection(editor.state.selection.to).unsetMark("consumedTrigger").run();
|
|
85
|
-
}
|
|
86
|
-
} catch (e) {
|
|
87
|
-
}
|
|
61
|
+
const editorRef = { current: null };
|
|
62
|
+
const imeState = {
|
|
63
|
+
isComposing: false
|
|
88
64
|
};
|
|
89
|
-
const HashTag = import_extension_mention.default.extend({
|
|
90
|
-
name: "hashTag",
|
|
91
|
-
parseHTML() {
|
|
92
|
-
return [{ tag: 'span[data-type="hashTag"]' }];
|
|
93
|
-
},
|
|
94
|
-
addAttributes() {
|
|
95
|
-
return {
|
|
96
|
-
id: {
|
|
97
|
-
default: null,
|
|
98
|
-
parseHTML: (element) => element.getAttribute("data-id"),
|
|
99
|
-
renderHTML: (attributes) => {
|
|
100
|
-
if (!attributes.id)
|
|
101
|
-
return {};
|
|
102
|
-
return { "data-id": attributes.id };
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
label: {
|
|
106
|
-
default: null,
|
|
107
|
-
parseHTML: (element) => element.getAttribute("data-label"),
|
|
108
|
-
renderHTML: (attributes) => {
|
|
109
|
-
if (!attributes.label)
|
|
110
|
-
return {};
|
|
111
|
-
return { "data-label": attributes.label };
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
type: {
|
|
115
|
-
default: null,
|
|
116
|
-
parseHTML: (element) => element.getAttribute("data-tag-type"),
|
|
117
|
-
renderHTML: (attributes) => {
|
|
118
|
-
if (!attributes.type)
|
|
119
|
-
return {};
|
|
120
|
-
return { "data-tag-type": attributes.type };
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
renderHTML({ node }) {
|
|
126
|
-
var _a, _b, _c, _d, _e, _f;
|
|
127
|
-
const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
|
|
128
|
-
const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
|
|
129
|
-
const type = (_f = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.type) != null ? _f : "";
|
|
130
|
-
return [
|
|
131
|
-
"span",
|
|
132
|
-
{
|
|
133
|
-
class: "hash-tag",
|
|
134
|
-
"data-type": "hashTag",
|
|
135
|
-
"data-id": id,
|
|
136
|
-
"data-label": label,
|
|
137
|
-
"data-tag-type": type,
|
|
138
|
-
"data-hash-tag": "#",
|
|
139
|
-
contenteditable: "false"
|
|
140
|
-
},
|
|
141
|
-
`#${label}`
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
|
-
}).configure({
|
|
145
|
-
deleteTriggerWithBackspace: true,
|
|
146
|
-
suggestion: {
|
|
147
|
-
char: "#",
|
|
148
|
-
allowedPrefixes: null,
|
|
149
|
-
allowSpaces: false,
|
|
150
|
-
/**
|
|
151
|
-
* allow
|
|
152
|
-
* - 功能:判断是否允许触发建议态。
|
|
153
|
-
* - 若该字符带有 consumedTrigger 标记,说明此前已触发过或用户选择忽略,则不再触发建议。
|
|
154
|
-
*/
|
|
155
|
-
allow: ({ state, range }) => {
|
|
156
|
-
return !checkConsumed(state, range);
|
|
157
|
-
},
|
|
158
|
-
render() {
|
|
159
|
-
let activeRange = null;
|
|
160
|
-
let exitCause = "unknown";
|
|
161
|
-
return {
|
|
162
|
-
onStart({ editor, range, command, query }) {
|
|
163
|
-
activeRange = range;
|
|
164
|
-
activeEditor = editor;
|
|
165
|
-
exitCause = "unknown";
|
|
166
|
-
emit("hashTag-triggered", (data) => {
|
|
167
|
-
try {
|
|
168
|
-
(activeEditor || editor).chain().focus().deleteRange(activeRange || range).insertContentAt((activeRange || range).from, {
|
|
169
|
-
type: "hashTag",
|
|
170
|
-
attrs: { id: data.hashTagId, label: data.name, type: data.type }
|
|
171
|
-
}).setTextSelection((activeRange || range).from + 1).insertContent(" ").run();
|
|
172
|
-
} catch (e) {
|
|
173
|
-
command({ id: data.hashTagId, label: data.name, type: data.type });
|
|
174
|
-
(activeEditor || editor).chain().focus().insertContent(" ").run();
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
emit("hashTag-input", query != null ? query : "");
|
|
178
|
-
},
|
|
179
|
-
onUpdate({ query, range, editor }) {
|
|
180
|
-
activeRange = range || activeRange;
|
|
181
|
-
activeEditor = editor || activeEditor;
|
|
182
|
-
emit("hashTag-input", query != null ? query : "");
|
|
183
|
-
},
|
|
184
|
-
onKeyDown({ event }) {
|
|
185
|
-
const isSpaceKey = [" ", "Space", "Spacebar"].includes(event.key) || // @ts-ignore
|
|
186
|
-
event.keyCode === 32 || event.code === "Space";
|
|
187
|
-
if (isSpaceKey) {
|
|
188
|
-
exitCause = "space";
|
|
189
|
-
}
|
|
190
|
-
return false;
|
|
191
|
-
},
|
|
192
|
-
onExit({ editor, range }) {
|
|
193
|
-
var _a, _b, _c, _d, _e;
|
|
194
|
-
try {
|
|
195
|
-
const sel = (_a = editor.state) == null ? void 0 : _a.selection;
|
|
196
|
-
const from = (_b = sel == null ? void 0 : sel.from) != null ? _b : 0;
|
|
197
|
-
const prevChar = (_e = (_d = (_c = editor.state) == null ? void 0 : _c.doc) == null ? void 0 : _d.textBetween(Math.max(from - 1, 0), from, "\0", "\0")) != null ? _e : "";
|
|
198
|
-
if (prevChar === " ") {
|
|
199
|
-
exitCause = "space";
|
|
200
|
-
}
|
|
201
|
-
} catch (e) {
|
|
202
|
-
}
|
|
203
|
-
markAsConsumed(editor, range, "#");
|
|
204
|
-
activeRange = null;
|
|
205
|
-
activeEditor = null;
|
|
206
|
-
emit("hashTag-exit", {
|
|
207
|
-
reason: exitCause,
|
|
208
|
-
nonContiguous: exitCause === "space"
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
const CustomContent = import_extension_mention.default.extend({
|
|
216
|
-
name: "customContent",
|
|
217
|
-
parseHTML() {
|
|
218
|
-
return [{ tag: 'span[data-type="custom-content"]' }];
|
|
219
|
-
},
|
|
220
|
-
addAttributes() {
|
|
221
|
-
return {
|
|
222
|
-
id: {
|
|
223
|
-
default: null,
|
|
224
|
-
parseHTML: (element) => element.getAttribute("data-id"),
|
|
225
|
-
renderHTML: (attributes) => {
|
|
226
|
-
if (!attributes.id) {
|
|
227
|
-
return {};
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
"data-id": attributes.id
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
label: {
|
|
235
|
-
default: null,
|
|
236
|
-
parseHTML: (element) => element.getAttribute("file-label"),
|
|
237
|
-
renderHTML: (attributes) => {
|
|
238
|
-
if (!attributes.label) {
|
|
239
|
-
return {};
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
"file-label": attributes.label
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
obj: {
|
|
247
|
-
default: null,
|
|
248
|
-
parseHTML: (element) => {
|
|
249
|
-
const objStr = element.getAttribute("obj");
|
|
250
|
-
try {
|
|
251
|
-
return objStr ? JSON.parse(objStr) : null;
|
|
252
|
-
} catch (e) {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
renderHTML: (attributes) => {
|
|
257
|
-
if (!attributes.obj) {
|
|
258
|
-
return {};
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
obj: JSON.stringify(attributes.obj)
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
color: {
|
|
266
|
-
default: null,
|
|
267
|
-
parseHTML: (element) => element.getAttribute("data-color"),
|
|
268
|
-
renderHTML: (attributes) => {
|
|
269
|
-
if (!attributes.color)
|
|
270
|
-
return {};
|
|
271
|
-
return { "data-color": attributes.color };
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
hoverColor: {
|
|
275
|
-
default: null,
|
|
276
|
-
parseHTML: (element) => element.getAttribute("data-hover-color"),
|
|
277
|
-
renderHTML: (attributes) => {
|
|
278
|
-
if (!attributes.hoverColor)
|
|
279
|
-
return {};
|
|
280
|
-
return { "data-hover-color": attributes.hoverColor };
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
},
|
|
285
|
-
renderHTML({ node }) {
|
|
286
|
-
var _a, _b, _c, _d, _e, _f;
|
|
287
|
-
const obj = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.obj) != null ? _b : {};
|
|
288
|
-
const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
|
|
289
|
-
const color = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.color;
|
|
290
|
-
const hoverColor = (_f = node == null ? void 0 : node.attrs) == null ? void 0 : _f.hoverColor;
|
|
291
|
-
const styleParts = [];
|
|
292
|
-
if (color)
|
|
293
|
-
styleParts.push(`--custom-content-color: ${color}`);
|
|
294
|
-
if (hoverColor)
|
|
295
|
-
styleParts.push(`--custom-content-hover-color: ${hoverColor}`);
|
|
296
|
-
return [
|
|
297
|
-
"span",
|
|
298
|
-
{
|
|
299
|
-
class: "custom-content",
|
|
300
|
-
"data-type": "custom-content",
|
|
301
|
-
obj: JSON.stringify(obj),
|
|
302
|
-
"file-label": label,
|
|
303
|
-
"data-color": color,
|
|
304
|
-
"data-hover-color": hoverColor,
|
|
305
|
-
style: styleParts.length ? styleParts.join(";") : void 0,
|
|
306
|
-
contenteditable: "false"
|
|
307
|
-
},
|
|
308
|
-
label
|
|
309
|
-
];
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
65
|
const extensions = [
|
|
66
|
+
// 基础扩展
|
|
313
67
|
import_starter_kit.default,
|
|
314
68
|
import_HtmlBlock.default,
|
|
315
|
-
ConsumedTrigger,
|
|
316
|
-
//
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
find: /!video\(([^)]+)\)\s/,
|
|
323
|
-
handler: ({ range, match, commands }) => {
|
|
324
|
-
const [, url] = match;
|
|
325
|
-
if (url) {
|
|
326
|
-
const html = `<video src="${url}" autoplay="" loop="" muted="" controls="" playsinline=""></video>`;
|
|
327
|
-
commands.deleteRange(range);
|
|
328
|
-
commands.insertContent({
|
|
329
|
-
type: "htmlBlock",
|
|
330
|
-
attrs: { html }
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
})
|
|
335
|
-
];
|
|
336
|
-
}
|
|
337
|
-
}),
|
|
338
|
-
import_core.Extension.create({
|
|
339
|
-
name: "audioInputRule",
|
|
340
|
-
addInputRules() {
|
|
341
|
-
return [
|
|
342
|
-
new import_core.InputRule({
|
|
343
|
-
find: /!audio\(([^)]+)\)\s/,
|
|
344
|
-
handler: ({ range, match, commands }) => {
|
|
345
|
-
const [, url] = match;
|
|
346
|
-
if (url) {
|
|
347
|
-
const html = `<audio src="${url}" controls="" playsinline=""></audio>`;
|
|
348
|
-
commands.deleteRange(range);
|
|
349
|
-
commands.insertContent({
|
|
350
|
-
type: "htmlBlock",
|
|
351
|
-
attrs: { html }
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
})
|
|
356
|
-
];
|
|
357
|
-
}
|
|
358
|
-
}),
|
|
69
|
+
import_ConsumedTrigger.ConsumedTrigger,
|
|
70
|
+
// IME 输入法跟踪
|
|
71
|
+
(0, import_IMEComposition.createIMECompositionExtension)(imeState),
|
|
72
|
+
// 媒体输入规则
|
|
73
|
+
import_MediaInputRules.VideoInputRule,
|
|
74
|
+
import_MediaInputRules.AudioInputRule,
|
|
75
|
+
// 文本样式
|
|
359
76
|
import_extension_text_style.TextStyle,
|
|
360
77
|
import_extension_color.Color,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
bulletListMarker: "-",
|
|
366
|
-
linkify: true,
|
|
367
|
-
breaks: false,
|
|
368
|
-
transformPastedText: true,
|
|
369
|
-
transformCopiedText: true
|
|
370
|
-
}),
|
|
371
|
-
import_core.Extension.create({
|
|
372
|
-
name: "markdownLinkInputRule",
|
|
373
|
-
addInputRules() {
|
|
374
|
-
return [
|
|
375
|
-
new import_core.InputRule({
|
|
376
|
-
find: /\[([^\]]+)\]\(([^\)]+)\)\s/,
|
|
377
|
-
handler: ({ range, match, commands }) => {
|
|
378
|
-
const [, text, href] = match;
|
|
379
|
-
commands.deleteRange({ from: range.from, to: range.to });
|
|
380
|
-
commands.insertContent({
|
|
381
|
-
type: "text",
|
|
382
|
-
text,
|
|
383
|
-
marks: [{ type: "link", attrs: { href } }]
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
})
|
|
387
|
-
];
|
|
388
|
-
}
|
|
389
|
-
}),
|
|
78
|
+
// Markdown 支持
|
|
79
|
+
import_MarkdownExtensions.MarkdownExtension,
|
|
80
|
+
import_MarkdownExtensions.MarkdownLinkInputRule,
|
|
81
|
+
// 图片
|
|
390
82
|
import_extension_image.default,
|
|
83
|
+
// 表格
|
|
391
84
|
import_extension_table.TableKit.configure({
|
|
392
85
|
table: { resizable: true }
|
|
393
86
|
}),
|
|
87
|
+
// 其他内置扩展
|
|
88
|
+
import_extension_underline.default,
|
|
89
|
+
import_extension_superscript.default,
|
|
90
|
+
import_extension_subscript.default,
|
|
91
|
+
import_extension_text_align.default.configure({ types: ["heading", "paragraph"] }),
|
|
92
|
+
import_extension_highlight.default.configure({ multicolor: true }),
|
|
93
|
+
import_extension_link.default.configure({
|
|
94
|
+
openOnClick: false
|
|
95
|
+
}),
|
|
96
|
+
import_extension_task_list.TaskList,
|
|
97
|
+
import_extension_task_item.TaskItem.configure({ nested: true }),
|
|
98
|
+
import_extension_typography.default,
|
|
99
|
+
import_HorizontalRule.default,
|
|
100
|
+
import_ImageUpload.default.configure({
|
|
101
|
+
accept: "image/*",
|
|
102
|
+
maxSize: import_tiptap_utils.MAX_FILE_SIZE,
|
|
103
|
+
limit: 3,
|
|
104
|
+
upload: import_tiptap_utils.handleImageUpload,
|
|
105
|
+
onError: (error) => console.error("Upload failed:", error)
|
|
106
|
+
}),
|
|
107
|
+
// 占位符
|
|
394
108
|
import_extensions.Placeholder.configure({
|
|
395
109
|
placeholder: () => props.placeholder
|
|
396
110
|
}),
|
|
111
|
+
// 列表(自定义键盘快捷键)
|
|
397
112
|
import_extension_list.ListKit.extend({
|
|
398
113
|
addKeyboardShortcuts() {
|
|
399
114
|
return {
|
|
@@ -409,55 +124,12 @@ function useExtensions({ props, emit }) {
|
|
|
409
124
|
};
|
|
410
125
|
}
|
|
411
126
|
}),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
char: "@",
|
|
419
|
-
allowedPrefixes: null,
|
|
420
|
-
allowSpaces: false,
|
|
421
|
-
allow: ({ state, range }) => {
|
|
422
|
-
if (checkConsumed(state, range))
|
|
423
|
-
return false;
|
|
424
|
-
const doc = state.doc;
|
|
425
|
-
const $from = doc.resolve(range.from);
|
|
426
|
-
const isAtStart = range.from === $from.start();
|
|
427
|
-
const prevChar = isAtStart ? "" : doc.textBetween(range.from - 1, range.from);
|
|
428
|
-
if (/[a-zA-Z0-9]/.test(prevChar))
|
|
429
|
-
return false;
|
|
430
|
-
const query = doc.textBetween(range.from + 1, range.to);
|
|
431
|
-
if (/[0-9]/.test(query))
|
|
432
|
-
return false;
|
|
433
|
-
return true;
|
|
434
|
-
},
|
|
435
|
-
render() {
|
|
436
|
-
return {
|
|
437
|
-
onStart({ editor, command, query }) {
|
|
438
|
-
activeEditor = editor;
|
|
439
|
-
emit("mention-triggered", (data) => {
|
|
440
|
-
command({
|
|
441
|
-
id: data.userId,
|
|
442
|
-
label: data.name
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
emit("mention-input", query != null ? query : "");
|
|
446
|
-
},
|
|
447
|
-
onUpdate({ query, editor }) {
|
|
448
|
-
activeEditor = editor;
|
|
449
|
-
emit("mention-input", query != null ? query : "");
|
|
450
|
-
},
|
|
451
|
-
onExit({ editor, range }) {
|
|
452
|
-
markAsConsumed(editor, range, "@");
|
|
453
|
-
emit("mention-exit");
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}),
|
|
459
|
-
HashTag,
|
|
460
|
-
CustomContent
|
|
127
|
+
// Mention 扩展(@ 提及)
|
|
128
|
+
(0, import_MentionExtension.createMentionExtension)({ emit, imeState, editorRef }),
|
|
129
|
+
// HashTag 扩展(# 标签)
|
|
130
|
+
(0, import_HashTag.createHashTagExtension)({ emit, imeState, editorRef }),
|
|
131
|
+
// CustomContent 扩展(自定义内容)
|
|
132
|
+
(0, import_CustomContent.createCustomContentExtension)()
|
|
461
133
|
];
|
|
462
134
|
return extensions;
|
|
463
135
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - 提供编辑器事件处理器工厂函数
|
|
4
|
+
* - 包括图片预览、标签点击、自定义内容交互等
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 创建 HashTag 点击处理器
|
|
8
|
+
* @param emit - Vue emit 函数
|
|
9
|
+
* @returns 事件处理函数
|
|
10
|
+
*/
|
|
11
|
+
export declare const createHashTagClickHandler: (emit: any) => (event: MouseEvent) => void;
|
|
12
|
+
/**
|
|
13
|
+
* 创建 Mention 点击处理器
|
|
14
|
+
* @param emit - Vue emit 函数
|
|
15
|
+
* @returns 事件处理函数
|
|
16
|
+
*/
|
|
17
|
+
export declare const createMentionClickHandler: (emit: any) => (event: MouseEvent) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 创建自定义内容点击处理器
|
|
20
|
+
* @param emit - Vue emit 函数
|
|
21
|
+
* @returns 事件处理函数
|
|
22
|
+
*/
|
|
23
|
+
export declare const createCustomContentClickHandler: (emit: any) => (event: MouseEvent) => void;
|
|
24
|
+
/**
|
|
25
|
+
* 创建自定义内容悬停处理器
|
|
26
|
+
* @param emit - Vue emit 函数
|
|
27
|
+
* @returns 事件处理函数
|
|
28
|
+
*/
|
|
29
|
+
export declare const createCustomContentHoverHandler: (emit: any) => (event: MouseEvent) => void;
|
|
30
|
+
/**
|
|
31
|
+
* 创建图片点击处理器(使用 ViewerJS 预览)
|
|
32
|
+
* @param viewerRef - Viewer 实例引用
|
|
33
|
+
* @returns 事件处理函数
|
|
34
|
+
*/
|
|
35
|
+
export declare const createImageClickHandler: (viewerRef: {
|
|
36
|
+
value: any;
|
|
37
|
+
}) => (event: MouseEvent) => void;
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
createCustomContentClickHandler: () => createCustomContentClickHandler,
|
|
31
|
+
createCustomContentHoverHandler: () => createCustomContentHoverHandler,
|
|
32
|
+
createHashTagClickHandler: () => createHashTagClickHandler,
|
|
33
|
+
createImageClickHandler: () => createImageClickHandler,
|
|
34
|
+
createMentionClickHandler: () => createMentionClickHandler
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
37
|
+
const createHashTagClickHandler = (emit) => {
|
|
38
|
+
return (event) => {
|
|
39
|
+
const target = event.target;
|
|
40
|
+
const tagEl = target.closest(".hash-tag") || null;
|
|
41
|
+
if (tagEl) {
|
|
42
|
+
const id = tagEl.getAttribute("data-id") || "";
|
|
43
|
+
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
44
|
+
const trigger = tagEl.getAttribute("data-hash-tag") || "#";
|
|
45
|
+
const tagType = tagEl.getAttribute("data-tag-type") || "";
|
|
46
|
+
emit("hashTag-clicked", { hashTagId: id, name: label, trigger, type: tagType });
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const createMentionClickHandler = (emit) => {
|
|
53
|
+
return (event) => {
|
|
54
|
+
const target = event.target;
|
|
55
|
+
const tagEl = target.closest(".mention") || null;
|
|
56
|
+
if (tagEl) {
|
|
57
|
+
const id = tagEl.getAttribute("data-id") || "";
|
|
58
|
+
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
59
|
+
emit("mention-clicked", { userId: id, name: label });
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const createCustomContentClickHandler = (emit) => {
|
|
66
|
+
return (event) => {
|
|
67
|
+
const target = event.target;
|
|
68
|
+
const tagEl = target.closest(".custom-content") || null;
|
|
69
|
+
if (tagEl) {
|
|
70
|
+
const objStr = tagEl.getAttribute("obj") || "{}";
|
|
71
|
+
const label = tagEl.getAttribute("file-label") || "";
|
|
72
|
+
try {
|
|
73
|
+
const obj = JSON.parse(objStr);
|
|
74
|
+
emit("customContent-clicked", { obj, label });
|
|
75
|
+
} catch (e) {
|
|
76
|
+
console.error("Failed to parse custom content obj:", e);
|
|
77
|
+
}
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const createCustomContentHoverHandler = (emit) => {
|
|
84
|
+
return (event) => {
|
|
85
|
+
const target = event.target;
|
|
86
|
+
const tagEl = target.closest(".custom-content") || null;
|
|
87
|
+
if (tagEl) {
|
|
88
|
+
const objStr = tagEl.getAttribute("obj") || "{}";
|
|
89
|
+
const label = tagEl.getAttribute("file-label") || "";
|
|
90
|
+
try {
|
|
91
|
+
const obj = JSON.parse(objStr);
|
|
92
|
+
emit("customContent-hovered", { obj, label });
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error("Failed to parse custom content obj:", e);
|
|
95
|
+
}
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const createImageClickHandler = (viewerRef) => {
|
|
102
|
+
return (event) => {
|
|
103
|
+
const target = event.target;
|
|
104
|
+
if (target.tagName === "IMG") {
|
|
105
|
+
import("viewerjs").then(({ default: Viewer }) => {
|
|
106
|
+
if (viewerRef.value) {
|
|
107
|
+
viewerRef.value.destroy();
|
|
108
|
+
}
|
|
109
|
+
viewerRef.value = new Viewer(target, {
|
|
110
|
+
inline: false,
|
|
111
|
+
navbar: true,
|
|
112
|
+
title: true,
|
|
113
|
+
toolbar: {
|
|
114
|
+
zoomIn: true,
|
|
115
|
+
zoomOut: true,
|
|
116
|
+
oneToOne: true,
|
|
117
|
+
reset: true,
|
|
118
|
+
prev: false,
|
|
119
|
+
next: false,
|
|
120
|
+
rotateLeft: true,
|
|
121
|
+
rotateRight: true,
|
|
122
|
+
flipHorizontal: true,
|
|
123
|
+
flipVertical: true
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
viewerRef.value.show();
|
|
127
|
+
});
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - 工具函数统一导出入口
|
|
4
|
+
*/
|
|
5
|
+
export { checkConsumed, markAsConsumed, isSpaceKey, checkLastCharIsSpace } from './triggerHelpers';
|
|
6
|
+
export { createHashTagClickHandler, createMentionClickHandler, createCustomContentClickHandler, createCustomContentHoverHandler, createImageClickHandler, } from './eventHandlers';
|