@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,367 @@
|
|
|
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
|
+
var _excluded = ["className"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { Box, MenuItem, Paper, Select, Stack } from '@mui/material';
|
|
18
|
+
import { ArrowDownSLineIcon, ArrowGoForwardLineIcon, ArrowLeftWideLineIcon, DeleteLineIcon, FontSizeIcon, ListOrdered2Icon, ListUnorderedIcon } from "../Icons";
|
|
19
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
20
|
+
import { ToolbarItem } from "../Toolbar";
|
|
21
|
+
var ListHover = function ListHover(_ref) {
|
|
22
|
+
var editor = _ref.editor;
|
|
23
|
+
var _useState = useState(null),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
hoveredList = _useState2[0],
|
|
26
|
+
setHoveredList = _useState2[1];
|
|
27
|
+
var _useState3 = useState(null),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
menuPosition = _useState4[0],
|
|
30
|
+
setMenuPosition = _useState4[1];
|
|
31
|
+
var timeoutRef = useRef(null);
|
|
32
|
+
var fontSizeOptions = [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) {
|
|
33
|
+
return it.toString();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 清理列表样式的工具函数
|
|
37
|
+
var clearListStyle = function clearListStyle(element) {
|
|
38
|
+
element.style.outline = '';
|
|
39
|
+
element.style.outlineOffset = '';
|
|
40
|
+
element.style.borderRadius = '';
|
|
41
|
+
element.style.transition = '';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 处理字体大小变化
|
|
45
|
+
var handleFontSizeChange = function handleFontSizeChange(newSize) {
|
|
46
|
+
if (!hoveredList) return;
|
|
47
|
+
if (hoveredList.type === 'orderedList') {
|
|
48
|
+
editor.chain().focus().updateAttributes('orderedList', {
|
|
49
|
+
fontSize: "".concat(newSize, "px")
|
|
50
|
+
}).run();
|
|
51
|
+
} else if (hoveredList.type === 'bulletList') {
|
|
52
|
+
editor.chain().focus().updateAttributes('bulletList', {
|
|
53
|
+
fontSize: "".concat(newSize, "px")
|
|
54
|
+
}).run();
|
|
55
|
+
}
|
|
56
|
+
setHoveredList(function (prev) {
|
|
57
|
+
return prev ? _objectSpread(_objectSpread({}, prev), {}, {
|
|
58
|
+
fontSize: newSize
|
|
59
|
+
}) : null;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// 列表类型转换
|
|
64
|
+
var convertToOrderedList = function convertToOrderedList() {
|
|
65
|
+
editor.chain().focus().toggleOrderedList().run();
|
|
66
|
+
// 更新悬停状态
|
|
67
|
+
if (hoveredList && hoveredList.type === 'bulletList') {
|
|
68
|
+
setHoveredList(function (prev) {
|
|
69
|
+
return prev ? _objectSpread(_objectSpread({}, prev), {}, {
|
|
70
|
+
type: 'orderedList'
|
|
71
|
+
}) : null;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var convertToBulletList = function convertToBulletList() {
|
|
76
|
+
editor.chain().focus().toggleBulletList().run();
|
|
77
|
+
// 更新悬停状态
|
|
78
|
+
if (hoveredList && hoveredList.type === 'orderedList') {
|
|
79
|
+
setHoveredList(function (prev) {
|
|
80
|
+
return prev ? _objectSpread(_objectSpread({}, prev), {}, {
|
|
81
|
+
type: 'bulletList'
|
|
82
|
+
}) : null;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// 删除列表
|
|
88
|
+
var removeList = function removeList() {
|
|
89
|
+
if (!hoveredList) return;
|
|
90
|
+
if (hoveredList.type === 'orderedList') {
|
|
91
|
+
editor.chain().focus().toggleOrderedList().run();
|
|
92
|
+
} else if (hoveredList.type === 'bulletList') {
|
|
93
|
+
editor.chain().focus().toggleBulletList().run();
|
|
94
|
+
}
|
|
95
|
+
setHoveredList(null);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// 缩进控制
|
|
99
|
+
var indentList = function indentList() {
|
|
100
|
+
editor.chain().focus().sinkListItem('listItem').run();
|
|
101
|
+
};
|
|
102
|
+
var outdentList = function outdentList() {
|
|
103
|
+
editor.chain().focus().liftListItem('listItem').run();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// 监听鼠标悬停事件
|
|
107
|
+
useEffect(function () {
|
|
108
|
+
// 基本检查编辑器是否存在
|
|
109
|
+
if (!editor || !editor.isEditable) return;
|
|
110
|
+
var cleanupFn = null;
|
|
111
|
+
var isSetup = false;
|
|
112
|
+
var setupListeners = function setupListeners() {
|
|
113
|
+
if (isSetup) return;
|
|
114
|
+
|
|
115
|
+
// 在设置函数内部安全地检查 view.dom
|
|
116
|
+
try {
|
|
117
|
+
if (!editor || !editor.view || !editor.view.dom) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
isSetup = true;
|
|
124
|
+
var editorElement = editor.view.dom;
|
|
125
|
+
var handleMouseEnter = function handleMouseEnter(event) {
|
|
126
|
+
var _listElement$getAttri;
|
|
127
|
+
var target = event.target;
|
|
128
|
+
|
|
129
|
+
// 查找最近的列表元素
|
|
130
|
+
var listElement = target.closest('ol[data-type="orderedList"], ul[data-type="bulletList"]');
|
|
131
|
+
if (!listElement) return;
|
|
132
|
+
|
|
133
|
+
// 检查是否已经悬停在同一个列表上
|
|
134
|
+
if ((hoveredList === null || hoveredList === void 0 ? void 0 : hoveredList.element) === listElement) return;
|
|
135
|
+
|
|
136
|
+
// 清除之前的定时器
|
|
137
|
+
if (timeoutRef.current) {
|
|
138
|
+
clearTimeout(timeoutRef.current);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// 清除之前列表的样式
|
|
142
|
+
if (hoveredList !== null && hoveredList !== void 0 && hoveredList.element && hoveredList.element !== listElement) {
|
|
143
|
+
clearListStyle(hoveredList.element);
|
|
144
|
+
}
|
|
145
|
+
var listType = listElement.tagName === 'OL' ? 'orderedList' : 'bulletList';
|
|
146
|
+
var fontSize = ((_listElement$getAttri = listElement.getAttribute('data-font-size')) === null || _listElement$getAttri === void 0 ? void 0 : _listElement$getAttri.replace('px', '')) || getComputedStyle(listElement).fontSize.replace('px', '') || '16';
|
|
147
|
+
|
|
148
|
+
// 计算菜单位置
|
|
149
|
+
var rect = listElement.getBoundingClientRect();
|
|
150
|
+
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
151
|
+
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
152
|
+
setMenuPosition({
|
|
153
|
+
top: rect.top + scrollTop - 50,
|
|
154
|
+
// 在列表上方50px
|
|
155
|
+
left: Math.max(10, rect.left + scrollLeft + rect.width / 2 - 210) // 菜单宽度420px的一半,但不能超出屏幕左边
|
|
156
|
+
});
|
|
157
|
+
setHoveredList({
|
|
158
|
+
element: listElement,
|
|
159
|
+
type: listType,
|
|
160
|
+
fontSize: fontSize
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// 添加悬停样式
|
|
164
|
+
listElement.style.outline = '2px solid var(--mui-palette-primary-main)';
|
|
165
|
+
listElement.style.outlineOffset = '2px';
|
|
166
|
+
listElement.style.borderRadius = 'var(--mui-shape-borderRadius)';
|
|
167
|
+
listElement.style.transition = 'outline 0.2s ease';
|
|
168
|
+
};
|
|
169
|
+
var handleMouseLeave = function handleMouseLeave(event) {
|
|
170
|
+
var target = event.target;
|
|
171
|
+
var listElement = target.closest('ol, ul');
|
|
172
|
+
if (!listElement) return;
|
|
173
|
+
|
|
174
|
+
// 设置延迟隐藏,给用户时间移动到菜单上
|
|
175
|
+
timeoutRef.current = setTimeout(function () {
|
|
176
|
+
if ((hoveredList === null || hoveredList === void 0 ? void 0 : hoveredList.element) === listElement) {
|
|
177
|
+
// 移除悬停样式
|
|
178
|
+
clearListStyle(listElement);
|
|
179
|
+
setHoveredList(null);
|
|
180
|
+
setMenuPosition(null);
|
|
181
|
+
}
|
|
182
|
+
}, 100);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// 使用事件委托的方式监听鼠标事件
|
|
186
|
+
editorElement.addEventListener('mouseover', handleMouseEnter);
|
|
187
|
+
editorElement.addEventListener('mouseout', handleMouseLeave);
|
|
188
|
+
|
|
189
|
+
// 设置清理函数
|
|
190
|
+
cleanupFn = function cleanupFn() {
|
|
191
|
+
editorElement.removeEventListener('mouseover', handleMouseEnter);
|
|
192
|
+
editorElement.removeEventListener('mouseout', handleMouseLeave);
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// 尝试立即设置
|
|
197
|
+
setupListeners();
|
|
198
|
+
|
|
199
|
+
// 如果立即设置失败,则使用延迟设置
|
|
200
|
+
var setupTimeout = setTimeout(setupListeners, 500);
|
|
201
|
+
|
|
202
|
+
// 监听编辑器的 update 事件,当编辑器准备好时设置监听器
|
|
203
|
+
editor.on('update', setupListeners);
|
|
204
|
+
editor.on('focus', setupListeners);
|
|
205
|
+
return function () {
|
|
206
|
+
clearTimeout(setupTimeout);
|
|
207
|
+
editor.off('update', setupListeners);
|
|
208
|
+
editor.off('focus', setupListeners);
|
|
209
|
+
if (cleanupFn) {
|
|
210
|
+
cleanupFn();
|
|
211
|
+
}
|
|
212
|
+
if (timeoutRef.current) {
|
|
213
|
+
clearTimeout(timeoutRef.current);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 清理样式
|
|
217
|
+
if (hoveredList !== null && hoveredList !== void 0 && hoveredList.element) {
|
|
218
|
+
clearListStyle(hoveredList.element);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}, [editor]);
|
|
222
|
+
|
|
223
|
+
// 菜单悬停处理
|
|
224
|
+
var handleMenuMouseEnter = function handleMenuMouseEnter() {
|
|
225
|
+
if (timeoutRef.current) {
|
|
226
|
+
clearTimeout(timeoutRef.current);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var handleMenuMouseLeave = function handleMenuMouseLeave() {
|
|
230
|
+
timeoutRef.current = setTimeout(function () {
|
|
231
|
+
if (hoveredList) {
|
|
232
|
+
// 移除悬停样式
|
|
233
|
+
clearListStyle(hoveredList.element);
|
|
234
|
+
setHoveredList(null);
|
|
235
|
+
setMenuPosition(null);
|
|
236
|
+
}
|
|
237
|
+
}, 100);
|
|
238
|
+
};
|
|
239
|
+
if (!hoveredList || !menuPosition || !editor.isEditable) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
243
|
+
sx: {
|
|
244
|
+
position: 'fixed',
|
|
245
|
+
top: menuPosition.top,
|
|
246
|
+
left: menuPosition.left,
|
|
247
|
+
zIndex: 1000,
|
|
248
|
+
pointerEvents: 'auto'
|
|
249
|
+
},
|
|
250
|
+
onMouseEnter: handleMenuMouseEnter,
|
|
251
|
+
onMouseLeave: handleMenuMouseLeave
|
|
252
|
+
}, /*#__PURE__*/React.createElement(Paper, {
|
|
253
|
+
sx: {
|
|
254
|
+
p: 0.5,
|
|
255
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
256
|
+
minWidth: 420,
|
|
257
|
+
boxShadow: '0 4px 20px rgba(0,0,0,0.15)',
|
|
258
|
+
border: '1px solid var(--mui-palette-divider)'
|
|
259
|
+
}
|
|
260
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
261
|
+
direction: 'row',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
spacing: 1
|
|
264
|
+
}, /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
265
|
+
tip: "\u8F6C\u6362\u4E3A\u6709\u5E8F\u5217\u8868",
|
|
266
|
+
icon: /*#__PURE__*/React.createElement(ListOrdered2Icon, {
|
|
267
|
+
sx: {
|
|
268
|
+
fontSize: '1rem'
|
|
269
|
+
}
|
|
270
|
+
}),
|
|
271
|
+
onClick: convertToOrderedList,
|
|
272
|
+
className: hoveredList.type === 'orderedList' ? "tool-active" : ""
|
|
273
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
274
|
+
tip: "\u8F6C\u6362\u4E3A\u65E0\u5E8F\u5217\u8868",
|
|
275
|
+
icon: /*#__PURE__*/React.createElement(ListUnorderedIcon, {
|
|
276
|
+
sx: {
|
|
277
|
+
fontSize: '1rem'
|
|
278
|
+
}
|
|
279
|
+
}),
|
|
280
|
+
onClick: convertToBulletList,
|
|
281
|
+
className: hoveredList.type === 'bulletList' ? "tool-active" : ""
|
|
282
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
283
|
+
sx: {
|
|
284
|
+
width: '1px',
|
|
285
|
+
height: '20px',
|
|
286
|
+
backgroundColor: 'divider'
|
|
287
|
+
}
|
|
288
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
289
|
+
tip: "\u51CF\u5C11\u7F29\u8FDB",
|
|
290
|
+
icon: /*#__PURE__*/React.createElement(ArrowLeftWideLineIcon, {
|
|
291
|
+
sx: {
|
|
292
|
+
fontSize: '1rem'
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
onClick: outdentList
|
|
296
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
297
|
+
tip: "\u589E\u52A0\u7F29\u8FDB",
|
|
298
|
+
icon: /*#__PURE__*/React.createElement(ArrowGoForwardLineIcon, {
|
|
299
|
+
sx: {
|
|
300
|
+
fontSize: '1rem'
|
|
301
|
+
}
|
|
302
|
+
}),
|
|
303
|
+
onClick: indentList
|
|
304
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
305
|
+
sx: {
|
|
306
|
+
width: '1px',
|
|
307
|
+
height: '20px',
|
|
308
|
+
backgroundColor: 'divider'
|
|
309
|
+
}
|
|
310
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
311
|
+
direction: 'row',
|
|
312
|
+
alignItems: 'center',
|
|
313
|
+
spacing: 1
|
|
314
|
+
}, /*#__PURE__*/React.createElement(FontSizeIcon, {
|
|
315
|
+
sx: {
|
|
316
|
+
fontSize: '1rem',
|
|
317
|
+
color: 'text.secondary'
|
|
318
|
+
}
|
|
319
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
320
|
+
value: hoveredList.fontSize,
|
|
321
|
+
onChange: function onChange(e) {
|
|
322
|
+
return handleFontSizeChange(e.target.value);
|
|
323
|
+
},
|
|
324
|
+
size: "small",
|
|
325
|
+
sx: {
|
|
326
|
+
minWidth: 60,
|
|
327
|
+
'& .MuiSelect-select': {
|
|
328
|
+
padding: '4px 8px',
|
|
329
|
+
fontSize: '0.875rem'
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
IconComponent: function IconComponent(_ref2) {
|
|
333
|
+
var className = _ref2.className,
|
|
334
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
335
|
+
return /*#__PURE__*/React.createElement(ArrowDownSLineIcon, _extends({
|
|
336
|
+
sx: {
|
|
337
|
+
fontSize: '0.875rem',
|
|
338
|
+
transform: className !== null && className !== void 0 && className.includes('MuiSelect-iconOpen') ? 'rotate(-180deg)' : 'none',
|
|
339
|
+
transition: 'transform 0.3s'
|
|
340
|
+
}
|
|
341
|
+
}, rest));
|
|
342
|
+
}
|
|
343
|
+
}, fontSizeOptions.map(function (size) {
|
|
344
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
345
|
+
key: size,
|
|
346
|
+
value: size,
|
|
347
|
+
sx: {
|
|
348
|
+
fontSize: '0.875rem'
|
|
349
|
+
}
|
|
350
|
+
}, size, "px");
|
|
351
|
+
}))), /*#__PURE__*/React.createElement(Box, {
|
|
352
|
+
sx: {
|
|
353
|
+
width: '1px',
|
|
354
|
+
height: '20px',
|
|
355
|
+
backgroundColor: 'divider'
|
|
356
|
+
}
|
|
357
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
358
|
+
tip: "\u79FB\u9664\u5217\u8868\u683C\u5F0F",
|
|
359
|
+
icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
|
|
360
|
+
sx: {
|
|
361
|
+
fontSize: '1rem'
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
onClick: removeList
|
|
365
|
+
}))));
|
|
366
|
+
};
|
|
367
|
+
export default ListHover;
|
|
@@ -0,0 +1,189 @@
|
|
|
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
import { Box, Popover, Stack, Typography } from '@mui/material';
|
|
15
|
+
import React from 'react';
|
|
16
|
+
var Menu = function Menu(_ref) {
|
|
17
|
+
var _ref$id = _ref.id,
|
|
18
|
+
id = _ref$id === void 0 ? 'menu-select' : _ref$id,
|
|
19
|
+
arrowIcon = _ref.arrowIcon,
|
|
20
|
+
list = _ref.list,
|
|
21
|
+
context = _ref.context,
|
|
22
|
+
_ref$anchorOrigin = _ref.anchorOrigin,
|
|
23
|
+
anchorOrigin = _ref$anchorOrigin === void 0 ? {
|
|
24
|
+
vertical: 'bottom',
|
|
25
|
+
horizontal: 'right'
|
|
26
|
+
} : _ref$anchorOrigin,
|
|
27
|
+
_ref$transformOrigin = _ref.transformOrigin,
|
|
28
|
+
transformOrigin = _ref$transformOrigin === void 0 ? {
|
|
29
|
+
vertical: 'top',
|
|
30
|
+
horizontal: 'right'
|
|
31
|
+
} : _ref$transformOrigin,
|
|
32
|
+
_ref$childrenProps = _ref.childrenProps,
|
|
33
|
+
childrenProps = _ref$childrenProps === void 0 ? {
|
|
34
|
+
anchorOrigin: {
|
|
35
|
+
vertical: 'top',
|
|
36
|
+
horizontal: 'right'
|
|
37
|
+
},
|
|
38
|
+
transformOrigin: {
|
|
39
|
+
vertical: 'top',
|
|
40
|
+
horizontal: 'left'
|
|
41
|
+
}
|
|
42
|
+
} : _ref$childrenProps;
|
|
43
|
+
var _React$useState = React.useState(null),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
anchorEl = _React$useState2[0],
|
|
46
|
+
setAnchorEl = _React$useState2[1];
|
|
47
|
+
var _React$useState3 = React.useState(null),
|
|
48
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
49
|
+
hoveredItem = _React$useState4[0],
|
|
50
|
+
setHoveredItem = _React$useState4[1];
|
|
51
|
+
var _React$useState5 = React.useState(null),
|
|
52
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
53
|
+
subMenuAnchor = _React$useState6[0],
|
|
54
|
+
setSubMenuAnchor = _React$useState6[1];
|
|
55
|
+
var handleClick = function handleClick(event) {
|
|
56
|
+
var _context$props;
|
|
57
|
+
if (context !== null && context !== void 0 && (_context$props = context.props) !== null && _context$props !== void 0 && _context$props.onClick) {
|
|
58
|
+
context.props.onClick(event);
|
|
59
|
+
}
|
|
60
|
+
setAnchorEl(event.currentTarget);
|
|
61
|
+
};
|
|
62
|
+
var handleClose = function handleClose() {
|
|
63
|
+
setAnchorEl(null);
|
|
64
|
+
setHoveredItem(null);
|
|
65
|
+
setSubMenuAnchor(null);
|
|
66
|
+
};
|
|
67
|
+
var handleItemHover = function handleItemHover(event, item) {
|
|
68
|
+
var _item$children;
|
|
69
|
+
if ((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
70
|
+
setHoveredItem(item);
|
|
71
|
+
setSubMenuAnchor(event.currentTarget);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var handleItemLeave = function handleItemLeave() {
|
|
75
|
+
setHoveredItem(null);
|
|
76
|
+
setSubMenuAnchor(null);
|
|
77
|
+
};
|
|
78
|
+
var handleItemClick = function handleItemClick(item) {
|
|
79
|
+
if (item.onClick) {
|
|
80
|
+
item.onClick();
|
|
81
|
+
}
|
|
82
|
+
handleClose();
|
|
83
|
+
};
|
|
84
|
+
var open = Boolean(anchorEl);
|
|
85
|
+
var curId = open ? id : undefined;
|
|
86
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, context && /*#__PURE__*/React.cloneElement(context, {
|
|
87
|
+
onClick: handleClick,
|
|
88
|
+
'aria-describedby': curId
|
|
89
|
+
}), /*#__PURE__*/React.createElement(Popover, {
|
|
90
|
+
id: curId,
|
|
91
|
+
open: open,
|
|
92
|
+
anchorEl: anchorEl,
|
|
93
|
+
onClose: handleClose,
|
|
94
|
+
anchorOrigin: anchorOrigin,
|
|
95
|
+
transformOrigin: transformOrigin
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
97
|
+
className: "menu-select-list",
|
|
98
|
+
sx: {
|
|
99
|
+
p: 0.5,
|
|
100
|
+
minWidth: 160,
|
|
101
|
+
lineHeight: '1.5rem'
|
|
102
|
+
}
|
|
103
|
+
}, list.map(function (item) {
|
|
104
|
+
var _item$children2;
|
|
105
|
+
return item.customLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
106
|
+
key: item.key
|
|
107
|
+
}, item.customLabel) : /*#__PURE__*/React.createElement(Box, {
|
|
108
|
+
key: item.key,
|
|
109
|
+
className: "menu-select-item",
|
|
110
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
111
|
+
return handleItemHover(e, item);
|
|
112
|
+
},
|
|
113
|
+
onMouseLeave: handleItemLeave,
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
return handleItemClick(item);
|
|
116
|
+
},
|
|
117
|
+
sx: _objectSpread({
|
|
118
|
+
position: 'relative',
|
|
119
|
+
cursor: 'pointer',
|
|
120
|
+
borderRadius: 1,
|
|
121
|
+
p: 1,
|
|
122
|
+
':hover': {
|
|
123
|
+
bgcolor: 'action.hover'
|
|
124
|
+
}
|
|
125
|
+
}, item.selected ? {
|
|
126
|
+
color: 'primary.main',
|
|
127
|
+
bgcolor: 'action.selected'
|
|
128
|
+
} : {})
|
|
129
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
gap: 1.5,
|
|
132
|
+
direction: "row"
|
|
133
|
+
}, item.icon, /*#__PURE__*/React.createElement(Typography, {
|
|
134
|
+
sx: _objectSpread({
|
|
135
|
+
flexGrow: 1
|
|
136
|
+
}, item.textSx)
|
|
137
|
+
}, item.label), item.extra, (_item$children2 = item.children) !== null && _item$children2 !== void 0 && _item$children2.length ? arrowIcon : null), hoveredItem === item && item.children && /*#__PURE__*/React.createElement(Popover, _extends({
|
|
138
|
+
open: Boolean(subMenuAnchor),
|
|
139
|
+
anchorEl: subMenuAnchor,
|
|
140
|
+
onClose: handleItemLeave,
|
|
141
|
+
sx: {
|
|
142
|
+
pointerEvents: 'none'
|
|
143
|
+
}
|
|
144
|
+
}, childrenProps), /*#__PURE__*/React.createElement(Box, {
|
|
145
|
+
className: "menu-select-sub-list",
|
|
146
|
+
sx: _objectSpread(_objectSpread({
|
|
147
|
+
pointerEvents: 'auto',
|
|
148
|
+
p: 0.5,
|
|
149
|
+
minWidth: 160,
|
|
150
|
+
maxHeight: 360,
|
|
151
|
+
overflow: 'auto'
|
|
152
|
+
}, item.minWidth ? {
|
|
153
|
+
minWidth: item.minWidth
|
|
154
|
+
} : {}), item.maxHeight ? {
|
|
155
|
+
maxHeight: item.maxHeight
|
|
156
|
+
} : {})
|
|
157
|
+
}, item.children.map(function (child) {
|
|
158
|
+
return child.customLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
159
|
+
key: child.key
|
|
160
|
+
}, child.customLabel) : /*#__PURE__*/React.createElement(Box, {
|
|
161
|
+
key: child.key,
|
|
162
|
+
className: "menu-select-sub-item",
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
return handleItemClick(child);
|
|
165
|
+
},
|
|
166
|
+
sx: _objectSpread({
|
|
167
|
+
cursor: 'pointer',
|
|
168
|
+
borderRadius: 1,
|
|
169
|
+
p: 1,
|
|
170
|
+
':hover': {
|
|
171
|
+
bgcolor: 'action.hover'
|
|
172
|
+
}
|
|
173
|
+
}, child.selected ? {
|
|
174
|
+
color: 'primary.main',
|
|
175
|
+
bgcolor: 'action.selected'
|
|
176
|
+
} : {})
|
|
177
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
178
|
+
alignItems: "center",
|
|
179
|
+
gap: 1.5,
|
|
180
|
+
direction: "row"
|
|
181
|
+
}, child.icon, /*#__PURE__*/React.createElement(Typography, {
|
|
182
|
+
sx: _objectSpread({
|
|
183
|
+
flexGrow: 1
|
|
184
|
+
}, child.textSx)
|
|
185
|
+
}, child.label), child.extra));
|
|
186
|
+
}))));
|
|
187
|
+
}))));
|
|
188
|
+
};
|
|
189
|
+
export default Menu;
|