adtec-core-package 3.0.0 → 3.0.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/auto-imports.d.ts +299 -0
- package/package.json +93 -49
- package/prebuilt/umo-editor/favicon.ico +0 -0
- package/prebuilt/umo-editor/umo-editor.css +1 -0
- package/prebuilt/umo-editor/umo-editor.js +86138 -0
- package/prebuilt/umo-editor/umo-editor.js.map +1 -0
- package/scripts/build-umo.mjs +47 -0
- package/scripts/generate-umo-entry.mjs +81 -0
- package/scripts/inject-umo-composable-imports.mjs +66 -0
- package/scripts/patch-es-drager-vue35.mjs +68 -0
- package/scripts/patch-tiptap-vue3.mjs +117 -0
- package/scripts/prepare-umo-source.mjs +122 -0
- package/src/components/RichTextEditor/RichTextEditor.vue +566 -398
- package/src/components/RichTextEditor/installUmoEditorApp.ts +31 -0
- package/src/components/RichTextEditor/richTextHtmlUtils.ts +151 -17
- package/src/components/RichTextEditor/umo-editor.d.ts +9 -0
- package/src/components/editor-main/src/assets/icons/align-center.svg +1 -0
- package/src/components/editor-main/src/assets/icons/align-distributed.svg +1 -0
- package/src/components/editor-main/src/assets/icons/align-justify.svg +1 -0
- package/src/components/editor-main/src/assets/icons/align-left.svg +1 -0
- package/src/components/editor-main/src/assets/icons/align-right.svg +1 -0
- package/src/components/editor-main/src/assets/icons/arrow-down.svg +1 -0
- package/src/components/editor-main/src/assets/icons/audio.svg +1 -0
- package/src/components/editor-main/src/assets/icons/auto-width.svg +1 -0
- package/src/components/editor-main/src/assets/icons/background-color.svg +1 -0
- package/src/components/editor-main/src/assets/icons/barcode.svg +1 -0
- package/src/components/editor-main/src/assets/icons/block-add.svg +1 -0
- package/src/components/editor-main/src/assets/icons/block-menu.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bold.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bookmark.svg +10 -0
- package/src/components/editor-main/src/assets/icons/border-none.svg +1 -0
- package/src/components/editor-main/src/assets/icons/border.svg +1 -0
- package/src/components/editor-main/src/assets/icons/break-marks.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bullet-list-2.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bullet-list-circle.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bullet-list-disc.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bullet-list-square.svg +1 -0
- package/src/components/editor-main/src/assets/icons/bullet-list.svg +1 -0
- package/src/components/editor-main/src/assets/icons/callout.svg +1 -0
- package/src/components/editor-main/src/assets/icons/check.svg +1 -0
- package/src/components/editor-main/src/assets/icons/checkbox.svg +1 -0
- package/src/components/editor-main/src/assets/icons/chinese-case.svg +1 -0
- package/src/components/editor-main/src/assets/icons/clear-cache.svg +1 -0
- package/src/components/editor-main/src/assets/icons/clear-format.svg +1 -0
- package/src/components/editor-main/src/assets/icons/clickable.svg +1 -0
- package/src/components/editor-main/src/assets/icons/close.svg +1 -0
- package/src/components/editor-main/src/assets/icons/code-block.svg +1 -0
- package/src/components/editor-main/src/assets/icons/code-line-number.svg +1 -0
- package/src/components/editor-main/src/assets/icons/code-word-wrap.svg +1 -0
- package/src/components/editor-main/src/assets/icons/code.svg +1 -0
- package/src/components/editor-main/src/assets/icons/color.svg +1 -0
- package/src/components/editor-main/src/assets/icons/columns.svg +1 -0
- package/src/components/editor-main/src/assets/icons/copy.svg +1 -0
- package/src/components/editor-main/src/assets/icons/copyright.svg +1 -0
- package/src/components/editor-main/src/assets/icons/date.svg +1 -0
- package/src/components/editor-main/src/assets/icons/details.svg +1 -0
- package/src/components/editor-main/src/assets/icons/diagrams.svg +1 -0
- package/src/components/editor-main/src/assets/icons/download.svg +1 -0
- package/src/components/editor-main/src/assets/icons/echarts.svg +1 -0
- package/src/components/editor-main/src/assets/icons/edit.svg +1 -0
- package/src/components/editor-main/src/assets/icons/embed.svg +1 -0
- package/src/components/editor-main/src/assets/icons/emoji.svg +1 -0
- package/src/components/editor-main/src/assets/icons/equal-proportion.svg +1 -0
- package/src/components/editor-main/src/assets/icons/exit.svg +1 -0
- package/src/components/editor-main/src/assets/icons/expand-down.svg +1 -0
- package/src/components/editor-main/src/assets/icons/file-view.svg +1 -0
- package/src/components/editor-main/src/assets/icons/file.svg +1 -0
- package/src/components/editor-main/src/assets/icons/font-size-decrease.svg +1 -0
- package/src/components/editor-main/src/assets/icons/font-size-increase.svg +1 -0
- package/src/components/editor-main/src/assets/icons/footnote.svg +1 -0
- package/src/components/editor-main/src/assets/icons/format-painter.svg +1 -0
- package/src/components/editor-main/src/assets/icons/format.svg +1 -0
- package/src/components/editor-main/src/assets/icons/full-screen-exit.svg +1 -0
- package/src/components/editor-main/src/assets/icons/full-screen.svg +1 -0
- package/src/components/editor-main/src/assets/icons/hand-drawn.svg +1 -0
- package/src/components/editor-main/src/assets/icons/hard-break.svg +1 -0
- package/src/components/editor-main/src/assets/icons/heading.svg +1 -0
- package/src/components/editor-main/src/assets/icons/help.svg +1 -0
- package/src/components/editor-main/src/assets/icons/hide-toolbar.svg +1 -0
- package/src/components/editor-main/src/assets/icons/highlight.svg +1 -0
- package/src/components/editor-main/src/assets/icons/hr.svg +1 -0
- package/src/components/editor-main/src/assets/icons/html5.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-draggable.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-failed.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-flip.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-inline.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-preview.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-remove-background.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-reset.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image-rotate.svg +1 -0
- package/src/components/editor-main/src/assets/icons/image.svg +1 -0
- package/src/components/editor-main/src/assets/icons/indent.svg +1 -0
- package/src/components/editor-main/src/assets/icons/italic.svg +1 -0
- package/src/components/editor-main/src/assets/icons/laser-pointer.svg +1 -0
- package/src/components/editor-main/src/assets/icons/layout-page.svg +1 -0
- package/src/components/editor-main/src/assets/icons/layout-web.svg +1 -0
- package/src/components/editor-main/src/assets/icons/letter-spacing.svg +1 -0
- package/src/components/editor-main/src/assets/icons/line-height.svg +1 -0
- package/src/components/editor-main/src/assets/icons/line-number.svg +1 -0
- package/src/components/editor-main/src/assets/icons/link.svg +1 -0
- package/src/components/editor-main/src/assets/icons/loading.svg +1 -0
- package/src/components/editor-main/src/assets/icons/locale.svg +1 -0
- package/src/components/editor-main/src/assets/icons/margin.svg +1 -0
- package/src/components/editor-main/src/assets/icons/markdown.svg +1 -0
- package/src/components/editor-main/src/assets/icons/math.svg +1 -0
- package/src/components/editor-main/src/assets/icons/mention.svg +1 -0
- package/src/components/editor-main/src/assets/icons/menu.svg +1 -0
- package/src/components/editor-main/src/assets/icons/mermaid.svg +1 -0
- package/src/components/editor-main/src/assets/icons/mind-map.svg +1 -0
- package/src/components/editor-main/src/assets/icons/minus.svg +1 -0
- package/src/components/editor-main/src/assets/icons/new-window.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-add.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-clear-format.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-copy.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-cut.svg +2 -0
- package/src/components/editor-main/src/assets/icons/node-delete-2.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-delete.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-duplicate.svg +1 -0
- package/src/components/editor-main/src/assets/icons/node-switch.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-2.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-decimal-leading-zero.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-decimal.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-lower-latin.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-lower-roman.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-simp-chinese-formal.svg +12 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-trad-chinese-informal.svg +12 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-upper-latin.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list-upper-roman.svg +1 -0
- package/src/components/editor-main/src/assets/icons/ordered-list.svg +1 -0
- package/src/components/editor-main/src/assets/icons/outdent.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-background.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-break.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-footer.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-header.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-margin.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-orientation.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page-size.svg +1 -0
- package/src/components/editor-main/src/assets/icons/page.svg +1 -0
- package/src/components/editor-main/src/assets/icons/palette-color.svg +1 -0
- package/src/components/editor-main/src/assets/icons/paragraph.svg +1 -0
- package/src/components/editor-main/src/assets/icons/pdf.svg +1 -0
- package/src/components/editor-main/src/assets/icons/plus.svg +1 -0
- package/src/components/editor-main/src/assets/icons/preview.svg +1 -0
- package/src/components/editor-main/src/assets/icons/print.svg +1 -0
- package/src/components/editor-main/src/assets/icons/qrcode.svg +1 -0
- package/src/components/editor-main/src/assets/icons/quote.svg +1 -0
- package/src/components/editor-main/src/assets/icons/redo.svg +1 -0
- package/src/components/editor-main/src/assets/icons/register.js +47 -0
- package/src/components/editor-main/src/assets/icons/reload.svg +1 -0
- package/src/components/editor-main/src/assets/icons/remove.svg +1 -0
- package/src/components/editor-main/src/assets/icons/reply.svg +1 -0
- package/src/components/editor-main/src/assets/icons/search-replace.svg +1 -0
- package/src/components/editor-main/src/assets/icons/select-all.svg +1 -0
- package/src/components/editor-main/src/assets/icons/selected.svg +1 -0
- package/src/components/editor-main/src/assets/icons/setting.svg +1 -0
- package/src/components/editor-main/src/assets/icons/share.svg +1 -0
- package/src/components/editor-main/src/assets/icons/shortcut.svg +1 -0
- package/src/components/editor-main/src/assets/icons/signature.svg +1 -0
- package/src/components/editor-main/src/assets/icons/skin.svg +1 -0
- package/src/components/editor-main/src/assets/icons/spellcheck.svg +1 -0
- package/src/components/editor-main/src/assets/icons/strike.svg +1 -0
- package/src/components/editor-main/src/assets/icons/subscript.svg +1 -0
- package/src/components/editor-main/src/assets/icons/superscript.svg +1 -0
- package/src/components/editor-main/src/assets/icons/symbol.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-add-column-after.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-add-column-before.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-add-row-after.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-add-row-before.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-cells-align.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-cells-background.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-delete-column.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-delete-row.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-delete.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-fix.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-header-cell.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-header-column.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-header-row.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-merge-cell.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-next-cell.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-previous-cell.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table-split-cell.svg +1 -0
- package/src/components/editor-main/src/assets/icons/table.svg +1 -0
- package/src/components/editor-main/src/assets/icons/tag.svg +1 -0
- package/src/components/editor-main/src/assets/icons/task-list-2.svg +1 -0
- package/src/components/editor-main/src/assets/icons/task-list.svg +1 -0
- package/src/components/editor-main/src/assets/icons/template.svg +1 -0
- package/src/components/editor-main/src/assets/icons/text-box.svg +1 -0
- package/src/components/editor-main/src/assets/icons/text.svg +1 -0
- package/src/components/editor-main/src/assets/icons/theme.svg +1 -0
- package/src/components/editor-main/src/assets/icons/time.svg +1 -0
- package/src/components/editor-main/src/assets/icons/toc.svg +1 -0
- package/src/components/editor-main/src/assets/icons/toolbar-classic.svg +1 -0
- package/src/components/editor-main/src/assets/icons/toolbar-ribbon.svg +1 -0
- package/src/components/editor-main/src/assets/icons/toolbar-source.svg +1 -0
- package/src/components/editor-main/src/assets/icons/underline.svg +1 -0
- package/src/components/editor-main/src/assets/icons/undo.svg +1 -0
- package/src/components/editor-main/src/assets/icons/unlink.svg +1 -0
- package/src/components/editor-main/src/assets/icons/video.svg +1 -0
- package/src/components/editor-main/src/assets/icons/view.svg +1 -0
- package/src/components/editor-main/src/assets/icons/watermark.svg +1 -0
- package/src/components/editor-main/src/assets/icons/web-page.svg +1 -0
- package/src/components/editor-main/src/assets/icons/word-wrap.svg +1 -0
- package/src/components/editor-main/src/assets/icons/word.svg +1 -0
- package/src/components/editor-main/src/assets/icons/writing-mode.svg +1 -0
- package/src/components/editor-main/src/assets/icons/zoom-1.svg +1 -0
- package/src/components/editor-main/src/assets/icons/zoom-auto.svg +1 -0
- package/src/components/editor-main/src/assets/icons/zoom.svg +1 -0
- package/src/components/editor-main/src/assets/images/avatar.svg +1 -0
- package/src/components/editor-main/src/assets/images/format-painter.svg +1 -0
- package/src/components/editor-main/src/assets/images/laser-pointer.svg +1 -0
- package/src/components/editor-main/src/assets/images/logo.svg +1 -0
- package/src/components/editor-main/src/assets/images/watermark-compact.png +0 -0
- package/src/components/editor-main/src/assets/images/watermark-spacious.png +0 -0
- package/src/components/editor-main/src/assets/styles/_mixins.less +150 -0
- package/src/components/editor-main/src/assets/styles/_variables.less +97 -0
- package/src/components/editor-main/src/assets/styles/drager.less +123 -0
- package/src/components/editor-main/src/assets/styles/editor.less +917 -0
- package/src/components/editor-main/src/assets/styles/index.less +19 -0
- package/src/components/editor-main/src/assets/styles/plyr.less +26 -0
- package/src/components/editor-main/src/assets/styles/tdesign.less +341 -0
- package/src/components/editor-main/src/components/container/page.vue +392 -0
- package/src/components/editor-main/src/components/container/print.vue +191 -0
- package/src/components/editor-main/src/components/container/search-replace.vue +264 -0
- package/src/components/editor-main/src/components/container/toc.vue +260 -0
- package/src/components/editor-main/src/components/editor/index.vue +213 -0
- package/src/components/editor-main/src/components/icon.vue +43 -0
- package/src/components/editor-main/src/components/index.js +22 -0
- package/src/components/editor-main/src/components/index.vue +1396 -0
- package/src/components/editor-main/src/components/menus/block/common.vue +127 -0
- package/src/components/editor-main/src/components/menus/block/index.vue +217 -0
- package/src/components/editor-main/src/components/menus/block/node.vue +183 -0
- package/src/components/editor-main/src/components/menus/bubble/callout/background.vue +39 -0
- package/src/components/editor-main/src/components/menus/bubble/callout/builtin.vue +90 -0
- package/src/components/editor-main/src/components/menus/bubble/callout/emoji-remove.vue +28 -0
- package/src/components/editor-main/src/components/menus/bubble/file/download.vue +30 -0
- package/src/components/editor-main/src/components/menus/bubble/file/width.vue +22 -0
- package/src/components/editor-main/src/components/menus/bubble/image/convert.vue +63 -0
- package/src/components/editor-main/src/components/menus/bubble/image/edit.vue +32 -0
- package/src/components/editor-main/src/components/menus/bubble/image/open.vue +27 -0
- package/src/components/editor-main/src/components/menus/bubble/image/preview.vue +24 -0
- package/src/components/editor-main/src/components/menus/bubble/image/proportion.vue +34 -0
- package/src/components/editor-main/src/components/menus/bubble/index.vue +55 -0
- package/src/components/editor-main/src/components/menus/bubble/link/copy.vue +29 -0
- package/src/components/editor-main/src/components/menus/bubble/link/open.vue +27 -0
- package/src/components/editor-main/src/components/menus/bubble/link/unlink.vue +19 -0
- package/src/components/editor-main/src/components/menus/bubble/math.vue +36 -0
- package/src/components/editor-main/src/components/menus/bubble/menus.vue +209 -0
- package/src/components/editor-main/src/components/menus/bubble/node/delete.vue +15 -0
- package/src/components/editor-main/src/components/menus/bubble/node/duplicate.vue +40 -0
- package/src/components/editor-main/src/components/menus/bubble/node/tofile.vue +31 -0
- package/src/components/editor-main/src/components/menus/bubble/tag/background.vue +36 -0
- package/src/components/editor-main/src/components/menus/bubble/tag/builtin.vue +88 -0
- package/src/components/editor-main/src/components/menus/bubble/tag/color.vue +36 -0
- package/src/components/editor-main/src/components/menus/bubble/tag/delete.vue +14 -0
- package/src/components/editor-main/src/components/menus/bubble/tag/input.vue +63 -0
- package/src/components/editor-main/src/components/menus/bubble/text-box/background.vue +37 -0
- package/src/components/editor-main/src/components/menus/bubble/text-box/border.vue +186 -0
- package/src/components/editor-main/src/components/menus/bubble/text-box/writing-mode.vue +42 -0
- package/src/components/editor-main/src/components/menus/bubble/webpage/clickable.vue +31 -0
- package/src/components/editor-main/src/components/menus/bubble/webpage/open.vue +29 -0
- package/src/components/editor-main/src/components/menus/button.vue +630 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-center.vue +33 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-distributed.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-dropdown.vue +56 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-justify.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-left.vue +32 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/align-right.vue +33 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/background-color.vue +72 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/bold.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/bullet-list.vue +110 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/clear-format.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/code.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/color.vue +75 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/font-family.vue +528 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/font-size.vue +163 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/format-painter.vue +27 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/heading.vue +322 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/highlight.vue +127 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/indent.vue +17 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/italic.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/letter-spacing.vue +113 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/line-height.vue +40 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/margin.vue +118 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/markdown.vue +50 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/ordered-list.vue +184 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/outdent.vue +17 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/print.vue +19 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/quote.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/redo.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/search-replace.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/select-all.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/strike.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/subscript.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/superscript.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/task-list.vue +47 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/underline.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/undo.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/base/word-wrap.vue +47 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/embed.vue +67 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/html.vue +27 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/image.vue +66 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/pdf.vue +8 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/share.vue +63 -0
- package/src/components/editor-main/src/components/menus/toolbar/export/text.vue +32 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/audio.vue +23 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/bookmark.vue +206 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/callout.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/chinese-date.vue +112 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/code-block.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/columns.vue +97 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/details.vue +34 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/emoji.vue +103 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/file.vue +23 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/footnote.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/hard-break.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/hr.vue +141 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/image.vue +84 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/link.vue +121 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/mention.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/option-box.vue +324 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/symbol.vue +88 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/tag.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/template.vue +76 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/text-box.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/toc.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/video.vue +23 -0
- package/src/components/editor-main/src/components/menus/toolbar/insert/web-page.vue +173 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/background.vue +138 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/break-marks.vue +26 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/break.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/footer.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/header.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/line-number.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/margin.vue +17 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/orientation.vue +63 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/size.vue +67 -0
- package/src/components/editor-main/src/components/menus/toolbar/page/watermark.vue +200 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/add-column-after.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/add-column-before.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/add-row-after.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/add-row-before.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/border-color.vue +35 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/cells-align.vue +41 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/cells-background.vue +32 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/delete-column.vue +44 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/delete-row.vue +44 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/delete.vue +40 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/fix.vue +17 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/insert.vue +137 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/merge-cells.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/next-cell.vue +21 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/previous-cell.vue +21 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/split-cell.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/toggle-header-cell.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/toggle-header-column.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/table/toggle-header-row.vue +20 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/barcode.vue +441 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/chinese-case.vue +135 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/diagrams.vue +141 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/echarts.vue +718 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/math.vue +339 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/mermaid.vue +293 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/mind-map.vue +7 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/qrcode.vue +293 -0
- package/src/components/editor-main/src/components/menus/toolbar/tools/signature.vue +208 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/fullscreen.vue +17 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/locale.vue +40 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/page.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/preview.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/skin.vue +43 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/theme.vue +41 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/toc.vue +15 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/web.vue +16 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/zoom-auto.vue +27 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/zoom-original.vue +18 -0
- package/src/components/editor-main/src/components/menus/toolbar/view/zoom.vue +35 -0
- package/src/components/editor-main/src/components/modal.vue +22 -0
- package/src/components/editor-main/src/components/page-options.vue +392 -0
- package/src/components/editor-main/src/components/picker/color.vue +208 -0
- package/src/components/editor-main/src/components/statusbar/about.vue +37 -0
- package/src/components/editor-main/src/components/statusbar/countdown.vue +273 -0
- package/src/components/editor-main/src/components/statusbar/index.vue +753 -0
- package/src/components/editor-main/src/components/statusbar/shortcuts.vue +313 -0
- package/src/components/editor-main/src/components/toolbar/classic.vue +325 -0
- package/src/components/editor-main/src/components/toolbar/index.vue +369 -0
- package/src/components/editor-main/src/components/toolbar/ribbon.vue +398 -0
- package/src/components/editor-main/src/components/toolbar/scrollable.vue +205 -0
- package/src/components/editor-main/src/components/tooltip.vue +23 -0
- package/src/components/editor-main/src/composables/copy.js +24 -0
- package/src/components/editor-main/src/composables/dialog.js +25 -0
- package/src/components/editor-main/src/composables/hotkeys.js +14 -0
- package/src/components/editor-main/src/composables/i18n.js +19 -0
- package/src/components/editor-main/src/composables/popup.js +11 -0
- package/src/components/editor-main/src/composables/select.js +13 -0
- package/src/components/editor-main/src/composables/state.js +30 -0
- package/src/components/editor-main/src/composables/toolbarSelection.js +68 -0
- package/src/components/editor-main/src/extensions/audio/index.js +59 -0
- package/src/components/editor-main/src/extensions/audio/node-view.vue +141 -0
- package/src/components/editor-main/src/extensions/bookmark.js +110 -0
- package/src/components/editor-main/src/extensions/break-marks.js +19 -0
- package/src/components/editor-main/src/extensions/bullet-list.js +21 -0
- package/src/components/editor-main/src/extensions/callout/index.js +128 -0
- package/src/components/editor-main/src/extensions/callout/node-view.vue +130 -0
- package/src/components/editor-main/src/extensions/code-block/index.js +32 -0
- package/src/components/editor-main/src/extensions/code-block/node-view.vue +399 -0
- package/src/components/editor-main/src/extensions/columns/dom.js +142 -0
- package/src/components/editor-main/src/extensions/columns/index.js +77 -0
- package/src/components/editor-main/src/extensions/columns/keymap.js +62 -0
- package/src/components/editor-main/src/extensions/columns/resize.js +60 -0
- package/src/components/editor-main/src/extensions/columns/schema.js +47 -0
- package/src/components/editor-main/src/extensions/columns/state.js +26 -0
- package/src/components/editor-main/src/extensions/columns/utils.js +55 -0
- package/src/components/editor-main/src/extensions/datetime/index.js +55 -0
- package/src/components/editor-main/src/extensions/datetime/node-view.vue +116 -0
- package/src/components/editor-main/src/extensions/echarts/cal-service.js +142 -0
- package/src/components/editor-main/src/extensions/echarts/index.js +115 -0
- package/src/components/editor-main/src/extensions/echarts/node-view.vue +220 -0
- package/src/components/editor-main/src/extensions/file/index.js +254 -0
- package/src/components/editor-main/src/extensions/file/node-view.vue +333 -0
- package/src/components/editor-main/src/extensions/file-handler.js +93 -0
- package/src/components/editor-main/src/extensions/foonotes/footnote.js +152 -0
- package/src/components/editor-main/src/extensions/foonotes/footnotes.js +41 -0
- package/src/components/editor-main/src/extensions/foonotes/index.js +7 -0
- package/src/components/editor-main/src/extensions/foonotes/reference.js +211 -0
- package/src/components/editor-main/src/extensions/foonotes/rules.js +103 -0
- package/src/components/editor-main/src/extensions/foonotes/utils.js +171 -0
- package/src/components/editor-main/src/extensions/format-painter.js +104 -0
- package/src/components/editor-main/src/extensions/horizontal-rule.js +93 -0
- package/src/components/editor-main/src/extensions/iframe/index.js +54 -0
- package/src/components/editor-main/src/extensions/iframe/node-view.vue +106 -0
- package/src/components/editor-main/src/extensions/image/image-resizer.vue +349 -0
- package/src/components/editor-main/src/extensions/image/index.js +216 -0
- package/src/components/editor-main/src/extensions/image/node-view.vue +592 -0
- package/src/components/editor-main/src/extensions/indent.js +226 -0
- package/src/components/editor-main/src/extensions/index.js +341 -0
- package/src/components/editor-main/src/extensions/letter-spacing.js +66 -0
- package/src/components/editor-main/src/extensions/line-height.js +147 -0
- package/src/components/editor-main/src/extensions/margin.js +266 -0
- package/src/components/editor-main/src/extensions/mention/index.js +33 -0
- package/src/components/editor-main/src/extensions/mention/mentions.vue +180 -0
- package/src/components/editor-main/src/extensions/mention/suggestion.js +90 -0
- package/src/components/editor-main/src/extensions/node-align.js +164 -0
- package/src/components/editor-main/src/extensions/node-select.js +51 -0
- package/src/components/editor-main/src/extensions/office-paste/index.js +70 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/bookmark.js +17 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/excel.js +85 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/html-classes.js +9 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/line-number.js +10 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/list.js +148 -0
- package/src/components/editor-main/src/extensions/office-paste/transform/style.js +24 -0
- package/src/components/editor-main/src/extensions/office-paste/utils.js +120 -0
- package/src/components/editor-main/src/extensions/option-box/index.js +77 -0
- package/src/components/editor-main/src/extensions/option-box/node-view.vue +194 -0
- package/src/components/editor-main/src/extensions/ordered-list.js +36 -0
- package/src/components/editor-main/src/extensions/page-break.js +42 -0
- package/src/components/editor-main/src/extensions/search-replace.js +304 -0
- package/src/components/editor-main/src/extensions/selection.js +38 -0
- package/src/components/editor-main/src/extensions/table.js +65 -0
- package/src/components/editor-main/src/extensions/tag/index.js +47 -0
- package/src/components/editor-main/src/extensions/tag/node-view.vue +51 -0
- package/src/components/editor-main/src/extensions/text-align.js +44 -0
- package/src/components/editor-main/src/extensions/text-box/index.js +78 -0
- package/src/components/editor-main/src/extensions/text-box/node-view.vue +141 -0
- package/src/components/editor-main/src/extensions/toc/index.js +48 -0
- package/src/components/editor-main/src/extensions/toc/node-view.vue +159 -0
- package/src/components/editor-main/src/extensions/type-writer.js +256 -0
- package/src/components/editor-main/src/extensions/video/index.js +65 -0
- package/src/components/editor-main/src/extensions/video/node-view.vue +211 -0
- package/src/components/editor-main/src/extensions/word-wrap.js +94 -0
- package/src/components/editor-main/src/i18n.js +15 -0
- package/src/components/editor-main/src/locales/bo.json +707 -0
- package/src/components/editor-main/src/locales/en-US.json +802 -0
- package/src/components/editor-main/src/locales/it-IT.json +721 -0
- package/src/components/editor-main/src/locales/ru-RU.json +779 -0
- package/src/components/editor-main/src/locales/zh-CN.json +804 -0
- package/src/components/editor-main/src/options/config/dicts.js +369 -0
- package/src/components/editor-main/src/options/config/index.js +203 -0
- package/src/components/editor-main/src/options/index.js +7 -0
- package/src/components/editor-main/src/options/schema.js +732 -0
- package/src/components/editor-main/src/utils/content-transform.js +12 -0
- package/src/components/editor-main/src/utils/copyright.js +4 -0
- package/src/components/editor-main/src/utils/diagram-editor.js +153 -0
- package/src/components/editor-main/src/utils/editor-scroll.js +75 -0
- package/src/components/editor-main/src/utils/file.js +177 -0
- package/src/components/editor-main/src/utils/history-record.js +135 -0
- package/src/components/editor-main/src/utils/load-resource.js +45 -0
- package/src/components/editor-main/src/utils/options.js +25 -0
- package/src/components/editor-main/src/utils/player.js +91 -0
- package/src/components/editor-main/src/utils/selection.js +39 -0
- package/src/components/editor-main/src/utils/short-id.js +4 -0
- package/src/components/editor-main/src/utils/shortcut.js +17 -0
- package/src/components/editor-main/src/utils/time-ago.js +8 -0
- package/src/components/editor-main/umo-build-entry.js +570 -0
- package/src/css/elementUI/col.scss +10 -2
- package/src/css/elementUI/mixins/_col.scss +10 -2
- package/vite/highlightJsLibVirtual.ts +98 -0
- package/vite/nodeModulesResolve.ts +175 -0
- package/vite/projectRoot.ts +17 -0
- package/vite/tiptapUmoResolve.ts +85 -0
- package/vite/tiptapVueRendererFix.ts +171 -0
- package/vite/umoCjsVirtual.ts +192 -0
- package/vite/umoIntegration.js +661 -0
- package/vite/umoIntegration.ts +56 -0
- package/vite/yjsPeerResolve.ts +46 -0
- package/vite.config.ts +8 -0
- package/vite.config.umo.ts +81 -0
- package/src/components/RichTextEditor/UmoRichTextEditor.vue +0 -257
- package/src/types/umoteam-editor.d.ts +0 -8
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core'
|
|
2
|
+
import { AllSelection, TextSelection } from '@tiptap/pm/state'
|
|
3
|
+
|
|
4
|
+
const DEFAULT_INDENT_UNIT = 'em'
|
|
5
|
+
|
|
6
|
+
const parseIndentConfig = (indentSize, fallbackUnit = DEFAULT_INDENT_UNIT) => {
|
|
7
|
+
if (typeof indentSize === 'number') {
|
|
8
|
+
return Number.isFinite(indentSize)
|
|
9
|
+
? { value: indentSize, unit: fallbackUnit }
|
|
10
|
+
: null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (typeof indentSize !== 'string') {
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const match = indentSize.trim().match(/^(-?[\d.]+)\s*([a-z%]*)$/i)
|
|
18
|
+
if (!match) {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const value = Number.parseFloat(match[1])
|
|
23
|
+
if (!Number.isFinite(value)) {
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
value,
|
|
29
|
+
unit: match[2] || fallbackUnit,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const parseTextIndent = (textIndent, fallbackUnit = DEFAULT_INDENT_UNIT) => {
|
|
34
|
+
if (typeof textIndent !== 'string') {
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const match = textIndent.trim().match(/^(-?[\d.]+)\s*([a-z%]*)$/i)
|
|
39
|
+
if (!match) {
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const value = Number.parseFloat(match[1])
|
|
44
|
+
if (!Number.isFinite(value)) {
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
value,
|
|
50
|
+
unit: match[2] || fallbackUnit,
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default Extension.create({
|
|
55
|
+
name: 'indent',
|
|
56
|
+
addOptions() {
|
|
57
|
+
return {
|
|
58
|
+
types: ['heading', 'listItem', 'taskItem', 'paragraph'],
|
|
59
|
+
minLevel: 0,
|
|
60
|
+
maxLevel: 20,
|
|
61
|
+
indentSize: 2,
|
|
62
|
+
defaultUnit: DEFAULT_INDENT_UNIT,
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
addGlobalAttributes() {
|
|
66
|
+
const getIndentConfig = () =>
|
|
67
|
+
parseIndentConfig(this.options.indentSize, this.options.defaultUnit)
|
|
68
|
+
const parseElementIndent = (element) => {
|
|
69
|
+
const config = getIndentConfig()
|
|
70
|
+
if (!config) {
|
|
71
|
+
return null
|
|
72
|
+
}
|
|
73
|
+
return parseTextIndent(element.style.textIndent, config.unit)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
types: this.options.types,
|
|
79
|
+
attributes: {
|
|
80
|
+
indent: {
|
|
81
|
+
default: null,
|
|
82
|
+
renderHTML: (attributes) => {
|
|
83
|
+
const { indent, indentUnit } = attributes
|
|
84
|
+
const { minLevel } = this.options
|
|
85
|
+
if (!indent || indent <= minLevel) {
|
|
86
|
+
return {}
|
|
87
|
+
}
|
|
88
|
+
const config = getIndentConfig()
|
|
89
|
+
if (!config) {
|
|
90
|
+
return {}
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
style: `text-indent: ${indent * config.value}${indentUnit || config.unit};`,
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
parseHTML: (element) => {
|
|
97
|
+
const parsedIndent = parseElementIndent(element)
|
|
98
|
+
const config = getIndentConfig()
|
|
99
|
+
if (!parsedIndent || !config?.value) {
|
|
100
|
+
return null
|
|
101
|
+
}
|
|
102
|
+
const level = Math.round(parsedIndent.value / config.value)
|
|
103
|
+
return level > this.options.minLevel ? level : null
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
indentUnit: {
|
|
107
|
+
default: null,
|
|
108
|
+
renderHTML: () => ({}),
|
|
109
|
+
parseHTML: (element) => {
|
|
110
|
+
const parsedIndent = parseElementIndent(element)
|
|
111
|
+
const config = getIndentConfig()
|
|
112
|
+
if (!parsedIndent || !config?.value) {
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
const level = Math.round(parsedIndent.value / config.value)
|
|
116
|
+
return level > this.options.minLevel ? parsedIndent.unit : null
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
addCommands() {
|
|
124
|
+
const getIndentConfig = () =>
|
|
125
|
+
parseIndentConfig(this.options.indentSize, this.options.defaultUnit)
|
|
126
|
+
const shouldClampMaxLevel = (indentUnit) => {
|
|
127
|
+
const config = getIndentConfig()
|
|
128
|
+
if (!config) {
|
|
129
|
+
return true
|
|
130
|
+
}
|
|
131
|
+
return !indentUnit || indentUnit === config.unit
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const setNodeIndentMarkup = (tr, pos, delta) => {
|
|
135
|
+
const node = tr.doc.nodeAt(pos)
|
|
136
|
+
if (!node) return tr
|
|
137
|
+
const nextLevel = (node.attrs.indent || 0) + delta
|
|
138
|
+
const { minLevel, maxLevel } = this.options
|
|
139
|
+
let indent = nextLevel
|
|
140
|
+
if (nextLevel < minLevel) indent = minLevel
|
|
141
|
+
if (nextLevel > maxLevel && shouldClampMaxLevel(node.attrs.indentUnit)) {
|
|
142
|
+
indent = maxLevel
|
|
143
|
+
}
|
|
144
|
+
if (indent !== node.attrs.indent) {
|
|
145
|
+
const attrs = { ...node.attrs }
|
|
146
|
+
delete attrs.indent
|
|
147
|
+
delete attrs.indentUnit
|
|
148
|
+
const config = getIndentConfig()
|
|
149
|
+
const nextAttrs =
|
|
150
|
+
indent > minLevel
|
|
151
|
+
? {
|
|
152
|
+
...attrs,
|
|
153
|
+
indent,
|
|
154
|
+
indentUnit:
|
|
155
|
+
node.attrs.indentUnit || config?.unit || DEFAULT_INDENT_UNIT,
|
|
156
|
+
}
|
|
157
|
+
: attrs
|
|
158
|
+
return tr.setNodeMarkup(pos, node.type, nextAttrs, node.marks)
|
|
159
|
+
}
|
|
160
|
+
return tr
|
|
161
|
+
}
|
|
162
|
+
const updateIndentLevel = (tr, delta) => {
|
|
163
|
+
const { doc, selection } = tr
|
|
164
|
+
if (
|
|
165
|
+
selection instanceof TextSelection ||
|
|
166
|
+
selection instanceof AllSelection
|
|
167
|
+
) {
|
|
168
|
+
const { from, to } = selection
|
|
169
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
170
|
+
if (this.options.types.includes(node.type.name)) {
|
|
171
|
+
tr = setNodeIndentMarkup(tr, pos, delta)
|
|
172
|
+
return false
|
|
173
|
+
}
|
|
174
|
+
return true
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
return tr
|
|
178
|
+
}
|
|
179
|
+
const applyIndent =
|
|
180
|
+
(direction) =>
|
|
181
|
+
() =>
|
|
182
|
+
({ tr, state, dispatch }) => {
|
|
183
|
+
tr.setSelection(state.selection)
|
|
184
|
+
tr = updateIndentLevel(tr, direction)
|
|
185
|
+
if (tr.docChanged) {
|
|
186
|
+
if (dispatch) {
|
|
187
|
+
dispatch(tr)
|
|
188
|
+
}
|
|
189
|
+
return true
|
|
190
|
+
}
|
|
191
|
+
return false
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
setIndent: applyIndent(1),
|
|
195
|
+
setOutdent: applyIndent(-1),
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
addKeyboardShortcuts() {
|
|
199
|
+
return {
|
|
200
|
+
Tab: () => {
|
|
201
|
+
if (
|
|
202
|
+
this.editor.isActive('bulletList') ||
|
|
203
|
+
this.editor.isActive('orderedList')
|
|
204
|
+
) {
|
|
205
|
+
return this.editor.commands.sinkListItem('listItem')
|
|
206
|
+
}
|
|
207
|
+
if (this.editor.isActive('taskList')) {
|
|
208
|
+
return this.editor.commands.sinkListItem('taskItem')
|
|
209
|
+
}
|
|
210
|
+
return this.editor.commands.setIndent()
|
|
211
|
+
},
|
|
212
|
+
'Shift-Tab': () => {
|
|
213
|
+
if (
|
|
214
|
+
this.editor.isActive('bulletList') ||
|
|
215
|
+
this.editor.isActive('orderedList')
|
|
216
|
+
) {
|
|
217
|
+
return this.editor.commands.liftListItem('listItem')
|
|
218
|
+
}
|
|
219
|
+
if (this.editor.isActive('taskList')) {
|
|
220
|
+
return this.editor.commands.liftListItem('taskItem')
|
|
221
|
+
}
|
|
222
|
+
return this.editor.commands.setOutdent()
|
|
223
|
+
},
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
})
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { t } from '../composables/i18n.js';
|
|
2
|
+
import Bold from '@tiptap/extension-bold'
|
|
3
|
+
import {
|
|
4
|
+
Details,
|
|
5
|
+
DetailsContent,
|
|
6
|
+
DetailsSummary,
|
|
7
|
+
} from '@tiptap/extension-details'
|
|
8
|
+
import Document from '@tiptap/extension-document'
|
|
9
|
+
import Link from '@tiptap/extension-link'
|
|
10
|
+
import { TaskItem, TaskList } from '@tiptap/extension-list'
|
|
11
|
+
import Mathematics from '@tiptap/extension-mathematics'
|
|
12
|
+
import NodeRange from '@tiptap/extension-node-range'
|
|
13
|
+
import Subscript from '@tiptap/extension-subscript'
|
|
14
|
+
import Superscript from '@tiptap/extension-superscript'
|
|
15
|
+
import { getHierarchicalIndexes } from '@tiptap/extension-table-of-contents'
|
|
16
|
+
import { TableOfContents } from '@tiptap/extension-table-of-contents'
|
|
17
|
+
import { TextStyleKit } from '@tiptap/extension-text-style'
|
|
18
|
+
import Typography from '@tiptap/extension-typography'
|
|
19
|
+
import UniqueID from '@tiptap/extension-unique-id'
|
|
20
|
+
import {
|
|
21
|
+
CharacterCount,
|
|
22
|
+
Dropcursor,
|
|
23
|
+
Focus,
|
|
24
|
+
TrailingNode,
|
|
25
|
+
Placeholder,
|
|
26
|
+
UndoRedo,
|
|
27
|
+
} from '@tiptap/extensions'
|
|
28
|
+
import StarterKit from '@tiptap/starter-kit'
|
|
29
|
+
|
|
30
|
+
import { l } from '../composables/i18n'
|
|
31
|
+
import { useState } from '../composables/state'
|
|
32
|
+
import { getImageDimensions } from '../utils/file'
|
|
33
|
+
import { shortId } from '../utils/short-id'
|
|
34
|
+
|
|
35
|
+
import Audio from './audio'
|
|
36
|
+
import Bookmark from './bookmark'
|
|
37
|
+
import BreakMarks from './break-marks'
|
|
38
|
+
import BulletList from './bullet-list'
|
|
39
|
+
import Callout from './callout'
|
|
40
|
+
import CodeBlock from './code-block'
|
|
41
|
+
import Columns from './columns'
|
|
42
|
+
import Datetime from './datetime'
|
|
43
|
+
import Echarts from './echarts'
|
|
44
|
+
import File from './file'
|
|
45
|
+
import FileHandler from './file-handler'
|
|
46
|
+
import { Footnote, FootnoteReference, Footnotes } from './foonotes'
|
|
47
|
+
import FormatPainter from './format-painter'
|
|
48
|
+
import HorizontalRule from './horizontal-rule'
|
|
49
|
+
import Iframe from './iframe'
|
|
50
|
+
import { BlockImage, InlineImage } from './image'
|
|
51
|
+
import Indent from './indent'
|
|
52
|
+
import LetterSpacing from './letter-spacing'
|
|
53
|
+
import LineHeight from './line-height'
|
|
54
|
+
import Margin from './margin'
|
|
55
|
+
import Mention from './mention'
|
|
56
|
+
import getUsersSuggestion from './mention/suggestion'
|
|
57
|
+
import NodeAlign from './node-align'
|
|
58
|
+
import NodeSelect from './node-select'
|
|
59
|
+
import OfficePaste from './office-paste'
|
|
60
|
+
import OptionBox from './option-box'
|
|
61
|
+
import OrderedList from './ordered-list'
|
|
62
|
+
import PageBreak from './page-break'
|
|
63
|
+
import SearchReplace from './search-replace'
|
|
64
|
+
import Selection from './selection'
|
|
65
|
+
import { Table, TableCell, TableHeader, TableRow } from './table'
|
|
66
|
+
import Tag from './tag'
|
|
67
|
+
import TextAlign from './text-align'
|
|
68
|
+
import TextBox from './text-box'
|
|
69
|
+
import Toc from './toc'
|
|
70
|
+
import TypeWriter from './type-writer'
|
|
71
|
+
import Video from './video'
|
|
72
|
+
import WordWrap from './word-wrap'
|
|
73
|
+
|
|
74
|
+
const nodeTypes = [
|
|
75
|
+
'paragraph',
|
|
76
|
+
'heading',
|
|
77
|
+
'blockquote',
|
|
78
|
+
'codeBlock',
|
|
79
|
+
'hardBreak',
|
|
80
|
+
'horizontalRule',
|
|
81
|
+
'bulletList',
|
|
82
|
+
'orderedList',
|
|
83
|
+
'listItem',
|
|
84
|
+
'taskList',
|
|
85
|
+
'taskItem',
|
|
86
|
+
'details',
|
|
87
|
+
'detailsSummary',
|
|
88
|
+
'detailsContent',
|
|
89
|
+
'table',
|
|
90
|
+
'tableRow',
|
|
91
|
+
'tableHeader',
|
|
92
|
+
'tableCell',
|
|
93
|
+
'image',
|
|
94
|
+
'inlineImage',
|
|
95
|
+
'video',
|
|
96
|
+
'audio',
|
|
97
|
+
'file',
|
|
98
|
+
'callout',
|
|
99
|
+
'column',
|
|
100
|
+
'columnBlock',
|
|
101
|
+
'textBox',
|
|
102
|
+
'datetime',
|
|
103
|
+
'optionBox',
|
|
104
|
+
'iframe',
|
|
105
|
+
'echarts',
|
|
106
|
+
'toc',
|
|
107
|
+
'tag',
|
|
108
|
+
'pageBreak',
|
|
109
|
+
'mention',
|
|
110
|
+
'blockMath',
|
|
111
|
+
'inlineMath',
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
export const getDefaultExtensions = ({ container, options, uploadFileMap }) => {
|
|
115
|
+
const { page, document: doc, users, file, disableExtensions } = options.value
|
|
116
|
+
|
|
117
|
+
const extensions = {
|
|
118
|
+
'ordered-list': OrderedList,
|
|
119
|
+
'bullet-list': BulletList,
|
|
120
|
+
'task-list': TaskList.configure({
|
|
121
|
+
HTMLAttributes: {
|
|
122
|
+
class: 'umo-task-list',
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
margin: Margin,
|
|
126
|
+
link: Link.configure({
|
|
127
|
+
openOnClick: false,
|
|
128
|
+
enableClickSelection: true,
|
|
129
|
+
}),
|
|
130
|
+
image: BlockImage,
|
|
131
|
+
inlineImage: InlineImage,
|
|
132
|
+
video: Video,
|
|
133
|
+
audio: Audio,
|
|
134
|
+
'code-block': CodeBlock,
|
|
135
|
+
symbol: Symbol,
|
|
136
|
+
math: Mathematics.configure({
|
|
137
|
+
katex: { throwOnError: false },
|
|
138
|
+
}),
|
|
139
|
+
tag: Tag,
|
|
140
|
+
columns: Columns,
|
|
141
|
+
callout: Callout,
|
|
142
|
+
mention: Mention.configure({
|
|
143
|
+
suggestion: getUsersSuggestion(users, container),
|
|
144
|
+
}),
|
|
145
|
+
'date-time': Datetime,
|
|
146
|
+
'option-box': OptionBox,
|
|
147
|
+
bookmark: Bookmark,
|
|
148
|
+
footnote: [Footnotes, FootnoteReference, Footnote],
|
|
149
|
+
'hard-break': BreakMarks.configure({
|
|
150
|
+
visible: page?.showBreakMarks,
|
|
151
|
+
}),
|
|
152
|
+
'horizontal-rule': HorizontalRule,
|
|
153
|
+
toc: Toc,
|
|
154
|
+
'text-box': TextBox,
|
|
155
|
+
'web-page': Iframe,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const buildInExtensions = [
|
|
159
|
+
StarterKit.configure({
|
|
160
|
+
document: false,
|
|
161
|
+
bold: false,
|
|
162
|
+
codeBlock: false,
|
|
163
|
+
horizontalRule: false,
|
|
164
|
+
undoRedo: false,
|
|
165
|
+
link: false,
|
|
166
|
+
placeholder: false,
|
|
167
|
+
dropcursor: false,
|
|
168
|
+
selection: false,
|
|
169
|
+
bulletList: false,
|
|
170
|
+
orderedList: false,
|
|
171
|
+
trailingNode: false,
|
|
172
|
+
listKeymap: true,
|
|
173
|
+
}),
|
|
174
|
+
Document.extend({
|
|
175
|
+
content: disableExtensions.includes('footnote')
|
|
176
|
+
? doc.structure
|
|
177
|
+
: `${doc.structure} footnotes?`,
|
|
178
|
+
}),
|
|
179
|
+
TextStyleKit.configure({
|
|
180
|
+
lineHeight: false,
|
|
181
|
+
}),
|
|
182
|
+
UndoRedo.extend({
|
|
183
|
+
addKeyboardShortcuts() {
|
|
184
|
+
// 返回空对象表示移除所有默认快捷键
|
|
185
|
+
return {}
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
Focus.configure({
|
|
189
|
+
className: 'umo-node-focused',
|
|
190
|
+
mode: 'all',
|
|
191
|
+
}),
|
|
192
|
+
TrailingNode.configure({
|
|
193
|
+
node: 'paragraph',
|
|
194
|
+
}),
|
|
195
|
+
Placeholder.configure({
|
|
196
|
+
showOnlyCurrent: false,
|
|
197
|
+
placeholder: ({ node, pos }) => {
|
|
198
|
+
if (node.type.name === 'heading') {
|
|
199
|
+
return pos === 0 ? t('document.headingPlaceholder') : ''
|
|
200
|
+
}
|
|
201
|
+
return String(l(doc?.placeholder || ''))
|
|
202
|
+
},
|
|
203
|
+
}),
|
|
204
|
+
FormatPainter,
|
|
205
|
+
WordWrap,
|
|
206
|
+
Bold.extend({
|
|
207
|
+
renderHTML: ({ HTMLAttributes }) => ['b', HTMLAttributes, 0],
|
|
208
|
+
}),
|
|
209
|
+
Subscript,
|
|
210
|
+
Superscript,
|
|
211
|
+
Indent,
|
|
212
|
+
TextAlign,
|
|
213
|
+
NodeAlign,
|
|
214
|
+
LetterSpacing,
|
|
215
|
+
TaskItem.configure({ nested: true }),
|
|
216
|
+
LineHeight,
|
|
217
|
+
SearchReplace,
|
|
218
|
+
|
|
219
|
+
// 插入
|
|
220
|
+
File,
|
|
221
|
+
Details.configure({
|
|
222
|
+
HTMLAttributes: {
|
|
223
|
+
class: 'umo-node-details',
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
DetailsContent.configure({
|
|
227
|
+
HTMLAttributes: {
|
|
228
|
+
class: 'umo-node-details-content',
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
DetailsSummary.configure({
|
|
232
|
+
HTMLAttributes: {
|
|
233
|
+
class: 'umo-node-details-summary',
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
|
|
237
|
+
// 表格
|
|
238
|
+
Table,
|
|
239
|
+
TableRow,
|
|
240
|
+
TableCell,
|
|
241
|
+
TableHeader,
|
|
242
|
+
|
|
243
|
+
// 工具
|
|
244
|
+
Echarts,
|
|
245
|
+
|
|
246
|
+
// 页面
|
|
247
|
+
PageBreak,
|
|
248
|
+
|
|
249
|
+
// 其他
|
|
250
|
+
Selection,
|
|
251
|
+
NodeRange,
|
|
252
|
+
NodeSelect,
|
|
253
|
+
TableOfContents.configure({
|
|
254
|
+
getIndex: getHierarchicalIndexes,
|
|
255
|
+
scrollParent: () =>
|
|
256
|
+
document.querySelector(`${container} .umo-zoomable-container`),
|
|
257
|
+
getId: () => shortId(10),
|
|
258
|
+
}),
|
|
259
|
+
Typography.configure(doc?.typographyRules),
|
|
260
|
+
CharacterCount.configure({
|
|
261
|
+
limit: doc?.characterLimit !== 0 ? doc?.characterLimit : undefined,
|
|
262
|
+
}),
|
|
263
|
+
FileHandler.configure({
|
|
264
|
+
allowedMimeTypes: file?.allowedMimeTypes,
|
|
265
|
+
async onPaste(editor, files) {
|
|
266
|
+
// 记录 已有位置
|
|
267
|
+
const pageContainer = document.querySelector(
|
|
268
|
+
`${container} .umo-zoomable-container`,
|
|
269
|
+
)
|
|
270
|
+
const scrollTop = pageContainer?.scrollTop || 0
|
|
271
|
+
for (const file of files) {
|
|
272
|
+
const dimensions = await getImageDimensions(file)
|
|
273
|
+
editor.commands.insertFile({
|
|
274
|
+
file,
|
|
275
|
+
uploadFileMap: uploadFileMap.value,
|
|
276
|
+
autoType: true,
|
|
277
|
+
dimensions,
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
// 恢复滚动位置
|
|
281
|
+
if (pageContainer) {
|
|
282
|
+
// 使用 setTimeout 确保 DOM 更新完成后再恢复滚动位置
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
pageContainer.scrollTop = scrollTop
|
|
285
|
+
}, 0)
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
async onDrop(editor, files, pos) {
|
|
289
|
+
for (const file of files) {
|
|
290
|
+
const dimensions = await getImageDimensions(file)
|
|
291
|
+
editor.commands.insertFile({
|
|
292
|
+
file,
|
|
293
|
+
uploadFileMap: uploadFileMap.value,
|
|
294
|
+
autoType: true,
|
|
295
|
+
pos,
|
|
296
|
+
dimensions,
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
}),
|
|
301
|
+
Dropcursor.configure({
|
|
302
|
+
color: 'var(--umo-primary-color)',
|
|
303
|
+
}),
|
|
304
|
+
TypeWriter,
|
|
305
|
+
OfficePaste,
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
// 合并扩展
|
|
309
|
+
Object.values(extensions).forEach((item) => {
|
|
310
|
+
if (!disableExtensions?.includes(item.name)) {
|
|
311
|
+
if (Array.isArray(item)) {
|
|
312
|
+
buildInExtensions.push(...item)
|
|
313
|
+
return
|
|
314
|
+
}
|
|
315
|
+
buildInExtensions.push(item)
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
if (doc?.enableNodeId) {
|
|
320
|
+
buildInExtensions.push(
|
|
321
|
+
UniqueID.configure({
|
|
322
|
+
types: nodeTypes,
|
|
323
|
+
generateID: () => shortId(10),
|
|
324
|
+
}),
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return buildInExtensions
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export const inputAndPasteRules = (options) => {
|
|
332
|
+
let enableRules = true
|
|
333
|
+
const $document = useState('document', options)
|
|
334
|
+
if (
|
|
335
|
+
!options.value.document?.enableMarkdown ||
|
|
336
|
+
!$document.value?.enableMarkdown
|
|
337
|
+
) {
|
|
338
|
+
enableRules = [Mathematics, Typography, BlockImage]
|
|
339
|
+
}
|
|
340
|
+
return enableRules
|
|
341
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Mark, mergeAttributes } from '@tiptap/core'
|
|
2
|
+
|
|
3
|
+
export default Mark.create({
|
|
4
|
+
name: 'letterSpacing',
|
|
5
|
+
|
|
6
|
+
// 默认配置
|
|
7
|
+
addOptions() {
|
|
8
|
+
return {
|
|
9
|
+
types: ['textStyle'],
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
// 定义属性如何映射到 HTML 样式
|
|
14
|
+
addAttributes() {
|
|
15
|
+
return {
|
|
16
|
+
spacing: {
|
|
17
|
+
default: null,
|
|
18
|
+
parseHTML: (element) =>
|
|
19
|
+
element.style.letterSpacing?.replace(/['"]+/g, ''),
|
|
20
|
+
renderHTML: (attributes) => {
|
|
21
|
+
if (!attributes.spacing) {
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
style: `letter-spacing: ${attributes.spacing}`,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
parseHTML() {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
tag: 'span',
|
|
36
|
+
getAttrs: (element) => {
|
|
37
|
+
const hasSpacing = element.style.letterSpacing
|
|
38
|
+
if (!hasSpacing) return false
|
|
39
|
+
return {}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
renderHTML({ HTMLAttributes }) {
|
|
46
|
+
return [
|
|
47
|
+
'span',
|
|
48
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
49
|
+
0,
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
addCommands() {
|
|
53
|
+
return {
|
|
54
|
+
setLetterSpacing:
|
|
55
|
+
(spacing) =>
|
|
56
|
+
({ chain }) => {
|
|
57
|
+
return chain().setMark(this.name, { spacing }).run()
|
|
58
|
+
},
|
|
59
|
+
unsetLetterSpacing:
|
|
60
|
+
() =>
|
|
61
|
+
({ chain }) => {
|
|
62
|
+
return chain().unsetMark(this.name).run()
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
})
|