@ctzhian/tiptap 1.5.2 → 1.5.4
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/dist/Editor/demo.d.ts +4 -0
- package/dist/Editor/demo.js +153 -0
- package/dist/Editor/index.d.ts +4 -0
- package/dist/Editor/index.js +21 -0
- package/dist/EditorDiff/demo.d.ts +4 -0
- package/dist/EditorDiff/demo.js +12 -0
- package/dist/EditorDiff/index.d.ts +7 -0
- package/dist/EditorDiff/index.js +24 -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 +325 -0
- package/dist/asset/css/index.css +165 -0
- package/dist/asset/images/disk.png +0 -0
- package/dist/component/CustomBubbleMenu/SelectionText.d.ts +9 -0
- package/dist/component/CustomBubbleMenu/SelectionText.js +292 -0
- package/dist/component/CustomDragHandle/index.d.ts +9 -0
- package/dist/component/CustomDragHandle/index.js +1407 -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 +15 -0
- package/dist/component/FloatingPopover/index.js +113 -0
- package/dist/component/Icons/add-line-icon.d.ts +6 -0
- package/dist/component/Icons/add-line-icon.js +13 -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-fill-icon.d.ts +6 -0
- package/dist/component/Icons/checkbox-circle-fill-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/close-circle-fill-icon.d.ts +6 -0
- package/dist/component/Icons/close-circle-fill-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/error-warning-fill-icon.d.ts +6 -0
- package/dist/component/Icons/error-warning-fill-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/indent-decrease-icon.d.ts +6 -0
- package/dist/component/Icons/indent-decrease-icon.js +13 -0
- package/dist/component/Icons/indent-increase-icon.d.ts +6 -0
- package/dist/component/Icons/indent-increase-icon.js +13 -0
- package/dist/component/Icons/index.d.ts +120 -0
- package/dist/component/Icons/index.js +123 -0
- package/dist/component/Icons/information-2-fill-icon.d.ts +6 -0
- package/dist/component/Icons/information-2-fill-icon.js +13 -0
- package/dist/component/Icons/information-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/information-2-line-icon.js +13 -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/question-fill-icon.d.ts +6 -0
- package/dist/component/Icons/question-fill-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/Icons/window-fill-icon.d.ts +6 -0
- package/dist/component/Icons/window-fill-icon.js +13 -0
- package/dist/component/Menu/NestedList.d.ts +14 -0
- package/dist/component/Menu/NestedList.js +151 -0
- package/dist/component/Menu/index.d.ts +4 -0
- package/dist/component/Menu/index.js +84 -0
- package/dist/component/Toolbar/EditorAlignSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorAlignSelect.js +187 -0
- package/dist/component/Toolbar/EditorCode.d.ts +7 -0
- package/dist/component/Toolbar/EditorCode.js +161 -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 +149 -0
- package/dist/component/Toolbar/EditorHeading.d.ts +7 -0
- package/dist/component/Toolbar/EditorHeading.js +185 -0
- package/dist/component/Toolbar/EditorInsert/index.d.ts +7 -0
- package/dist/component/Toolbar/EditorInsert/index.js +197 -0
- package/dist/component/Toolbar/EditorListSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorListSelect.js +174 -0
- package/dist/component/Toolbar/EditorMath.d.ts +7 -0
- package/dist/component/Toolbar/EditorMath.js +159 -0
- package/dist/component/Toolbar/EditorMore/NotificationDialog.d.ts +7 -0
- package/dist/component/Toolbar/EditorMore/NotificationDialog.js +73 -0
- package/dist/component/Toolbar/EditorMore/index.d.ts +7 -0
- package/dist/component/Toolbar/EditorMore/index.js +112 -0
- package/dist/component/Toolbar/EditorScript.d.ts +7 -0
- package/dist/component/Toolbar/EditorScript.js +161 -0
- package/dist/component/Toolbar/EditorVerticalAlignSelect.d.ts +7 -0
- package/dist/component/Toolbar/EditorVerticalAlignSelect.js +174 -0
- package/dist/component/Toolbar/Item.d.ts +16 -0
- package/dist/component/Toolbar/Item.js +74 -0
- package/dist/component/Toolbar/TableSizePicker.d.ts +5 -0
- package/dist/component/Toolbar/TableSizePicker.js +80 -0
- package/dist/component/Toolbar/index.d.ts +13 -0
- package/dist/component/Toolbar/index.js +13 -0
- package/dist/component/index.d.ts +3 -0
- package/dist/component/index.js +3 -0
- package/dist/contants/enums.d.ts +32 -0
- package/dist/contants/enums.js +108 -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 +14 -0
- package/dist/contants/slash-commands.js +370 -0
- package/dist/extension/component/Alert/index.d.ts +9 -0
- package/dist/extension/component/Alert/index.js +204 -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 +92 -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 +133 -0
- package/dist/extension/component/CodeBlock/index.d.ts +4 -0
- package/dist/extension/component/CodeBlock/index.js +291 -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/Iframe/Insert.d.ts +14 -0
- package/dist/extension/component/Iframe/Insert.js +112 -0
- package/dist/extension/component/Iframe/Readonly.d.ts +10 -0
- package/dist/extension/component/Iframe/Readonly.js +14 -0
- package/dist/extension/component/Iframe/index.d.ts +5 -0
- package/dist/extension/component/Iframe/index.js +290 -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 +51 -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 +111 -0
- package/dist/extension/component/Link/index.d.ts +12 -0
- package/dist/extension/component/Link/index.js +515 -0
- package/dist/extension/component/Mathematics/block/Readonly.d.ts +9 -0
- package/dist/extension/component/Mathematics/block/Readonly.js +35 -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 +33 -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/Overlay.d.ts +10 -0
- package/dist/extension/component/SlashCommandsList/Overlay.js +26 -0
- package/dist/extension/component/SlashCommandsList/index.d.ts +4 -0
- package/dist/extension/component/SlashCommandsList/index.js +266 -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 +40 -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/StructuredDiff.d.ts +18 -0
- package/dist/extension/extension/StructuredDiff.js +131 -0
- package/dist/extension/extension/index.d.ts +2 -0
- package/dist/extension/extension/index.js +2 -0
- package/dist/extension/index.d.ts +2 -0
- package/dist/extension/index.js +146 -0
- package/dist/extension/mark/Code.d.ts +2 -0
- package/dist/extension/mark/Code.js +9 -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/Alert.d.ts +33 -0
- package/dist/extension/node/Alert.js +116 -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 +42 -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/Iframe.d.ts +16 -0
- package/dist/extension/node/Iframe.js +120 -0
- package/dist/extension/node/Image.d.ts +3 -0
- package/dist/extension/node/Image.js +38 -0
- package/dist/extension/node/Indent.d.ts +17 -0
- package/dist/extension/node/Indent.js +103 -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 +462 -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 +283 -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 +20 -0
- package/dist/extension/node/index.js +20 -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 +39 -0
- package/dist/extension/suggestion/slash.js +94 -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 +555 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/themes/color.d.ts +5 -0
- package/dist/themes/color.js +4 -0
- package/dist/themes/componentStyleOverrides.d.ts +365 -0
- package/dist/themes/componentStyleOverrides.js +392 -0
- package/dist/themes/custom.d.ts +5 -0
- package/dist/themes/custom.js +4 -0
- package/dist/themes/dark.d.ts +84 -0
- package/dist/themes/dark.js +84 -0
- package/dist/themes/index.d.ts +19 -0
- package/dist/themes/index.js +37 -0
- package/dist/themes/light.d.ts +84 -0
- package/dist/themes/light.js +84 -0
- package/dist/themes/palette.d.ts +92 -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 +121 -0
- package/dist/type/index.js +1 -0
- package/dist/types/images.d.ts +19 -0
- package/dist/util/decorations.d.ts +22 -0
- package/dist/util/decorations.js +302 -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 +3 -0
- package/dist/util/floating.js +23 -0
- package/dist/util/index.d.ts +12 -0
- package/dist/util/index.js +40 -0
- package/dist/util/linewiseConvert.d.ts +40 -0
- package/dist/util/linewiseConvert.js +221 -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 +61 -0
- package/dist/util/shortcutKey.d.ts +2 -0
- package/dist/util/shortcutKey.js +9 -0
- package/dist/util/structuredDiff.d.ts +59 -0
- package/dist/util/structuredDiff.js +550 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
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 { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
8
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
export var TableOfContentsPlugin = function TableOfContentsPlugin(_ref) {
|
|
10
|
+
var getId = _ref.getId,
|
|
11
|
+
_ref$anchorTypes = _ref.anchorTypes,
|
|
12
|
+
anchorTypes = _ref$anchorTypes === void 0 ? ['heading'] : _ref$anchorTypes;
|
|
13
|
+
return new Plugin({
|
|
14
|
+
key: new PluginKey('tableOfContent'),
|
|
15
|
+
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
16
|
+
var _view;
|
|
17
|
+
// 若处于组合输入,完全避免在此事务中写入 id,交由扩展层异步生成
|
|
18
|
+
if ((_view = newState.view) !== null && _view !== void 0 && _view.composing || typeof document !== 'undefined' && document.composing || typeof window !== 'undefined' && window.compositionState) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 检查是否有任何事务包含组合相关的变化
|
|
23
|
+
var hasCompositionChanges = transactions.some(function (tr) {
|
|
24
|
+
return tr.getMeta('composition') || tr.getMeta('compositionend') || tr.getMeta('compositionstart');
|
|
25
|
+
});
|
|
26
|
+
if (hasCompositionChanges) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
var tr = newState.tr;
|
|
30
|
+
var modified = false;
|
|
31
|
+
if (transactions.some(function (transaction) {
|
|
32
|
+
return transaction.docChanged;
|
|
33
|
+
}) && !oldState.doc.eq(newState.doc)) {
|
|
34
|
+
var existingIds = [];
|
|
35
|
+
newState.doc.descendants(function (node, pos) {
|
|
36
|
+
var nodeId = node.attrs.id;
|
|
37
|
+
if (!anchorTypes.includes(node.type.name) || node.textContent.length === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (nodeId === null || nodeId === undefined || existingIds.includes(nodeId)) {
|
|
41
|
+
var id = '';
|
|
42
|
+
if (getId) {
|
|
43
|
+
id = getId(node.textContent);
|
|
44
|
+
} else {
|
|
45
|
+
id = uuidv4();
|
|
46
|
+
}
|
|
47
|
+
tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
48
|
+
id: id
|
|
49
|
+
}));
|
|
50
|
+
modified = true;
|
|
51
|
+
}
|
|
52
|
+
existingIds.push(nodeId);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return modified ? tr : null;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { Node } from '@tiptap/pm/model';
|
|
3
|
+
export type GetTableOfContentLevelFunction = (headline: {
|
|
4
|
+
node: Node;
|
|
5
|
+
pos: number;
|
|
6
|
+
}, previousItems: TableOfContentDataItem[]) => number;
|
|
7
|
+
export type GetTableOfContentIndexFunction = (headline: {
|
|
8
|
+
node: Node;
|
|
9
|
+
pos: number;
|
|
10
|
+
}, previousItems: TableOfContentDataItem[], currentLevel?: number) => number;
|
|
11
|
+
export type TableOfContentsOptions = {
|
|
12
|
+
getId?: (textContent: string) => string;
|
|
13
|
+
onUpdate?: (data: TableOfContentData, isCreate?: boolean) => void;
|
|
14
|
+
getLevel?: GetTableOfContentLevelFunction;
|
|
15
|
+
getIndex?: GetTableOfContentIndexFunction;
|
|
16
|
+
scrollParent?: (() => HTMLElement | Window) | HTMLElement | Window;
|
|
17
|
+
anchorTypes?: Array<string>;
|
|
18
|
+
};
|
|
19
|
+
export type TableOfContentsStorage = {
|
|
20
|
+
content: TableOfContentData;
|
|
21
|
+
anchors: Array<HTMLHeadingElement | HTMLElement>;
|
|
22
|
+
scrollHandler: () => void;
|
|
23
|
+
scrollPosition: number;
|
|
24
|
+
};
|
|
25
|
+
export type TableOfContentData = Array<TableOfContentDataItem>;
|
|
26
|
+
export type TableOfContentDataItem = {
|
|
27
|
+
dom: HTMLHeadingElement;
|
|
28
|
+
editor: Editor;
|
|
29
|
+
id: string;
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
isScrolledOver: boolean;
|
|
32
|
+
itemIndex: number;
|
|
33
|
+
level: number;
|
|
34
|
+
node: Node;
|
|
35
|
+
originalLevel: number;
|
|
36
|
+
pos: number;
|
|
37
|
+
textContent: string;
|
|
38
|
+
};
|
|
39
|
+
declare module '@tiptap/core' {
|
|
40
|
+
interface Commands<ReturnType> {
|
|
41
|
+
tableOfContents: {
|
|
42
|
+
updateTableOfContents: () => ReturnType;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -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 { EditorFnProps } from "../../type";
|
|
2
|
+
import { Node } from '@tiptap/core';
|
|
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;
|