@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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetTableOfContentIndexFunction, GetTableOfContentLevelFunction, TableOfContentDataItem } from './type';
|
|
2
|
+
export declare const getLastHeadingOnLevel: (headings: TableOfContentDataItem[], level: number) => TableOfContentDataItem | undefined;
|
|
3
|
+
export declare const getHeadlineLevel: GetTableOfContentLevelFunction;
|
|
4
|
+
export declare const getLinearIndexes: GetTableOfContentIndexFunction;
|
|
5
|
+
export declare const getHierarchicalIndexes: GetTableOfContentIndexFunction;
|
|
6
|
+
export declare function debounce(func: (...args: any[]) => void, wait: number): (...args: any[]) => void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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; }
|
|
7
|
+
export var getLastHeadingOnLevel = function getLastHeadingOnLevel(headings, level) {
|
|
8
|
+
var heading = headings.filter(function (currentHeading) {
|
|
9
|
+
return currentHeading.level === level;
|
|
10
|
+
}).pop();
|
|
11
|
+
if (level === 0) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (!heading) {
|
|
15
|
+
heading = getLastHeadingOnLevel(headings, level - 1);
|
|
16
|
+
}
|
|
17
|
+
return heading;
|
|
18
|
+
};
|
|
19
|
+
export var getHeadlineLevel = function getHeadlineLevel(headline, previousItems) {
|
|
20
|
+
var level = 1;
|
|
21
|
+
var previousHeadline = previousItems.at(-1);
|
|
22
|
+
var highestHeadlineAbove = _toConsumableArray(previousItems).reverse().find(function (h) {
|
|
23
|
+
return h.originalLevel <= headline.node.attrs.level;
|
|
24
|
+
});
|
|
25
|
+
var highestLevelAbove = (highestHeadlineAbove === null || highestHeadlineAbove === void 0 ? void 0 : highestHeadlineAbove.level) || 1;
|
|
26
|
+
if (headline.node.attrs.level > ((previousHeadline === null || previousHeadline === void 0 ? void 0 : previousHeadline.originalLevel) || 1)) {
|
|
27
|
+
level = ((previousHeadline === null || previousHeadline === void 0 ? void 0 : previousHeadline.level) || 1) + 1;
|
|
28
|
+
} else if (headline.node.attrs.level < ((previousHeadline === null || previousHeadline === void 0 ? void 0 : previousHeadline.originalLevel) || 1)) {
|
|
29
|
+
level = highestLevelAbove;
|
|
30
|
+
} else {
|
|
31
|
+
level = (previousHeadline === null || previousHeadline === void 0 ? void 0 : previousHeadline.level) || 1;
|
|
32
|
+
}
|
|
33
|
+
return level;
|
|
34
|
+
};
|
|
35
|
+
export var getLinearIndexes = function getLinearIndexes(_headline, previousHeadlines) {
|
|
36
|
+
var previousHeadline = previousHeadlines.at(-1);
|
|
37
|
+
if (!previousHeadline) {
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
return ((previousHeadline === null || previousHeadline === void 0 ? void 0 : previousHeadline.itemIndex) || 1) + 1;
|
|
41
|
+
};
|
|
42
|
+
export var getHierarchicalIndexes = function getHierarchicalIndexes(headline, previousHeadlines, currentLevel) {
|
|
43
|
+
var _previousHeadlinesOnL;
|
|
44
|
+
var level = currentLevel || headline.node.attrs.level || 1;
|
|
45
|
+
var itemIndex = 1;
|
|
46
|
+
var previousHeadlinesOnLevelOrBelow = previousHeadlines.filter(function (h) {
|
|
47
|
+
return h.level <= level;
|
|
48
|
+
});
|
|
49
|
+
if (((_previousHeadlinesOnL = previousHeadlinesOnLevelOrBelow.at(-1)) === null || _previousHeadlinesOnL === void 0 ? void 0 : _previousHeadlinesOnL.level) === level) {
|
|
50
|
+
var _previousHeadlinesOnL2;
|
|
51
|
+
itemIndex = (((_previousHeadlinesOnL2 = previousHeadlinesOnLevelOrBelow.at(-1)) === null || _previousHeadlinesOnL2 === void 0 ? void 0 : _previousHeadlinesOnL2.itemIndex) || 1) + 1;
|
|
52
|
+
} else {
|
|
53
|
+
itemIndex = 1;
|
|
54
|
+
}
|
|
55
|
+
return itemIndex;
|
|
56
|
+
};
|
|
57
|
+
export function debounce(func, wait) {
|
|
58
|
+
var timeout = null;
|
|
59
|
+
return function () {
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
if (timeout) {
|
|
64
|
+
clearTimeout(timeout);
|
|
65
|
+
}
|
|
66
|
+
timeout = setTimeout(function () {
|
|
67
|
+
func.apply(void 0, args);
|
|
68
|
+
}, wait);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { UploadProgressAttributes } from '../component/UploadProgress';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
uploadProgress: {
|
|
6
|
+
/**
|
|
7
|
+
* Insert upload progress indicator
|
|
8
|
+
*/
|
|
9
|
+
setUploadProgress: (options: UploadProgressAttributes) => ReturnType;
|
|
10
|
+
/**
|
|
11
|
+
* Update upload progress
|
|
12
|
+
*/
|
|
13
|
+
updateUploadProgress: (tempId: string, progress: number) => ReturnType;
|
|
14
|
+
/**
|
|
15
|
+
* Remove upload progress indicator
|
|
16
|
+
*/
|
|
17
|
+
removeUploadProgress: (tempId: string) => ReturnType;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare const UploadProgressExtension: Node<any, any>;
|
|
@@ -0,0 +1,135 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { mergeAttributes, Node } from '@tiptap/core';
|
|
8
|
+
import { ReactNodeViewRenderer } from '@tiptap/react';
|
|
9
|
+
import UploadProgressView from "../component/UploadProgress";
|
|
10
|
+
export var UploadProgressExtension = Node.create({
|
|
11
|
+
name: 'uploadProgress',
|
|
12
|
+
group: 'block',
|
|
13
|
+
atom: true,
|
|
14
|
+
selectable: false,
|
|
15
|
+
draggable: false,
|
|
16
|
+
addAttributes: function addAttributes() {
|
|
17
|
+
return {
|
|
18
|
+
fileName: {
|
|
19
|
+
default: '',
|
|
20
|
+
parseHTML: function parseHTML(element) {
|
|
21
|
+
return element.getAttribute('data-file-name');
|
|
22
|
+
},
|
|
23
|
+
renderHTML: function renderHTML(attributes) {
|
|
24
|
+
if (!attributes.fileName) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
'data-file-name': attributes.fileName
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
fileType: {
|
|
33
|
+
default: 'other',
|
|
34
|
+
parseHTML: function parseHTML(element) {
|
|
35
|
+
return element.getAttribute('data-file-type');
|
|
36
|
+
},
|
|
37
|
+
renderHTML: function renderHTML(attributes) {
|
|
38
|
+
if (!attributes.fileType) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
'data-file-type': attributes.fileType
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
progress: {
|
|
47
|
+
default: 0,
|
|
48
|
+
parseHTML: function parseHTML(element) {
|
|
49
|
+
return parseFloat(element.getAttribute('data-progress') || '0');
|
|
50
|
+
},
|
|
51
|
+
renderHTML: function renderHTML(attributes) {
|
|
52
|
+
return {
|
|
53
|
+
'data-progress': attributes.progress
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
tempId: {
|
|
58
|
+
default: '',
|
|
59
|
+
parseHTML: function parseHTML(element) {
|
|
60
|
+
return element.getAttribute('data-temp-id');
|
|
61
|
+
},
|
|
62
|
+
renderHTML: function renderHTML(attributes) {
|
|
63
|
+
if (!attributes.tempId) {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
'data-temp-id': attributes.tempId
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
parseHTML: function parseHTML() {
|
|
74
|
+
return [{
|
|
75
|
+
tag: 'div[data-type="upload-progress"]'
|
|
76
|
+
}];
|
|
77
|
+
},
|
|
78
|
+
renderHTML: function renderHTML(_ref) {
|
|
79
|
+
var HTMLAttributes = _ref.HTMLAttributes;
|
|
80
|
+
return ['div', mergeAttributes({
|
|
81
|
+
'data-type': 'upload-progress'
|
|
82
|
+
}, HTMLAttributes)];
|
|
83
|
+
},
|
|
84
|
+
addCommands: function addCommands() {
|
|
85
|
+
var _this = this;
|
|
86
|
+
return {
|
|
87
|
+
setUploadProgress: function setUploadProgress(options) {
|
|
88
|
+
return function (_ref2) {
|
|
89
|
+
var commands = _ref2.commands;
|
|
90
|
+
return commands.insertContent({
|
|
91
|
+
type: _this.name,
|
|
92
|
+
attrs: options
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
updateUploadProgress: function updateUploadProgress(tempId, progress) {
|
|
97
|
+
return function (_ref3) {
|
|
98
|
+
var tr = _ref3.tr,
|
|
99
|
+
state = _ref3.state;
|
|
100
|
+
var doc = state.doc;
|
|
101
|
+
var updated = false;
|
|
102
|
+
doc.descendants(function (node, pos) {
|
|
103
|
+
if (node.type.name === _this.name && node.attrs.tempId === tempId) {
|
|
104
|
+
tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
105
|
+
progress: progress
|
|
106
|
+
}));
|
|
107
|
+
updated = true;
|
|
108
|
+
return false; // 停止遍历
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return updated;
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
removeUploadProgress: function removeUploadProgress(tempId) {
|
|
115
|
+
return function (_ref4) {
|
|
116
|
+
var tr = _ref4.tr,
|
|
117
|
+
state = _ref4.state;
|
|
118
|
+
var doc = state.doc;
|
|
119
|
+
var removed = false;
|
|
120
|
+
doc.descendants(function (node, pos) {
|
|
121
|
+
if (node.type.name === _this.name && node.attrs.tempId === tempId) {
|
|
122
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
123
|
+
removed = true;
|
|
124
|
+
return false; // 停止遍历
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return removed;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
addNodeView: function addNodeView() {
|
|
133
|
+
return ReactNodeViewRenderer(UploadProgressView);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export interface VerticalAlignOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The types where the vertical align attribute can be applied.
|
|
5
|
+
* @default ['textStyle']
|
|
6
|
+
* @example ['textStyle']
|
|
7
|
+
*/
|
|
8
|
+
types: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The alignments which are allowed.
|
|
11
|
+
* @default ['top', 'middle', 'bottom']
|
|
12
|
+
*/
|
|
13
|
+
alignments: string[];
|
|
14
|
+
/**
|
|
15
|
+
* The default alignment.
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
defaultAlignment: string | null;
|
|
19
|
+
}
|
|
20
|
+
declare module '@tiptap/core' {
|
|
21
|
+
interface Commands<ReturnType> {
|
|
22
|
+
verticalAlign: {
|
|
23
|
+
/**
|
|
24
|
+
* Set the vertical align attribute
|
|
25
|
+
* @param alignment The alignment
|
|
26
|
+
* @example editor.commands.setVerticalAlign('top')
|
|
27
|
+
*/
|
|
28
|
+
setVerticalAlign: (alignment: string) => ReturnType;
|
|
29
|
+
/**
|
|
30
|
+
* Unset the vertical align attribute
|
|
31
|
+
* @example editor.commands.unsetVerticalAlign()
|
|
32
|
+
*/
|
|
33
|
+
unsetVerticalAlign: () => ReturnType;
|
|
34
|
+
/**
|
|
35
|
+
* Toggle the vertical align attribute
|
|
36
|
+
* @param alignment The alignment
|
|
37
|
+
* @example editor.commands.toggleVerticalAlign('middle')
|
|
38
|
+
*/
|
|
39
|
+
toggleVerticalAlign: (alignment: string) => ReturnType;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
declare module '@tiptap/extension-text-style' {
|
|
44
|
+
interface TextStyleAttributes {
|
|
45
|
+
verticalAlign?: string | null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export declare const VerticalAlign: Extension<VerticalAlignOptions, any>;
|
|
49
|
+
export default VerticalAlign;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export var VerticalAlign = Extension.create({
|
|
3
|
+
name: 'verticalAlign',
|
|
4
|
+
addOptions: function addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
types: ['textStyle'],
|
|
7
|
+
alignments: ['top', 'middle', 'bottom'],
|
|
8
|
+
defaultAlignment: null
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
addGlobalAttributes: function addGlobalAttributes() {
|
|
12
|
+
var _this = this;
|
|
13
|
+
return [{
|
|
14
|
+
types: this.options.types,
|
|
15
|
+
attributes: {
|
|
16
|
+
verticalAlign: {
|
|
17
|
+
default: this.options.defaultAlignment,
|
|
18
|
+
parseHTML: function parseHTML(element) {
|
|
19
|
+
var alignment = element.style.verticalAlign;
|
|
20
|
+
return _this.options.alignments.includes(alignment) ? alignment : _this.options.defaultAlignment;
|
|
21
|
+
},
|
|
22
|
+
renderHTML: function renderHTML(attributes) {
|
|
23
|
+
if (!attributes.verticalAlign) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
style: "vertical-align: ".concat(attributes.verticalAlign)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}];
|
|
33
|
+
},
|
|
34
|
+
addCommands: function addCommands() {
|
|
35
|
+
var _this2 = this;
|
|
36
|
+
return {
|
|
37
|
+
setVerticalAlign: function setVerticalAlign(alignment) {
|
|
38
|
+
return function (_ref) {
|
|
39
|
+
var commands = _ref.commands;
|
|
40
|
+
if (!_this2.options.alignments.includes(alignment)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return commands.toggleTextStyle({
|
|
44
|
+
verticalAlign: alignment
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
unsetVerticalAlign: function unsetVerticalAlign() {
|
|
49
|
+
return function (_ref2) {
|
|
50
|
+
var commands = _ref2.commands;
|
|
51
|
+
return commands.toggleTextStyle({
|
|
52
|
+
verticalAlign: null
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
toggleVerticalAlign: function toggleVerticalAlign(alignment) {
|
|
57
|
+
return function (_ref3) {
|
|
58
|
+
var editor = _ref3.editor,
|
|
59
|
+
commands = _ref3.commands;
|
|
60
|
+
if (!_this2.options.alignments.includes(alignment)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (editor.isActive('textStyle', {
|
|
64
|
+
verticalAlign: alignment
|
|
65
|
+
})) {
|
|
66
|
+
return commands.unsetVerticalAlign();
|
|
67
|
+
}
|
|
68
|
+
return commands.setVerticalAlign(alignment);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
74
|
+
var _this3 = this;
|
|
75
|
+
return {
|
|
76
|
+
'Mod-Alt-t': function ModAltT() {
|
|
77
|
+
return _this3.editor.commands.setVerticalAlign('top');
|
|
78
|
+
},
|
|
79
|
+
'Mod-Alt-m': function ModAltM() {
|
|
80
|
+
return _this3.editor.commands.setVerticalAlign('middle');
|
|
81
|
+
},
|
|
82
|
+
'Mod-Alt-b': function ModAltB() {
|
|
83
|
+
return _this3.editor.commands.setVerticalAlign('bottom');
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
export default VerticalAlign;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { EditorFnProps } from "../../type";
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
video: {
|
|
6
|
+
/**
|
|
7
|
+
* Insert a video
|
|
8
|
+
*/
|
|
9
|
+
setVideo: (options: {
|
|
10
|
+
src: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
controls?: boolean;
|
|
13
|
+
autoplay?: boolean;
|
|
14
|
+
loop?: boolean;
|
|
15
|
+
muted?: boolean;
|
|
16
|
+
poster?: string;
|
|
17
|
+
}) => ReturnType;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export type VideoExtensionProps = EditorFnProps;
|
|
22
|
+
export declare const VideoExtension: (props: VideoExtensionProps) => Node<any, any>;
|
|
23
|
+
export default VideoExtension;
|
|
@@ -0,0 +1,195 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { mergeAttributes, Node } from '@tiptap/core';
|
|
8
|
+
import { ReactNodeViewRenderer } from '@tiptap/react';
|
|
9
|
+
import VideoViewWrapper from "../component/Video";
|
|
10
|
+
export var VideoExtension = function VideoExtension(props) {
|
|
11
|
+
return Node.create({
|
|
12
|
+
name: 'video',
|
|
13
|
+
group: 'block',
|
|
14
|
+
atom: true,
|
|
15
|
+
selectable: true,
|
|
16
|
+
draggable: true,
|
|
17
|
+
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
18
|
+
var _this = this;
|
|
19
|
+
return {
|
|
20
|
+
'Mod-3': function Mod3() {
|
|
21
|
+
return _this.editor.commands.setVideo({
|
|
22
|
+
src: '',
|
|
23
|
+
width: 760,
|
|
24
|
+
controls: true,
|
|
25
|
+
autoplay: false
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
addAttributes: function addAttributes() {
|
|
31
|
+
return {
|
|
32
|
+
class: {
|
|
33
|
+
default: 'video-wrapper'
|
|
34
|
+
},
|
|
35
|
+
src: {
|
|
36
|
+
default: null,
|
|
37
|
+
parseHTML: function parseHTML(element) {
|
|
38
|
+
return element.getAttribute('src');
|
|
39
|
+
},
|
|
40
|
+
renderHTML: function renderHTML(attributes) {
|
|
41
|
+
if (!attributes.src) return {};
|
|
42
|
+
return {
|
|
43
|
+
src: attributes.src
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
controls: {
|
|
48
|
+
default: true,
|
|
49
|
+
parseHTML: function parseHTML(element) {
|
|
50
|
+
return element.hasAttribute('controls');
|
|
51
|
+
},
|
|
52
|
+
renderHTML: function renderHTML(attributes) {
|
|
53
|
+
if (!attributes.controls) return {};
|
|
54
|
+
return {
|
|
55
|
+
controls: 'true'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
autoplay: {
|
|
60
|
+
default: false,
|
|
61
|
+
parseHTML: function parseHTML(element) {
|
|
62
|
+
return element.hasAttribute('autoplay');
|
|
63
|
+
},
|
|
64
|
+
renderHTML: function renderHTML(attributes) {
|
|
65
|
+
if (!attributes.autoplay) return {};
|
|
66
|
+
return {
|
|
67
|
+
autoplay: 'true'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
loop: {
|
|
72
|
+
default: false,
|
|
73
|
+
parseHTML: function parseHTML(element) {
|
|
74
|
+
return element.hasAttribute('loop');
|
|
75
|
+
},
|
|
76
|
+
renderHTML: function renderHTML(attributes) {
|
|
77
|
+
if (!attributes.loop) return {};
|
|
78
|
+
return {
|
|
79
|
+
loop: 'true'
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
muted: {
|
|
84
|
+
default: false,
|
|
85
|
+
parseHTML: function parseHTML(element) {
|
|
86
|
+
return element.hasAttribute('muted');
|
|
87
|
+
},
|
|
88
|
+
renderHTML: function renderHTML(attributes) {
|
|
89
|
+
if (!attributes.muted) return {};
|
|
90
|
+
return {
|
|
91
|
+
muted: 'true'
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
poster: {
|
|
96
|
+
default: null,
|
|
97
|
+
parseHTML: function parseHTML(element) {
|
|
98
|
+
return element.getAttribute('poster');
|
|
99
|
+
},
|
|
100
|
+
renderHTML: function renderHTML(attributes) {
|
|
101
|
+
if (!attributes.poster) return {};
|
|
102
|
+
return {
|
|
103
|
+
poster: attributes.poster
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
width: {
|
|
108
|
+
default: 760,
|
|
109
|
+
parseHTML: function parseHTML(element) {
|
|
110
|
+
var width = element.getAttribute('width');
|
|
111
|
+
return width ? parseInt(width, 10) : 760;
|
|
112
|
+
},
|
|
113
|
+
renderHTML: function renderHTML(attributes) {
|
|
114
|
+
return {
|
|
115
|
+
width: attributes.width
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
parseHTML: function parseHTML() {
|
|
122
|
+
return [{
|
|
123
|
+
tag: 'video',
|
|
124
|
+
getAttrs: function getAttrs(dom) {
|
|
125
|
+
if (!(dom instanceof HTMLElement)) return false;
|
|
126
|
+
var src = dom.getAttribute('src');
|
|
127
|
+
if (!src) return false;
|
|
128
|
+
return {
|
|
129
|
+
src: src,
|
|
130
|
+
controls: dom.hasAttribute('controls'),
|
|
131
|
+
autoplay: dom.hasAttribute('autoplay'),
|
|
132
|
+
loop: dom.hasAttribute('loop'),
|
|
133
|
+
muted: dom.hasAttribute('muted'),
|
|
134
|
+
poster: dom.getAttribute('poster'),
|
|
135
|
+
width: dom.getAttribute('width') ? parseInt(dom.getAttribute('width'), 10) : 760
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}];
|
|
139
|
+
},
|
|
140
|
+
renderHTML: function renderHTML(_ref) {
|
|
141
|
+
var HTMLAttributes = _ref.HTMLAttributes;
|
|
142
|
+
return ['video', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
143
|
+
},
|
|
144
|
+
addCommands: function addCommands() {
|
|
145
|
+
var _this2 = this;
|
|
146
|
+
return {
|
|
147
|
+
setVideo: function setVideo(options) {
|
|
148
|
+
return function (_ref2) {
|
|
149
|
+
var commands = _ref2.commands;
|
|
150
|
+
return commands.insertContent({
|
|
151
|
+
type: _this2.name,
|
|
152
|
+
attrs: {
|
|
153
|
+
src: options.src,
|
|
154
|
+
width: options.width || 760,
|
|
155
|
+
controls: options.controls !== false,
|
|
156
|
+
autoplay: options.autoplay || false,
|
|
157
|
+
loop: options.loop || false,
|
|
158
|
+
muted: options.muted || false,
|
|
159
|
+
poster: options.poster || null
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
addInputRules: function addInputRules() {
|
|
167
|
+
var _this3 = this;
|
|
168
|
+
return [
|
|
169
|
+
// Auto-embed video URLs
|
|
170
|
+
{
|
|
171
|
+
find: /^https?:\/\/.*\.(mp4|webm|ogg|mov|m4v|avi|wmv|flv|mkv|mpg|mpeg|m4p|m4v|m4b|m4r|m4a)$/,
|
|
172
|
+
handler: function handler(_ref3) {
|
|
173
|
+
var state = _ref3.state,
|
|
174
|
+
range = _ref3.range,
|
|
175
|
+
match = _ref3.match;
|
|
176
|
+
var from = range.from,
|
|
177
|
+
to = range.to;
|
|
178
|
+
var videoUrl = match[0];
|
|
179
|
+
state.tr.replaceWith(from, to, _this3.type.create({
|
|
180
|
+
src: videoUrl
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
}];
|
|
184
|
+
},
|
|
185
|
+
addNodeView: function addNodeView() {
|
|
186
|
+
return ReactNodeViewRenderer(function (renderProps) {
|
|
187
|
+
return VideoViewWrapper(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
188
|
+
onUpload: props.onUpload,
|
|
189
|
+
onError: props.onError
|
|
190
|
+
}));
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
export default VideoExtension;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import Youtube from "@tiptap/extension-youtube";
|
|
8
|
+
export var YoutubeExtension = function YoutubeExtension(youtube) {
|
|
9
|
+
return Youtube.configure(_objectSpread({
|
|
10
|
+
ccLanguage: 'zh-CN',
|
|
11
|
+
nocookie: true
|
|
12
|
+
}, youtube));
|
|
13
|
+
};
|
|
14
|
+
export default YoutubeExtension;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './Attachment';
|
|
2
|
+
export * from './Audio';
|
|
3
|
+
export * from './CodeBlockLowlight';
|
|
4
|
+
export * from './Details';
|
|
5
|
+
export * from './Emoji';
|
|
6
|
+
export * from './FileHandler';
|
|
7
|
+
export * from './Image';
|
|
8
|
+
export * from './Link';
|
|
9
|
+
export * from './ListKit';
|
|
10
|
+
export * from './Mathematics';
|
|
11
|
+
export * from './Mention';
|
|
12
|
+
export * from './Table';
|
|
13
|
+
export * from './TableOfContents';
|
|
14
|
+
export * from './UploadProgress';
|
|
15
|
+
export * from './VerticalAlign';
|
|
16
|
+
export * from './Video';
|
|
17
|
+
export * from './Youtube';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./Attachment";
|
|
2
|
+
export * from "./Audio";
|
|
3
|
+
export * from "./CodeBlockLowlight";
|
|
4
|
+
export * from "./Details";
|
|
5
|
+
export * from "./Emoji";
|
|
6
|
+
export * from "./FileHandler";
|
|
7
|
+
export * from "./Image";
|
|
8
|
+
export * from "./Link";
|
|
9
|
+
export * from "./ListKit";
|
|
10
|
+
export * from "./Mathematics";
|
|
11
|
+
export * from "./Mention";
|
|
12
|
+
export * from "./Table";
|
|
13
|
+
export * from "./TableOfContents";
|
|
14
|
+
export * from "./UploadProgress";
|
|
15
|
+
export * from "./VerticalAlign";
|
|
16
|
+
export * from "./Video";
|
|
17
|
+
export * from "./Youtube";
|