@ctzhian/tiptap 1.5.0 → 1.5.2
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/package.json +1 -1
- package/dist/Editor/demo.d.ts +0 -4
- package/dist/Editor/demo.js +0 -153
- package/dist/Editor/index.d.ts +0 -4
- package/dist/Editor/index.js +0 -21
- package/dist/EditorDiff/demo.d.ts +0 -4
- package/dist/EditorDiff/demo.js +0 -12
- package/dist/EditorDiff/index.d.ts +0 -7
- package/dist/EditorDiff/index.js +0 -24
- package/dist/EditorThemeProvider/index.d.ts +0 -11
- package/dist/EditorThemeProvider/index.js +0 -90
- package/dist/EditorToolbar/index.d.ts +0 -9
- package/dist/EditorToolbar/index.js +0 -325
- package/dist/asset/css/index.css +0 -165
- package/dist/asset/images/disk.png +0 -0
- package/dist/component/CustomBubbleMenu/SelectionText.d.ts +0 -9
- package/dist/component/CustomBubbleMenu/SelectionText.js +0 -292
- package/dist/component/CustomDragHandle/index.d.ts +0 -9
- package/dist/component/CustomDragHandle/index.js +0 -1345
- package/dist/component/CustomFloatingMenu/index.d.ts +0 -0
- package/dist/component/CustomFloatingMenu/index.js +0 -85
- package/dist/component/FloatingPopover/index.d.ts +0 -15
- package/dist/component/FloatingPopover/index.js +0 -108
- package/dist/component/Icons/ai-generate-2-icon.d.ts +0 -6
- package/dist/component/Icons/ai-generate-2-icon.js +0 -13
- package/dist/component/Icons/ai-generate-text-icon.d.ts +0 -6
- package/dist/component/Icons/ai-generate-text-icon.js +0 -13
- package/dist/component/Icons/align-bottom-icon.d.ts +0 -6
- package/dist/component/Icons/align-bottom-icon.js +0 -13
- package/dist/component/Icons/align-center-icon.d.ts +0 -6
- package/dist/component/Icons/align-center-icon.js +0 -13
- package/dist/component/Icons/align-justify-icon.d.ts +0 -6
- package/dist/component/Icons/align-justify-icon.js +0 -13
- package/dist/component/Icons/align-left-icon.d.ts +0 -6
- package/dist/component/Icons/align-left-icon.js +0 -13
- package/dist/component/Icons/align-right-icon.d.ts +0 -6
- package/dist/component/Icons/align-right-icon.js +0 -13
- package/dist/component/Icons/align-top-icon.d.ts +0 -6
- package/dist/component/Icons/align-top-icon.js +0 -13
- package/dist/component/Icons/align-vertically-icon.d.ts +0 -6
- package/dist/component/Icons/align-vertically-icon.js +0 -13
- package/dist/component/Icons/anticlockwise-line-icon.d.ts +0 -6
- package/dist/component/Icons/anticlockwise-line-icon.js +0 -13
- package/dist/component/Icons/arrow-down-s-line-icon.d.ts +0 -6
- package/dist/component/Icons/arrow-down-s-line-icon.js +0 -13
- package/dist/component/Icons/arrow-go-back-line-icon.d.ts +0 -6
- package/dist/component/Icons/arrow-go-back-line-icon.js +0 -13
- package/dist/component/Icons/arrow-go-forward-line-icon.d.ts +0 -6
- package/dist/component/Icons/arrow-go-forward-line-icon.js +0 -13
- package/dist/component/Icons/arrow-left-wide-line-icon.d.ts +0 -6
- package/dist/component/Icons/arrow-left-wide-line-icon.js +0 -13
- package/dist/component/Icons/at-line-icon.d.ts +0 -6
- package/dist/component/Icons/at-line-icon.js +0 -13
- package/dist/component/Icons/attachment-2-icon.d.ts +0 -6
- package/dist/component/Icons/attachment-2-icon.js +0 -13
- package/dist/component/Icons/attachment-line-icon.d.ts +0 -6
- package/dist/component/Icons/attachment-line-icon.js +0 -13
- package/dist/component/Icons/bold-icon.d.ts +0 -6
- package/dist/component/Icons/bold-icon.js +0 -13
- package/dist/component/Icons/brush-line-icon.d.ts +0 -6
- package/dist/component/Icons/brush-line-icon.js +0 -13
- package/dist/component/Icons/carousel-view-icon.d.ts +0 -6
- package/dist/component/Icons/carousel-view-icon.js +0 -13
- package/dist/component/Icons/checkbox-blank-circle-line-icon.d.ts +0 -6
- package/dist/component/Icons/checkbox-blank-circle-line-icon.js +0 -13
- package/dist/component/Icons/checkbox-circle-fill-icon.d.ts +0 -6
- package/dist/component/Icons/checkbox-circle-fill-icon.js +0 -13
- package/dist/component/Icons/checkbox-circle-line-icon.d.ts +0 -6
- package/dist/component/Icons/checkbox-circle-line-icon.js +0 -13
- package/dist/component/Icons/clockwise-line-icon.d.ts +0 -6
- package/dist/component/Icons/clockwise-line-icon.js +0 -13
- package/dist/component/Icons/close-circle-fill-icon.d.ts +0 -6
- package/dist/component/Icons/close-circle-fill-icon.js +0 -13
- package/dist/component/Icons/code-box-line-icon.d.ts +0 -6
- package/dist/component/Icons/code-box-line-icon.js +0 -13
- package/dist/component/Icons/code-line-icon.d.ts +0 -6
- package/dist/component/Icons/code-line-icon.js +0 -13
- package/dist/component/Icons/code-s-slash-line-icon.d.ts +0 -6
- package/dist/component/Icons/code-s-slash-line-icon.js +0 -13
- package/dist/component/Icons/copy-icon.d.ts +0 -6
- package/dist/component/Icons/copy-icon.js +0 -13
- package/dist/component/Icons/custom-size-icon.d.ts +0 -6
- package/dist/component/Icons/custom-size-icon.js +0 -13
- package/dist/component/Icons/delete-column-icon.d.ts +0 -6
- package/dist/component/Icons/delete-column-icon.js +0 -13
- package/dist/component/Icons/delete-line-icon.d.ts +0 -6
- package/dist/component/Icons/delete-line-icon.js +0 -13
- package/dist/component/Icons/delete-row-icon.d.ts +0 -6
- package/dist/component/Icons/delete-row-icon.js +0 -13
- package/dist/component/Icons/double-quotes-l-icon.d.ts +0 -6
- package/dist/component/Icons/double-quotes-l-icon.js +0 -13
- package/dist/component/Icons/download-line-icon.d.ts +0 -6
- package/dist/component/Icons/download-line-icon.js +0 -13
- package/dist/component/Icons/draggable-icon.d.ts +0 -6
- package/dist/component/Icons/draggable-icon.js +0 -13
- package/dist/component/Icons/edit-box-line-icon.d.ts +0 -6
- package/dist/component/Icons/edit-box-line-icon.js +0 -13
- package/dist/component/Icons/error-warning-fill-icon.d.ts +0 -6
- package/dist/component/Icons/error-warning-fill-icon.js +0 -13
- package/dist/component/Icons/export-line-icon.d.ts +0 -6
- package/dist/component/Icons/export-line-icon.js +0 -13
- package/dist/component/Icons/file-copy-line-icon.d.ts +0 -6
- package/dist/component/Icons/file-copy-line-icon.js +0 -13
- package/dist/component/Icons/file-upload-line-icon.d.ts +0 -6
- package/dist/component/Icons/file-upload-line-icon.js +0 -13
- package/dist/component/Icons/flow-chart-icon.d.ts +0 -6
- package/dist/component/Icons/flow-chart-icon.js +0 -13
- package/dist/component/Icons/font-color-icon.d.ts +0 -6
- package/dist/component/Icons/font-color-icon.js +0 -13
- package/dist/component/Icons/font-family-icon.d.ts +0 -6
- package/dist/component/Icons/font-family-icon.js +0 -13
- package/dist/component/Icons/font-size-icon.d.ts +0 -6
- package/dist/component/Icons/font-size-icon.js +0 -13
- package/dist/component/Icons/format-clear-icon.d.ts +0 -6
- package/dist/component/Icons/format-clear-icon.js +0 -13
- package/dist/component/Icons/formula-icon.d.ts +0 -6
- package/dist/component/Icons/formula-icon.js +0 -13
- package/dist/component/Icons/fullscreen-exit-line-icon.d.ts +0 -6
- package/dist/component/Icons/fullscreen-exit-line-icon.js +0 -13
- package/dist/component/Icons/fullscreen-line-icon.d.ts +0 -6
- package/dist/component/Icons/fullscreen-line-icon.js +0 -13
- package/dist/component/Icons/functions-icon.d.ts +0 -6
- package/dist/component/Icons/functions-icon.js +0 -13
- package/dist/component/Icons/game-line-icon.d.ts +0 -6
- package/dist/component/Icons/game-line-icon.js +0 -13
- package/dist/component/Icons/h-1-icon.d.ts +0 -6
- package/dist/component/Icons/h-1-icon.js +0 -13
- package/dist/component/Icons/h-2-icon.d.ts +0 -6
- package/dist/component/Icons/h-2-icon.js +0 -13
- package/dist/component/Icons/h-3-icon.d.ts +0 -6
- package/dist/component/Icons/h-3-icon.js +0 -13
- package/dist/component/Icons/h-4-icon.d.ts +0 -6
- package/dist/component/Icons/h-4-icon.js +0 -13
- package/dist/component/Icons/h-5-icon.d.ts +0 -6
- package/dist/component/Icons/h-5-icon.js +0 -13
- package/dist/component/Icons/h-6-icon.d.ts +0 -6
- package/dist/component/Icons/h-6-icon.js +0 -13
- package/dist/component/Icons/heading-icon.d.ts +0 -6
- package/dist/component/Icons/heading-icon.js +0 -13
- package/dist/component/Icons/image-add-line-icon.d.ts +0 -6
- package/dist/component/Icons/image-add-line-icon.js +0 -13
- package/dist/component/Icons/image-line-icon.d.ts +0 -6
- package/dist/component/Icons/image-line-icon.js +0 -13
- package/dist/component/Icons/import-line-icon.d.ts +0 -6
- package/dist/component/Icons/import-line-icon.js +0 -13
- package/dist/component/Icons/indent-decrease-icon.d.ts +0 -6
- package/dist/component/Icons/indent-decrease-icon.js +0 -13
- package/dist/component/Icons/indent-increase-icon.d.ts +0 -6
- package/dist/component/Icons/indent-increase-icon.js +0 -13
- package/dist/component/Icons/index.d.ts +0 -119
- package/dist/component/Icons/index.js +0 -122
- package/dist/component/Icons/information-2-fill-icon.d.ts +0 -6
- package/dist/component/Icons/information-2-fill-icon.js +0 -13
- package/dist/component/Icons/information-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/information-2-line-icon.js +0 -13
- package/dist/component/Icons/insert-column-left-icon.d.ts +0 -6
- package/dist/component/Icons/insert-column-left-icon.js +0 -13
- package/dist/component/Icons/insert-column-right-icon.d.ts +0 -6
- package/dist/component/Icons/insert-column-right-icon.js +0 -13
- package/dist/component/Icons/insert-row-bottom-icon.d.ts +0 -6
- package/dist/component/Icons/insert-row-bottom-icon.js +0 -13
- package/dist/component/Icons/insert-row-top-icon.d.ts +0 -6
- package/dist/component/Icons/insert-row-top-icon.js +0 -13
- package/dist/component/Icons/italic-icon.d.ts +0 -6
- package/dist/component/Icons/italic-icon.js +0 -13
- package/dist/component/Icons/layout-left-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/layout-left-2-line-icon.js +0 -13
- package/dist/component/Icons/layout-top-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/layout-top-2-line-icon.js +0 -13
- package/dist/component/Icons/link-icon.d.ts +0 -6
- package/dist/component/Icons/link-icon.js +0 -13
- package/dist/component/Icons/link-unlink-icon.d.ts +0 -6
- package/dist/component/Icons/link-unlink-icon.js +0 -13
- package/dist/component/Icons/list-check-2-icon.d.ts +0 -6
- package/dist/component/Icons/list-check-2-icon.js +0 -13
- package/dist/component/Icons/list-check-3-icon.d.ts +0 -6
- package/dist/component/Icons/list-check-3-icon.js +0 -13
- package/dist/component/Icons/list-ordered-2-icon.d.ts +0 -6
- package/dist/component/Icons/list-ordered-2-icon.js +0 -13
- package/dist/component/Icons/list-unordered-icon.d.ts +0 -6
- package/dist/component/Icons/list-unordered-icon.js +0 -13
- package/dist/component/Icons/markdown-line-icon.d.ts +0 -6
- package/dist/component/Icons/markdown-line-icon.js +0 -13
- package/dist/component/Icons/markup-line-icon.d.ts +0 -6
- package/dist/component/Icons/markup-line-icon.js +0 -13
- package/dist/component/Icons/menu-fold-2-fill-icon.d.ts +0 -6
- package/dist/component/Icons/menu-fold-2-fill-icon.js +0 -13
- package/dist/component/Icons/merge-cells-horizontal-icon.d.ts +0 -6
- package/dist/component/Icons/merge-cells-horizontal-icon.js +0 -13
- package/dist/component/Icons/merge-cells-vertical-icon.d.ts +0 -6
- package/dist/component/Icons/merge-cells-vertical-icon.js +0 -13
- package/dist/component/Icons/mind-map-icon.d.ts +0 -6
- package/dist/component/Icons/mind-map-icon.js +0 -13
- package/dist/component/Icons/more-line-icon.d.ts +0 -6
- package/dist/component/Icons/more-line-icon.js +0 -13
- package/dist/component/Icons/movie-line-icon.d.ts +0 -6
- package/dist/component/Icons/movie-line-icon.js +0 -13
- package/dist/component/Icons/music-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/music-2-line-icon.js +0 -13
- package/dist/component/Icons/node-tree-icon.d.ts +0 -6
- package/dist/component/Icons/node-tree-icon.js +0 -13
- package/dist/component/Icons/notification-3-line-icon.d.ts +0 -6
- package/dist/component/Icons/notification-3-line-icon.js +0 -13
- package/dist/component/Icons/organization-chart-icon.d.ts +0 -6
- package/dist/component/Icons/organization-chart-icon.js +0 -13
- package/dist/component/Icons/pause-line-icon.d.ts +0 -6
- package/dist/component/Icons/pause-line-icon.js +0 -13
- package/dist/component/Icons/play-line-icon.d.ts +0 -6
- package/dist/component/Icons/play-line-icon.js +0 -13
- package/dist/component/Icons/question-fill-icon.d.ts +0 -6
- package/dist/component/Icons/question-fill-icon.js +0 -13
- package/dist/component/Icons/quote-text-icon.d.ts +0 -6
- package/dist/component/Icons/quote-text-icon.js +0 -13
- package/dist/component/Icons/repeat-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/repeat-2-line-icon.js +0 -13
- package/dist/component/Icons/reset-left-fill-icon.d.ts +0 -6
- package/dist/component/Icons/reset-left-fill-icon.js +0 -13
- package/dist/component/Icons/scissors-cut-line-icon.d.ts +0 -6
- package/dist/component/Icons/scissors-cut-line-icon.js +0 -13
- package/dist/component/Icons/screenshot-line-icon.d.ts +0 -6
- package/dist/component/Icons/screenshot-line-icon.js +0 -13
- package/dist/component/Icons/scroll-to-bottom-line-icon.d.ts +0 -6
- package/dist/component/Icons/scroll-to-bottom-line-icon.js +0 -13
- package/dist/component/Icons/separator-icon.d.ts +0 -6
- package/dist/component/Icons/separator-icon.js +0 -13
- package/dist/component/Icons/share-box-line-icon.d.ts +0 -6
- package/dist/component/Icons/share-box-line-icon.js +0 -13
- package/dist/component/Icons/slash-commands-2-icon.d.ts +0 -3
- package/dist/component/Icons/slash-commands-2-icon.js +0 -13
- package/dist/component/Icons/speed-line-icon.d.ts +0 -6
- package/dist/component/Icons/speed-line-icon.js +0 -13
- package/dist/component/Icons/split-cells-horizontal-icon.d.ts +0 -6
- package/dist/component/Icons/split-cells-horizontal-icon.js +0 -13
- package/dist/component/Icons/split-cells-vertical-icon.d.ts +0 -6
- package/dist/component/Icons/split-cells-vertical-icon.js +0 -13
- package/dist/component/Icons/square-root-icon.d.ts +0 -6
- package/dist/component/Icons/square-root-icon.js +0 -13
- package/dist/component/Icons/strikethrough-icon.d.ts +0 -6
- package/dist/component/Icons/strikethrough-icon.js +0 -13
- package/dist/component/Icons/subscript-icon.d.ts +0 -6
- package/dist/component/Icons/subscript-icon.js +0 -13
- package/dist/component/Icons/superscript-icon.d.ts +0 -6
- package/dist/component/Icons/superscript-icon.js +0 -13
- package/dist/component/Icons/table-2-icon.d.ts +0 -6
- package/dist/component/Icons/table-2-icon.js +0 -13
- package/dist/component/Icons/text-icon.d.ts +0 -6
- package/dist/component/Icons/text-icon.js +0 -13
- package/dist/component/Icons/text-wrap-icon.d.ts +0 -6
- package/dist/component/Icons/text-wrap-icon.js +0 -13
- package/dist/component/Icons/title-icon.d.ts +0 -6
- package/dist/component/Icons/title-icon.js +0 -13
- package/dist/component/Icons/underline-icon.d.ts +0 -6
- package/dist/component/Icons/underline-icon.js +0 -13
- package/dist/component/Icons/upload-cloud-2-line-icon.d.ts +0 -6
- package/dist/component/Icons/upload-cloud-2-line-icon.js +0 -13
- package/dist/component/Icons/upload-icon.d.ts +0 -6
- package/dist/component/Icons/upload-icon.js +0 -13
- package/dist/component/Icons/volume-mute-line-icon.d.ts +0 -6
- package/dist/component/Icons/volume-mute-line-icon.js +0 -13
- package/dist/component/Icons/volume-up-line-icon.d.ts +0 -6
- package/dist/component/Icons/volume-up-line-icon.js +0 -13
- package/dist/component/Icons/window-fill-icon.d.ts +0 -6
- package/dist/component/Icons/window-fill-icon.js +0 -13
- package/dist/component/Menu/NestedList.d.ts +0 -14
- package/dist/component/Menu/NestedList.js +0 -151
- package/dist/component/Menu/index.d.ts +0 -4
- package/dist/component/Menu/index.js +0 -84
- package/dist/component/Toolbar/EditorAlignSelect.d.ts +0 -7
- package/dist/component/Toolbar/EditorAlignSelect.js +0 -187
- package/dist/component/Toolbar/EditorCode.d.ts +0 -7
- package/dist/component/Toolbar/EditorCode.js +0 -161
- package/dist/component/Toolbar/EditorFontBgColor.d.ts +0 -7
- package/dist/component/Toolbar/EditorFontBgColor.js +0 -244
- package/dist/component/Toolbar/EditorFontColor.d.ts +0 -7
- package/dist/component/Toolbar/EditorFontColor.js +0 -246
- package/dist/component/Toolbar/EditorFontSize.d.ts +0 -7
- package/dist/component/Toolbar/EditorFontSize.js +0 -149
- package/dist/component/Toolbar/EditorHeading.d.ts +0 -7
- package/dist/component/Toolbar/EditorHeading.js +0 -185
- package/dist/component/Toolbar/EditorInsert/index.d.ts +0 -7
- package/dist/component/Toolbar/EditorInsert/index.js +0 -197
- package/dist/component/Toolbar/EditorListSelect.d.ts +0 -7
- package/dist/component/Toolbar/EditorListSelect.js +0 -174
- package/dist/component/Toolbar/EditorMath.d.ts +0 -7
- package/dist/component/Toolbar/EditorMath.js +0 -159
- package/dist/component/Toolbar/EditorMore/NotificationDialog.d.ts +0 -7
- package/dist/component/Toolbar/EditorMore/NotificationDialog.js +0 -73
- package/dist/component/Toolbar/EditorMore/index.d.ts +0 -7
- package/dist/component/Toolbar/EditorMore/index.js +0 -112
- package/dist/component/Toolbar/EditorScript.d.ts +0 -7
- package/dist/component/Toolbar/EditorScript.js +0 -161
- package/dist/component/Toolbar/EditorVerticalAlignSelect.d.ts +0 -7
- package/dist/component/Toolbar/EditorVerticalAlignSelect.js +0 -174
- package/dist/component/Toolbar/Item.d.ts +0 -16
- package/dist/component/Toolbar/Item.js +0 -74
- package/dist/component/Toolbar/TableSizePicker.d.ts +0 -5
- package/dist/component/Toolbar/TableSizePicker.js +0 -80
- package/dist/component/Toolbar/index.d.ts +0 -13
- package/dist/component/Toolbar/index.js +0 -13
- package/dist/component/index.d.ts +0 -3
- package/dist/component/index.js +0 -3
- package/dist/contants/enums.d.ts +0 -32
- package/dist/contants/enums.js +0 -108
- package/dist/contants/highlight.d.ts +0 -4
- package/dist/contants/highlight.js +0 -580
- package/dist/contants/placeholder.d.ts +0 -16
- package/dist/contants/placeholder.js +0 -16
- package/dist/contants/shortcut-key.d.ts +0 -48
- package/dist/contants/shortcut-key.js +0 -224
- package/dist/contants/slash-commands.d.ts +0 -14
- package/dist/contants/slash-commands.js +0 -370
- package/dist/extension/component/Alert/index.d.ts +0 -9
- package/dist/extension/component/Alert/index.js +0 -204
- package/dist/extension/component/Attachment/Insert.d.ts +0 -13
- package/dist/extension/component/Attachment/Insert.js +0 -222
- package/dist/extension/component/Attachment/Readonly.d.ts +0 -9
- package/dist/extension/component/Attachment/Readonly.js +0 -92
- package/dist/extension/component/Attachment/index.d.ts +0 -13
- package/dist/extension/component/Attachment/index.js +0 -317
- package/dist/extension/component/Audio/Insert.d.ts +0 -10
- package/dist/extension/component/Audio/Insert.js +0 -351
- package/dist/extension/component/Audio/Readonly.d.ts +0 -8
- package/dist/extension/component/Audio/Readonly.js +0 -428
- package/dist/extension/component/Audio/index.d.ts +0 -14
- package/dist/extension/component/Audio/index.js +0 -740
- package/dist/extension/component/CodeBlock/Readonly.d.ts +0 -4
- package/dist/extension/component/CodeBlock/Readonly.js +0 -133
- package/dist/extension/component/CodeBlock/index.d.ts +0 -4
- package/dist/extension/component/CodeBlock/index.js +0 -291
- package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
- package/dist/extension/component/CustomLink/Insert.js +0 -176
- package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
- package/dist/extension/component/CustomLink/Readonly.js +0 -106
- package/dist/extension/component/CustomLink/index.d.ts +0 -0
- package/dist/extension/component/CustomLink/index.js +0 -440
- package/dist/extension/component/EmojiList/index.d.ts +0 -14
- package/dist/extension/component/EmojiList/index.js +0 -104
- package/dist/extension/component/Iframe/Insert.d.ts +0 -14
- package/dist/extension/component/Iframe/Insert.js +0 -112
- package/dist/extension/component/Iframe/Readonly.d.ts +0 -10
- package/dist/extension/component/Iframe/Readonly.js +0 -14
- package/dist/extension/component/Iframe/index.d.ts +0 -5
- package/dist/extension/component/Iframe/index.js +0 -290
- package/dist/extension/component/Image/Crop.d.ts +0 -12
- package/dist/extension/component/Image/Crop.js +0 -218
- package/dist/extension/component/Image/Insert.d.ts +0 -10
- package/dist/extension/component/Image/Insert.js +0 -309
- package/dist/extension/component/Image/Readonly.d.ts +0 -8
- package/dist/extension/component/Image/Readonly.js +0 -51
- package/dist/extension/component/Image/index.d.ts +0 -21
- package/dist/extension/component/Image/index.js +0 -372
- package/dist/extension/component/Link/Insert.d.ts +0 -10
- package/dist/extension/component/Link/Insert.js +0 -253
- package/dist/extension/component/Link/Readonly.d.ts +0 -8
- package/dist/extension/component/Link/Readonly.js +0 -111
- package/dist/extension/component/Link/index.d.ts +0 -12
- package/dist/extension/component/Link/index.js +0 -512
- package/dist/extension/component/Mathematics/block/Readonly.d.ts +0 -9
- package/dist/extension/component/Mathematics/block/Readonly.js +0 -35
- package/dist/extension/component/Mathematics/block/index.d.ts +0 -8
- package/dist/extension/component/Mathematics/block/index.js +0 -149
- package/dist/extension/component/Mathematics/index.d.ts +0 -3
- package/dist/extension/component/Mathematics/index.js +0 -3
- package/dist/extension/component/Mathematics/inline/Readonly.d.ts +0 -9
- package/dist/extension/component/Mathematics/inline/Readonly.js +0 -33
- package/dist/extension/component/Mathematics/inline/index.d.ts +0 -8
- package/dist/extension/component/Mathematics/inline/index.js +0 -148
- package/dist/extension/component/MentionList/index.d.ts +0 -13
- package/dist/extension/component/MentionList/index.js +0 -92
- package/dist/extension/component/SlashCommandsList/index.d.ts +0 -4
- package/dist/extension/component/SlashCommandsList/index.js +0 -268
- package/dist/extension/component/Table/ContextMenu.d.ts +0 -10
- package/dist/extension/component/Table/ContextMenu.js +0 -228
- package/dist/extension/component/Table/TableContextMenuPlugin.d.ts +0 -9
- package/dist/extension/component/Table/TableContextMenuPlugin.js +0 -272
- package/dist/extension/component/Table/index.d.ts +0 -2
- package/dist/extension/component/Table/index.js +0 -2
- package/dist/extension/component/UploadProgress/index.d.ts +0 -10
- package/dist/extension/component/UploadProgress/index.js +0 -103
- package/dist/extension/component/Video/Insert.d.ts +0 -10
- package/dist/extension/component/Video/Insert.js +0 -257
- package/dist/extension/component/Video/Readonly.d.ts +0 -8
- package/dist/extension/component/Video/Readonly.js +0 -40
- package/dist/extension/component/Video/index.d.ts +0 -14
- package/dist/extension/component/Video/index.js +0 -166
- package/dist/extension/extension/SlashCommands.d.ts +0 -3
- package/dist/extension/extension/SlashCommands.js +0 -25
- package/dist/extension/extension/StructuredDiff.d.ts +0 -18
- package/dist/extension/extension/StructuredDiff.js +0 -131
- package/dist/extension/extension/index.d.ts +0 -2
- package/dist/extension/extension/index.js +0 -2
- package/dist/extension/index.d.ts +0 -2
- package/dist/extension/index.js +0 -146
- package/dist/extension/mark/Code.d.ts +0 -2
- package/dist/extension/mark/Code.js +0 -9
- package/dist/extension/mark/Link.d.ts +0 -0
- package/dist/extension/mark/Link.js +0 -58
- package/dist/extension/mark/index.d.ts +0 -0
- package/dist/extension/mark/index.js +0 -1
- package/dist/extension/node/Alert.d.ts +0 -33
- package/dist/extension/node/Alert.js +0 -116
- package/dist/extension/node/Attachment.d.ts +0 -28
- package/dist/extension/node/Attachment.js +0 -227
- package/dist/extension/node/Audio.d.ts +0 -23
- package/dist/extension/node/Audio.js +0 -194
- package/dist/extension/node/CodeBlockLowlight.d.ts +0 -1
- package/dist/extension/node/CodeBlockLowlight.js +0 -42
- package/dist/extension/node/Details.d.ts +0 -3
- package/dist/extension/node/Details.js +0 -39
- package/dist/extension/node/Emoji.d.ts +0 -1
- package/dist/extension/node/Emoji.js +0 -7
- package/dist/extension/node/FileHandler.d.ts +0 -4
- package/dist/extension/node/FileHandler.js +0 -294
- package/dist/extension/node/Iframe.d.ts +0 -16
- package/dist/extension/node/Iframe.js +0 -120
- package/dist/extension/node/Image.d.ts +0 -3
- package/dist/extension/node/Image.js +0 -38
- package/dist/extension/node/Indent.d.ts +0 -17
- package/dist/extension/node/Indent.js +0 -103
- package/dist/extension/node/Link/helpers/autolink.d.ts +0 -15
- package/dist/extension/node/Link/helpers/autolink.js +0 -162
- package/dist/extension/node/Link/helpers/clickHandler.d.ts +0 -10
- package/dist/extension/node/Link/helpers/clickHandler.js +0 -46
- package/dist/extension/node/Link/helpers/pasteHandler.d.ts +0 -10
- package/dist/extension/node/Link/helpers/pasteHandler.js +0 -32
- package/dist/extension/node/Link/helpers/whitespace.d.ts +0 -4
- package/dist/extension/node/Link/helpers/whitespace.js +0 -6
- package/dist/extension/node/Link/index.d.ts +0 -162
- package/dist/extension/node/Link/index.js +0 -461
- package/dist/extension/node/ListKit.d.ts +0 -2
- package/dist/extension/node/ListKit.js +0 -23
- package/dist/extension/node/Mathematics.d.ts +0 -27
- package/dist/extension/node/Mathematics.js +0 -97
- package/dist/extension/node/Mention.d.ts +0 -2
- package/dist/extension/node/Mention.js +0 -10
- package/dist/extension/node/Table.d.ts +0 -5
- package/dist/extension/node/Table.js +0 -283
- package/dist/extension/node/TableOfContents/index.d.ts +0 -9
- package/dist/extension/node/TableOfContents/index.js +0 -391
- package/dist/extension/node/TableOfContents/plugin.d.ts +0 -6
- package/dist/extension/node/TableOfContents/plugin.js +0 -58
- package/dist/extension/node/TableOfContents/type.d.ts +0 -45
- package/dist/extension/node/TableOfContents/type.js +0 -1
- package/dist/extension/node/TableOfContents/utils.d.ts +0 -6
- package/dist/extension/node/TableOfContents/utils.js +0 -70
- package/dist/extension/node/UploadProgress.d.ts +0 -21
- package/dist/extension/node/UploadProgress.js +0 -135
- package/dist/extension/node/VerticalAlign.d.ts +0 -49
- package/dist/extension/node/VerticalAlign.js +0 -88
- package/dist/extension/node/Video.d.ts +0 -23
- package/dist/extension/node/Video.js +0 -195
- package/dist/extension/node/Youtube.d.ts +0 -3
- package/dist/extension/node/Youtube.js +0 -14
- package/dist/extension/node/index.d.ts +0 -20
- package/dist/extension/node/index.js +0 -20
- package/dist/extension/suggestion/emoji.d.ts +0 -3
- package/dist/extension/suggestion/emoji.js +0 -57
- package/dist/extension/suggestion/mention.d.ts +0 -4
- package/dist/extension/suggestion/mention.js +0 -88
- package/dist/extension/suggestion/slash.d.ts +0 -35
- package/dist/extension/suggestion/slash.js +0 -64
- package/dist/hook/fn.d.ts +0 -13
- package/dist/hook/fn.js +0 -37
- package/dist/hook/index.d.ts +0 -4
- package/dist/hook/index.js +0 -110
- package/dist/index.css +0 -541
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/themes/color.d.ts +0 -5
- package/dist/themes/color.js +0 -4
- package/dist/themes/componentStyleOverrides.d.ts +0 -365
- package/dist/themes/componentStyleOverrides.js +0 -392
- package/dist/themes/custom.d.ts +0 -5
- package/dist/themes/custom.js +0 -4
- package/dist/themes/dark.d.ts +0 -84
- package/dist/themes/dark.js +0 -84
- package/dist/themes/index.d.ts +0 -19
- package/dist/themes/index.js +0 -37
- package/dist/themes/light.d.ts +0 -84
- package/dist/themes/light.js +0 -84
- package/dist/themes/palette.d.ts +0 -92
- package/dist/themes/palette.js +0 -24
- package/dist/themes/shadows.d.ts +0 -2
- package/dist/themes/shadows.js +0 -3
- package/dist/themes/themeContext.d.ts +0 -8
- package/dist/themes/themeContext.js +0 -3
- package/dist/themes/typography.d.ts +0 -6
- package/dist/themes/typography.js +0 -8
- package/dist/type/index.d.ts +0 -121
- package/dist/type/index.js +0 -1
- package/dist/types/images.d.ts +0 -19
- package/dist/util/decorations.d.ts +0 -22
- package/dist/util/decorations.js +0 -302
- package/dist/util/fileDownload.d.ts +0 -16
- package/dist/util/fileDownload.js +0 -268
- package/dist/util/fileHandler.d.ts +0 -7
- package/dist/util/fileHandler.js +0 -79
- package/dist/util/floating.d.ts +0 -3
- package/dist/util/floating.js +0 -23
- package/dist/util/index.d.ts +0 -12
- package/dist/util/index.js +0 -40
- package/dist/util/linewiseConvert.d.ts +0 -40
- package/dist/util/linewiseConvert.js +0 -221
- package/dist/util/migrateMathStrings.d.ts +0 -73
- package/dist/util/migrateMathStrings.js +0 -192
- package/dist/util/resourceExtractor.d.ts +0 -15
- package/dist/util/resourceExtractor.js +0 -61
- package/dist/util/shortcutKey.d.ts +0 -2
- package/dist/util/shortcutKey.js +0 -9
- package/dist/util/structuredDiff.d.ts +0 -59
- package/dist/util/structuredDiff.js +0 -550
|
@@ -1,283 +0,0 @@
|
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
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 _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; }
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
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); }
|
|
10
|
-
// @ts-nocheck
|
|
11
|
-
|
|
12
|
-
import { Extension } from '@tiptap/core';
|
|
13
|
-
import { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table';
|
|
14
|
-
import { Plugin, TextSelection } from '@tiptap/pm/state';
|
|
15
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
16
|
-
import { createTableContextMenuPlugin } from "../component/Table";
|
|
17
|
-
export var TableExtension = function TableExtension(_ref) {
|
|
18
|
-
var editable = _ref.editable;
|
|
19
|
-
return [Table.extend({
|
|
20
|
-
addCommands: function addCommands() {
|
|
21
|
-
var _this$parent;
|
|
22
|
-
return _objectSpread(_objectSpread({}, (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.call(this)), {}, {
|
|
23
|
-
cancelSelection: function cancelSelection() {
|
|
24
|
-
return function (_ref2) {
|
|
25
|
-
var state = _ref2.state,
|
|
26
|
-
dispatch = _ref2.dispatch;
|
|
27
|
-
if (dispatch) {
|
|
28
|
-
var selection = state.selection;
|
|
29
|
-
var $from = selection.$from;
|
|
30
|
-
|
|
31
|
-
// 找到当前单元格的起始和结束位置
|
|
32
|
-
var cellStart = $from.pos;
|
|
33
|
-
var cellEnd = $from.pos;
|
|
34
|
-
var depth = $from.depth;
|
|
35
|
-
|
|
36
|
-
// 向上查找直到找到表格单元格
|
|
37
|
-
while (depth > 0) {
|
|
38
|
-
var node = $from.node(depth);
|
|
39
|
-
if (node.type.name === 'tableCell' || node.type.name === 'tableHeader') {
|
|
40
|
-
cellStart = $from.start(depth);
|
|
41
|
-
cellEnd = $from.end(depth);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
depth--;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// 设置选区为单元格的最后位置(不选中文本)
|
|
48
|
-
var newSelection = TextSelection.create(state.doc, cellEnd - 1);
|
|
49
|
-
dispatch(state.tr.setSelection(newSelection));
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
57
|
-
var _this = this;
|
|
58
|
-
return {
|
|
59
|
-
'Mod-9': function Mod9() {
|
|
60
|
-
return _this.editor.commands.insertTable({
|
|
61
|
-
rows: 3,
|
|
62
|
-
cols: 4,
|
|
63
|
-
withHeaderRow: true
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
renderHTML: function renderHTML(_ref3) {
|
|
69
|
-
var _this$parent2;
|
|
70
|
-
var node = _ref3.node,
|
|
71
|
-
HTMLAttributes = _ref3.HTMLAttributes;
|
|
72
|
-
var originalRender = (_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.call(this, {
|
|
73
|
-
node: node,
|
|
74
|
-
HTMLAttributes: HTMLAttributes
|
|
75
|
-
});
|
|
76
|
-
var wrapper = ['div', {
|
|
77
|
-
class: 'tableWrapper'
|
|
78
|
-
}, originalRender];
|
|
79
|
-
return wrapper;
|
|
80
|
-
}
|
|
81
|
-
}).configure({
|
|
82
|
-
handleWidth: 5,
|
|
83
|
-
cellMinWidth: 100,
|
|
84
|
-
resizable: editable,
|
|
85
|
-
lastColumnResizable: editable,
|
|
86
|
-
allowTableNodeSelection: editable
|
|
87
|
-
}), TableHeader.configure({
|
|
88
|
-
HTMLAttributes: {
|
|
89
|
-
class: 'table-header'
|
|
90
|
-
}
|
|
91
|
-
}), TableRow.configure({
|
|
92
|
-
HTMLAttributes: {
|
|
93
|
-
class: 'table-row'
|
|
94
|
-
}
|
|
95
|
-
}), TableCell.extend({
|
|
96
|
-
addAttributes: function addAttributes() {
|
|
97
|
-
var _this$parent3;
|
|
98
|
-
return _objectSpread(_objectSpread({}, (_this$parent3 = this.parent) === null || _this$parent3 === void 0 ? void 0 : _this$parent3.call(this)), {}, {
|
|
99
|
-
bgcolor: {
|
|
100
|
-
default: 'transparent',
|
|
101
|
-
parseHTML: function parseHTML(element) {
|
|
102
|
-
return element.getAttribute('data-background-color') || element.style.backgroundColor;
|
|
103
|
-
},
|
|
104
|
-
renderHTML: function renderHTML(attributes) {
|
|
105
|
-
return {
|
|
106
|
-
'data-background-color': attributes.bgcolor,
|
|
107
|
-
style: "background-color: ".concat(attributes.bgcolor)
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
textAlign: {
|
|
112
|
-
default: null,
|
|
113
|
-
parseHTML: function parseHTML(element) {
|
|
114
|
-
return element.getAttribute('data-text-align') || element.style.textAlign;
|
|
115
|
-
},
|
|
116
|
-
renderHTML: function renderHTML(attributes) {
|
|
117
|
-
if (!attributes.textAlign) return {};
|
|
118
|
-
return {
|
|
119
|
-
style: "text-align: ".concat(attributes.textAlign),
|
|
120
|
-
'data-text-align': attributes.textAlign
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
fontSize: {
|
|
125
|
-
default: null,
|
|
126
|
-
parseHTML: function parseHTML(element) {
|
|
127
|
-
return element.getAttribute('data-font-size') || element.style.fontSize;
|
|
128
|
-
},
|
|
129
|
-
renderHTML: function renderHTML(attributes) {
|
|
130
|
-
if (!attributes.fontSize) return {};
|
|
131
|
-
return {
|
|
132
|
-
style: "font-size: ".concat(attributes.fontSize),
|
|
133
|
-
'data-font-size': attributes.fontSize
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
fontWeight: {
|
|
138
|
-
default: null,
|
|
139
|
-
parseHTML: function parseHTML(element) {
|
|
140
|
-
return element.getAttribute('data-font-weight') || element.style.fontWeight;
|
|
141
|
-
},
|
|
142
|
-
renderHTML: function renderHTML(attributes) {
|
|
143
|
-
if (!attributes.fontWeight) return {};
|
|
144
|
-
return {
|
|
145
|
-
style: "font-weight: ".concat(attributes.fontWeight),
|
|
146
|
-
'data-font-weight': attributes.fontWeight
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
153
|
-
var _this2 = this;
|
|
154
|
-
return {
|
|
155
|
-
Tab: function Tab() {
|
|
156
|
-
if (_this2.editor.commands.goToNextCell()) {
|
|
157
|
-
return _this2.editor.chain().cancelSelection().run();
|
|
158
|
-
} else if (!_this2.editor.can().addRowAfter()) {
|
|
159
|
-
return false;
|
|
160
|
-
} else {
|
|
161
|
-
return _this2.editor.chain().addRowAfter().goToNextCell().cancelSelection().run();
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
'Shift-Tab': function ShiftTab() {
|
|
165
|
-
return _this2.editor.chain().goToPreviousCell().cancelSelection().run();
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}),
|
|
170
|
-
// 表格右键菜单插件
|
|
171
|
-
Extension.create({
|
|
172
|
-
name: 'tableContextMenu',
|
|
173
|
-
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
174
|
-
return editable ? [createTableContextMenuPlugin(this.editor)] : [];
|
|
175
|
-
}
|
|
176
|
-
}),
|
|
177
|
-
// 选中表格时为 table 添加聚焦样式类名
|
|
178
|
-
Extension.create({
|
|
179
|
-
name: 'tableActiveClass',
|
|
180
|
-
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
181
|
-
if (!editable) return [];
|
|
182
|
-
return [new Plugin({
|
|
183
|
-
props: {
|
|
184
|
-
decorations: function decorations(state) {
|
|
185
|
-
var selection = state.selection,
|
|
186
|
-
doc = state.doc;
|
|
187
|
-
var $from = selection.$from;
|
|
188
|
-
// 如果当前不在表格内,移除装饰
|
|
189
|
-
// 通过向上寻找最近的 table 节点
|
|
190
|
-
for (var depth = $from.depth; depth > 0; depth--) {
|
|
191
|
-
var node = $from.node(depth);
|
|
192
|
-
if (node.type.name === 'table') {
|
|
193
|
-
var from = $from.before(depth);
|
|
194
|
-
var to = $from.after(depth);
|
|
195
|
-
var deco = Decoration.node(from, to, {
|
|
196
|
-
class: 'table-focus'
|
|
197
|
-
});
|
|
198
|
-
return DecorationSet.create(doc, [deco]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
})];
|
|
205
|
-
}
|
|
206
|
-
}),
|
|
207
|
-
// Safari 中文输入 deleteCompositionText 修复
|
|
208
|
-
Extension.create({
|
|
209
|
-
name: 'safariCompositionDeleteFix',
|
|
210
|
-
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
211
|
-
if (!editable) return [];
|
|
212
|
-
var ZERO_WIDTH_SPACE = "\u200B";
|
|
213
|
-
var isSafari = function () {
|
|
214
|
-
if (typeof navigator === 'undefined') return false;
|
|
215
|
-
var ua = navigator.userAgent;
|
|
216
|
-
var isAppleMobile = /iP(ad|hone|od)/.test(ua);
|
|
217
|
-
var isMacSafari = /Safari\//.test(ua) && !/Chrome\//.test(ua);
|
|
218
|
-
return isAppleMobile || isMacSafari;
|
|
219
|
-
}();
|
|
220
|
-
if (!isSafari) return [];
|
|
221
|
-
|
|
222
|
-
// 注意:这里不能使用上面从 ProseMirror 导入的 Node 类型,需判断 DOM 文本节点
|
|
223
|
-
var isTextNode = function isTextNode(node) {
|
|
224
|
-
return !!node && node.nodeType === 3;
|
|
225
|
-
};
|
|
226
|
-
return [new Plugin({
|
|
227
|
-
props: {
|
|
228
|
-
handleDOMEvents: {
|
|
229
|
-
beforeinput: function beforeinput(_view, event) {
|
|
230
|
-
// 仅处理 Safari 在中文合成结束后触发的删除合成文本行为
|
|
231
|
-
if (event.inputType !== 'deleteCompositionText') {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
var selection = window.getSelection();
|
|
235
|
-
if (!selection || selection.rangeCount === 0) return false;
|
|
236
|
-
var range = selection.getRangeAt(0);
|
|
237
|
-
var startContainer = range.startContainer,
|
|
238
|
-
endContainer = range.endContainer,
|
|
239
|
-
startOffset = range.startOffset,
|
|
240
|
-
endOffset = range.endOffset;
|
|
241
|
-
if (isTextNode(startContainer) && startContainer === endContainer && startOffset === 0 && endOffset === startContainer.length) {
|
|
242
|
-
var _startContainer$paren;
|
|
243
|
-
(_startContainer$paren = startContainer.parentElement) === null || _startContainer$paren === void 0 || _startContainer$paren.insertBefore(document.createTextNode(ZERO_WIDTH_SPACE), startContainer);
|
|
244
|
-
}
|
|
245
|
-
// 让 ProseMirror 照常处理
|
|
246
|
-
return false;
|
|
247
|
-
},
|
|
248
|
-
input: function input(_view, event) {
|
|
249
|
-
if (event.inputType !== 'deleteCompositionText') {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
var selection = window.getSelection();
|
|
253
|
-
if (!selection || selection.rangeCount === 0) return false;
|
|
254
|
-
var range = selection.getRangeAt(0);
|
|
255
|
-
var node = range.startContainer;
|
|
256
|
-
var parentEl = (node === null || node === void 0 ? void 0 : node.parentElement) || null;
|
|
257
|
-
if (!parentEl) return false;
|
|
258
|
-
var textNodes = Array.from(parentEl.childNodes).filter(isTextNode);
|
|
259
|
-
var _iterator = _createForOfIteratorHelper(textNodes),
|
|
260
|
-
_step;
|
|
261
|
-
try {
|
|
262
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
263
|
-
var textNode = _step.value;
|
|
264
|
-
if (textNode.textContent === ZERO_WIDTH_SPACE) {
|
|
265
|
-
textNode.remove();
|
|
266
|
-
} else if (textNode.textContent && textNode.textContent.includes(ZERO_WIDTH_SPACE)) {
|
|
267
|
-
textNode.textContent = textNode.textContent.split(ZERO_WIDTH_SPACE).join('');
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
} catch (err) {
|
|
271
|
-
_iterator.e(err);
|
|
272
|
-
} finally {
|
|
273
|
-
_iterator.f();
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
})];
|
|
280
|
-
}
|
|
281
|
-
})];
|
|
282
|
-
};
|
|
283
|
-
export default TableExtension;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { TocList } from "../../../type";
|
|
3
|
-
import type { TableOfContentsOptions, TableOfContentsStorage } from './type';
|
|
4
|
-
export * from './type';
|
|
5
|
-
export declare const TableOfContentsExtension: Extension<TableOfContentsOptions, TableOfContentsStorage>;
|
|
6
|
-
export declare const TableOfContents: ({ onTocUpdate }: {
|
|
7
|
-
onTocUpdate?: ((toc: TocList) => void) | undefined;
|
|
8
|
-
}) => Extension<TableOfContentsOptions, TableOfContentsStorage>;
|
|
9
|
-
export default TableOfContents;
|
|
@@ -1,391 +0,0 @@
|
|
|
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 { Extension } from '@tiptap/core';
|
|
8
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
-
import { TableOfContentsPlugin } from "./plugin";
|
|
10
|
-
import { getHeadlineLevel, getHierarchicalIndexes, getLinearIndexes } from "./utils";
|
|
11
|
-
export * from "./type";
|
|
12
|
-
|
|
13
|
-
// 全局组合状态管理,避免在 IME 组合期间触发 TOC 更新
|
|
14
|
-
var globalCompositionState = false;
|
|
15
|
-
var globalCompositionEndTimer = null;
|
|
16
|
-
var globalInputTimer = null;
|
|
17
|
-
var lastInputTime = 0;
|
|
18
|
-
|
|
19
|
-
// 全局监听组合状态和输入事件
|
|
20
|
-
if (typeof document !== 'undefined') {
|
|
21
|
-
document.addEventListener('compositionstart', function () {
|
|
22
|
-
globalCompositionState = true;
|
|
23
|
-
}, {
|
|
24
|
-
passive: true
|
|
25
|
-
});
|
|
26
|
-
document.addEventListener('compositionend', function () {
|
|
27
|
-
globalCompositionState = false;
|
|
28
|
-
// 组合结束后,延迟刷新所有 TOC 实例
|
|
29
|
-
if (globalCompositionEndTimer) {
|
|
30
|
-
clearTimeout(globalCompositionEndTimer);
|
|
31
|
-
}
|
|
32
|
-
globalCompositionEndTimer = setTimeout(function () {
|
|
33
|
-
// 这里会通过 editor 实例来触发刷新
|
|
34
|
-
// 具体实现在 onTransaction 中处理
|
|
35
|
-
}, 200);
|
|
36
|
-
}, {
|
|
37
|
-
passive: true
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// 监听所有输入事件,记录最后输入时间
|
|
41
|
-
document.addEventListener('input', function () {
|
|
42
|
-
lastInputTime = Date.now();
|
|
43
|
-
}, {
|
|
44
|
-
passive: true
|
|
45
|
-
});
|
|
46
|
-
document.addEventListener('keydown', function () {
|
|
47
|
-
lastInputTime = Date.now();
|
|
48
|
-
}, {
|
|
49
|
-
passive: true
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
var addTocActiveStatesAndGetItems = function addTocActiveStatesAndGetItems(content, options) {
|
|
53
|
-
var editor = options.editor;
|
|
54
|
-
var headlines = [];
|
|
55
|
-
var scrolledOverIds = [];
|
|
56
|
-
var activeId = null;
|
|
57
|
-
if (editor.isDestroyed) {
|
|
58
|
-
return content;
|
|
59
|
-
}
|
|
60
|
-
editor.state.doc.descendants(function (node, pos) {
|
|
61
|
-
var _options$anchorTypes;
|
|
62
|
-
var isValidType = (_options$anchorTypes = options.anchorTypes) === null || _options$anchorTypes === void 0 ? void 0 : _options$anchorTypes.includes(node.type.name);
|
|
63
|
-
if (!isValidType) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
headlines.push({
|
|
67
|
-
node: node,
|
|
68
|
-
pos: pos
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
headlines.forEach(function (headline) {
|
|
72
|
-
var domElement = editor.view.domAtPos(headline.pos + 1).node;
|
|
73
|
-
var scrolledOver = options.storage.scrollPosition >= domElement.offsetTop;
|
|
74
|
-
if (scrolledOver) {
|
|
75
|
-
activeId = headline.node.attrs.id;
|
|
76
|
-
scrolledOverIds.push(headline.node.attrs.id);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return content.map(function (heading) {
|
|
80
|
-
return _objectSpread(_objectSpread({}, heading), {}, {
|
|
81
|
-
isActive: heading.id === activeId,
|
|
82
|
-
isScrolledOver: scrolledOverIds.includes(heading.id)
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
var setTocData = function setTocData(options) {
|
|
87
|
-
var editor = options.editor,
|
|
88
|
-
onUpdate = options.onUpdate;
|
|
89
|
-
if (editor.isDestroyed) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
var headlines = [];
|
|
93
|
-
var anchors = [];
|
|
94
|
-
var anchorEls = [];
|
|
95
|
-
editor.state.doc.descendants(function (node, pos) {
|
|
96
|
-
var _options$anchorTypes2;
|
|
97
|
-
var isValidType = (_options$anchorTypes2 = options.anchorTypes) === null || _options$anchorTypes2 === void 0 ? void 0 : _options$anchorTypes2.includes(node.type.name);
|
|
98
|
-
if (!isValidType) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
headlines.push({
|
|
102
|
-
node: node,
|
|
103
|
-
pos: pos
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
headlines.forEach(function (headline, i) {
|
|
107
|
-
if (headline.node.textContent.length === 0) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
var domElement = editor.view.domAtPos(headline.pos + 1).node;
|
|
111
|
-
var scrolledOver = options.storage.scrollPosition >= domElement.offsetTop;
|
|
112
|
-
anchorEls.push(domElement);
|
|
113
|
-
var originalLevel = headline.node.attrs.level;
|
|
114
|
-
var level = options.getLevelFn(headline, anchors);
|
|
115
|
-
var itemIndex = options.getIndexFn(headline, anchors, level);
|
|
116
|
-
anchors.push({
|
|
117
|
-
itemIndex: itemIndex,
|
|
118
|
-
id: headline.node.attrs.id || options.getId(headline.node.textContent),
|
|
119
|
-
originalLevel: originalLevel,
|
|
120
|
-
level: level,
|
|
121
|
-
textContent: headline.node.textContent,
|
|
122
|
-
pos: headline.pos,
|
|
123
|
-
editor: editor,
|
|
124
|
-
isActive: false,
|
|
125
|
-
isScrolledOver: scrolledOver,
|
|
126
|
-
node: headline.node,
|
|
127
|
-
dom: domElement
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// 计算 active 和 scrolledOver 状态
|
|
132
|
-
anchors = addTocActiveStatesAndGetItems(anchors, {
|
|
133
|
-
editor: options.editor,
|
|
134
|
-
anchorTypes: options.anchorTypes,
|
|
135
|
-
storage: options.storage
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// 更新存储
|
|
139
|
-
options.storage.anchors = anchorEls;
|
|
140
|
-
options.storage.content = anchors;
|
|
141
|
-
|
|
142
|
-
// 调用回调
|
|
143
|
-
if (onUpdate) {
|
|
144
|
-
var isInitialCreation = options.storage.content.length === 0;
|
|
145
|
-
onUpdate(anchors, isInitialCreation);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
export var TableOfContentsExtension = Extension.create({
|
|
149
|
-
name: 'tableOfContents',
|
|
150
|
-
addStorage: function addStorage() {
|
|
151
|
-
return {
|
|
152
|
-
content: [],
|
|
153
|
-
anchors: [],
|
|
154
|
-
scrollHandler: function scrollHandler() {
|
|
155
|
-
return null;
|
|
156
|
-
},
|
|
157
|
-
scrollPosition: 0
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
addGlobalAttributes: function addGlobalAttributes() {
|
|
161
|
-
return [{
|
|
162
|
-
types: this.options.anchorTypes || ['heading'],
|
|
163
|
-
attributes: {
|
|
164
|
-
id: {
|
|
165
|
-
default: null,
|
|
166
|
-
renderHTML: function renderHTML(attributes) {
|
|
167
|
-
return {
|
|
168
|
-
id: attributes.id
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
parseHTML: function parseHTML(element) {
|
|
172
|
-
return element.id || null;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}];
|
|
177
|
-
},
|
|
178
|
-
addOptions: function addOptions() {
|
|
179
|
-
var defaultScrollParent = typeof window !== 'undefined' ? function () {
|
|
180
|
-
return window;
|
|
181
|
-
} : undefined;
|
|
182
|
-
return {
|
|
183
|
-
// eslint-disable-next-line
|
|
184
|
-
onUpdate: function onUpdate() {},
|
|
185
|
-
// eslint-disable-next-line
|
|
186
|
-
getId: function getId(_textContent) {
|
|
187
|
-
return uuidv4();
|
|
188
|
-
},
|
|
189
|
-
scrollParent: defaultScrollParent,
|
|
190
|
-
anchorTypes: ['heading']
|
|
191
|
-
};
|
|
192
|
-
},
|
|
193
|
-
addCommands: function addCommands() {
|
|
194
|
-
var _this = this;
|
|
195
|
-
return {
|
|
196
|
-
updateTableOfContents: function updateTableOfContents() {
|
|
197
|
-
return function (_ref) {
|
|
198
|
-
var dispatch = _ref.dispatch;
|
|
199
|
-
if (dispatch) {
|
|
200
|
-
var _this$options$onUpdat;
|
|
201
|
-
setTocData({
|
|
202
|
-
editor: _this.editor,
|
|
203
|
-
storage: _this.storage,
|
|
204
|
-
onUpdate: (_this$options$onUpdat = _this.options.onUpdate) === null || _this$options$onUpdat === void 0 ? void 0 : _this$options$onUpdat.bind(_this),
|
|
205
|
-
getIndexFn: _this.options.getIndex || getLinearIndexes,
|
|
206
|
-
getLevelFn: _this.options.getLevel || getHeadlineLevel,
|
|
207
|
-
anchorTypes: _this.options.anchorTypes,
|
|
208
|
-
getId: _this.options.getId || function (textContent) {
|
|
209
|
-
return uuidv4();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
return true;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
onTransaction: function onTransaction(_ref2) {
|
|
219
|
-
var _this2 = this;
|
|
220
|
-
var transaction = _ref2.transaction;
|
|
221
|
-
if (!transaction.docChanged) return;
|
|
222
|
-
var now = Date.now();
|
|
223
|
-
var timeSinceLastInput = now - lastInputTime;
|
|
224
|
-
|
|
225
|
-
// 组合期间完全不处理 TOC 更新,避免打断输入
|
|
226
|
-
if (globalCompositionState || this.editor.view.composing) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// 如果最近有输入(1秒内),延迟处理
|
|
231
|
-
if (timeSinceLastInput < 1000) {
|
|
232
|
-
if (globalInputTimer) {
|
|
233
|
-
clearTimeout(globalInputTimer);
|
|
234
|
-
}
|
|
235
|
-
globalInputTimer = setTimeout(function () {
|
|
236
|
-
// 再次检查组合状态
|
|
237
|
-
if (!globalCompositionState && !_this2.editor.view.composing) {
|
|
238
|
-
var _this2$options$onUpda;
|
|
239
|
-
setTocData({
|
|
240
|
-
editor: _this2.editor,
|
|
241
|
-
storage: _this2.storage,
|
|
242
|
-
onUpdate: (_this2$options$onUpda = _this2.options.onUpdate) === null || _this2$options$onUpda === void 0 ? void 0 : _this2$options$onUpda.bind(_this2),
|
|
243
|
-
getIndexFn: _this2.options.getIndex || getLinearIndexes,
|
|
244
|
-
getLevelFn: _this2.options.getLevel || getHeadlineLevel,
|
|
245
|
-
anchorTypes: _this2.options.anchorTypes,
|
|
246
|
-
getId: _this2.options.getId || function (textContent) {
|
|
247
|
-
return uuidv4();
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}, 1000 - timeSinceLastInput + 200);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// 非组合期间且无最近输入,使用 setTimeout 确保有足够延迟
|
|
256
|
-
setTimeout(function () {
|
|
257
|
-
// 再次检查,确保组合状态没有变化
|
|
258
|
-
if (!globalCompositionState && !_this2.editor.view.composing) {
|
|
259
|
-
var _this2$options$onUpda2;
|
|
260
|
-
setTocData({
|
|
261
|
-
editor: _this2.editor,
|
|
262
|
-
storage: _this2.storage,
|
|
263
|
-
onUpdate: (_this2$options$onUpda2 = _this2.options.onUpdate) === null || _this2$options$onUpda2 === void 0 ? void 0 : _this2$options$onUpda2.bind(_this2),
|
|
264
|
-
getIndexFn: _this2.options.getIndex || getLinearIndexes,
|
|
265
|
-
getLevelFn: _this2.options.getLevel || getHeadlineLevel,
|
|
266
|
-
anchorTypes: _this2.options.anchorTypes,
|
|
267
|
-
getId: _this2.options.getId || function (textContent) {
|
|
268
|
-
return uuidv4();
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}, 100);
|
|
273
|
-
},
|
|
274
|
-
onCreate: function onCreate() {
|
|
275
|
-
var _this3 = this;
|
|
276
|
-
var tr = this.editor.state.tr;
|
|
277
|
-
var existingIds = [];
|
|
278
|
-
if (this.options.scrollParent && typeof this.options.scrollParent !== 'function') {
|
|
279
|
-
console.warn("[Tiptap Table of Contents Deprecation Notice]: The 'scrollParent' option must now be provided as a callback function that returns the 'scrollParent' element. The ability to pass this option directly will be deprecated in future releases.");
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// 异步处理初始 ID 分配,避免与初始输入竞争
|
|
283
|
-
requestAnimationFrame(function () {
|
|
284
|
-
_this3.editor.state.doc.descendants(function (node, pos) {
|
|
285
|
-
var _this3$options$anchor;
|
|
286
|
-
var nodeId = node.attrs.id;
|
|
287
|
-
var isValidType = (_this3$options$anchor = _this3.options.anchorTypes) === null || _this3$options$anchor === void 0 ? void 0 : _this3$options$anchor.includes(node.type.name);
|
|
288
|
-
if (!isValidType || node.textContent.length === 0) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
if (nodeId === null || nodeId === undefined || existingIds.includes(nodeId)) {
|
|
292
|
-
var id = '';
|
|
293
|
-
if (_this3.options.getId) {
|
|
294
|
-
id = _this3.options.getId(node.textContent);
|
|
295
|
-
} else {
|
|
296
|
-
id = uuidv4();
|
|
297
|
-
}
|
|
298
|
-
tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
299
|
-
id: id
|
|
300
|
-
}));
|
|
301
|
-
}
|
|
302
|
-
existingIds.push(nodeId);
|
|
303
|
-
});
|
|
304
|
-
_this3.editor.view.dispatch(tr);
|
|
305
|
-
|
|
306
|
-
// 延迟初始化 TOC 数据
|
|
307
|
-
setTimeout(function () {
|
|
308
|
-
var _this3$options$onUpda;
|
|
309
|
-
setTocData({
|
|
310
|
-
editor: _this3.editor,
|
|
311
|
-
storage: _this3.storage,
|
|
312
|
-
onUpdate: (_this3$options$onUpda = _this3.options.onUpdate) === null || _this3$options$onUpda === void 0 ? void 0 : _this3$options$onUpda.bind(_this3),
|
|
313
|
-
getIndexFn: _this3.options.getIndex || getLinearIndexes,
|
|
314
|
-
getLevelFn: _this3.options.getLevel || getHeadlineLevel,
|
|
315
|
-
anchorTypes: _this3.options.anchorTypes,
|
|
316
|
-
getId: _this3.options.getId || function (textContent) {
|
|
317
|
-
return uuidv4();
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}, 100);
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
// 防抖的 scroll handler,避免滚动期间频繁触发回调
|
|
324
|
-
var scrollTimer = null;
|
|
325
|
-
this.storage.scrollHandler = function () {
|
|
326
|
-
if (!_this3.options.scrollParent) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
var scrollParent = typeof _this3.options.scrollParent === 'function' ? _this3.options.scrollParent() : _this3.options.scrollParent;
|
|
330
|
-
var scrollPosition = scrollParent instanceof HTMLElement ? scrollParent.scrollTop : scrollParent.scrollY;
|
|
331
|
-
_this3.storage.scrollPosition = scrollPosition || 0;
|
|
332
|
-
if (scrollTimer) clearTimeout(scrollTimer);
|
|
333
|
-
scrollTimer = setTimeout(function () {
|
|
334
|
-
var _this3$options$onUpda2, _this3$options;
|
|
335
|
-
var updatedItems = addTocActiveStatesAndGetItems(_this3.storage.content, {
|
|
336
|
-
editor: _this3.editor,
|
|
337
|
-
anchorTypes: _this3.options.anchorTypes,
|
|
338
|
-
storage: _this3.storage
|
|
339
|
-
});
|
|
340
|
-
_this3.storage.content = updatedItems;
|
|
341
|
-
// 调用 onUpdate 回调
|
|
342
|
-
(_this3$options$onUpda2 = (_this3$options = _this3.options).onUpdate) === null || _this3$options$onUpda2 === void 0 || _this3$options$onUpda2.call(_this3$options, updatedItems, false);
|
|
343
|
-
}, 100);
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
// 添加滚动监听
|
|
347
|
-
if (this.options.scrollParent) {
|
|
348
|
-
var scrollParent = typeof this.options.scrollParent === 'function' ? this.options.scrollParent() : this.options.scrollParent;
|
|
349
|
-
if (scrollParent) {
|
|
350
|
-
scrollParent.addEventListener('scroll', this.storage.scrollHandler);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
onDestroy: function onDestroy() {
|
|
355
|
-
if (this.options.scrollParent) {
|
|
356
|
-
var scrollParent = typeof this.options.scrollParent === 'function' ? this.options.scrollParent() : this.options.scrollParent;
|
|
357
|
-
if (scrollParent) {
|
|
358
|
-
scrollParent.removeEventListener('scroll', this.storage.scrollHandler);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
363
|
-
return [TableOfContentsPlugin({
|
|
364
|
-
getId: this.options.getId,
|
|
365
|
-
anchorTypes: this.options.anchorTypes
|
|
366
|
-
})];
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
export var TableOfContents = function TableOfContents(_ref3) {
|
|
370
|
-
var onTocUpdate = _ref3.onTocUpdate;
|
|
371
|
-
return TableOfContentsExtension.configure({
|
|
372
|
-
getIndex: getHierarchicalIndexes,
|
|
373
|
-
onUpdate: function onUpdate(data) {
|
|
374
|
-
setTimeout(function () {
|
|
375
|
-
onTocUpdate === null || onTocUpdate === void 0 || onTocUpdate(data.map(function (content) {
|
|
376
|
-
return {
|
|
377
|
-
id: content.id,
|
|
378
|
-
isActive: content.isActive,
|
|
379
|
-
isScrolledOver: content.isScrolledOver,
|
|
380
|
-
itemIndex: content.itemIndex,
|
|
381
|
-
level: content.level,
|
|
382
|
-
originalLevel: content.originalLevel,
|
|
383
|
-
pos: content.pos,
|
|
384
|
-
textContent: content.textContent
|
|
385
|
-
};
|
|
386
|
-
}));
|
|
387
|
-
}, 0);
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
};
|
|
391
|
-
export default TableOfContents;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@tiptap/pm/model';
|
|
2
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
3
|
-
export declare const TableOfContentsPlugin: ({ getId, anchorTypes, }: {
|
|
4
|
-
getId?: ((textContent: string) => string) | undefined;
|
|
5
|
-
anchorTypes?: (string | NodeType)[] | undefined;
|
|
6
|
-
}) => Plugin<any>;
|