@ctzhian/tiptap 0.4.0
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/Editor/demo.d.ts +4 -0
- package/dist/Editor/demo.js +150 -0
- package/dist/Editor/index.d.ts +4 -0
- package/dist/Editor/index.js +21 -0
- package/dist/EditorThemeProvider/index.d.ts +11 -0
- package/dist/EditorThemeProvider/index.js +90 -0
- package/dist/EditorToolbar/index.d.ts +9 -0
- package/dist/EditorToolbar/index.js +286 -0
- package/dist/asset/css/index.css +161 -0
- package/dist/asset/images/disk.png +0 -0
- package/dist/asset/images/down.svg +3 -0
- package/dist/component/CustomBubbleMenu/SelectionText.d.ts +9 -0
- package/dist/component/CustomBubbleMenu/SelectionText.js +295 -0
- package/dist/component/CustomDragHandle/index.d.ts +9 -0
- package/dist/component/CustomDragHandle/index.js +1172 -0
- package/dist/component/CustomFloatingMenu/index.d.ts +0 -0
- package/dist/component/CustomFloatingMenu/index.js +85 -0
- package/dist/component/FloatingPopover/index.d.ts +13 -0
- package/dist/component/FloatingPopover/index.js +104 -0
- package/dist/component/Icons/ai-generate-2-icon.d.ts +6 -0
- package/dist/component/Icons/ai-generate-2-icon.js +13 -0
- package/dist/component/Icons/ai-generate-text-icon.d.ts +6 -0
- package/dist/component/Icons/ai-generate-text-icon.js +13 -0
- package/dist/component/Icons/align-bottom-icon.d.ts +6 -0
- package/dist/component/Icons/align-bottom-icon.js +13 -0
- package/dist/component/Icons/align-center-icon.d.ts +6 -0
- package/dist/component/Icons/align-center-icon.js +13 -0
- package/dist/component/Icons/align-justify-icon.d.ts +6 -0
- package/dist/component/Icons/align-justify-icon.js +13 -0
- package/dist/component/Icons/align-left-icon.d.ts +6 -0
- package/dist/component/Icons/align-left-icon.js +13 -0
- package/dist/component/Icons/align-right-icon.d.ts +6 -0
- package/dist/component/Icons/align-right-icon.js +13 -0
- package/dist/component/Icons/align-top-icon.d.ts +6 -0
- package/dist/component/Icons/align-top-icon.js +13 -0
- package/dist/component/Icons/align-vertically-icon.d.ts +6 -0
- package/dist/component/Icons/align-vertically-icon.js +13 -0
- package/dist/component/Icons/anticlockwise-line-icon.d.ts +6 -0
- package/dist/component/Icons/anticlockwise-line-icon.js +13 -0
- package/dist/component/Icons/arrow-down-s-line-icon.d.ts +6 -0
- package/dist/component/Icons/arrow-down-s-line-icon.js +13 -0
- package/dist/component/Icons/arrow-go-back-line-icon.d.ts +6 -0
- package/dist/component/Icons/arrow-go-back-line-icon.js +13 -0
- package/dist/component/Icons/arrow-go-forward-line-icon.d.ts +6 -0
- package/dist/component/Icons/arrow-go-forward-line-icon.js +13 -0
- package/dist/component/Icons/arrow-left-wide-line-icon.d.ts +6 -0
- package/dist/component/Icons/arrow-left-wide-line-icon.js +13 -0
- package/dist/component/Icons/at-line-icon.d.ts +6 -0
- package/dist/component/Icons/at-line-icon.js +13 -0
- package/dist/component/Icons/attachment-2-icon.d.ts +6 -0
- package/dist/component/Icons/attachment-2-icon.js +13 -0
- package/dist/component/Icons/attachment-line-icon.d.ts +6 -0
- package/dist/component/Icons/attachment-line-icon.js +13 -0
- package/dist/component/Icons/bold-icon.d.ts +6 -0
- package/dist/component/Icons/bold-icon.js +13 -0
- package/dist/component/Icons/brush-line-icon.d.ts +6 -0
- package/dist/component/Icons/brush-line-icon.js +13 -0
- package/dist/component/Icons/carousel-view-icon.d.ts +6 -0
- package/dist/component/Icons/carousel-view-icon.js +13 -0
- package/dist/component/Icons/checkbox-blank-circle-line-icon.d.ts +6 -0
- package/dist/component/Icons/checkbox-blank-circle-line-icon.js +13 -0
- package/dist/component/Icons/checkbox-circle-line-icon.d.ts +6 -0
- package/dist/component/Icons/checkbox-circle-line-icon.js +13 -0
- package/dist/component/Icons/clockwise-line-icon.d.ts +6 -0
- package/dist/component/Icons/clockwise-line-icon.js +13 -0
- package/dist/component/Icons/code-box-line-icon.d.ts +6 -0
- package/dist/component/Icons/code-box-line-icon.js +13 -0
- package/dist/component/Icons/code-line-icon.d.ts +6 -0
- package/dist/component/Icons/code-line-icon.js +13 -0
- package/dist/component/Icons/code-s-slash-line-icon.d.ts +6 -0
- package/dist/component/Icons/code-s-slash-line-icon.js +13 -0
- package/dist/component/Icons/copy-icon.d.ts +6 -0
- package/dist/component/Icons/copy-icon.js +13 -0
- package/dist/component/Icons/custom-size-icon.d.ts +6 -0
- package/dist/component/Icons/custom-size-icon.js +13 -0
- package/dist/component/Icons/delete-column-icon.d.ts +6 -0
- package/dist/component/Icons/delete-column-icon.js +13 -0
- package/dist/component/Icons/delete-line-icon.d.ts +6 -0
- package/dist/component/Icons/delete-line-icon.js +13 -0
- package/dist/component/Icons/delete-row-icon.d.ts +6 -0
- package/dist/component/Icons/delete-row-icon.js +13 -0
- package/dist/component/Icons/double-quotes-l-icon.d.ts +6 -0
- package/dist/component/Icons/double-quotes-l-icon.js +13 -0
- package/dist/component/Icons/download-line-icon.d.ts +6 -0
- package/dist/component/Icons/download-line-icon.js +13 -0
- package/dist/component/Icons/draggable-icon.d.ts +6 -0
- package/dist/component/Icons/draggable-icon.js +13 -0
- package/dist/component/Icons/edit-box-line-icon.d.ts +6 -0
- package/dist/component/Icons/edit-box-line-icon.js +13 -0
- package/dist/component/Icons/export-line-icon.d.ts +6 -0
- package/dist/component/Icons/export-line-icon.js +13 -0
- package/dist/component/Icons/file-copy-line-icon.d.ts +6 -0
- package/dist/component/Icons/file-copy-line-icon.js +13 -0
- package/dist/component/Icons/file-upload-line-icon.d.ts +6 -0
- package/dist/component/Icons/file-upload-line-icon.js +13 -0
- package/dist/component/Icons/flow-chart-icon.d.ts +6 -0
- package/dist/component/Icons/flow-chart-icon.js +13 -0
- package/dist/component/Icons/font-color-icon.d.ts +6 -0
- package/dist/component/Icons/font-color-icon.js +13 -0
- package/dist/component/Icons/font-family-icon.d.ts +6 -0
- package/dist/component/Icons/font-family-icon.js +13 -0
- package/dist/component/Icons/font-size-icon.d.ts +6 -0
- package/dist/component/Icons/font-size-icon.js +13 -0
- package/dist/component/Icons/format-clear-icon.d.ts +6 -0
- package/dist/component/Icons/format-clear-icon.js +13 -0
- package/dist/component/Icons/formula-icon.d.ts +6 -0
- package/dist/component/Icons/formula-icon.js +13 -0
- package/dist/component/Icons/fullscreen-exit-line-icon.d.ts +6 -0
- package/dist/component/Icons/fullscreen-exit-line-icon.js +13 -0
- package/dist/component/Icons/fullscreen-line-icon.d.ts +6 -0
- package/dist/component/Icons/fullscreen-line-icon.js +13 -0
- package/dist/component/Icons/functions-icon.d.ts +6 -0
- package/dist/component/Icons/functions-icon.js +13 -0
- package/dist/component/Icons/game-line-icon.d.ts +6 -0
- package/dist/component/Icons/game-line-icon.js +13 -0
- package/dist/component/Icons/h-1-icon.d.ts +6 -0
- package/dist/component/Icons/h-1-icon.js +13 -0
- package/dist/component/Icons/h-2-icon.d.ts +6 -0
- package/dist/component/Icons/h-2-icon.js +13 -0
- package/dist/component/Icons/h-3-icon.d.ts +6 -0
- package/dist/component/Icons/h-3-icon.js +13 -0
- package/dist/component/Icons/h-4-icon.d.ts +6 -0
- package/dist/component/Icons/h-4-icon.js +13 -0
- package/dist/component/Icons/h-5-icon.d.ts +6 -0
- package/dist/component/Icons/h-5-icon.js +13 -0
- package/dist/component/Icons/h-6-icon.d.ts +6 -0
- package/dist/component/Icons/h-6-icon.js +13 -0
- package/dist/component/Icons/heading-icon.d.ts +6 -0
- package/dist/component/Icons/heading-icon.js +13 -0
- package/dist/component/Icons/image-add-line-icon.d.ts +6 -0
- package/dist/component/Icons/image-add-line-icon.js +13 -0
- package/dist/component/Icons/image-line-icon.d.ts +6 -0
- package/dist/component/Icons/image-line-icon.js +13 -0
- package/dist/component/Icons/import-line-icon.d.ts +6 -0
- package/dist/component/Icons/import-line-icon.js +13 -0
- package/dist/component/Icons/index.d.ts +110 -0
- package/dist/component/Icons/index.js +113 -0
- package/dist/component/Icons/insert-column-left-icon.d.ts +6 -0
- package/dist/component/Icons/insert-column-left-icon.js +13 -0
- package/dist/component/Icons/insert-column-right-icon.d.ts +6 -0
- package/dist/component/Icons/insert-column-right-icon.js +13 -0
- package/dist/component/Icons/insert-row-bottom-icon.d.ts +6 -0
- package/dist/component/Icons/insert-row-bottom-icon.js +13 -0
- package/dist/component/Icons/insert-row-top-icon.d.ts +6 -0
- package/dist/component/Icons/insert-row-top-icon.js +13 -0
- package/dist/component/Icons/italic-icon.d.ts +6 -0
- package/dist/component/Icons/italic-icon.js +13 -0
- package/dist/component/Icons/layout-left-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/layout-left-2-line-icon.js +13 -0
- package/dist/component/Icons/layout-top-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/layout-top-2-line-icon.js +13 -0
- package/dist/component/Icons/link-icon.d.ts +6 -0
- package/dist/component/Icons/link-icon.js +13 -0
- package/dist/component/Icons/link-unlink-icon.d.ts +6 -0
- package/dist/component/Icons/link-unlink-icon.js +13 -0
- package/dist/component/Icons/list-check-2-icon.d.ts +6 -0
- package/dist/component/Icons/list-check-2-icon.js +13 -0
- package/dist/component/Icons/list-check-3-icon.d.ts +6 -0
- package/dist/component/Icons/list-check-3-icon.js +13 -0
- package/dist/component/Icons/list-ordered-2-icon.d.ts +6 -0
- package/dist/component/Icons/list-ordered-2-icon.js +13 -0
- package/dist/component/Icons/list-unordered-icon.d.ts +6 -0
- package/dist/component/Icons/list-unordered-icon.js +13 -0
- package/dist/component/Icons/markdown-line-icon.d.ts +6 -0
- package/dist/component/Icons/markdown-line-icon.js +13 -0
- package/dist/component/Icons/markup-line-icon.d.ts +6 -0
- package/dist/component/Icons/markup-line-icon.js +13 -0
- package/dist/component/Icons/menu-fold-2-fill-icon.d.ts +6 -0
- package/dist/component/Icons/menu-fold-2-fill-icon.js +13 -0
- package/dist/component/Icons/merge-cells-horizontal-icon.d.ts +6 -0
- package/dist/component/Icons/merge-cells-horizontal-icon.js +13 -0
- package/dist/component/Icons/merge-cells-vertical-icon.d.ts +6 -0
- package/dist/component/Icons/merge-cells-vertical-icon.js +13 -0
- package/dist/component/Icons/mind-map-icon.d.ts +6 -0
- package/dist/component/Icons/mind-map-icon.js +13 -0
- package/dist/component/Icons/more-line-icon.d.ts +6 -0
- package/dist/component/Icons/more-line-icon.js +13 -0
- package/dist/component/Icons/movie-line-icon.d.ts +6 -0
- package/dist/component/Icons/movie-line-icon.js +13 -0
- package/dist/component/Icons/music-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/music-2-line-icon.js +13 -0
- package/dist/component/Icons/node-tree-icon.d.ts +6 -0
- package/dist/component/Icons/node-tree-icon.js +13 -0
- package/dist/component/Icons/notification-3-line-icon.d.ts +6 -0
- package/dist/component/Icons/notification-3-line-icon.js +13 -0
- package/dist/component/Icons/organization-chart-icon.d.ts +6 -0
- package/dist/component/Icons/organization-chart-icon.js +13 -0
- package/dist/component/Icons/pause-line-icon.d.ts +6 -0
- package/dist/component/Icons/pause-line-icon.js +13 -0
- package/dist/component/Icons/play-line-icon.d.ts +6 -0
- package/dist/component/Icons/play-line-icon.js +13 -0
- package/dist/component/Icons/quote-text-icon.d.ts +6 -0
- package/dist/component/Icons/quote-text-icon.js +13 -0
- package/dist/component/Icons/repeat-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/repeat-2-line-icon.js +13 -0
- package/dist/component/Icons/reset-left-fill-icon.d.ts +6 -0
- package/dist/component/Icons/reset-left-fill-icon.js +13 -0
- package/dist/component/Icons/scissors-cut-line-icon.d.ts +6 -0
- package/dist/component/Icons/scissors-cut-line-icon.js +13 -0
- package/dist/component/Icons/screenshot-line-icon.d.ts +6 -0
- package/dist/component/Icons/screenshot-line-icon.js +13 -0
- package/dist/component/Icons/scroll-to-bottom-line-icon.d.ts +6 -0
- package/dist/component/Icons/scroll-to-bottom-line-icon.js +13 -0
- package/dist/component/Icons/separator-icon.d.ts +6 -0
- package/dist/component/Icons/separator-icon.js +13 -0
- package/dist/component/Icons/share-box-line-icon.d.ts +6 -0
- package/dist/component/Icons/share-box-line-icon.js +13 -0
- package/dist/component/Icons/slash-commands-2-icon.d.ts +3 -0
- package/dist/component/Icons/slash-commands-2-icon.js +13 -0
- package/dist/component/Icons/speed-line-icon.d.ts +6 -0
- package/dist/component/Icons/speed-line-icon.js +13 -0
- package/dist/component/Icons/split-cells-horizontal-icon.d.ts +6 -0
- package/dist/component/Icons/split-cells-horizontal-icon.js +13 -0
- package/dist/component/Icons/split-cells-vertical-icon.d.ts +6 -0
- package/dist/component/Icons/split-cells-vertical-icon.js +13 -0
- package/dist/component/Icons/square-root-icon.d.ts +6 -0
- package/dist/component/Icons/square-root-icon.js +13 -0
- package/dist/component/Icons/strikethrough-icon.d.ts +6 -0
- package/dist/component/Icons/strikethrough-icon.js +13 -0
- package/dist/component/Icons/subscript-icon.d.ts +6 -0
- package/dist/component/Icons/subscript-icon.js +13 -0
- package/dist/component/Icons/superscript-icon.d.ts +6 -0
- package/dist/component/Icons/superscript-icon.js +13 -0
- package/dist/component/Icons/table-2-icon.d.ts +6 -0
- package/dist/component/Icons/table-2-icon.js +13 -0
- package/dist/component/Icons/text-icon.d.ts +6 -0
- package/dist/component/Icons/text-icon.js +13 -0
- package/dist/component/Icons/text-wrap-icon.d.ts +6 -0
- package/dist/component/Icons/text-wrap-icon.js +13 -0
- package/dist/component/Icons/title-icon.d.ts +6 -0
- package/dist/component/Icons/title-icon.js +13 -0
- package/dist/component/Icons/underline-icon.d.ts +6 -0
- package/dist/component/Icons/underline-icon.js +13 -0
- package/dist/component/Icons/upload-cloud-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/upload-cloud-2-line-icon.js +13 -0
- package/dist/component/Icons/upload-icon.d.ts +6 -0
- package/dist/component/Icons/upload-icon.js +13 -0
- package/dist/component/Icons/volume-mute-line-icon.d.ts +6 -0
- package/dist/component/Icons/volume-mute-line-icon.js +13 -0
- package/dist/component/Icons/volume-up-line-icon.d.ts +6 -0
- package/dist/component/Icons/volume-up-line-icon.js +13 -0
- package/dist/component/ListHover/index.d.ts +7 -0
- package/dist/component/ListHover/index.js +367 -0
- package/dist/component/Menu/index.d.ts +4 -0
- package/dist/component/Menu/index.js +189 -0
- package/dist/component/Toolbar/EditorAlignSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorAlignSelect.js +176 -0
- package/dist/component/Toolbar/EditorCode.d.ts +7 -0
- package/dist/component/Toolbar/EditorCode.js +150 -0
- package/dist/component/Toolbar/EditorFontBgColor.d.ts +7 -0
- package/dist/component/Toolbar/EditorFontBgColor.js +244 -0
- package/dist/component/Toolbar/EditorFontColor.d.ts +7 -0
- package/dist/component/Toolbar/EditorFontColor.js +246 -0
- package/dist/component/Toolbar/EditorFontSize.d.ts +7 -0
- package/dist/component/Toolbar/EditorFontSize.js +137 -0
- package/dist/component/Toolbar/EditorHeading.d.ts +7 -0
- package/dist/component/Toolbar/EditorHeading.js +174 -0
- package/dist/component/Toolbar/EditorInsert/index.d.ts +7 -0
- package/dist/component/Toolbar/EditorInsert/index.js +186 -0
- package/dist/component/Toolbar/EditorListSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorListSelect.js +163 -0
- package/dist/component/Toolbar/EditorMath.d.ts +7 -0
- package/dist/component/Toolbar/EditorMath.js +148 -0
- package/dist/component/Toolbar/EditorMore/NotificationDialog.d.ts +7 -0
- package/dist/component/Toolbar/EditorMore/NotificationDialog.js +72 -0
- package/dist/component/Toolbar/EditorMore/index.d.ts +7 -0
- package/dist/component/Toolbar/EditorMore/index.js +101 -0
- package/dist/component/Toolbar/EditorScript.d.ts +7 -0
- package/dist/component/Toolbar/EditorScript.js +150 -0
- package/dist/component/Toolbar/EditorVerticalAlignSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorVerticalAlignSelect.js +163 -0
- package/dist/component/Toolbar/Item.d.ts +15 -0
- package/dist/component/Toolbar/Item.js +69 -0
- package/dist/component/Toolbar/index.d.ts +13 -0
- package/dist/component/Toolbar/index.js +13 -0
- package/dist/component/index.d.ts +1 -0
- package/dist/component/index.js +1 -0
- package/dist/contants/enums.d.ts +30 -0
- package/dist/contants/enums.js +98 -0
- package/dist/contants/highlight.d.ts +4 -0
- package/dist/contants/highlight.js +580 -0
- package/dist/contants/placeholder.d.ts +16 -0
- package/dist/contants/placeholder.js +16 -0
- package/dist/contants/shortcut-key.d.ts +48 -0
- package/dist/contants/shortcut-key.js +224 -0
- package/dist/contants/slash-commands.d.ts +13 -0
- package/dist/contants/slash-commands.js +313 -0
- package/dist/extension/component/Attachment/Insert.d.ts +13 -0
- package/dist/extension/component/Attachment/Insert.js +222 -0
- package/dist/extension/component/Attachment/Readonly.d.ts +9 -0
- package/dist/extension/component/Attachment/Readonly.js +93 -0
- package/dist/extension/component/Attachment/index.d.ts +13 -0
- package/dist/extension/component/Attachment/index.js +317 -0
- package/dist/extension/component/Audio/Insert.d.ts +10 -0
- package/dist/extension/component/Audio/Insert.js +351 -0
- package/dist/extension/component/Audio/Readonly.d.ts +8 -0
- package/dist/extension/component/Audio/Readonly.js +428 -0
- package/dist/extension/component/Audio/index.d.ts +14 -0
- package/dist/extension/component/Audio/index.js +740 -0
- package/dist/extension/component/CodeBlock/Readonly.d.ts +4 -0
- package/dist/extension/component/CodeBlock/Readonly.js +135 -0
- package/dist/extension/component/CodeBlock/index.d.ts +4 -0
- package/dist/extension/component/CodeBlock/index.js +296 -0
- package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
- package/dist/extension/component/CustomLink/Insert.js +176 -0
- package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
- package/dist/extension/component/CustomLink/Readonly.js +106 -0
- package/dist/extension/component/CustomLink/index.d.ts +0 -0
- package/dist/extension/component/CustomLink/index.js +440 -0
- package/dist/extension/component/EmojiList/index.d.ts +14 -0
- package/dist/extension/component/EmojiList/index.js +104 -0
- package/dist/extension/component/Image/Crop.d.ts +12 -0
- package/dist/extension/component/Image/Crop.js +218 -0
- package/dist/extension/component/Image/Insert.d.ts +10 -0
- package/dist/extension/component/Image/Insert.js +309 -0
- package/dist/extension/component/Image/Readonly.d.ts +8 -0
- package/dist/extension/component/Image/Readonly.js +52 -0
- package/dist/extension/component/Image/index.d.ts +21 -0
- package/dist/extension/component/Image/index.js +372 -0
- package/dist/extension/component/Link/Insert.d.ts +10 -0
- package/dist/extension/component/Link/Insert.js +253 -0
- package/dist/extension/component/Link/Readonly.d.ts +8 -0
- package/dist/extension/component/Link/Readonly.js +102 -0
- package/dist/extension/component/Link/index.d.ts +12 -0
- package/dist/extension/component/Link/index.js +510 -0
- package/dist/extension/component/Mathematics/block/Readonly.d.ts +9 -0
- package/dist/extension/component/Mathematics/block/Readonly.js +36 -0
- package/dist/extension/component/Mathematics/block/index.d.ts +8 -0
- package/dist/extension/component/Mathematics/block/index.js +149 -0
- package/dist/extension/component/Mathematics/index.d.ts +3 -0
- package/dist/extension/component/Mathematics/index.js +3 -0
- package/dist/extension/component/Mathematics/inline/Readonly.d.ts +9 -0
- package/dist/extension/component/Mathematics/inline/Readonly.js +34 -0
- package/dist/extension/component/Mathematics/inline/index.d.ts +8 -0
- package/dist/extension/component/Mathematics/inline/index.js +148 -0
- package/dist/extension/component/MentionList/index.d.ts +13 -0
- package/dist/extension/component/MentionList/index.js +92 -0
- package/dist/extension/component/SlashCommandsList/index.d.ts +4 -0
- package/dist/extension/component/SlashCommandsList/index.js +121 -0
- package/dist/extension/component/Table/ContextMenu.d.ts +10 -0
- package/dist/extension/component/Table/ContextMenu.js +228 -0
- package/dist/extension/component/Table/TableContextMenuPlugin.d.ts +9 -0
- package/dist/extension/component/Table/TableContextMenuPlugin.js +272 -0
- package/dist/extension/component/Table/index.d.ts +2 -0
- package/dist/extension/component/Table/index.js +2 -0
- package/dist/extension/component/UploadProgress/index.d.ts +10 -0
- package/dist/extension/component/UploadProgress/index.js +103 -0
- package/dist/extension/component/Video/Insert.d.ts +10 -0
- package/dist/extension/component/Video/Insert.js +257 -0
- package/dist/extension/component/Video/Readonly.d.ts +8 -0
- package/dist/extension/component/Video/Readonly.js +41 -0
- package/dist/extension/component/Video/index.d.ts +14 -0
- package/dist/extension/component/Video/index.js +166 -0
- package/dist/extension/extension/SlashCommands.d.ts +3 -0
- package/dist/extension/extension/SlashCommands.js +25 -0
- package/dist/extension/extension/index.d.ts +1 -0
- package/dist/extension/extension/index.js +1 -0
- package/dist/extension/index.d.ts +2 -0
- package/dist/extension/index.js +176 -0
- package/dist/extension/mark/Link.d.ts +0 -0
- package/dist/extension/mark/Link.js +58 -0
- package/dist/extension/mark/index.d.ts +0 -0
- package/dist/extension/mark/index.js +1 -0
- package/dist/extension/node/Attachment.d.ts +28 -0
- package/dist/extension/node/Attachment.js +227 -0
- package/dist/extension/node/Audio.d.ts +23 -0
- package/dist/extension/node/Audio.js +194 -0
- package/dist/extension/node/CodeBlockLowlight.d.ts +1 -0
- package/dist/extension/node/CodeBlockLowlight.js +40 -0
- package/dist/extension/node/Details.d.ts +3 -0
- package/dist/extension/node/Details.js +39 -0
- package/dist/extension/node/Emoji.d.ts +1 -0
- package/dist/extension/node/Emoji.js +7 -0
- package/dist/extension/node/FileHandler.d.ts +4 -0
- package/dist/extension/node/FileHandler.js +294 -0
- package/dist/extension/node/Image.d.ts +3 -0
- package/dist/extension/node/Image.js +38 -0
- package/dist/extension/node/Link/helpers/autolink.d.ts +15 -0
- package/dist/extension/node/Link/helpers/autolink.js +162 -0
- package/dist/extension/node/Link/helpers/clickHandler.d.ts +10 -0
- package/dist/extension/node/Link/helpers/clickHandler.js +46 -0
- package/dist/extension/node/Link/helpers/pasteHandler.d.ts +10 -0
- package/dist/extension/node/Link/helpers/pasteHandler.js +32 -0
- package/dist/extension/node/Link/helpers/whitespace.d.ts +4 -0
- package/dist/extension/node/Link/helpers/whitespace.js +6 -0
- package/dist/extension/node/Link/index.d.ts +162 -0
- package/dist/extension/node/Link/index.js +461 -0
- package/dist/extension/node/ListKit.d.ts +2 -0
- package/dist/extension/node/ListKit.js +23 -0
- package/dist/extension/node/Mathematics.d.ts +27 -0
- package/dist/extension/node/Mathematics.js +97 -0
- package/dist/extension/node/Mention.d.ts +2 -0
- package/dist/extension/node/Mention.js +10 -0
- package/dist/extension/node/Table.d.ts +5 -0
- package/dist/extension/node/Table.js +174 -0
- package/dist/extension/node/TableOfContents/index.d.ts +9 -0
- package/dist/extension/node/TableOfContents/index.js +391 -0
- package/dist/extension/node/TableOfContents/plugin.d.ts +6 -0
- package/dist/extension/node/TableOfContents/plugin.js +58 -0
- package/dist/extension/node/TableOfContents/type.d.ts +45 -0
- package/dist/extension/node/TableOfContents/type.js +1 -0
- package/dist/extension/node/TableOfContents/utils.d.ts +6 -0
- package/dist/extension/node/TableOfContents/utils.js +70 -0
- package/dist/extension/node/UploadProgress.d.ts +21 -0
- package/dist/extension/node/UploadProgress.js +135 -0
- package/dist/extension/node/VerticalAlign.d.ts +49 -0
- package/dist/extension/node/VerticalAlign.js +88 -0
- package/dist/extension/node/Video.d.ts +23 -0
- package/dist/extension/node/Video.js +195 -0
- package/dist/extension/node/Youtube.d.ts +3 -0
- package/dist/extension/node/Youtube.js +14 -0
- package/dist/extension/node/index.d.ts +17 -0
- package/dist/extension/node/index.js +17 -0
- package/dist/extension/suggestion/emoji.d.ts +3 -0
- package/dist/extension/suggestion/emoji.js +57 -0
- package/dist/extension/suggestion/mention.d.ts +4 -0
- package/dist/extension/suggestion/mention.js +88 -0
- package/dist/extension/suggestion/slash.d.ts +34 -0
- package/dist/extension/suggestion/slash.js +63 -0
- package/dist/hook/fn.d.ts +13 -0
- package/dist/hook/fn.js +37 -0
- package/dist/hook/index.d.ts +4 -0
- package/dist/hook/index.js +110 -0
- package/dist/index.css +372 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/themes/color.d.ts +5 -0
- package/dist/themes/color.js +4 -0
- package/dist/themes/componentStyleOverrides.d.ts +396 -0
- package/dist/themes/componentStyleOverrides.js +431 -0
- package/dist/themes/custom.d.ts +5 -0
- package/dist/themes/custom.js +4 -0
- package/dist/themes/dark.d.ts +86 -0
- package/dist/themes/dark.js +86 -0
- package/dist/themes/index.d.ts +19 -0
- package/dist/themes/index.js +37 -0
- package/dist/themes/light.d.ts +86 -0
- package/dist/themes/light.js +86 -0
- package/dist/themes/palette.d.ts +94 -0
- package/dist/themes/palette.js +24 -0
- package/dist/themes/shadows.d.ts +2 -0
- package/dist/themes/shadows.js +3 -0
- package/dist/themes/themeContext.d.ts +8 -0
- package/dist/themes/themeContext.js +3 -0
- package/dist/themes/typography.d.ts +6 -0
- package/dist/themes/typography.js +8 -0
- package/dist/type/index.d.ts +112 -0
- package/dist/type/index.js +1 -0
- package/dist/types/images.d.ts +19 -0
- package/dist/util/fileDownload.d.ts +16 -0
- package/dist/util/fileDownload.js +268 -0
- package/dist/util/fileHandler.d.ts +7 -0
- package/dist/util/fileHandler.js +79 -0
- package/dist/util/floating.d.ts +2 -0
- package/dist/util/floating.js +22 -0
- package/dist/util/index.d.ts +11 -0
- package/dist/util/index.js +39 -0
- package/dist/util/migrateMathStrings.d.ts +73 -0
- package/dist/util/migrateMathStrings.js +192 -0
- package/dist/util/resourceExtractor.d.ts +15 -0
- package/dist/util/resourceExtractor.js +62 -0
- package/dist/util/shortcutKey.d.ts +2 -0
- package/dist/util/shortcutKey.js +9 -0
- package/package.json +135 -0
|
@@ -0,0 +1,1172 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
import { Box, Divider, Typography, useTheme } from '@mui/material';
|
|
16
|
+
import DragHandle from '@tiptap/extension-drag-handle-react';
|
|
17
|
+
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
18
|
+
import { AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, AttachmentLineIcon, BrushLineIcon, CodeBoxLineIcon, DeleteLineIcon, DownloadLineIcon, DraggableIcon, FontSizeIcon, FormatClearIcon, H1Icon, H2Icon, H3Icon, ImageLineIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MovieLineIcon, Music2LineIcon, QuoteTextIcon, Repeat2LineIcon, ScissorsCutLineIcon, TextIcon } from "../Icons";
|
|
19
|
+
import { NODE_TYPE_LABEL, NodeTypeEnum } from "../../contants/enums";
|
|
20
|
+
import React, { useCallback, useState } from 'react';
|
|
21
|
+
import { downloadFiles, filterResourcesByType, getAllResources } from "../../util";
|
|
22
|
+
import { FileCopyLineIcon } from "../Icons/file-copy-line-icon";
|
|
23
|
+
import Menu from "../Menu";
|
|
24
|
+
var DragIcon = function DragIcon(_ref) {
|
|
25
|
+
var onClick = _ref.onClick;
|
|
26
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
27
|
+
onClick: onClick,
|
|
28
|
+
sx: {
|
|
29
|
+
width: '1.25rem',
|
|
30
|
+
height: '1.25rem',
|
|
31
|
+
borderRadius: '0.25rem',
|
|
32
|
+
border: '1px solid',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
mr: 1,
|
|
37
|
+
color: 'text.tertiary',
|
|
38
|
+
cursor: 'grab',
|
|
39
|
+
borderColor: 'divider',
|
|
40
|
+
bgcolor: 'background.paper',
|
|
41
|
+
transition: 'all 0.2s ease-in-out',
|
|
42
|
+
'&:hover': {
|
|
43
|
+
color: 'text.secondary',
|
|
44
|
+
bgcolor: 'divider'
|
|
45
|
+
},
|
|
46
|
+
'&:active': {
|
|
47
|
+
color: 'text.primary',
|
|
48
|
+
cursor: 'grabbing'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(DraggableIcon, {
|
|
52
|
+
sx: {
|
|
53
|
+
fontSize: '1.25rem'
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
var CustomDragHandle = function CustomDragHandle(_ref2) {
|
|
58
|
+
var _current$node3, _current$node4;
|
|
59
|
+
var editor = _ref2.editor,
|
|
60
|
+
more = _ref2.more,
|
|
61
|
+
onTip = _ref2.onTip;
|
|
62
|
+
var theme = useTheme();
|
|
63
|
+
var _useState = useState(true),
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
showFormat = _useState2[0],
|
|
66
|
+
setShowFormat = _useState2[1];
|
|
67
|
+
var _useState3 = useState({
|
|
68
|
+
editor: editor,
|
|
69
|
+
node: null,
|
|
70
|
+
pos: -1
|
|
71
|
+
}),
|
|
72
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
73
|
+
current = _useState4[0],
|
|
74
|
+
setCurrent = _useState4[1];
|
|
75
|
+
var _useState5 = useState({
|
|
76
|
+
videos: [],
|
|
77
|
+
audios: [],
|
|
78
|
+
images: [],
|
|
79
|
+
attachments: []
|
|
80
|
+
}),
|
|
81
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
+
resources = _useState6[0],
|
|
83
|
+
setResources = _useState6[1];
|
|
84
|
+
var _useState7 = useState(null),
|
|
85
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
86
|
+
currentNode = _useState8[0],
|
|
87
|
+
setCurrentNode = _useState8[1];
|
|
88
|
+
var THEME_TEXT_COLOR = [{
|
|
89
|
+
label: '默认色',
|
|
90
|
+
value: theme.palette.text.primary
|
|
91
|
+
}, {
|
|
92
|
+
label: '主题色',
|
|
93
|
+
value: theme.palette.primary.main
|
|
94
|
+
}, {
|
|
95
|
+
label: '成功色',
|
|
96
|
+
value: theme.palette.success.main
|
|
97
|
+
}, {
|
|
98
|
+
label: '警告色',
|
|
99
|
+
value: theme.palette.warning.main
|
|
100
|
+
}, {
|
|
101
|
+
label: '错误色',
|
|
102
|
+
value: theme.palette.error.main
|
|
103
|
+
}, {
|
|
104
|
+
label: '黑色',
|
|
105
|
+
value: theme.palette.common.black
|
|
106
|
+
}, {
|
|
107
|
+
label: '灰色',
|
|
108
|
+
value: theme.palette.text.disabled
|
|
109
|
+
}, {
|
|
110
|
+
label: '白色',
|
|
111
|
+
value: theme.palette.common.white
|
|
112
|
+
}];
|
|
113
|
+
var THEME_TEXT_BG_COLOR = [{
|
|
114
|
+
label: '默认背景',
|
|
115
|
+
value: theme.palette.background.paper
|
|
116
|
+
}, {
|
|
117
|
+
label: '灰色背景',
|
|
118
|
+
value: '#f8f8f7'
|
|
119
|
+
}, {
|
|
120
|
+
label: '棕色背景',
|
|
121
|
+
value: '#f4eeee'
|
|
122
|
+
}, {
|
|
123
|
+
label: '橙色背景',
|
|
124
|
+
value: '#fbecdd'
|
|
125
|
+
}, {
|
|
126
|
+
label: '黄色背景',
|
|
127
|
+
value: '#fef9c3'
|
|
128
|
+
}, {
|
|
129
|
+
label: '绿色背景',
|
|
130
|
+
value: '#dcfce7'
|
|
131
|
+
}, {
|
|
132
|
+
label: '蓝色背景',
|
|
133
|
+
value: '#e0f2fe'
|
|
134
|
+
}, {
|
|
135
|
+
label: '紫色背景',
|
|
136
|
+
value: '#f3e8ff'
|
|
137
|
+
}, {
|
|
138
|
+
label: '粉色背景',
|
|
139
|
+
value: '#fcf1f6'
|
|
140
|
+
}, {
|
|
141
|
+
label: '红色背景',
|
|
142
|
+
value: '#ffe4e6'
|
|
143
|
+
}];
|
|
144
|
+
var cancelNodeType = function cancelNodeType() {
|
|
145
|
+
var _current$node;
|
|
146
|
+
var type = (_current$node = current.node) === null || _current$node === void 0 ? void 0 : _current$node.type.name;
|
|
147
|
+
switch (type) {
|
|
148
|
+
case NodeTypeEnum.Paragraph:
|
|
149
|
+
current.editor.chain().focus().setParagraph().run();
|
|
150
|
+
break;
|
|
151
|
+
case NodeTypeEnum.Heading:
|
|
152
|
+
current.editor.chain().focus().setParagraph().run();
|
|
153
|
+
break;
|
|
154
|
+
case NodeTypeEnum.BulletList:
|
|
155
|
+
current.editor.chain().focus().toggleBulletList().run();
|
|
156
|
+
break;
|
|
157
|
+
case NodeTypeEnum.OrderedList:
|
|
158
|
+
current.editor.chain().focus().toggleOrderedList().run();
|
|
159
|
+
break;
|
|
160
|
+
case NodeTypeEnum.TaskList:
|
|
161
|
+
current.editor.chain().focus().toggleTaskList().run();
|
|
162
|
+
break;
|
|
163
|
+
case NodeTypeEnum.Blockquote:
|
|
164
|
+
current.editor.chain().focus().toggleBlockquote().run();
|
|
165
|
+
break;
|
|
166
|
+
case NodeTypeEnum.CodeBlock:
|
|
167
|
+
current.editor.chain().focus().toggleCodeBlock().run();
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var hasMarksDeep = function hasMarksDeep(node) {
|
|
172
|
+
var _content;
|
|
173
|
+
if (!node) return false;
|
|
174
|
+
if (node.marks && node.marks.length > 0) return true;
|
|
175
|
+
var children = (_content = node.content) === null || _content === void 0 ? void 0 : _content.content;
|
|
176
|
+
if (!children || children.length === 0) return false;
|
|
177
|
+
return children.some(function (child) {
|
|
178
|
+
return hasMarksDeep(child);
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
var shouldShowButton = function shouldShowButton(_ref3) {
|
|
182
|
+
var editor = _ref3.editor,
|
|
183
|
+
data = _ref3.data;
|
|
184
|
+
if (!editor || !editor.isEditable) return false;
|
|
185
|
+
var currentNode = data.node;
|
|
186
|
+
var empty = (currentNode === null || currentNode === void 0 ? void 0 : currentNode.textContent) === '';
|
|
187
|
+
if (empty) return false;
|
|
188
|
+
var content = currentNode === null || currentNode === void 0 ? void 0 : currentNode.content.content;
|
|
189
|
+
if (content && content.length > 0) {
|
|
190
|
+
return content.some(function (item) {
|
|
191
|
+
return hasMarksDeep(item);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
};
|
|
196
|
+
var updateNodeChange = useCallback(function (data) {
|
|
197
|
+
var _data$node, _current$node2;
|
|
198
|
+
if ((data.pos !== current.pos || ((_data$node = data.node) === null || _data$node === void 0 ? void 0 : _data$node.type.name) !== ((_current$node2 = current.node) === null || _current$node2 === void 0 ? void 0 : _current$node2.type.name)) && data.pos !== -1 || data.node === null && data.pos >= 0) {
|
|
199
|
+
var _data$node2;
|
|
200
|
+
var allResources = data.node ? getAllResources(data.node) : [];
|
|
201
|
+
var videos = filterResourcesByType(allResources, [NodeTypeEnum.Video]);
|
|
202
|
+
var audios = filterResourcesByType(allResources, [NodeTypeEnum.Audio]);
|
|
203
|
+
var images = filterResourcesByType(allResources, [NodeTypeEnum.Image]);
|
|
204
|
+
var attachments = filterResourcesByType(allResources, [NodeTypeEnum.InlineAttachment, NodeTypeEnum.BlockAttachment]);
|
|
205
|
+
setCurrent(data);
|
|
206
|
+
setCurrentNode(NODE_TYPE_LABEL[((_data$node2 = data.node) === null || _data$node2 === void 0 ? void 0 : _data$node2.type.name) || 'paragraph']);
|
|
207
|
+
setResources({
|
|
208
|
+
videos: videos,
|
|
209
|
+
audios: audios,
|
|
210
|
+
images: images,
|
|
211
|
+
attachments: attachments
|
|
212
|
+
});
|
|
213
|
+
setShowFormat(shouldShowButton({
|
|
214
|
+
editor: editor,
|
|
215
|
+
data: data
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
}, [current.pos, current.node]);
|
|
219
|
+
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
220
|
+
editor: editor,
|
|
221
|
+
onNodeChange: updateNodeChange
|
|
222
|
+
}, currentNode ? /*#__PURE__*/React.createElement(Menu, {
|
|
223
|
+
anchorOrigin: {
|
|
224
|
+
vertical: 'top',
|
|
225
|
+
horizontal: 'right'
|
|
226
|
+
},
|
|
227
|
+
transformOrigin: {
|
|
228
|
+
vertical: 'top',
|
|
229
|
+
horizontal: 'left'
|
|
230
|
+
},
|
|
231
|
+
childrenProps: {
|
|
232
|
+
anchorOrigin: {
|
|
233
|
+
vertical: 'center',
|
|
234
|
+
horizontal: 'right'
|
|
235
|
+
},
|
|
236
|
+
transformOrigin: {
|
|
237
|
+
vertical: 'center',
|
|
238
|
+
horizontal: 'left'
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
arrowIcon: /*#__PURE__*/React.createElement(ArrowDownSLineIcon, {
|
|
242
|
+
sx: {
|
|
243
|
+
fontSize: '1rem',
|
|
244
|
+
transform: 'rotate(-90deg)'
|
|
245
|
+
}
|
|
246
|
+
}),
|
|
247
|
+
list: [{
|
|
248
|
+
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
249
|
+
sx: {
|
|
250
|
+
p: 1,
|
|
251
|
+
fontSize: '0.75rem',
|
|
252
|
+
color: 'text.secondary',
|
|
253
|
+
fontWeight: 'bold'
|
|
254
|
+
}
|
|
255
|
+
}, currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
256
|
+
key: 'current-node'
|
|
257
|
+
}].concat(_toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.color ? [{
|
|
258
|
+
key: 'color',
|
|
259
|
+
label: '颜色',
|
|
260
|
+
maxHeight: 400,
|
|
261
|
+
icon: /*#__PURE__*/React.createElement(BrushLineIcon, {
|
|
262
|
+
sx: {
|
|
263
|
+
fontSize: '1rem'
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
children: [{
|
|
267
|
+
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
268
|
+
sx: {
|
|
269
|
+
p: 1,
|
|
270
|
+
fontSize: '0.75rem',
|
|
271
|
+
color: 'text.secondary',
|
|
272
|
+
fontWeight: 'bold'
|
|
273
|
+
}
|
|
274
|
+
}, "\u6587\u5B57\u989C\u8272"),
|
|
275
|
+
key: 'text-color'
|
|
276
|
+
}].concat(_toConsumableArray(THEME_TEXT_COLOR.map(function (it) {
|
|
277
|
+
return {
|
|
278
|
+
label: it.label,
|
|
279
|
+
key: it.value,
|
|
280
|
+
icon: /*#__PURE__*/React.createElement(Box, {
|
|
281
|
+
sx: {
|
|
282
|
+
color: it.value,
|
|
283
|
+
width: '1rem',
|
|
284
|
+
height: '1rem',
|
|
285
|
+
borderRadius: '50%',
|
|
286
|
+
bgcolor: it.value,
|
|
287
|
+
border: '1px solid',
|
|
288
|
+
borderColor: it.value === theme.palette.common.white ? 'divider' : 'transparent'
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
291
|
+
onClick: function onClick() {
|
|
292
|
+
if (current.node && current.pos !== undefined) {
|
|
293
|
+
var from = current.pos;
|
|
294
|
+
var to = current.pos + current.node.nodeSize;
|
|
295
|
+
current.editor.chain().setTextSelection({
|
|
296
|
+
from: from,
|
|
297
|
+
to: to
|
|
298
|
+
}).setColor(it.value).run();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
})), [{
|
|
303
|
+
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
304
|
+
sx: {
|
|
305
|
+
p: 1,
|
|
306
|
+
fontSize: '0.75rem',
|
|
307
|
+
color: 'text.secondary',
|
|
308
|
+
fontWeight: 'bold'
|
|
309
|
+
}
|
|
310
|
+
}, "\u9AD8\u4EAE\u989C\u8272"),
|
|
311
|
+
key: 'highlight-color'
|
|
312
|
+
}], _toConsumableArray(THEME_TEXT_BG_COLOR.map(function (it) {
|
|
313
|
+
return {
|
|
314
|
+
label: it.label,
|
|
315
|
+
key: it.value,
|
|
316
|
+
icon: /*#__PURE__*/React.createElement(Box, {
|
|
317
|
+
sx: {
|
|
318
|
+
width: '1rem',
|
|
319
|
+
height: '1rem',
|
|
320
|
+
borderRadius: '50%',
|
|
321
|
+
bgcolor: it.value,
|
|
322
|
+
border: '1px solid',
|
|
323
|
+
borderColor: 'divider'
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
onClick: function onClick() {
|
|
327
|
+
if (current.node && current.pos !== undefined) {
|
|
328
|
+
var from = current.pos;
|
|
329
|
+
var to = current.pos + current.node.nodeSize;
|
|
330
|
+
current.editor.chain().setTextSelection({
|
|
331
|
+
from: from,
|
|
332
|
+
to: to
|
|
333
|
+
}).setBackgroundColor(it.value).run();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
})))
|
|
338
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.fontSize ? [{
|
|
339
|
+
key: 'fontSize',
|
|
340
|
+
label: '字号',
|
|
341
|
+
icon: /*#__PURE__*/React.createElement(FontSizeIcon, {
|
|
342
|
+
sx: {
|
|
343
|
+
fontSize: '1rem'
|
|
344
|
+
}
|
|
345
|
+
}),
|
|
346
|
+
minWidth: 100,
|
|
347
|
+
maxHeight: 200,
|
|
348
|
+
children: _toConsumableArray([10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60].map(function (it) {
|
|
349
|
+
return {
|
|
350
|
+
label: it,
|
|
351
|
+
key: "".concat(it, "px"),
|
|
352
|
+
textSx: {
|
|
353
|
+
textAlign: 'center'
|
|
354
|
+
},
|
|
355
|
+
onClick: function onClick() {
|
|
356
|
+
if (current.node && current.pos !== undefined) {
|
|
357
|
+
var from = current.pos;
|
|
358
|
+
var to = current.pos + current.node.nodeSize;
|
|
359
|
+
current.editor.chain().setTextSelection({
|
|
360
|
+
from: from,
|
|
361
|
+
to: to
|
|
362
|
+
}).setFontSize("".concat(it, "px")).run();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}))
|
|
367
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.align ? [{
|
|
368
|
+
key: 'align',
|
|
369
|
+
label: '对齐方式',
|
|
370
|
+
icon: /*#__PURE__*/React.createElement(AlignLeftIcon, {
|
|
371
|
+
sx: {
|
|
372
|
+
fontSize: '1rem'
|
|
373
|
+
}
|
|
374
|
+
}),
|
|
375
|
+
children: [{
|
|
376
|
+
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
377
|
+
sx: {
|
|
378
|
+
p: 1,
|
|
379
|
+
fontSize: '0.75rem',
|
|
380
|
+
color: 'text.secondary',
|
|
381
|
+
fontWeight: 'bold'
|
|
382
|
+
}
|
|
383
|
+
}, "\u6C34\u5E73\u5BF9\u9F50\u65B9\u5F0F"),
|
|
384
|
+
key: 'align-horizontal'
|
|
385
|
+
}, {
|
|
386
|
+
label: '左侧对齐',
|
|
387
|
+
key: 'align-horizontal-left',
|
|
388
|
+
icon: /*#__PURE__*/React.createElement(AlignLeftIcon, {
|
|
389
|
+
sx: {
|
|
390
|
+
fontSize: '1rem'
|
|
391
|
+
}
|
|
392
|
+
}),
|
|
393
|
+
onClick: function onClick() {
|
|
394
|
+
if (current.node && current.pos !== undefined) {
|
|
395
|
+
var from = current.pos;
|
|
396
|
+
var to = current.pos + current.node.nodeSize;
|
|
397
|
+
current.editor.chain().setTextSelection({
|
|
398
|
+
from: from,
|
|
399
|
+
to: to
|
|
400
|
+
}).toggleTextAlign('left').run();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
label: '居中对齐',
|
|
405
|
+
key: 'align-horizontal-center',
|
|
406
|
+
icon: /*#__PURE__*/React.createElement(AlignCenterIcon, {
|
|
407
|
+
sx: {
|
|
408
|
+
fontSize: '1rem'
|
|
409
|
+
}
|
|
410
|
+
}),
|
|
411
|
+
onClick: function onClick() {
|
|
412
|
+
if (current.node && current.pos !== undefined) {
|
|
413
|
+
var from = current.pos;
|
|
414
|
+
var to = current.pos + current.node.nodeSize;
|
|
415
|
+
current.editor.chain().setTextSelection({
|
|
416
|
+
from: from,
|
|
417
|
+
to: to
|
|
418
|
+
}).toggleTextAlign('center').run();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
label: '右侧对齐',
|
|
423
|
+
key: 'align-horizontal-right',
|
|
424
|
+
icon: /*#__PURE__*/React.createElement(AlignRightIcon, {
|
|
425
|
+
sx: {
|
|
426
|
+
fontSize: '1rem'
|
|
427
|
+
}
|
|
428
|
+
}),
|
|
429
|
+
onClick: function onClick() {
|
|
430
|
+
if (current.node && current.pos !== undefined) {
|
|
431
|
+
var from = current.pos;
|
|
432
|
+
var to = current.pos + current.node.nodeSize;
|
|
433
|
+
current.editor.chain().setTextSelection({
|
|
434
|
+
from: from,
|
|
435
|
+
to: to
|
|
436
|
+
}).toggleTextAlign('right').run();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}, {
|
|
440
|
+
label: '两端对齐',
|
|
441
|
+
key: 'align-horizontal-justify',
|
|
442
|
+
icon: /*#__PURE__*/React.createElement(AlignJustifyIcon, {
|
|
443
|
+
sx: {
|
|
444
|
+
fontSize: '1rem'
|
|
445
|
+
}
|
|
446
|
+
}),
|
|
447
|
+
onClick: function onClick() {
|
|
448
|
+
if (current.node && current.pos !== undefined) {
|
|
449
|
+
var from = current.pos;
|
|
450
|
+
var to = current.pos + current.node.nodeSize;
|
|
451
|
+
current.editor.chain().setTextSelection({
|
|
452
|
+
from: from,
|
|
453
|
+
to: to
|
|
454
|
+
}).toggleTextAlign('justify').run();
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}, {
|
|
458
|
+
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
459
|
+
sx: {
|
|
460
|
+
p: 1,
|
|
461
|
+
fontSize: '0.75rem',
|
|
462
|
+
color: 'text.secondary',
|
|
463
|
+
fontWeight: 'bold'
|
|
464
|
+
}
|
|
465
|
+
}, "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F"),
|
|
466
|
+
key: 'align-vertical'
|
|
467
|
+
}, {
|
|
468
|
+
label: '顶部对齐',
|
|
469
|
+
key: 'align-vertical-top',
|
|
470
|
+
icon: /*#__PURE__*/React.createElement(AlignTopIcon, {
|
|
471
|
+
sx: {
|
|
472
|
+
fontSize: '1rem'
|
|
473
|
+
}
|
|
474
|
+
}),
|
|
475
|
+
onClick: function onClick() {
|
|
476
|
+
if (current.node && current.pos !== undefined) {
|
|
477
|
+
var from = current.pos;
|
|
478
|
+
var to = current.pos + current.node.nodeSize;
|
|
479
|
+
current.editor.chain().setTextSelection({
|
|
480
|
+
from: from,
|
|
481
|
+
to: to
|
|
482
|
+
}).toggleVerticalAlign('top').run();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}, {
|
|
486
|
+
label: '居中对齐',
|
|
487
|
+
key: 'align-vertical-center',
|
|
488
|
+
icon: /*#__PURE__*/React.createElement(AlignCenterIcon, {
|
|
489
|
+
sx: {
|
|
490
|
+
fontSize: '1rem'
|
|
491
|
+
}
|
|
492
|
+
}),
|
|
493
|
+
onClick: function onClick() {
|
|
494
|
+
if (current.node && current.pos !== undefined) {
|
|
495
|
+
var from = current.pos;
|
|
496
|
+
var to = current.pos + current.node.nodeSize;
|
|
497
|
+
current.editor.chain().setTextSelection({
|
|
498
|
+
from: from,
|
|
499
|
+
to: to
|
|
500
|
+
}).toggleVerticalAlign('middle').run();
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}, {
|
|
504
|
+
label: '底部对齐',
|
|
505
|
+
key: 'align-vertical-bottom',
|
|
506
|
+
icon: /*#__PURE__*/React.createElement(AlignBottomIcon, {
|
|
507
|
+
sx: {
|
|
508
|
+
fontSize: '1rem'
|
|
509
|
+
}
|
|
510
|
+
}),
|
|
511
|
+
onClick: function onClick() {
|
|
512
|
+
if (current.node && current.pos !== undefined) {
|
|
513
|
+
var from = current.pos;
|
|
514
|
+
var to = current.pos + current.node.nodeSize;
|
|
515
|
+
current.editor.chain().setTextSelection({
|
|
516
|
+
from: from,
|
|
517
|
+
to: to
|
|
518
|
+
}).toggleVerticalAlign('bottom').run();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}]
|
|
522
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.convert ? [{
|
|
523
|
+
label: '转换',
|
|
524
|
+
key: 'convert',
|
|
525
|
+
icon: /*#__PURE__*/React.createElement(Repeat2LineIcon, {
|
|
526
|
+
sx: {
|
|
527
|
+
fontSize: '1rem'
|
|
528
|
+
}
|
|
529
|
+
}),
|
|
530
|
+
children: [{
|
|
531
|
+
label: '文本',
|
|
532
|
+
selected: editor.isActive('paragraph'),
|
|
533
|
+
key: 'convert-to-paragraph',
|
|
534
|
+
icon: /*#__PURE__*/React.createElement(TextIcon, {
|
|
535
|
+
sx: {
|
|
536
|
+
fontSize: '1rem'
|
|
537
|
+
}
|
|
538
|
+
}),
|
|
539
|
+
onClick: function onClick() {
|
|
540
|
+
if (current.node && current.pos !== undefined) {
|
|
541
|
+
cancelNodeType();
|
|
542
|
+
current.editor.chain().focus().setParagraph().run();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}, {
|
|
546
|
+
label: '一级标题',
|
|
547
|
+
selected: editor.isActive('heading', {
|
|
548
|
+
level: 1
|
|
549
|
+
}),
|
|
550
|
+
key: 'convert-to-heading-1',
|
|
551
|
+
icon: /*#__PURE__*/React.createElement(H1Icon, {
|
|
552
|
+
sx: {
|
|
553
|
+
fontSize: '1rem'
|
|
554
|
+
}
|
|
555
|
+
}),
|
|
556
|
+
onClick: function onClick() {
|
|
557
|
+
if (current.node && current.pos !== undefined) {
|
|
558
|
+
cancelNodeType();
|
|
559
|
+
current.editor.chain().focus().setHeading({
|
|
560
|
+
level: 1
|
|
561
|
+
}).run();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}, {
|
|
565
|
+
label: '二级标题',
|
|
566
|
+
selected: editor.isActive('heading', {
|
|
567
|
+
level: 2
|
|
568
|
+
}),
|
|
569
|
+
key: 'convert-to-heading-2',
|
|
570
|
+
icon: /*#__PURE__*/React.createElement(H2Icon, {
|
|
571
|
+
sx: {
|
|
572
|
+
fontSize: '1rem'
|
|
573
|
+
}
|
|
574
|
+
}),
|
|
575
|
+
onClick: function onClick() {
|
|
576
|
+
if (current.node && current.pos !== undefined) {
|
|
577
|
+
cancelNodeType();
|
|
578
|
+
current.editor.chain().focus().setHeading({
|
|
579
|
+
level: 2
|
|
580
|
+
}).run();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}, {
|
|
584
|
+
label: '三级标题',
|
|
585
|
+
selected: editor.isActive('heading', {
|
|
586
|
+
level: 3
|
|
587
|
+
}),
|
|
588
|
+
key: 'convert-to-heading-3',
|
|
589
|
+
icon: /*#__PURE__*/React.createElement(H3Icon, {
|
|
590
|
+
sx: {
|
|
591
|
+
fontSize: '1rem'
|
|
592
|
+
}
|
|
593
|
+
}),
|
|
594
|
+
onClick: function onClick() {
|
|
595
|
+
if (current.node && current.pos !== undefined) {
|
|
596
|
+
cancelNodeType();
|
|
597
|
+
current.editor.chain().focus().setHeading({
|
|
598
|
+
level: 3
|
|
599
|
+
}).run();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}, {
|
|
603
|
+
customLabel: /*#__PURE__*/React.createElement(Divider, {
|
|
604
|
+
sx: {
|
|
605
|
+
my: 0.5
|
|
606
|
+
}
|
|
607
|
+
}),
|
|
608
|
+
key: 'divider2'
|
|
609
|
+
}, {
|
|
610
|
+
label: '有序列表',
|
|
611
|
+
selected: editor.isActive('orderedList'),
|
|
612
|
+
key: 'convert-to-ordered-list',
|
|
613
|
+
icon: /*#__PURE__*/React.createElement(ListOrdered2Icon, {
|
|
614
|
+
sx: {
|
|
615
|
+
fontSize: '1rem'
|
|
616
|
+
}
|
|
617
|
+
}),
|
|
618
|
+
onClick: function onClick() {
|
|
619
|
+
if (current.node && current.pos !== undefined) {
|
|
620
|
+
cancelNodeType();
|
|
621
|
+
current.editor.chain().focus().toggleOrderedList().run();
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}, {
|
|
625
|
+
label: '无序列表',
|
|
626
|
+
selected: editor.isActive('bulletList'),
|
|
627
|
+
key: 'convert-to-bullet-list',
|
|
628
|
+
icon: /*#__PURE__*/React.createElement(ListUnorderedIcon, {
|
|
629
|
+
sx: {
|
|
630
|
+
fontSize: '1rem'
|
|
631
|
+
}
|
|
632
|
+
}),
|
|
633
|
+
onClick: function onClick() {
|
|
634
|
+
if (current.node && current.pos !== undefined) {
|
|
635
|
+
cancelNodeType();
|
|
636
|
+
current.editor.chain().focus().toggleBulletList().run();
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}, {
|
|
640
|
+
label: '任务列表',
|
|
641
|
+
selected: editor.isActive('taskList'),
|
|
642
|
+
key: 'convert-to-task-list',
|
|
643
|
+
icon: /*#__PURE__*/React.createElement(ListCheck3Icon, {
|
|
644
|
+
sx: {
|
|
645
|
+
fontSize: '1rem'
|
|
646
|
+
}
|
|
647
|
+
}),
|
|
648
|
+
onClick: function onClick() {
|
|
649
|
+
if (current.node && current.pos !== undefined) {
|
|
650
|
+
cancelNodeType();
|
|
651
|
+
current.editor.chain().focus().toggleTaskList().run();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}, {
|
|
655
|
+
customLabel: /*#__PURE__*/React.createElement(Divider, {
|
|
656
|
+
sx: {
|
|
657
|
+
my: 0.5
|
|
658
|
+
}
|
|
659
|
+
}),
|
|
660
|
+
key: 'divider3'
|
|
661
|
+
}, {
|
|
662
|
+
label: '引用块',
|
|
663
|
+
selected: editor.isActive('blockquote'),
|
|
664
|
+
key: 'convert-to-blockquote',
|
|
665
|
+
icon: /*#__PURE__*/React.createElement(QuoteTextIcon, {
|
|
666
|
+
sx: {
|
|
667
|
+
fontSize: '1rem'
|
|
668
|
+
}
|
|
669
|
+
}),
|
|
670
|
+
onClick: function onClick() {
|
|
671
|
+
if (current.node && current.pos !== undefined) {
|
|
672
|
+
cancelNodeType();
|
|
673
|
+
current.editor.chain().focus().toggleBlockquote().run();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}, {
|
|
677
|
+
label: '代码块',
|
|
678
|
+
selected: editor.isActive('codeBlock'),
|
|
679
|
+
key: 'convert-to-code-block',
|
|
680
|
+
icon: /*#__PURE__*/React.createElement(CodeBoxLineIcon, {
|
|
681
|
+
sx: {
|
|
682
|
+
fontSize: '1rem'
|
|
683
|
+
}
|
|
684
|
+
}),
|
|
685
|
+
onClick: function onClick() {
|
|
686
|
+
if (current.node && current.pos !== undefined) {
|
|
687
|
+
cancelNodeType();
|
|
688
|
+
current.editor.chain().focus().toggleCodeBlock().run();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}]
|
|
692
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node3 = current.node) !== null && _current$node3 !== void 0 && _current$node3.attrs.src || (_current$node4 = current.node) !== null && _current$node4 !== void 0 && _current$node4.attrs.src) ? [{
|
|
693
|
+
label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
694
|
+
key: 'download',
|
|
695
|
+
icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
|
|
696
|
+
sx: {
|
|
697
|
+
fontSize: '1rem'
|
|
698
|
+
}
|
|
699
|
+
}),
|
|
700
|
+
onClick: function () {
|
|
701
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
702
|
+
var _current$node5, node, nodeFile, nodeBlob, nodeUrl, nodeName, a;
|
|
703
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
704
|
+
while (1) switch (_context.prev = _context.next) {
|
|
705
|
+
case 0:
|
|
706
|
+
if (!(current.node && current.pos !== undefined)) {
|
|
707
|
+
_context.next = 16;
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
if (![NodeTypeEnum.Video, NodeTypeEnum.Audio, NodeTypeEnum.BlockAttachment].includes((_current$node5 = current.node) === null || _current$node5 === void 0 ? void 0 : _current$node5.type.name)) {
|
|
711
|
+
_context.next = 16;
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
node = current.node;
|
|
715
|
+
_context.next = 5;
|
|
716
|
+
return fetch(node.attrs.src || node.attrs.url);
|
|
717
|
+
case 5:
|
|
718
|
+
nodeFile = _context.sent;
|
|
719
|
+
_context.next = 8;
|
|
720
|
+
return nodeFile.blob();
|
|
721
|
+
case 8:
|
|
722
|
+
nodeBlob = _context.sent;
|
|
723
|
+
nodeUrl = URL.createObjectURL(nodeBlob);
|
|
724
|
+
nodeName = node.attrs.title || "".concat(node.type.name, ".").concat(node.attrs.src.split('.').pop());
|
|
725
|
+
a = document.createElement('a');
|
|
726
|
+
a.href = nodeUrl;
|
|
727
|
+
a.download = nodeName;
|
|
728
|
+
a.click();
|
|
729
|
+
URL.revokeObjectURL(nodeUrl);
|
|
730
|
+
case 16:
|
|
731
|
+
case "end":
|
|
732
|
+
return _context.stop();
|
|
733
|
+
}
|
|
734
|
+
}, _callee);
|
|
735
|
+
}));
|
|
736
|
+
function onClick() {
|
|
737
|
+
return _onClick.apply(this, arguments);
|
|
738
|
+
}
|
|
739
|
+
return onClick;
|
|
740
|
+
}()
|
|
741
|
+
}] : [].concat(_toConsumableArray(resources.images.length > 0 ? [{
|
|
742
|
+
label: '下载图片',
|
|
743
|
+
key: 'download-img',
|
|
744
|
+
icon: /*#__PURE__*/React.createElement(ImageLineIcon, {
|
|
745
|
+
sx: {
|
|
746
|
+
fontSize: '1rem'
|
|
747
|
+
}
|
|
748
|
+
}),
|
|
749
|
+
extra: /*#__PURE__*/React.createElement(Box, {
|
|
750
|
+
sx: {
|
|
751
|
+
lineHeight: '0.75rem',
|
|
752
|
+
fontSize: '0.75rem',
|
|
753
|
+
color: 'text.disabled',
|
|
754
|
+
border: '1px solid',
|
|
755
|
+
borderColor: 'text.disabled',
|
|
756
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
757
|
+
py: 0,
|
|
758
|
+
px: 0.5,
|
|
759
|
+
minWidth: '1.25rem',
|
|
760
|
+
cursor: 'pointer',
|
|
761
|
+
display: 'flex',
|
|
762
|
+
alignItems: 'center',
|
|
763
|
+
justifyContent: 'center'
|
|
764
|
+
}
|
|
765
|
+
}, resources.images.length),
|
|
766
|
+
onClick: function () {
|
|
767
|
+
var _onClick2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
768
|
+
var imageInfos;
|
|
769
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
770
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
771
|
+
case 0:
|
|
772
|
+
_context2.prev = 0;
|
|
773
|
+
imageInfos = resources.images.map(function (img) {
|
|
774
|
+
return {
|
|
775
|
+
src: img.attrs.src,
|
|
776
|
+
filename: img.attrs.alt || img.attrs.title || undefined
|
|
777
|
+
};
|
|
778
|
+
});
|
|
779
|
+
_context2.next = 4;
|
|
780
|
+
return downloadFiles(imageInfos, 'img');
|
|
781
|
+
case 4:
|
|
782
|
+
_context2.next = 9;
|
|
783
|
+
break;
|
|
784
|
+
case 6:
|
|
785
|
+
_context2.prev = 6;
|
|
786
|
+
_context2.t0 = _context2["catch"](0);
|
|
787
|
+
console.error('下载图片失败:', _context2.t0);
|
|
788
|
+
case 9:
|
|
789
|
+
case "end":
|
|
790
|
+
return _context2.stop();
|
|
791
|
+
}
|
|
792
|
+
}, _callee2, null, [[0, 6]]);
|
|
793
|
+
}));
|
|
794
|
+
function onClick() {
|
|
795
|
+
return _onClick2.apply(this, arguments);
|
|
796
|
+
}
|
|
797
|
+
return onClick;
|
|
798
|
+
}()
|
|
799
|
+
}] : []), _toConsumableArray(resources.videos.length > 0 ? [{
|
|
800
|
+
label: '下载视频',
|
|
801
|
+
key: 'download-video',
|
|
802
|
+
icon: /*#__PURE__*/React.createElement(MovieLineIcon, {
|
|
803
|
+
sx: {
|
|
804
|
+
fontSize: '1rem'
|
|
805
|
+
}
|
|
806
|
+
}),
|
|
807
|
+
extra: /*#__PURE__*/React.createElement(Box, {
|
|
808
|
+
sx: {
|
|
809
|
+
lineHeight: '0.75rem',
|
|
810
|
+
fontSize: '0.75rem',
|
|
811
|
+
color: 'text.disabled',
|
|
812
|
+
border: '1px solid',
|
|
813
|
+
borderColor: 'text.disabled',
|
|
814
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
815
|
+
py: 0,
|
|
816
|
+
px: 0.5,
|
|
817
|
+
minWidth: '1.25rem',
|
|
818
|
+
cursor: 'pointer',
|
|
819
|
+
display: 'flex',
|
|
820
|
+
alignItems: 'center',
|
|
821
|
+
justifyContent: 'center'
|
|
822
|
+
}
|
|
823
|
+
}, resources.videos.length),
|
|
824
|
+
onClick: function () {
|
|
825
|
+
var _onClick3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
826
|
+
var videoInfos;
|
|
827
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
828
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
829
|
+
case 0:
|
|
830
|
+
_context3.prev = 0;
|
|
831
|
+
videoInfos = resources.videos.map(function (video) {
|
|
832
|
+
return {
|
|
833
|
+
src: video.attrs.src,
|
|
834
|
+
filename: video.attrs.alt || video.attrs.title || undefined
|
|
835
|
+
};
|
|
836
|
+
});
|
|
837
|
+
_context3.next = 4;
|
|
838
|
+
return downloadFiles(videoInfos, 'video');
|
|
839
|
+
case 4:
|
|
840
|
+
_context3.next = 9;
|
|
841
|
+
break;
|
|
842
|
+
case 6:
|
|
843
|
+
_context3.prev = 6;
|
|
844
|
+
_context3.t0 = _context3["catch"](0);
|
|
845
|
+
console.error('下载视频失败:', _context3.t0);
|
|
846
|
+
case 9:
|
|
847
|
+
case "end":
|
|
848
|
+
return _context3.stop();
|
|
849
|
+
}
|
|
850
|
+
}, _callee3, null, [[0, 6]]);
|
|
851
|
+
}));
|
|
852
|
+
function onClick() {
|
|
853
|
+
return _onClick3.apply(this, arguments);
|
|
854
|
+
}
|
|
855
|
+
return onClick;
|
|
856
|
+
}()
|
|
857
|
+
}] : []), _toConsumableArray(resources.audios.length > 0 ? [{
|
|
858
|
+
label: '下载音频',
|
|
859
|
+
key: 'download-audio',
|
|
860
|
+
icon: /*#__PURE__*/React.createElement(Music2LineIcon, {
|
|
861
|
+
sx: {
|
|
862
|
+
fontSize: '1rem'
|
|
863
|
+
}
|
|
864
|
+
}),
|
|
865
|
+
extra: /*#__PURE__*/React.createElement(Box, {
|
|
866
|
+
sx: {
|
|
867
|
+
lineHeight: '0.75rem',
|
|
868
|
+
fontSize: '0.75rem',
|
|
869
|
+
color: 'text.disabled',
|
|
870
|
+
border: '1px solid',
|
|
871
|
+
borderColor: 'text.disabled',
|
|
872
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
873
|
+
py: 0,
|
|
874
|
+
px: 0.5,
|
|
875
|
+
minWidth: '1.25rem',
|
|
876
|
+
cursor: 'pointer',
|
|
877
|
+
display: 'flex',
|
|
878
|
+
alignItems: 'center',
|
|
879
|
+
justifyContent: 'center'
|
|
880
|
+
}
|
|
881
|
+
}, resources.audios.length),
|
|
882
|
+
onClick: function () {
|
|
883
|
+
var _onClick4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
884
|
+
var audioInfos;
|
|
885
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
886
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
887
|
+
case 0:
|
|
888
|
+
_context4.prev = 0;
|
|
889
|
+
audioInfos = resources.audios.map(function (audio) {
|
|
890
|
+
return {
|
|
891
|
+
src: audio.attrs.src,
|
|
892
|
+
filename: audio.attrs.alt || audio.attrs.title || undefined
|
|
893
|
+
};
|
|
894
|
+
});
|
|
895
|
+
_context4.next = 4;
|
|
896
|
+
return downloadFiles(audioInfos, 'audio');
|
|
897
|
+
case 4:
|
|
898
|
+
_context4.next = 9;
|
|
899
|
+
break;
|
|
900
|
+
case 6:
|
|
901
|
+
_context4.prev = 6;
|
|
902
|
+
_context4.t0 = _context4["catch"](0);
|
|
903
|
+
console.error('下载音频失败:', _context4.t0);
|
|
904
|
+
case 9:
|
|
905
|
+
case "end":
|
|
906
|
+
return _context4.stop();
|
|
907
|
+
}
|
|
908
|
+
}, _callee4, null, [[0, 6]]);
|
|
909
|
+
}));
|
|
910
|
+
function onClick() {
|
|
911
|
+
return _onClick4.apply(this, arguments);
|
|
912
|
+
}
|
|
913
|
+
return onClick;
|
|
914
|
+
}()
|
|
915
|
+
}] : []), _toConsumableArray(resources.attachments.length > 0 ? [{
|
|
916
|
+
label: '下载附件',
|
|
917
|
+
key: 'download-attachment',
|
|
918
|
+
icon: /*#__PURE__*/React.createElement(AttachmentLineIcon, {
|
|
919
|
+
sx: {
|
|
920
|
+
fontSize: '1rem'
|
|
921
|
+
}
|
|
922
|
+
}),
|
|
923
|
+
extra: /*#__PURE__*/React.createElement(Box, {
|
|
924
|
+
sx: {
|
|
925
|
+
lineHeight: '0.75rem',
|
|
926
|
+
fontSize: '0.75rem',
|
|
927
|
+
color: 'text.disabled',
|
|
928
|
+
border: '1px solid',
|
|
929
|
+
borderColor: 'text.disabled',
|
|
930
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
931
|
+
py: 0,
|
|
932
|
+
px: 0.5,
|
|
933
|
+
minWidth: '1.25rem',
|
|
934
|
+
cursor: 'pointer',
|
|
935
|
+
display: 'flex',
|
|
936
|
+
alignItems: 'center',
|
|
937
|
+
justifyContent: 'center'
|
|
938
|
+
}
|
|
939
|
+
}, resources.attachments.length),
|
|
940
|
+
onClick: function () {
|
|
941
|
+
var _onClick5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
942
|
+
var attachmentInfos;
|
|
943
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
944
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
945
|
+
case 0:
|
|
946
|
+
_context5.prev = 0;
|
|
947
|
+
attachmentInfos = resources.attachments.map(function (attachment) {
|
|
948
|
+
return {
|
|
949
|
+
src: attachment.attrs.url,
|
|
950
|
+
filename: attachment.attrs.title || undefined
|
|
951
|
+
};
|
|
952
|
+
});
|
|
953
|
+
_context5.next = 4;
|
|
954
|
+
return downloadFiles(attachmentInfos, 'attachment');
|
|
955
|
+
case 4:
|
|
956
|
+
_context5.next = 9;
|
|
957
|
+
break;
|
|
958
|
+
case 6:
|
|
959
|
+
_context5.prev = 6;
|
|
960
|
+
_context5.t0 = _context5["catch"](0);
|
|
961
|
+
console.error('下载附件失败:', _context5.t0);
|
|
962
|
+
case 9:
|
|
963
|
+
case "end":
|
|
964
|
+
return _context5.stop();
|
|
965
|
+
}
|
|
966
|
+
}, _callee5, null, [[0, 6]]);
|
|
967
|
+
}));
|
|
968
|
+
function onClick() {
|
|
969
|
+
return _onClick5.apply(this, arguments);
|
|
970
|
+
}
|
|
971
|
+
return onClick;
|
|
972
|
+
}()
|
|
973
|
+
}] : []))), _toConsumableArray(more ? more : []), _toConsumableArray(showFormat ? [{
|
|
974
|
+
label: '文本格式化',
|
|
975
|
+
key: 'format',
|
|
976
|
+
icon: /*#__PURE__*/React.createElement(FormatClearIcon, {
|
|
977
|
+
sx: {
|
|
978
|
+
fontSize: '1rem'
|
|
979
|
+
}
|
|
980
|
+
}),
|
|
981
|
+
onClick: function () {
|
|
982
|
+
var _onClick6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
983
|
+
var tr, _currentNode, empty, content;
|
|
984
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
985
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
986
|
+
case 0:
|
|
987
|
+
if (current.node && current.pos !== undefined) {
|
|
988
|
+
tr = current.editor.state.tr;
|
|
989
|
+
_currentNode = current.node;
|
|
990
|
+
empty = (_currentNode === null || _currentNode === void 0 ? void 0 : _currentNode.textContent) === '';
|
|
991
|
+
if (!empty) {
|
|
992
|
+
content = _currentNode === null || _currentNode === void 0 ? void 0 : _currentNode.content.content;
|
|
993
|
+
if (content && content.length > 0) {
|
|
994
|
+
tr.doc.nodesBetween(current.pos, current.pos + current.node.nodeSize, function (node, pos) {
|
|
995
|
+
if (!node.isInline) return true;
|
|
996
|
+
node.marks.forEach(function (mark) {
|
|
997
|
+
tr.removeMark(pos, pos + node.nodeSize, mark.type);
|
|
998
|
+
});
|
|
999
|
+
return true;
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
editor.view.dispatch(tr);
|
|
1004
|
+
}
|
|
1005
|
+
case 1:
|
|
1006
|
+
case "end":
|
|
1007
|
+
return _context6.stop();
|
|
1008
|
+
}
|
|
1009
|
+
}, _callee6);
|
|
1010
|
+
}));
|
|
1011
|
+
function onClick() {
|
|
1012
|
+
return _onClick6.apply(this, arguments);
|
|
1013
|
+
}
|
|
1014
|
+
return onClick;
|
|
1015
|
+
}()
|
|
1016
|
+
}] : []), [{
|
|
1017
|
+
label: "\u590D\u5236".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1018
|
+
key: 'copy',
|
|
1019
|
+
icon: /*#__PURE__*/React.createElement(FileCopyLineIcon, {
|
|
1020
|
+
sx: {
|
|
1021
|
+
fontSize: '1rem'
|
|
1022
|
+
}
|
|
1023
|
+
}),
|
|
1024
|
+
onClick: function () {
|
|
1025
|
+
var _onClick7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1026
|
+
var content, textContent, htmlContent, blob, clipboardItem;
|
|
1027
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1028
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1029
|
+
case 0:
|
|
1030
|
+
if (!(current.node && current.pos !== undefined)) {
|
|
1031
|
+
_context7.next = 17;
|
|
1032
|
+
break;
|
|
1033
|
+
}
|
|
1034
|
+
content = new Slice(Fragment.from(current.node), 0, 0);
|
|
1035
|
+
textContent = current.node.textContent;
|
|
1036
|
+
htmlContent = editor.view.serializeForClipboard(content).dom.innerHTML;
|
|
1037
|
+
_context7.prev = 4;
|
|
1038
|
+
if (!(htmlContent && navigator.clipboard && "write" in navigator.clipboard)) {
|
|
1039
|
+
_context7.next = 11;
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
blob = new Blob([htmlContent], {
|
|
1043
|
+
type: "text/html"
|
|
1044
|
+
});
|
|
1045
|
+
clipboardItem = new ClipboardItem({
|
|
1046
|
+
"text/html": blob
|
|
1047
|
+
});
|
|
1048
|
+
_context7.next = 10;
|
|
1049
|
+
return navigator.clipboard.write([clipboardItem]);
|
|
1050
|
+
case 10:
|
|
1051
|
+
onTip === null || onTip === void 0 || onTip('success', '复制成功');
|
|
1052
|
+
case 11:
|
|
1053
|
+
_context7.next = 17;
|
|
1054
|
+
break;
|
|
1055
|
+
case 13:
|
|
1056
|
+
_context7.prev = 13;
|
|
1057
|
+
_context7.t0 = _context7["catch"](4);
|
|
1058
|
+
_context7.next = 17;
|
|
1059
|
+
return navigator.clipboard.writeText(textContent);
|
|
1060
|
+
case 17:
|
|
1061
|
+
case "end":
|
|
1062
|
+
return _context7.stop();
|
|
1063
|
+
}
|
|
1064
|
+
}, _callee7, null, [[4, 13]]);
|
|
1065
|
+
}));
|
|
1066
|
+
function onClick() {
|
|
1067
|
+
return _onClick7.apply(this, arguments);
|
|
1068
|
+
}
|
|
1069
|
+
return onClick;
|
|
1070
|
+
}()
|
|
1071
|
+
}, {
|
|
1072
|
+
label: "\u526A\u5207".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1073
|
+
key: 'cut',
|
|
1074
|
+
icon: /*#__PURE__*/React.createElement(ScissorsCutLineIcon, {
|
|
1075
|
+
sx: {
|
|
1076
|
+
fontSize: '1rem'
|
|
1077
|
+
}
|
|
1078
|
+
}),
|
|
1079
|
+
onClick: function () {
|
|
1080
|
+
var _onClick8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
1081
|
+
var content, textContent, htmlContent, blob, clipboardItem;
|
|
1082
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1083
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1084
|
+
case 0:
|
|
1085
|
+
if (!(current.node && current.pos !== undefined)) {
|
|
1086
|
+
_context8.next = 23;
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
_context8.prev = 1;
|
|
1090
|
+
content = new Slice(Fragment.from(current.node), 0, 0);
|
|
1091
|
+
textContent = current.node.textContent;
|
|
1092
|
+
htmlContent = editor.view.serializeForClipboard(content).dom.innerHTML;
|
|
1093
|
+
_context8.prev = 5;
|
|
1094
|
+
if (!(htmlContent && navigator.clipboard && "write" in navigator.clipboard)) {
|
|
1095
|
+
_context8.next = 11;
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
blob = new Blob([htmlContent], {
|
|
1099
|
+
type: "text/html"
|
|
1100
|
+
});
|
|
1101
|
+
clipboardItem = new ClipboardItem({
|
|
1102
|
+
"text/html": blob
|
|
1103
|
+
});
|
|
1104
|
+
_context8.next = 11;
|
|
1105
|
+
return navigator.clipboard.write([clipboardItem]);
|
|
1106
|
+
case 11:
|
|
1107
|
+
_context8.next = 17;
|
|
1108
|
+
break;
|
|
1109
|
+
case 13:
|
|
1110
|
+
_context8.prev = 13;
|
|
1111
|
+
_context8.t0 = _context8["catch"](5);
|
|
1112
|
+
_context8.next = 17;
|
|
1113
|
+
return navigator.clipboard.writeText(textContent);
|
|
1114
|
+
case 17:
|
|
1115
|
+
current.editor.chain().focus().deleteRange({
|
|
1116
|
+
from: current.pos,
|
|
1117
|
+
to: current.pos + current.node.nodeSize
|
|
1118
|
+
}).run();
|
|
1119
|
+
_context8.next = 23;
|
|
1120
|
+
break;
|
|
1121
|
+
case 20:
|
|
1122
|
+
_context8.prev = 20;
|
|
1123
|
+
_context8.t1 = _context8["catch"](1);
|
|
1124
|
+
onTip === null || onTip === void 0 || onTip('error', '剪切失败');
|
|
1125
|
+
case 23:
|
|
1126
|
+
case "end":
|
|
1127
|
+
return _context8.stop();
|
|
1128
|
+
}
|
|
1129
|
+
}, _callee8, null, [[1, 20], [5, 13]]);
|
|
1130
|
+
}));
|
|
1131
|
+
function onClick() {
|
|
1132
|
+
return _onClick8.apply(this, arguments);
|
|
1133
|
+
}
|
|
1134
|
+
return onClick;
|
|
1135
|
+
}()
|
|
1136
|
+
},
|
|
1137
|
+
// {
|
|
1138
|
+
// label: `复制并粘贴`,
|
|
1139
|
+
// key: 'duplicate-and-overwrite',
|
|
1140
|
+
// icon: <FileCopyLineIcon sx={{ fontSize: '1rem' }} />,
|
|
1141
|
+
// onClick: () => {
|
|
1142
|
+
// if (current.node && current.pos !== undefined) {
|
|
1143
|
+
// const nodeJSON = current.node.toJSON();
|
|
1144
|
+
// const insertPos = current.pos + current.node.nodeSize;
|
|
1145
|
+
// current.editor.chain()
|
|
1146
|
+
// .focus()
|
|
1147
|
+
// .insertContentAt(insertPos, nodeJSON)
|
|
1148
|
+
// .run();
|
|
1149
|
+
// }
|
|
1150
|
+
// },
|
|
1151
|
+
// },
|
|
1152
|
+
{
|
|
1153
|
+
label: "\u5220\u9664".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1154
|
+
key: 'delete',
|
|
1155
|
+
icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
|
|
1156
|
+
sx: {
|
|
1157
|
+
fontSize: '1rem'
|
|
1158
|
+
}
|
|
1159
|
+
}),
|
|
1160
|
+
onClick: function onClick() {
|
|
1161
|
+
if (current.node && current.pos !== undefined) {
|
|
1162
|
+
current.editor.chain().focus().deleteRange({
|
|
1163
|
+
from: current.pos,
|
|
1164
|
+
to: current.pos + current.node.nodeSize
|
|
1165
|
+
}).run();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}]),
|
|
1169
|
+
context: /*#__PURE__*/React.createElement(DragIcon, null)
|
|
1170
|
+
}) : /*#__PURE__*/React.createElement(DragIcon, null));
|
|
1171
|
+
};
|
|
1172
|
+
export default CustomDragHandle;
|