@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
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -16,7 +16,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
16
16
|
type: BooleanConstructor;
|
|
17
17
|
default: boolean;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
showMenu: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "hashTag-clicked" | "mention-clicked" | "customContent-clicked" | "customContent-hovered" | "update:modelValue" | "customContent-triggered" | "customContent-input" | "customContent-exit")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "hashTag-clicked" | "mention-clicked" | "customContent-clicked" | "customContent-hovered" | "update:modelValue" | "customContent-triggered" | "customContent-input" | "customContent-exit", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
24
|
modelValue: {
|
|
21
25
|
type: StringConstructor;
|
|
22
26
|
default: string;
|
|
@@ -32,26 +36,31 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
32
36
|
type: BooleanConstructor;
|
|
33
37
|
default: boolean;
|
|
34
38
|
};
|
|
39
|
+
showMenu: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
35
43
|
}>> & Readonly<{
|
|
36
44
|
onFocus?: ((...args: any[]) => any) | undefined;
|
|
37
45
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
46
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
38
47
|
"onHashTag-triggered"?: ((...args: any[]) => any) | undefined;
|
|
39
48
|
"onHashTag-input"?: ((...args: any[]) => any) | undefined;
|
|
40
49
|
"onHashTag-exit"?: ((...args: any[]) => any) | undefined;
|
|
41
50
|
"onMention-triggered"?: ((...args: any[]) => any) | undefined;
|
|
42
51
|
"onMention-input"?: ((...args: any[]) => any) | undefined;
|
|
43
52
|
"onMention-exit"?: ((...args: any[]) => any) | undefined;
|
|
44
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
45
|
-
"onMention-clicked"?: ((...args: any[]) => any) | undefined;
|
|
46
53
|
"onHashTag-clicked"?: ((...args: any[]) => any) | undefined;
|
|
54
|
+
"onMention-clicked"?: ((...args: any[]) => any) | undefined;
|
|
55
|
+
"onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
"onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
|
|
47
57
|
"onCustomContent-triggered"?: ((...args: any[]) => any) | undefined;
|
|
48
58
|
"onCustomContent-input"?: ((...args: any[]) => any) | undefined;
|
|
49
59
|
"onCustomContent-exit"?: ((...args: any[]) => any) | undefined;
|
|
50
|
-
"onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
|
|
51
|
-
"onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
|
|
52
60
|
}>, {
|
|
53
61
|
modelValue: string;
|
|
54
62
|
placeholder: string;
|
|
55
63
|
editable: boolean;
|
|
64
|
+
showMenu: boolean;
|
|
56
65
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
66
|
export default _default;
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { createVNode as _createVNode } from "vue";
|
|
22
2
|
import "./_atomic.css";
|
|
23
3
|
import { defineComponent, onMounted, onBeforeUnmount, ref, watch, nextTick } from "vue";
|
|
24
4
|
import { Editor, EditorContent } from "@tiptap/vue-3";
|
|
25
|
-
import Viewer from "viewerjs";
|
|
26
5
|
import "viewerjs/dist/viewer.css";
|
|
27
6
|
import { useExtensions } from "./useExtensions";
|
|
28
|
-
import
|
|
7
|
+
import { useEditorHistory } from "./hooks/useEditorHistory";
|
|
8
|
+
import { createHashTagClickHandler, createMentionClickHandler, createCustomContentClickHandler, createCustomContentHoverHandler, createImageClickHandler } from "./utils/eventHandlers";
|
|
29
9
|
import { richTextEditorProps } from "./types";
|
|
30
10
|
import "./index.css";
|
|
11
|
+
import { Toolbar, ToolbarGroup, ToolbarSeparator } from "./menu-system/primitives/toolbar";
|
|
12
|
+
import { HeadingDropdownMenu } from "./menu-system/components/heading-dropdown-menu";
|
|
13
|
+
import { ListDropdownMenu } from "./menu-system/components/list-dropdown-menu";
|
|
14
|
+
import { BlockquoteButton } from "./menu-system/components/blockquote-button";
|
|
15
|
+
import { CodeBlockButton } from "./menu-system/components/code-block-button";
|
|
16
|
+
import { MarkButton } from "./menu-system/components/mark-button";
|
|
17
|
+
import { HorizontalRuleButton } from "./menu-system/components/horizontal-rule-button";
|
|
31
18
|
var stdin_default = defineComponent({
|
|
32
19
|
name: "RichTextEditor",
|
|
33
20
|
props: richTextEditorProps,
|
|
@@ -37,24 +24,26 @@ var stdin_default = defineComponent({
|
|
|
37
24
|
expose
|
|
38
25
|
}) {
|
|
39
26
|
const editor = ref();
|
|
27
|
+
const viewerRef = ref(null);
|
|
40
28
|
const extensions = useExtensions({
|
|
41
29
|
props,
|
|
42
30
|
emit
|
|
43
31
|
});
|
|
32
|
+
useEditorHistory({
|
|
33
|
+
editor: () => editor.value,
|
|
34
|
+
enabled: props.editable
|
|
35
|
+
});
|
|
36
|
+
const imageClickHandler = createImageClickHandler(viewerRef);
|
|
37
|
+
const hashTagClickHandler = createHashTagClickHandler(emit);
|
|
38
|
+
const mentionClickHandler = createMentionClickHandler(emit);
|
|
39
|
+
const customContentClickHandler = createCustomContentClickHandler(emit);
|
|
40
|
+
const customContentHoverHandler = createCustomContentHoverHandler(emit);
|
|
44
41
|
let isFocusFromPlaceholder = false;
|
|
45
42
|
const initEditor = () => {
|
|
46
43
|
editor.value = new Editor({
|
|
47
44
|
extensions,
|
|
48
45
|
content: props.modelValue,
|
|
49
46
|
editable: props.editable,
|
|
50
|
-
// onMount: ({ editor }) => {
|
|
51
|
-
// // 非可编辑状态下,需要手动设置 contenteditable 为 false
|
|
52
|
-
// if (props.editable === false) {
|
|
53
|
-
// editor.setOptions({
|
|
54
|
-
// editable: false,
|
|
55
|
-
// });
|
|
56
|
-
// }
|
|
57
|
-
// },
|
|
58
47
|
onUpdate: ({
|
|
59
48
|
editor: editor2
|
|
60
49
|
}) => {
|
|
@@ -138,186 +127,77 @@ var stdin_default = defineComponent({
|
|
|
138
127
|
var _a;
|
|
139
128
|
(_a = editor.value) == null ? void 0 : _a.setEditable(val);
|
|
140
129
|
});
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
navbar: true,
|
|
151
|
-
title: true,
|
|
152
|
-
toolbar: {
|
|
153
|
-
zoomIn: true,
|
|
154
|
-
zoomOut: true,
|
|
155
|
-
oneToOne: true,
|
|
156
|
-
reset: true,
|
|
157
|
-
prev: false,
|
|
158
|
-
next: false,
|
|
159
|
-
rotateLeft: true,
|
|
160
|
-
rotateRight: true,
|
|
161
|
-
flipHorizontal: true,
|
|
162
|
-
flipVertical: true
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
viewerRef.value.show();
|
|
166
|
-
event.stopPropagation();
|
|
167
|
-
event.preventDefault();
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const hashTagClickHandler = (event) => {
|
|
171
|
-
const target = event.target;
|
|
172
|
-
const tagEl = target.closest(".hash-tag") || null;
|
|
173
|
-
if (tagEl) {
|
|
174
|
-
const id = tagEl.getAttribute("data-id") || "";
|
|
175
|
-
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
176
|
-
const trigger = tagEl.getAttribute("data-hash-tag") || "#";
|
|
177
|
-
const tagType = tagEl.getAttribute("data-tag-type") || "";
|
|
178
|
-
emit("hashTag-clicked", {
|
|
179
|
-
hashTagId: id,
|
|
180
|
-
name: label,
|
|
181
|
-
trigger,
|
|
182
|
-
type: tagType
|
|
183
|
-
});
|
|
184
|
-
event.stopPropagation();
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const mentionClickHandler = (event) => {
|
|
190
|
-
const target = event.target;
|
|
191
|
-
const tagEl = target.closest(".mention") || null;
|
|
192
|
-
if (tagEl) {
|
|
193
|
-
const id = tagEl.getAttribute("data-id") || "";
|
|
194
|
-
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
195
|
-
emit("mention-clicked", {
|
|
196
|
-
userId: id,
|
|
197
|
-
name: label
|
|
198
|
-
});
|
|
199
|
-
event.stopPropagation();
|
|
200
|
-
event.preventDefault();
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
const customContentClickHandler = (event) => {
|
|
205
|
-
const target = event.target;
|
|
206
|
-
const tagEl = target.closest(".custom-content") || null;
|
|
207
|
-
if (tagEl) {
|
|
208
|
-
const objStr = tagEl.getAttribute("obj") || "{}";
|
|
209
|
-
const label = tagEl.getAttribute("file-label") || "";
|
|
210
|
-
try {
|
|
211
|
-
const obj = JSON.parse(objStr);
|
|
212
|
-
emit("customContent-clicked", {
|
|
213
|
-
obj,
|
|
214
|
-
label
|
|
215
|
-
});
|
|
216
|
-
} catch (e) {
|
|
217
|
-
console.error("Failed to parse custom content obj:", e);
|
|
218
|
-
}
|
|
219
|
-
event.stopPropagation();
|
|
220
|
-
event.preventDefault();
|
|
221
|
-
return;
|
|
130
|
+
const addEventListeners = () => {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
133
|
+
if (editorElement) {
|
|
134
|
+
editorElement.addEventListener("click", imageClickHandler);
|
|
135
|
+
editorElement.addEventListener("click", hashTagClickHandler);
|
|
136
|
+
editorElement.addEventListener("click", mentionClickHandler);
|
|
137
|
+
editorElement.addEventListener("click", customContentClickHandler);
|
|
138
|
+
editorElement.addEventListener("mouseover", customContentHoverHandler);
|
|
222
139
|
}
|
|
223
140
|
};
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
obj,
|
|
234
|
-
label
|
|
235
|
-
});
|
|
236
|
-
} catch (e) {
|
|
237
|
-
console.error("Failed to parse custom content obj:", e);
|
|
238
|
-
}
|
|
239
|
-
event.stopPropagation();
|
|
240
|
-
event.preventDefault();
|
|
241
|
-
return;
|
|
141
|
+
const removeEventListeners = () => {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
144
|
+
if (editorElement) {
|
|
145
|
+
editorElement.removeEventListener("click", imageClickHandler);
|
|
146
|
+
editorElement.removeEventListener("click", hashTagClickHandler);
|
|
147
|
+
editorElement.removeEventListener("click", mentionClickHandler);
|
|
148
|
+
editorElement.removeEventListener("click", customContentClickHandler);
|
|
149
|
+
editorElement.removeEventListener("mouseover", customContentHoverHandler);
|
|
242
150
|
}
|
|
243
151
|
};
|
|
244
|
-
const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
|
|
245
|
-
const MAX_HISTORY_ITEMS = 10;
|
|
246
|
-
let saveTimeoutId = null;
|
|
247
|
-
const noteId = ref("");
|
|
248
|
-
const historyStore = localforage.createInstance({
|
|
249
|
-
name: "RichTextEditorHistory",
|
|
250
|
-
storeName: "notes"
|
|
251
|
-
});
|
|
252
|
-
const saveLoop = () => __async(this, null, function* () {
|
|
253
|
-
if (editor.value && !editor.value.isDestroyed && editor.value.isEditable) {
|
|
254
|
-
const content = editor.value.getHTML();
|
|
255
|
-
const now = /* @__PURE__ */ new Date();
|
|
256
|
-
const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
|
|
257
|
-
const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
|
|
258
|
-
if (content !== "<p></p>") {
|
|
259
|
-
yield historyStore.setItem(noteId.value, {
|
|
260
|
-
title: noteTitle,
|
|
261
|
-
content
|
|
262
|
-
});
|
|
263
|
-
let metadata = (yield historyStore.getItem(HISTORY_METADATA_KEY)) || [];
|
|
264
|
-
const existingNoteIndex = metadata.findIndex((meta) => meta.id === noteId.value);
|
|
265
|
-
if (existingNoteIndex === -1) {
|
|
266
|
-
metadata.push({
|
|
267
|
-
id: noteId.value,
|
|
268
|
-
timestamp: now.getTime()
|
|
269
|
-
});
|
|
270
|
-
metadata.sort((a, b) => b.timestamp - a.timestamp);
|
|
271
|
-
if (metadata.length > MAX_HISTORY_ITEMS) {
|
|
272
|
-
const itemsToRemove = metadata.splice(MAX_HISTORY_ITEMS);
|
|
273
|
-
for (const item of itemsToRemove) {
|
|
274
|
-
yield historyStore.removeItem(item.id);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
yield historyStore.setItem(HISTORY_METADATA_KEY, metadata);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
saveTimeoutId = setTimeout(saveLoop, 1e4);
|
|
282
|
-
});
|
|
283
152
|
onMounted(() => {
|
|
284
153
|
initEditor();
|
|
285
|
-
const now = /* @__PURE__ */ new Date();
|
|
286
|
-
noteId.value = `note-${now.getTime()}`;
|
|
287
|
-
if (props.editable) {
|
|
288
|
-
saveLoop();
|
|
289
|
-
}
|
|
290
154
|
nextTick(() => {
|
|
291
|
-
|
|
292
|
-
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
293
|
-
if (editorElement) {
|
|
294
|
-
editorElement.addEventListener("click", imageClickHandler);
|
|
295
|
-
editorElement.addEventListener("click", hashTagClickHandler);
|
|
296
|
-
editorElement.addEventListener("click", mentionClickHandler);
|
|
297
|
-
editorElement.addEventListener("click", customContentClickHandler);
|
|
298
|
-
editorElement.addEventListener("mouseover", customContentHoverHandler);
|
|
299
|
-
}
|
|
155
|
+
addEventListeners();
|
|
300
156
|
});
|
|
301
157
|
});
|
|
302
158
|
onBeforeUnmount(() => {
|
|
303
|
-
var _a
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
308
|
-
if (editorElement) {
|
|
309
|
-
editorElement.removeEventListener("click", imageClickHandler);
|
|
310
|
-
editorElement.removeEventListener("click", hashTagClickHandler);
|
|
311
|
-
editorElement.removeEventListener("click", mentionClickHandler);
|
|
312
|
-
editorElement.removeEventListener("click", customContentClickHandler);
|
|
313
|
-
editorElement.removeEventListener("mouseover", customContentHoverHandler);
|
|
159
|
+
var _a;
|
|
160
|
+
if (viewerRef.value) {
|
|
161
|
+
viewerRef.value.destroy();
|
|
314
162
|
}
|
|
315
|
-
(
|
|
163
|
+
removeEventListeners();
|
|
164
|
+
(_a = editor.value) == null ? void 0 : _a.destroy();
|
|
316
165
|
});
|
|
317
|
-
return () => _createVNode(
|
|
166
|
+
return () => _createVNode("div", {
|
|
167
|
+
"class": "tiptap-editor-container"
|
|
168
|
+
}, [props.showMenu && editor.value && _createVNode(Toolbar, {
|
|
169
|
+
"class": "tiptap-editor-toolbar"
|
|
170
|
+
}, {
|
|
171
|
+
default: () => [_createVNode(ToolbarGroup, null, {
|
|
172
|
+
default: () => [_createVNode(HeadingDropdownMenu, {
|
|
173
|
+
"editor": editor.value
|
|
174
|
+
}, null), _createVNode(ListDropdownMenu, {
|
|
175
|
+
"editor": editor.value
|
|
176
|
+
}, null), _createVNode(HorizontalRuleButton, {
|
|
177
|
+
"editor": editor.value
|
|
178
|
+
}, null), _createVNode(BlockquoteButton, {
|
|
179
|
+
"editor": editor.value
|
|
180
|
+
}, null), _createVNode(CodeBlockButton, {
|
|
181
|
+
"editor": editor.value
|
|
182
|
+
}, null)]
|
|
183
|
+
}), _createVNode(ToolbarSeparator, null, null), _createVNode(ToolbarGroup, null, {
|
|
184
|
+
default: () => [_createVNode(MarkButton, {
|
|
185
|
+
"editor": editor.value,
|
|
186
|
+
"type": "bold"
|
|
187
|
+
}, null), _createVNode(MarkButton, {
|
|
188
|
+
"editor": editor.value,
|
|
189
|
+
"type": "italic"
|
|
190
|
+
}, null), _createVNode(MarkButton, {
|
|
191
|
+
"editor": editor.value,
|
|
192
|
+
"type": "code"
|
|
193
|
+
}, null)]
|
|
194
|
+
})]
|
|
195
|
+
}), _createVNode("div", {
|
|
196
|
+
"class": "tiptap-editor-content-wrapper"
|
|
197
|
+
}, [_createVNode(EditorContent, {
|
|
318
198
|
"class": "ProseMirror",
|
|
319
199
|
"editor": editor.value
|
|
320
|
-
}, null);
|
|
200
|
+
}, null)])]);
|
|
321
201
|
}
|
|
322
202
|
});
|
|
323
203
|
export {
|
|
@@ -31,5 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* layer: default */
|
|
34
|
-
.cgx-atm .
|
|
34
|
+
.cgx-atm .italic{font-style:italic;}
|
|
35
|
+
.cgx-atm .underline{text-decoration-line:underline;}
|
|
35
36
|
.cgx-atm .blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Mark, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
const ConsumedTrigger = Mark.create({
|
|
3
|
+
name: "consumedTrigger",
|
|
4
|
+
keepOnSplit: false,
|
|
5
|
+
// 保证在标记后继续输入时不延续标记
|
|
6
|
+
parseHTML() {
|
|
7
|
+
return [{ tag: "span[data-consumed-trigger]" }];
|
|
8
|
+
},
|
|
9
|
+
renderHTML({ HTMLAttributes }) {
|
|
10
|
+
return [
|
|
11
|
+
"span",
|
|
12
|
+
mergeAttributes(HTMLAttributes, {
|
|
13
|
+
"data-consumed-trigger": "true",
|
|
14
|
+
style: "color: inherit;"
|
|
15
|
+
}),
|
|
16
|
+
0
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
ConsumedTrigger
|
|
22
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import Mention from "@tiptap/extension-mention";
|
|
2
|
+
const createCustomContentExtension = () => {
|
|
3
|
+
return Mention.extend({
|
|
4
|
+
name: "customContent",
|
|
5
|
+
parseHTML() {
|
|
6
|
+
return [{ tag: 'span[data-type="custom-content"]' }];
|
|
7
|
+
},
|
|
8
|
+
addAttributes() {
|
|
9
|
+
return {
|
|
10
|
+
id: {
|
|
11
|
+
default: null,
|
|
12
|
+
parseHTML: (element) => element.getAttribute("data-id"),
|
|
13
|
+
renderHTML: (attributes) => {
|
|
14
|
+
if (!attributes.id) {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
"data-id": attributes.id
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
default: null,
|
|
24
|
+
parseHTML: (element) => element.getAttribute("file-label"),
|
|
25
|
+
renderHTML: (attributes) => {
|
|
26
|
+
if (!attributes.label) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
"file-label": attributes.label
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
obj: {
|
|
35
|
+
default: null,
|
|
36
|
+
parseHTML: (element) => {
|
|
37
|
+
const objStr = element.getAttribute("obj");
|
|
38
|
+
try {
|
|
39
|
+
return objStr ? JSON.parse(objStr) : null;
|
|
40
|
+
} catch (e) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
renderHTML: (attributes) => {
|
|
45
|
+
if (!attributes.obj) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
obj: JSON.stringify(attributes.obj)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
color: {
|
|
54
|
+
default: null,
|
|
55
|
+
parseHTML: (element) => element.getAttribute("data-color"),
|
|
56
|
+
renderHTML: (attributes) => {
|
|
57
|
+
if (!attributes.color)
|
|
58
|
+
return {};
|
|
59
|
+
return { "data-color": attributes.color };
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
hoverColor: {
|
|
63
|
+
default: null,
|
|
64
|
+
parseHTML: (element) => element.getAttribute("data-hover-color"),
|
|
65
|
+
renderHTML: (attributes) => {
|
|
66
|
+
if (!attributes.hoverColor)
|
|
67
|
+
return {};
|
|
68
|
+
return { "data-hover-color": attributes.hoverColor };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
renderHTML({ node }) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f;
|
|
75
|
+
const obj = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.obj) != null ? _b : {};
|
|
76
|
+
const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
|
|
77
|
+
const color = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.color;
|
|
78
|
+
const hoverColor = (_f = node == null ? void 0 : node.attrs) == null ? void 0 : _f.hoverColor;
|
|
79
|
+
const styleParts = [];
|
|
80
|
+
if (color)
|
|
81
|
+
styleParts.push(`--custom-content-color: ${color}`);
|
|
82
|
+
if (hoverColor)
|
|
83
|
+
styleParts.push(`--custom-content-hover-color: ${hoverColor}`);
|
|
84
|
+
return [
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
class: "custom-content",
|
|
88
|
+
"data-type": "custom-content",
|
|
89
|
+
obj: JSON.stringify(obj),
|
|
90
|
+
"file-label": label,
|
|
91
|
+
"data-color": color,
|
|
92
|
+
"data-hover-color": hoverColor,
|
|
93
|
+
style: styleParts.length ? styleParts.join(";") : void 0,
|
|
94
|
+
contenteditable: "false"
|
|
95
|
+
},
|
|
96
|
+
label
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
createCustomContentExtension
|
|
103
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface HashTagOptions {
|
|
2
|
+
emit: any;
|
|
3
|
+
imeState: {
|
|
4
|
+
isComposing: boolean;
|
|
5
|
+
};
|
|
6
|
+
editorRef: {
|
|
7
|
+
current: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 创建 HashTag 扩展
|
|
12
|
+
* @param options - 配置选项
|
|
13
|
+
* @returns TipTap Extension
|
|
14
|
+
*/
|
|
15
|
+
export declare const createHashTagExtension: (options: HashTagOptions) => import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
|