@cgboiler/biz-basic 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/es/rich-text-editor/RichTextEditor.js +76 -196
- package/es/rich-text-editor/_atomic.css +2 -1
- package/es/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/es/rich-text-editor/extensions/ConsumedTrigger.js +22 -0
- package/es/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/es/rich-text-editor/extensions/CustomContent.js +103 -0
- package/es/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/es/rich-text-editor/extensions/HashTag.js +133 -0
- package/es/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/es/rich-text-editor/extensions/HorizontalRule.js +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/es/rich-text-editor/extensions/IMEComposition.js +30 -0
- package/es/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/es/rich-text-editor/extensions/ImageUpload.js +80 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/es/rich-text-editor/extensions/MarkdownExtensions.js +35 -0
- package/es/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/es/rich-text-editor/extensions/MediaInputRules.js +47 -0
- package/es/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/es/rich-text-editor/extensions/MentionExtension.js +60 -0
- package/es/rich-text-editor/extensions/index.d.ts +16 -0
- package/es/rich-text-editor/extensions/index.js +20 -0
- package/es/rich-text-editor/hooks/index.d.ts +6 -0
- package/es/rich-text-editor/hooks/index.js +4 -0
- package/es/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/es/rich-text-editor/hooks/useEditorHistory.js +87 -0
- package/es/rich-text-editor/index copy 2.css +1 -0
- package/es/rich-text-editor/index copy 2.less +598 -0
- package/es/rich-text-editor/index copy.css +1 -0
- package/es/rich-text-editor/index copy.less +356 -0
- package/es/rich-text-editor/index.css +1 -1
- package/es/rich-text-editor/index.less +444 -254
- package/es/rich-text-editor/lib/utils.d.ts +123 -0
- package/es/rich-text-editor/lib/utils.js +244 -0
- package/es/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/blockquote-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/es/rich-text-editor/menu-system/components/code-block-button.js +75 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-button.js +102 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/color-highlight-popover.js +99 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/es/rich-text-editor/menu-system/components/heading-dropdown-menu.js +102 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/es/rich-text-editor/menu-system/components/horizontal-rule-button.js +42 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/image-upload-button.js +71 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/es/rich-text-editor/menu-system/components/image-upload-node.js +299 -0
- package/es/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/es/rich-text-editor/menu-system/components/link-popover.js +127 -0
- package/es/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/es/rich-text-editor/menu-system/components/list-button.js +69 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/components/list-dropdown-menu.js +97 -0
- package/es/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/mark-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/text-align-button.js +80 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/es/rich-text-editor/menu-system/components/undo-redo-button.js +77 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-blockquote.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-code-block.js +140 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-color-highlight.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/es/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +46 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-element-rect.js +132 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/es/rich-text-editor/menu-system/hooks/use-file-upload.js +135 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +70 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/es/rich-text-editor/menu-system/hooks/use-heading.js +166 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/es/rich-text-editor/menu-system/hooks/use-image-upload.js +103 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/es/rich-text-editor/menu-system/hooks/use-link-popover.js +62 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/es/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +121 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-list.js +191 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/es/rich-text-editor/menu-system/hooks/use-mark.js +109 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/es/rich-text-editor/menu-system/hooks/use-menu-navigation.js +134 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/es/rich-text-editor/menu-system/hooks/use-mobile.js +20 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/es/rich-text-editor/menu-system/hooks/use-text-align.js +113 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/es/rich-text-editor/menu-system/hooks/use-throttled-callback.js +45 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/es/rich-text-editor/menu-system/hooks/use-undo-redo.js +96 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/es/rich-text-editor/menu-system/hooks/use-window-size.js +74 -0
- package/es/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/es/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/es/rich-text-editor/menu-system/icons/index.js +487 -0
- package/es/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/es/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/es/rich-text-editor/menu-system/primitives/button.js +107 -0
- package/es/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/es/rich-text-editor/menu-system/primitives/card.js +116 -0
- package/es/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/es/rich-text-editor/menu-system/primitives/input.js +55 -0
- package/es/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/es/rich-text-editor/menu-system/primitives/separator.js +42 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/es/rich-text-editor/menu-system/primitives/toolbar.js +149 -0
- package/es/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/es/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/es/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/es/rich-text-editor/menu-system/styles/button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/button.less +322 -0
- package/es/rich-text-editor/menu-system/styles/card.css +1 -0
- package/es/rich-text-editor/menu-system/styles/card.less +78 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/es/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/es/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/es/rich-text-editor/menu-system/styles/input.css +1 -0
- package/es/rich-text-editor/menu-system/styles/input.less +53 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/es/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/es/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/es/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/es/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/es/rich-text-editor/menu-system/styles/toolbar.less +87 -0
- package/es/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/es/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/es/rich-text-editor/menu-system/utils/tiptap-utils.js +243 -0
- package/es/rich-text-editor/types.d.ts +4 -0
- package/es/rich-text-editor/types.js +4 -0
- package/es/rich-text-editor/useExtensions.d.ts +3 -3
- package/es/rich-text-editor/useExtensions.js +63 -428
- package/es/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/es/rich-text-editor/utils/eventHandlers.js +103 -0
- package/es/rich-text-editor/utils/index.d.ts +6 -0
- package/es/rich-text-editor/utils/index.js +19 -0
- package/es/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/es/rich-text-editor/utils/triggerHelpers.js +46 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/rich-text-editor/RichTextEditor.d.ts +14 -5
- package/lib/rich-text-editor/RichTextEditor.js +76 -206
- package/lib/rich-text-editor/_atomic.css +2 -1
- package/lib/rich-text-editor/extensions/ConsumedTrigger.d.ts +8 -0
- package/lib/rich-text-editor/extensions/ConsumedTrigger.js +41 -0
- package/lib/rich-text-editor/extensions/CustomContent.d.ts +5 -0
- package/lib/rich-text-editor/extensions/CustomContent.js +132 -0
- package/lib/rich-text-editor/extensions/HashTag.d.ts +15 -0
- package/lib/rich-text-editor/extensions/HashTag.js +157 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.d.ts +2 -0
- package/lib/rich-text-editor/extensions/HorizontalRule.js +45 -0
- package/lib/rich-text-editor/extensions/IMEComposition.d.ts +16 -0
- package/lib/rich-text-editor/extensions/IMEComposition.js +49 -0
- package/lib/rich-text-editor/extensions/ImageUpload.d.ts +56 -0
- package/lib/rich-text-editor/extensions/ImageUpload.js +99 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MarkdownExtensions.js +54 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.d.ts +17 -0
- package/lib/rich-text-editor/extensions/MediaInputRules.js +66 -0
- package/lib/rich-text-editor/extensions/MentionExtension.d.ts +15 -0
- package/lib/rich-text-editor/extensions/MentionExtension.js +89 -0
- package/lib/rich-text-editor/extensions/index.d.ts +16 -0
- package/lib/rich-text-editor/extensions/index.js +49 -0
- package/lib/rich-text-editor/hooks/index.d.ts +6 -0
- package/lib/rich-text-editor/hooks/index.js +23 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.d.ts +17 -0
- package/lib/rich-text-editor/hooks/useEditorHistory.js +116 -0
- package/lib/rich-text-editor/index copy 2.css +1 -0
- package/lib/rich-text-editor/index copy 2.less +598 -0
- package/lib/rich-text-editor/index copy.css +1 -0
- package/lib/rich-text-editor/index copy.less +356 -0
- package/lib/rich-text-editor/index.css +1 -1
- package/lib/rich-text-editor/index.less +444 -254
- package/lib/rich-text-editor/lib/utils.d.ts +123 -0
- package/lib/rich-text-editor/lib/utils.js +263 -0
- package/lib/rich-text-editor/menu-system/components/_atomic.css +44 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/blockquote-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.d.ts +49 -0
- package/lib/rich-text-editor/menu-system/components/code-block-button.js +94 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.d.ts +61 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-button.js +119 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/color-highlight-popover.js +118 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.d.ts +43 -0
- package/lib/rich-text-editor/menu-system/components/heading-dropdown-menu.js +131 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/components/horizontal-rule-button.js +61 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-button.js +90 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.d.ts +93 -0
- package/lib/rich-text-editor/menu-system/components/image-upload-node.js +316 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.d.ts +32 -0
- package/lib/rich-text-editor/menu-system/components/link-popover.js +146 -0
- package/lib/rich-text-editor/menu-system/components/list-button.d.ts +40 -0
- package/lib/rich-text-editor/menu-system/components/list-button.js +88 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/components/list-dropdown-menu.js +116 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/mark-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/text-align-button.js +99 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.d.ts +58 -0
- package/lib/rich-text-editor/menu-system/components/undo-redo-button.js +96 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-blockquote.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-code-block.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.d.ts +46 -0
- package/lib/rich-text-editor/menu-system/hooks/use-color-highlight.js +185 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.d.ts +7 -0
- package/lib/rich-text-editor/menu-system/hooks/use-cursor-visibility.js +65 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-element-rect.js +149 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.d.ts +94 -0
- package/lib/rich-text-editor/menu-system/hooks/use-file-upload.js +154 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.d.ts +41 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading-dropdown-menu.js +84 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.d.ts +26 -0
- package/lib/rich-text-editor/menu-system/hooks/use-heading.js +190 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.d.ts +35 -0
- package/lib/rich-text-editor/menu-system/hooks/use-image-upload.js +122 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.d.ts +10 -0
- package/lib/rich-text-editor/menu-system/hooks/use-link-popover.js +81 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list-dropdown-menu.js +140 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-list.js +205 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.d.ts +22 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mark.js +138 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.d.ts +16 -0
- package/lib/rich-text-editor/menu-system/hooks/use-menu-navigation.js +153 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.d.ts +1 -0
- package/lib/rich-text-editor/menu-system/hooks/use-mobile.js +39 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.d.ts +28 -0
- package/lib/rich-text-editor/menu-system/hooks/use-text-align.js +132 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.d.ts +8 -0
- package/lib/rich-text-editor/menu-system/hooks/use-throttled-callback.js +64 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.d.ts +60 -0
- package/lib/rich-text-editor/menu-system/hooks/use-undo-redo.js +115 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.d.ts +21 -0
- package/lib/rich-text-editor/menu-system/hooks/use-window-size.js +93 -0
- package/lib/rich-text-editor/menu-system/icons/_atomic.css +32 -0
- package/lib/rich-text-editor/menu-system/icons/index.d.ts +546 -0
- package/lib/rich-text-editor/menu-system/icons/index.js +506 -0
- package/lib/rich-text-editor/menu-system/primitives/_atomic.css +38 -0
- package/lib/rich-text-editor/menu-system/primitives/button.d.ts +110 -0
- package/lib/rich-text-editor/menu-system/primitives/button.js +126 -0
- package/lib/rich-text-editor/menu-system/primitives/card.d.ts +75 -0
- package/lib/rich-text-editor/menu-system/primitives/card.js +135 -0
- package/lib/rich-text-editor/menu-system/primitives/input.d.ts +37 -0
- package/lib/rich-text-editor/menu-system/primitives/input.js +74 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.d.ts +34 -0
- package/lib/rich-text-editor/menu-system/primitives/separator.js +61 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.d.ts +39 -0
- package/lib/rich-text-editor/menu-system/primitives/toolbar.js +168 -0
- package/lib/rich-text-editor/menu-system/styles/animations.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/animations.less +91 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-colors.less +142 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button-group.less +23 -0
- package/lib/rich-text-editor/menu-system/styles/button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/button.less +322 -0
- package/lib/rich-text-editor/menu-system/styles/card.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/card.less +78 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-button.less +57 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/color-highlight-popover.less +51 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/dropdown-menu.less +40 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/image-upload-node.less +240 -0
- package/lib/rich-text-editor/menu-system/styles/input.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/input.less +53 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/link-popover.less +32 -0
- package/lib/rich-text-editor/menu-system/styles/separator.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/separator.less +26 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/simple-editor.less +39 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/toolbar.less +87 -0
- package/lib/rich-text-editor/menu-system/styles/variables.css +1 -0
- package/lib/rich-text-editor/menu-system/styles/variables.less +296 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.d.ts +122 -0
- package/lib/rich-text-editor/menu-system/utils/tiptap-utils.js +262 -0
- package/lib/rich-text-editor/types.d.ts +4 -0
- package/lib/rich-text-editor/types.js +4 -0
- package/lib/rich-text-editor/useExtensions.d.ts +3 -3
- package/lib/rich-text-editor/useExtensions.js +64 -429
- package/lib/rich-text-editor/utils/eventHandlers.d.ts +37 -0
- package/lib/rich-text-editor/utils/eventHandlers.js +132 -0
- package/lib/rich-text-editor/utils/index.d.ts +6 -0
- package/lib/rich-text-editor/utils/index.js +32 -0
- package/lib/rich-text-editor/utils/triggerHelpers.d.ts +31 -0
- package/lib/rich-text-editor/utils/triggerHelpers.js +65 -0
- package/package.json +13 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { checkConsumed, markAsConsumed, isSpaceKey, checkLastCharIsSpace } from "./triggerHelpers";
|
|
2
|
+
import {
|
|
3
|
+
createHashTagClickHandler,
|
|
4
|
+
createMentionClickHandler,
|
|
5
|
+
createCustomContentClickHandler,
|
|
6
|
+
createCustomContentHoverHandler,
|
|
7
|
+
createImageClickHandler
|
|
8
|
+
} from "./eventHandlers";
|
|
9
|
+
export {
|
|
10
|
+
checkConsumed,
|
|
11
|
+
checkLastCharIsSpace,
|
|
12
|
+
createCustomContentClickHandler,
|
|
13
|
+
createCustomContentHoverHandler,
|
|
14
|
+
createHashTagClickHandler,
|
|
15
|
+
createImageClickHandler,
|
|
16
|
+
createMentionClickHandler,
|
|
17
|
+
isSpaceKey,
|
|
18
|
+
markAsConsumed
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件说明:
|
|
3
|
+
* - 提供触发符(# 或 @)相关的辅助函数
|
|
4
|
+
* - 包括消费状态检查、标记操作等
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 检查指定位置是否已被标记为"已消费"
|
|
8
|
+
* @param state - 编辑器状态
|
|
9
|
+
* @param range - 文本范围
|
|
10
|
+
* @returns 是否已被消费
|
|
11
|
+
*/
|
|
12
|
+
export declare const checkConsumed: (state: any, range: any) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 在触发符位置打上已消费标记
|
|
15
|
+
* @param editor - 编辑器实例
|
|
16
|
+
* @param range - 文本范围
|
|
17
|
+
* @param char - 触发符字符
|
|
18
|
+
*/
|
|
19
|
+
export declare const markAsConsumed: (editor: any, range: any, char: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 检查是否为空格键
|
|
22
|
+
* @param event - 键盘事件
|
|
23
|
+
* @returns 是否为空格键
|
|
24
|
+
*/
|
|
25
|
+
export declare const isSpaceKey: (event: KeyboardEvent) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 检测最后一个输入是否为空格(兼容安卓软键盘)
|
|
28
|
+
* @param editor - 编辑器实例
|
|
29
|
+
* @returns 是否为空格
|
|
30
|
+
*/
|
|
31
|
+
export declare const checkLastCharIsSpace: (editor: any) => boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const checkConsumed = (state, range) => {
|
|
2
|
+
const { doc, schema } = state;
|
|
3
|
+
const markType = schema.marks.consumedTrigger;
|
|
4
|
+
if (!markType)
|
|
5
|
+
return false;
|
|
6
|
+
let isConsumed = false;
|
|
7
|
+
doc.nodesBetween(range.from, range.to, (node) => {
|
|
8
|
+
if (node.marks.some((m) => m.type === markType)) {
|
|
9
|
+
isConsumed = true;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return isConsumed;
|
|
13
|
+
};
|
|
14
|
+
const markAsConsumed = (editor, range, char) => {
|
|
15
|
+
if (!editor || !range || range.from === void 0)
|
|
16
|
+
return;
|
|
17
|
+
try {
|
|
18
|
+
const { doc } = editor.state;
|
|
19
|
+
const actualChar = doc.textBetween(range.from, range.from + 1);
|
|
20
|
+
if (actualChar === char) {
|
|
21
|
+
editor.chain().setMeta("addToHistory", false).setTextSelection({ from: range.from, to: range.from + 1 }).setMark("consumedTrigger").setTextSelection(editor.state.selection.to).unsetMark("consumedTrigger").run();
|
|
22
|
+
}
|
|
23
|
+
} catch (e) {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const isSpaceKey = (event) => {
|
|
27
|
+
return [" ", "Space", "Spacebar"].includes(event.key) || // @ts-ignore
|
|
28
|
+
event.keyCode === 32 || event.code === "Space";
|
|
29
|
+
};
|
|
30
|
+
const checkLastCharIsSpace = (editor) => {
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
32
|
+
try {
|
|
33
|
+
const sel = (_a = editor.state) == null ? void 0 : _a.selection;
|
|
34
|
+
const from = (_b = sel == null ? void 0 : sel.from) != null ? _b : 0;
|
|
35
|
+
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 : "";
|
|
36
|
+
return prevChar === " ";
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
checkConsumed,
|
|
43
|
+
checkLastCharIsSpace,
|
|
44
|
+
isSpaceKey,
|
|
45
|
+
markAsConsumed
|
|
46
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(stdin_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(stdin_exports);
|
|
37
37
|
var import_rich_text_editor = __toESM(require("./rich-text-editor"));
|
|
38
38
|
__reExport(stdin_exports, require("./rich-text-editor"), module.exports);
|
|
39
|
-
const version = "1.0.
|
|
39
|
+
const version = "1.0.54";
|
|
40
40
|
function install(app) {
|
|
41
41
|
const components = [
|
|
42
42
|
import_rich_text_editor.default
|
|
@@ -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,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,35 +14,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
18
|
var stdin_exports = {};
|
|
49
19
|
__export(stdin_exports, {
|
|
50
20
|
default: () => stdin_default
|
|
@@ -54,12 +24,19 @@ var import_vue = require("vue");
|
|
|
54
24
|
var import_atomic = require("./_atomic.css");
|
|
55
25
|
var import_vue2 = require("vue");
|
|
56
26
|
var import_vue_3 = require("@tiptap/vue-3");
|
|
57
|
-
var import_viewerjs = __toESM(require("viewerjs"));
|
|
58
27
|
var import_viewer = require("viewerjs/dist/viewer.css");
|
|
59
28
|
var import_useExtensions = require("./useExtensions");
|
|
60
|
-
var
|
|
29
|
+
var import_useEditorHistory = require("./hooks/useEditorHistory");
|
|
30
|
+
var import_eventHandlers = require("./utils/eventHandlers");
|
|
61
31
|
var import_types = require("./types");
|
|
62
32
|
var import_index = require("./index.css");
|
|
33
|
+
var import_toolbar = require("./menu-system/primitives/toolbar");
|
|
34
|
+
var import_heading_dropdown_menu = require("./menu-system/components/heading-dropdown-menu");
|
|
35
|
+
var import_list_dropdown_menu = require("./menu-system/components/list-dropdown-menu");
|
|
36
|
+
var import_blockquote_button = require("./menu-system/components/blockquote-button");
|
|
37
|
+
var import_code_block_button = require("./menu-system/components/code-block-button");
|
|
38
|
+
var import_mark_button = require("./menu-system/components/mark-button");
|
|
39
|
+
var import_horizontal_rule_button = require("./menu-system/components/horizontal-rule-button");
|
|
63
40
|
var stdin_default = (0, import_vue2.defineComponent)({
|
|
64
41
|
name: "RichTextEditor",
|
|
65
42
|
props: import_types.richTextEditorProps,
|
|
@@ -69,24 +46,26 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
69
46
|
expose
|
|
70
47
|
}) {
|
|
71
48
|
const editor = (0, import_vue2.ref)();
|
|
49
|
+
const viewerRef = (0, import_vue2.ref)(null);
|
|
72
50
|
const extensions = (0, import_useExtensions.useExtensions)({
|
|
73
51
|
props,
|
|
74
52
|
emit
|
|
75
53
|
});
|
|
54
|
+
(0, import_useEditorHistory.useEditorHistory)({
|
|
55
|
+
editor: () => editor.value,
|
|
56
|
+
enabled: props.editable
|
|
57
|
+
});
|
|
58
|
+
const imageClickHandler = (0, import_eventHandlers.createImageClickHandler)(viewerRef);
|
|
59
|
+
const hashTagClickHandler = (0, import_eventHandlers.createHashTagClickHandler)(emit);
|
|
60
|
+
const mentionClickHandler = (0, import_eventHandlers.createMentionClickHandler)(emit);
|
|
61
|
+
const customContentClickHandler = (0, import_eventHandlers.createCustomContentClickHandler)(emit);
|
|
62
|
+
const customContentHoverHandler = (0, import_eventHandlers.createCustomContentHoverHandler)(emit);
|
|
76
63
|
let isFocusFromPlaceholder = false;
|
|
77
64
|
const initEditor = () => {
|
|
78
65
|
editor.value = new import_vue_3.Editor({
|
|
79
66
|
extensions,
|
|
80
67
|
content: props.modelValue,
|
|
81
68
|
editable: props.editable,
|
|
82
|
-
// onMount: ({ editor }) => {
|
|
83
|
-
// // 非可编辑状态下,需要手动设置 contenteditable 为 false
|
|
84
|
-
// if (props.editable === false) {
|
|
85
|
-
// editor.setOptions({
|
|
86
|
-
// editable: false,
|
|
87
|
-
// });
|
|
88
|
-
// }
|
|
89
|
-
// },
|
|
90
69
|
onUpdate: ({
|
|
91
70
|
editor: editor2
|
|
92
71
|
}) => {
|
|
@@ -170,185 +149,76 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
170
149
|
var _a;
|
|
171
150
|
(_a = editor.value) == null ? void 0 : _a.setEditable(val);
|
|
172
151
|
});
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
navbar: true,
|
|
183
|
-
title: true,
|
|
184
|
-
toolbar: {
|
|
185
|
-
zoomIn: true,
|
|
186
|
-
zoomOut: true,
|
|
187
|
-
oneToOne: true,
|
|
188
|
-
reset: true,
|
|
189
|
-
prev: false,
|
|
190
|
-
next: false,
|
|
191
|
-
rotateLeft: true,
|
|
192
|
-
rotateRight: true,
|
|
193
|
-
flipHorizontal: true,
|
|
194
|
-
flipVertical: true
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
viewerRef.value.show();
|
|
198
|
-
event.stopPropagation();
|
|
199
|
-
event.preventDefault();
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const hashTagClickHandler = (event) => {
|
|
203
|
-
const target = event.target;
|
|
204
|
-
const tagEl = target.closest(".hash-tag") || null;
|
|
205
|
-
if (tagEl) {
|
|
206
|
-
const id = tagEl.getAttribute("data-id") || "";
|
|
207
|
-
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
208
|
-
const trigger = tagEl.getAttribute("data-hash-tag") || "#";
|
|
209
|
-
const tagType = tagEl.getAttribute("data-tag-type") || "";
|
|
210
|
-
emit("hashTag-clicked", {
|
|
211
|
-
hashTagId: id,
|
|
212
|
-
name: label,
|
|
213
|
-
trigger,
|
|
214
|
-
type: tagType
|
|
215
|
-
});
|
|
216
|
-
event.stopPropagation();
|
|
217
|
-
event.preventDefault();
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
const mentionClickHandler = (event) => {
|
|
222
|
-
const target = event.target;
|
|
223
|
-
const tagEl = target.closest(".mention") || null;
|
|
224
|
-
if (tagEl) {
|
|
225
|
-
const id = tagEl.getAttribute("data-id") || "";
|
|
226
|
-
const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
|
|
227
|
-
emit("mention-clicked", {
|
|
228
|
-
userId: id,
|
|
229
|
-
name: label
|
|
230
|
-
});
|
|
231
|
-
event.stopPropagation();
|
|
232
|
-
event.preventDefault();
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
const customContentClickHandler = (event) => {
|
|
237
|
-
const target = event.target;
|
|
238
|
-
const tagEl = target.closest(".custom-content") || null;
|
|
239
|
-
if (tagEl) {
|
|
240
|
-
const objStr = tagEl.getAttribute("obj") || "{}";
|
|
241
|
-
const label = tagEl.getAttribute("file-label") || "";
|
|
242
|
-
try {
|
|
243
|
-
const obj = JSON.parse(objStr);
|
|
244
|
-
emit("customContent-clicked", {
|
|
245
|
-
obj,
|
|
246
|
-
label
|
|
247
|
-
});
|
|
248
|
-
} catch (e) {
|
|
249
|
-
console.error("Failed to parse custom content obj:", e);
|
|
250
|
-
}
|
|
251
|
-
event.stopPropagation();
|
|
252
|
-
event.preventDefault();
|
|
253
|
-
return;
|
|
152
|
+
const addEventListeners = () => {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
155
|
+
if (editorElement) {
|
|
156
|
+
editorElement.addEventListener("click", imageClickHandler);
|
|
157
|
+
editorElement.addEventListener("click", hashTagClickHandler);
|
|
158
|
+
editorElement.addEventListener("click", mentionClickHandler);
|
|
159
|
+
editorElement.addEventListener("click", customContentClickHandler);
|
|
160
|
+
editorElement.addEventListener("mouseover", customContentHoverHandler);
|
|
254
161
|
}
|
|
255
162
|
};
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
obj,
|
|
266
|
-
label
|
|
267
|
-
});
|
|
268
|
-
} catch (e) {
|
|
269
|
-
console.error("Failed to parse custom content obj:", e);
|
|
270
|
-
}
|
|
271
|
-
event.stopPropagation();
|
|
272
|
-
event.preventDefault();
|
|
273
|
-
return;
|
|
163
|
+
const removeEventListeners = () => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
166
|
+
if (editorElement) {
|
|
167
|
+
editorElement.removeEventListener("click", imageClickHandler);
|
|
168
|
+
editorElement.removeEventListener("click", hashTagClickHandler);
|
|
169
|
+
editorElement.removeEventListener("click", mentionClickHandler);
|
|
170
|
+
editorElement.removeEventListener("click", customContentClickHandler);
|
|
171
|
+
editorElement.removeEventListener("mouseover", customContentHoverHandler);
|
|
274
172
|
}
|
|
275
173
|
};
|
|
276
|
-
const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
|
|
277
|
-
const MAX_HISTORY_ITEMS = 10;
|
|
278
|
-
let saveTimeoutId = null;
|
|
279
|
-
const noteId = (0, import_vue2.ref)("");
|
|
280
|
-
const historyStore = import_localforage.default.createInstance({
|
|
281
|
-
name: "RichTextEditorHistory",
|
|
282
|
-
storeName: "notes"
|
|
283
|
-
});
|
|
284
|
-
const saveLoop = () => __async(this, null, function* () {
|
|
285
|
-
if (editor.value && !editor.value.isDestroyed && editor.value.isEditable) {
|
|
286
|
-
const content = editor.value.getHTML();
|
|
287
|
-
const now = /* @__PURE__ */ new Date();
|
|
288
|
-
const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
|
|
289
|
-
const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
|
|
290
|
-
if (content !== "<p></p>") {
|
|
291
|
-
yield historyStore.setItem(noteId.value, {
|
|
292
|
-
title: noteTitle,
|
|
293
|
-
content
|
|
294
|
-
});
|
|
295
|
-
let metadata = (yield historyStore.getItem(HISTORY_METADATA_KEY)) || [];
|
|
296
|
-
const existingNoteIndex = metadata.findIndex((meta) => meta.id === noteId.value);
|
|
297
|
-
if (existingNoteIndex === -1) {
|
|
298
|
-
metadata.push({
|
|
299
|
-
id: noteId.value,
|
|
300
|
-
timestamp: now.getTime()
|
|
301
|
-
});
|
|
302
|
-
metadata.sort((a, b) => b.timestamp - a.timestamp);
|
|
303
|
-
if (metadata.length > MAX_HISTORY_ITEMS) {
|
|
304
|
-
const itemsToRemove = metadata.splice(MAX_HISTORY_ITEMS);
|
|
305
|
-
for (const item of itemsToRemove) {
|
|
306
|
-
yield historyStore.removeItem(item.id);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
yield historyStore.setItem(HISTORY_METADATA_KEY, metadata);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
saveTimeoutId = setTimeout(saveLoop, 1e4);
|
|
314
|
-
});
|
|
315
174
|
(0, import_vue2.onMounted)(() => {
|
|
316
175
|
initEditor();
|
|
317
|
-
const now = /* @__PURE__ */ new Date();
|
|
318
|
-
noteId.value = `note-${now.getTime()}`;
|
|
319
|
-
if (props.editable) {
|
|
320
|
-
saveLoop();
|
|
321
|
-
}
|
|
322
176
|
(0, import_vue2.nextTick)(() => {
|
|
323
|
-
|
|
324
|
-
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
325
|
-
if (editorElement) {
|
|
326
|
-
editorElement.addEventListener("click", imageClickHandler);
|
|
327
|
-
editorElement.addEventListener("click", hashTagClickHandler);
|
|
328
|
-
editorElement.addEventListener("click", mentionClickHandler);
|
|
329
|
-
editorElement.addEventListener("click", customContentClickHandler);
|
|
330
|
-
editorElement.addEventListener("mouseover", customContentHoverHandler);
|
|
331
|
-
}
|
|
177
|
+
addEventListeners();
|
|
332
178
|
});
|
|
333
179
|
});
|
|
334
180
|
(0, import_vue2.onBeforeUnmount)(() => {
|
|
335
|
-
var _a
|
|
336
|
-
if (
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
340
|
-
if (editorElement) {
|
|
341
|
-
editorElement.removeEventListener("click", imageClickHandler);
|
|
342
|
-
editorElement.removeEventListener("click", hashTagClickHandler);
|
|
343
|
-
editorElement.removeEventListener("click", mentionClickHandler);
|
|
344
|
-
editorElement.removeEventListener("click", customContentClickHandler);
|
|
345
|
-
editorElement.removeEventListener("mouseover", customContentHoverHandler);
|
|
181
|
+
var _a;
|
|
182
|
+
if (viewerRef.value) {
|
|
183
|
+
viewerRef.value.destroy();
|
|
346
184
|
}
|
|
347
|
-
(
|
|
185
|
+
removeEventListeners();
|
|
186
|
+
(_a = editor.value) == null ? void 0 : _a.destroy();
|
|
348
187
|
});
|
|
349
|
-
return () => (0, import_vue.createVNode)(
|
|
188
|
+
return () => (0, import_vue.createVNode)("div", {
|
|
189
|
+
"class": "tiptap-editor-container"
|
|
190
|
+
}, [props.showMenu && editor.value && (0, import_vue.createVNode)(import_toolbar.Toolbar, {
|
|
191
|
+
"class": "tiptap-editor-toolbar"
|
|
192
|
+
}, {
|
|
193
|
+
default: () => [(0, import_vue.createVNode)(import_toolbar.ToolbarGroup, null, {
|
|
194
|
+
default: () => [(0, import_vue.createVNode)(import_heading_dropdown_menu.HeadingDropdownMenu, {
|
|
195
|
+
"editor": editor.value
|
|
196
|
+
}, null), (0, import_vue.createVNode)(import_list_dropdown_menu.ListDropdownMenu, {
|
|
197
|
+
"editor": editor.value
|
|
198
|
+
}, null), (0, import_vue.createVNode)(import_horizontal_rule_button.HorizontalRuleButton, {
|
|
199
|
+
"editor": editor.value
|
|
200
|
+
}, null), (0, import_vue.createVNode)(import_blockquote_button.BlockquoteButton, {
|
|
201
|
+
"editor": editor.value
|
|
202
|
+
}, null), (0, import_vue.createVNode)(import_code_block_button.CodeBlockButton, {
|
|
203
|
+
"editor": editor.value
|
|
204
|
+
}, null)]
|
|
205
|
+
}), (0, import_vue.createVNode)(import_toolbar.ToolbarSeparator, null, null), (0, import_vue.createVNode)(import_toolbar.ToolbarGroup, null, {
|
|
206
|
+
default: () => [(0, import_vue.createVNode)(import_mark_button.MarkButton, {
|
|
207
|
+
"editor": editor.value,
|
|
208
|
+
"type": "bold"
|
|
209
|
+
}, null), (0, import_vue.createVNode)(import_mark_button.MarkButton, {
|
|
210
|
+
"editor": editor.value,
|
|
211
|
+
"type": "italic"
|
|
212
|
+
}, null), (0, import_vue.createVNode)(import_mark_button.MarkButton, {
|
|
213
|
+
"editor": editor.value,
|
|
214
|
+
"type": "code"
|
|
215
|
+
}, null)]
|
|
216
|
+
})]
|
|
217
|
+
}), (0, import_vue.createVNode)("div", {
|
|
218
|
+
"class": "tiptap-editor-content-wrapper"
|
|
219
|
+
}, [(0, import_vue.createVNode)(import_vue_3.EditorContent, {
|
|
350
220
|
"class": "ProseMirror",
|
|
351
221
|
"editor": editor.value
|
|
352
|
-
}, null);
|
|
222
|
+
}, null)])]);
|
|
353
223
|
}
|
|
354
224
|
});
|
|
@@ -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,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
ConsumedTrigger: () => ConsumedTrigger
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
var import_core = require("@tiptap/core");
|
|
24
|
+
const ConsumedTrigger = import_core.Mark.create({
|
|
25
|
+
name: "consumedTrigger",
|
|
26
|
+
keepOnSplit: false,
|
|
27
|
+
// 保证在标记后继续输入时不延续标记
|
|
28
|
+
parseHTML() {
|
|
29
|
+
return [{ tag: "span[data-consumed-trigger]" }];
|
|
30
|
+
},
|
|
31
|
+
renderHTML({ HTMLAttributes }) {
|
|
32
|
+
return [
|
|
33
|
+
"span",
|
|
34
|
+
(0, import_core.mergeAttributes)(HTMLAttributes, {
|
|
35
|
+
"data-consumed-trigger": "true",
|
|
36
|
+
style: "color: inherit;"
|
|
37
|
+
}),
|
|
38
|
+
0
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
});
|