adtec-core-package 2.9.9 → 3.0.1
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 +99 -5
- package/prebuilt/umo-editor/favicon.ico +0 -0
- package/prebuilt/umo-editor/umo-editor.css +1 -0
- package/prebuilt/umo-editor/umo-editor.js +85998 -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/projectRoot.ts +17 -0
- package/vite/tiptapUmoResolve.ts +140 -0
- package/vite/tiptapVueRendererFix.ts +171 -0
- package/vite/umoCjsVirtual.ts +192 -0
- package/vite/umoIntegration.js +611 -0
- package/vite/umoIntegration.ts +56 -0
- package/vite/yjsPeerResolve.ts +100 -0
- package/vite.config.ts +8 -0
- package/vite.config.umo.ts +82 -0
- package/src/components/RichTextEditor/UmoRichTextEditor.vue +0 -257
- package/src/types/umoteam-editor.d.ts +0 -8
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { mergeAttributes, Node } from '@tiptap/core'
|
|
2
|
+
import { VueNodeViewRenderer } from '@tiptap/vue-3'
|
|
3
|
+
|
|
4
|
+
import NodeView from './node-view.vue'
|
|
5
|
+
|
|
6
|
+
export default Node.create({
|
|
7
|
+
name: 'iframe',
|
|
8
|
+
inline: false,
|
|
9
|
+
group: 'block',
|
|
10
|
+
atom: true,
|
|
11
|
+
addAttributes() {
|
|
12
|
+
return {
|
|
13
|
+
vnode: {
|
|
14
|
+
default: true,
|
|
15
|
+
},
|
|
16
|
+
type: {
|
|
17
|
+
default: 0,
|
|
18
|
+
},
|
|
19
|
+
src: {
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
22
|
+
width: {
|
|
23
|
+
default: null,
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
default: 200,
|
|
27
|
+
},
|
|
28
|
+
clickable: {
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
parseHTML() {
|
|
34
|
+
return [{ tag: 'iframe' }]
|
|
35
|
+
},
|
|
36
|
+
renderHTML({ HTMLAttributes }) {
|
|
37
|
+
return ['iframe', mergeAttributes(HTMLAttributes)]
|
|
38
|
+
},
|
|
39
|
+
addNodeView() {
|
|
40
|
+
return VueNodeViewRenderer(NodeView)
|
|
41
|
+
},
|
|
42
|
+
addCommands() {
|
|
43
|
+
return {
|
|
44
|
+
setIframe:
|
|
45
|
+
(options) =>
|
|
46
|
+
({ commands }) => {
|
|
47
|
+
return commands.insertContent({
|
|
48
|
+
type: this.name,
|
|
49
|
+
attrs: options,
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
})
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<node-view-wrapper
|
|
3
|
+
:id="attrs.id"
|
|
4
|
+
ref="containerRef"
|
|
5
|
+
class="umo-node-view"
|
|
6
|
+
:style="nodeStyle"
|
|
7
|
+
@click.capture="editor?.commands.setNodeSelection(getPos())"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
class="umo-node-container umo-select-outline umo-node-iframe"
|
|
11
|
+
:class="{
|
|
12
|
+
'umo-hover-shadow': !options.document?.readOnly,
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<drager
|
|
16
|
+
:selected="selected"
|
|
17
|
+
:rotatable="false"
|
|
18
|
+
:width="attrs.width"
|
|
19
|
+
:height="attrs.height"
|
|
20
|
+
:min-width="400"
|
|
21
|
+
:min-height="200"
|
|
22
|
+
:max-width="maxWidth"
|
|
23
|
+
:disabled="options.document?.readOnly"
|
|
24
|
+
@resize="onResize"
|
|
25
|
+
@focus="selected = true"
|
|
26
|
+
>
|
|
27
|
+
<iframe
|
|
28
|
+
:src="attrs.src"
|
|
29
|
+
:style="{ pointerEvents: attrs.clickable ? 'auto' : 'none' }"
|
|
30
|
+
></iframe>
|
|
31
|
+
</drager>
|
|
32
|
+
</div>
|
|
33
|
+
</node-view-wrapper>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>import { computed as _computed, ref as _ref } from 'vue';
|
|
37
|
+
|
|
38
|
+
import { nodeViewProps, NodeViewWrapper } from '@tiptap/vue-3'
|
|
39
|
+
import Drager from 'es-drager'
|
|
40
|
+
|
|
41
|
+
import { inject, ref, onMounted, nextTick } from 'vue';
|
|
42
|
+
import { onClickOutside } from '@vueuse/core';
|
|
43
|
+
const options = inject('options')
|
|
44
|
+
const editor = inject('editor')
|
|
45
|
+
|
|
46
|
+
const props = defineProps(nodeViewProps)
|
|
47
|
+
const attrs = _computed(() => props.node.attrs)
|
|
48
|
+
const { updateAttributes, getPos } = props
|
|
49
|
+
const containerRef = ref(null)
|
|
50
|
+
let selected = _ref(false)
|
|
51
|
+
let maxWidth = _ref(0)
|
|
52
|
+
|
|
53
|
+
const nodeStyle = _computed(() => {
|
|
54
|
+
const { nodeAlign, margin } = attrs.value
|
|
55
|
+
const marginTop =
|
|
56
|
+
margin?.top && margin?.top !== '' ? `${margin.top}px` : undefined
|
|
57
|
+
const marginBottom =
|
|
58
|
+
margin?.bottom && margin?.bottom !== '' ? `${margin.bottom}px` : undefined
|
|
59
|
+
return {
|
|
60
|
+
'justify-content': nodeAlign,
|
|
61
|
+
marginTop,
|
|
62
|
+
marginBottom,
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
onMounted(async () => {
|
|
67
|
+
await nextTick()
|
|
68
|
+
if (containerRef.value) {
|
|
69
|
+
const { offsetWidth } = containerRef.value.$el
|
|
70
|
+
|
|
71
|
+
maxWidth.value = offsetWidth
|
|
72
|
+
if (attrs.value.width === null) {
|
|
73
|
+
updateAttributes({ width: offsetWidth })
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
const onResize = ({ width, height }) => {
|
|
78
|
+
updateAttributes({ width, height })
|
|
79
|
+
}
|
|
80
|
+
onClickOutside(containerRef, () => {
|
|
81
|
+
selected.value = false
|
|
82
|
+
// updateAttributes({ clickable: false })
|
|
83
|
+
})
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style lang="less">
|
|
87
|
+
.umo-node-view {
|
|
88
|
+
.umo-node-iframe {
|
|
89
|
+
max-width: 100%;
|
|
90
|
+
.es-drager {
|
|
91
|
+
&:not(.selected) {
|
|
92
|
+
outline: solid 1px var(--umo-content-node-border);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
iframe {
|
|
96
|
+
display: block;
|
|
97
|
+
min-width: 200px;
|
|
98
|
+
min-height: 200px;
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 100%;
|
|
101
|
+
border: none;
|
|
102
|
+
background-color: #fff;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="rootRef"
|
|
4
|
+
class="es-drager"
|
|
5
|
+
:class="{
|
|
6
|
+
disabled,
|
|
7
|
+
selected: selected && !disabled,
|
|
8
|
+
border: true,
|
|
9
|
+
'is-resizing': dragging,
|
|
10
|
+
}"
|
|
11
|
+
:style="boxStyle"
|
|
12
|
+
tabindex="-1"
|
|
13
|
+
@mousedown="onRootMousedown"
|
|
14
|
+
@focus="emit('focus')"
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
<template v-if="selected && !disabled && resizable">
|
|
18
|
+
<div
|
|
19
|
+
v-for="handle in handles"
|
|
20
|
+
:key="handle.side"
|
|
21
|
+
class="es-drager-dot"
|
|
22
|
+
:data-side="handle.side"
|
|
23
|
+
:style="handle.style"
|
|
24
|
+
@pointerdown.stop="onResizeStart(handle.side, $event)"
|
|
25
|
+
>
|
|
26
|
+
<div class="es-drager-dot-handle" />
|
|
27
|
+
</div>
|
|
28
|
+
<div
|
|
29
|
+
v-if="rotatable"
|
|
30
|
+
class="es-drager-rotate"
|
|
31
|
+
@pointerdown.stop="onRotateStart"
|
|
32
|
+
>
|
|
33
|
+
<div class="es-drager-rotate-handle">
|
|
34
|
+
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
|
35
|
+
<path
|
|
36
|
+
fill="currentColor"
|
|
37
|
+
d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
|
|
38
|
+
/>
|
|
39
|
+
</svg>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { computed, ref, watch } from 'vue'
|
|
48
|
+
|
|
49
|
+
const props = defineProps({
|
|
50
|
+
selected: { type: Boolean, default: false },
|
|
51
|
+
rotatable: { type: Boolean, default: false },
|
|
52
|
+
resizable: { type: Boolean, default: true },
|
|
53
|
+
disabled: { type: Boolean, default: false },
|
|
54
|
+
angle: { type: Number, default: 0 },
|
|
55
|
+
width: { type: Number, default: 0 },
|
|
56
|
+
height: { type: Number, default: 0 },
|
|
57
|
+
left: { type: Number, default: 0 },
|
|
58
|
+
top: { type: Number, default: 0 },
|
|
59
|
+
minWidth: { type: Number, default: 14 },
|
|
60
|
+
minHeight: { type: Number, default: 14 },
|
|
61
|
+
maxWidth: { type: Number, default: 0 },
|
|
62
|
+
maxHeight: { type: Number, default: 0 },
|
|
63
|
+
zIndex: { type: Number, default: 0 },
|
|
64
|
+
equalProportion: { type: Boolean, default: false },
|
|
65
|
+
/** 页面 zoom transform 补偿,与 es-drager scaleRatio 一致 */
|
|
66
|
+
scaleRatio: { type: Number, default: 1 },
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const emit = defineEmits(['rotate', 'resize', 'drag-end', 'mousedown', 'focus'])
|
|
70
|
+
|
|
71
|
+
const rootRef = ref(null)
|
|
72
|
+
const dragging = ref(false)
|
|
73
|
+
const liveWidth = ref(0)
|
|
74
|
+
const liveHeight = ref(0)
|
|
75
|
+
/** 松手后 attrs 尚未回写前,继续展示最终尺寸,避免闪回 */
|
|
76
|
+
const commitSize = ref(null)
|
|
77
|
+
|
|
78
|
+
defineExpose({
|
|
79
|
+
get $el() {
|
|
80
|
+
return rootRef.value
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
function effectiveScale() {
|
|
85
|
+
const ratio = Number(props.scaleRatio)
|
|
86
|
+
return ratio > 0 ? ratio : 1
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function currentWidth() {
|
|
90
|
+
if (commitSize.value?.width) return commitSize.value.width
|
|
91
|
+
if (dragging.value && liveWidth.value > 0) return liveWidth.value
|
|
92
|
+
return props.width > 0 ? props.width : 0
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function currentHeight() {
|
|
96
|
+
if (commitSize.value?.height) return commitSize.value.height
|
|
97
|
+
if (dragging.value && liveHeight.value > 0) return liveHeight.value
|
|
98
|
+
return props.height > 0 ? props.height : 0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function clearCommitWhenSynced() {
|
|
102
|
+
if (!commitSize.value) return
|
|
103
|
+
const { width: targetW, height: targetH } = commitSize.value
|
|
104
|
+
const w = Number(props.width)
|
|
105
|
+
const h = Number(props.height)
|
|
106
|
+
if (w > 0 && h > 0 && Math.abs(w - targetW) < 1 && Math.abs(h - targetH) < 1) {
|
|
107
|
+
commitSize.value = null
|
|
108
|
+
liveWidth.value = 0
|
|
109
|
+
liveHeight.value = 0
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
watch(() => [props.width, props.height], clearCommitWhenSynced)
|
|
114
|
+
|
|
115
|
+
const boxStyle = computed(() => {
|
|
116
|
+
const style = {
|
|
117
|
+
zIndex: props.zIndex,
|
|
118
|
+
transform: `rotate(${props.angle || 0}deg)`,
|
|
119
|
+
}
|
|
120
|
+
const w = currentWidth()
|
|
121
|
+
const h = currentHeight()
|
|
122
|
+
if (w > 0) style.width = `${w}px`
|
|
123
|
+
if (h > 0) style.height = `${h}px`
|
|
124
|
+
if (props.left) style.left = `${props.left}px`
|
|
125
|
+
if (props.top) style.top = `${props.top}px`
|
|
126
|
+
return style
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const HANDLE_SIDES = [
|
|
130
|
+
'top-left',
|
|
131
|
+
'top',
|
|
132
|
+
'top-right',
|
|
133
|
+
'right',
|
|
134
|
+
'bottom-right',
|
|
135
|
+
'bottom',
|
|
136
|
+
'bottom-left',
|
|
137
|
+
'left',
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
const handles = computed(() =>
|
|
141
|
+
HANDLE_SIDES.map((side) => ({
|
|
142
|
+
side,
|
|
143
|
+
style: handleStyle(side),
|
|
144
|
+
})),
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
function handleStyle(side) {
|
|
148
|
+
const style = { transform: 'translate(-50%, -50%)' }
|
|
149
|
+
if (side.includes('top')) style.top = '0'
|
|
150
|
+
else if (side.includes('bottom')) style.top = '100%'
|
|
151
|
+
else style.top = '50%'
|
|
152
|
+
|
|
153
|
+
if (side.includes('left')) style.left = '0'
|
|
154
|
+
else if (side.includes('right')) style.left = '100%'
|
|
155
|
+
else style.left = '50%'
|
|
156
|
+
|
|
157
|
+
return style
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function clampSize(width, height) {
|
|
161
|
+
let w = Math.max(props.minWidth, width)
|
|
162
|
+
let h = Math.max(props.minHeight, height)
|
|
163
|
+
if (props.maxWidth > 0) w = Math.min(w, props.maxWidth)
|
|
164
|
+
if (props.maxHeight > 0) h = Math.min(h, props.maxHeight)
|
|
165
|
+
return { width: w, height: h }
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function readPointer(event) {
|
|
169
|
+
if (event.touches?.length) {
|
|
170
|
+
return { x: event.touches[0].clientX, y: event.touches[0].clientY }
|
|
171
|
+
}
|
|
172
|
+
return { x: event.clientX, y: event.clientY }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function measureSize() {
|
|
176
|
+
let w = props.width
|
|
177
|
+
let h = props.height
|
|
178
|
+
const el = rootRef.value
|
|
179
|
+
if ((!w || !h) && el) {
|
|
180
|
+
const rect = el.getBoundingClientRect()
|
|
181
|
+
w = w || rect.width / effectiveScale()
|
|
182
|
+
h = h || rect.height / effectiveScale()
|
|
183
|
+
}
|
|
184
|
+
if ((!w || !h) && el) {
|
|
185
|
+
const img = el.querySelector('img')
|
|
186
|
+
if (img) {
|
|
187
|
+
w = w || img.offsetWidth || img.naturalWidth
|
|
188
|
+
h = h || img.offsetHeight || img.naturalHeight
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return { width: w || 0, height: h || 0 }
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function applyLiveSize(width, height) {
|
|
195
|
+
liveWidth.value = width
|
|
196
|
+
liveHeight.value = height
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function onRootMousedown(event) {
|
|
200
|
+
emit('focus')
|
|
201
|
+
emit('mousedown', event)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function bindDragListeners(target, onMove, onUp) {
|
|
205
|
+
const doc = rootRef.value?.ownerDocument ?? document
|
|
206
|
+
doc.addEventListener('pointermove', onMove)
|
|
207
|
+
doc.addEventListener('pointerup', onUp)
|
|
208
|
+
doc.addEventListener('pointercancel', onUp)
|
|
209
|
+
return () => {
|
|
210
|
+
doc.removeEventListener('pointermove', onMove)
|
|
211
|
+
doc.removeEventListener('pointerup', onUp)
|
|
212
|
+
doc.removeEventListener('pointercancel', onUp)
|
|
213
|
+
target?.releasePointerCapture?.(target._activePointerId)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function onResizeStart(side, event) {
|
|
218
|
+
if (props.disabled) return
|
|
219
|
+
event.preventDefault()
|
|
220
|
+
event.stopPropagation()
|
|
221
|
+
|
|
222
|
+
const target = event.currentTarget
|
|
223
|
+
if (target?.setPointerCapture && event.pointerId != null) {
|
|
224
|
+
try {
|
|
225
|
+
target.setPointerCapture(event.pointerId)
|
|
226
|
+
target._activePointerId = event.pointerId
|
|
227
|
+
} catch {
|
|
228
|
+
// ignore
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const scale = effectiveScale()
|
|
233
|
+
const start = readPointer(event)
|
|
234
|
+
const measured = measureSize()
|
|
235
|
+
let startW = measured.width
|
|
236
|
+
let startH = measured.height
|
|
237
|
+
if (!startW || !startH) return
|
|
238
|
+
|
|
239
|
+
dragging.value = true
|
|
240
|
+
applyLiveSize(startW, startH)
|
|
241
|
+
|
|
242
|
+
const ratio = startW / startH
|
|
243
|
+
const hasEast = side.includes('right')
|
|
244
|
+
const hasWest = side.includes('left')
|
|
245
|
+
const hasSouth = side.includes('bottom')
|
|
246
|
+
const hasNorth = side === 'top' || side.startsWith('top-')
|
|
247
|
+
|
|
248
|
+
let unbind = null
|
|
249
|
+
|
|
250
|
+
const onMove = (moveEvent) => {
|
|
251
|
+
moveEvent.preventDefault?.()
|
|
252
|
+
const point = readPointer(moveEvent)
|
|
253
|
+
const dx = (point.x - start.x) / scale
|
|
254
|
+
const dy = (point.y - start.y) / scale
|
|
255
|
+
|
|
256
|
+
let width = startW
|
|
257
|
+
let height = startH
|
|
258
|
+
|
|
259
|
+
if (hasEast) width = startW + dx
|
|
260
|
+
if (hasWest) width = startW - dx
|
|
261
|
+
if (hasSouth) height = startH + dy
|
|
262
|
+
if (hasNorth) height = startH - dy
|
|
263
|
+
|
|
264
|
+
if (props.equalProportion || moveEvent.shiftKey) {
|
|
265
|
+
if (hasNorth || hasSouth) {
|
|
266
|
+
width = height * ratio
|
|
267
|
+
} else if (hasEast || hasWest) {
|
|
268
|
+
height = width / ratio
|
|
269
|
+
} else {
|
|
270
|
+
const dominant = Math.abs(dx) > Math.abs(dy) ? 'x' : 'y'
|
|
271
|
+
if (dominant === 'x') height = width / ratio
|
|
272
|
+
else width = height * ratio
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const next = clampSize(width, height)
|
|
277
|
+
applyLiveSize(next.width, next.height)
|
|
278
|
+
emit('resize', next)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const onUp = () => {
|
|
282
|
+
const finalWidth = liveWidth.value
|
|
283
|
+
const finalHeight = liveHeight.value
|
|
284
|
+
unbind?.()
|
|
285
|
+
unbind = null
|
|
286
|
+
dragging.value = false
|
|
287
|
+
if (finalWidth > 0 && finalHeight > 0) {
|
|
288
|
+
commitSize.value = { width: finalWidth, height: finalHeight }
|
|
289
|
+
}
|
|
290
|
+
emit('drag-end', { width: finalWidth, height: finalHeight })
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
unbind = bindDragListeners(target, onMove, onUp)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function onRotateStart(event) {
|
|
297
|
+
if (props.disabled) return
|
|
298
|
+
event.preventDefault()
|
|
299
|
+
event.stopPropagation()
|
|
300
|
+
|
|
301
|
+
const target = event.currentTarget
|
|
302
|
+
if (target?.setPointerCapture && event.pointerId != null) {
|
|
303
|
+
try {
|
|
304
|
+
target.setPointerCapture(event.pointerId)
|
|
305
|
+
target._activePointerId = event.pointerId
|
|
306
|
+
} catch {
|
|
307
|
+
// ignore
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const rect = rootRef.value?.getBoundingClientRect()
|
|
312
|
+
if (!rect) return
|
|
313
|
+
const cx = rect.left + rect.width / 2
|
|
314
|
+
const cy = rect.top + rect.height / 2
|
|
315
|
+
|
|
316
|
+
let unbind = null
|
|
317
|
+
|
|
318
|
+
const onMove = (moveEvent) => {
|
|
319
|
+
const point = readPointer(moveEvent)
|
|
320
|
+
const angle = (Math.atan2(point.y - cy, point.x - cx) * 180) / Math.PI + 90
|
|
321
|
+
emit('rotate', { angle: (angle + 360) % 360 })
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const onUp = () => {
|
|
325
|
+
unbind?.()
|
|
326
|
+
unbind = null
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
unbind = bindDragListeners(target, onMove, onUp)
|
|
330
|
+
}
|
|
331
|
+
</script>
|
|
332
|
+
|
|
333
|
+
<style scoped>
|
|
334
|
+
.es-drager.selected .es-drager-dot,
|
|
335
|
+
.es-drager.selected .es-drager-rotate {
|
|
336
|
+
display: block;
|
|
337
|
+
pointer-events: auto;
|
|
338
|
+
z-index: 2;
|
|
339
|
+
touch-action: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.es-drager.selected .es-drager-rotate {
|
|
343
|
+
display: flex;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.es-drager.is-resizing {
|
|
347
|
+
user-select: none;
|
|
348
|
+
}
|
|
349
|
+
</style>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { mergeAttributes, nodeInputRule, nodePasteRule } from '@tiptap/core'
|
|
2
|
+
import Image from '@tiptap/extension-image'
|
|
3
|
+
import { VueNodeViewRenderer } from '@tiptap/vue-3'
|
|
4
|
+
|
|
5
|
+
import NodeView from './node-view.vue'
|
|
6
|
+
|
|
7
|
+
const parseDimension = (element, name) => {
|
|
8
|
+
const styleValue = element.style?.[name]
|
|
9
|
+
const attrValue = element.getAttribute(name)
|
|
10
|
+
const rawValue = styleValue || attrValue
|
|
11
|
+
|
|
12
|
+
if (!rawValue) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const normalizedValue = String(rawValue).trim()
|
|
17
|
+
|
|
18
|
+
if (/^\d+(\.\d+)?px$/i.test(normalizedValue)) {
|
|
19
|
+
return Number.parseFloat(normalizedValue)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (/^\d+(\.\d+)?$/.test(normalizedValue)) {
|
|
23
|
+
return Number.parseFloat(normalizedValue)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const customImage = Image.extend({
|
|
30
|
+
atom: true,
|
|
31
|
+
selectable: true,
|
|
32
|
+
addAttributes() {
|
|
33
|
+
return {
|
|
34
|
+
vnode: {
|
|
35
|
+
default: true,
|
|
36
|
+
},
|
|
37
|
+
type: {
|
|
38
|
+
default: 'image',
|
|
39
|
+
},
|
|
40
|
+
name: {
|
|
41
|
+
default: null,
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
46
|
+
id: {
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
src: {
|
|
50
|
+
default: null,
|
|
51
|
+
},
|
|
52
|
+
config: {
|
|
53
|
+
default: null,
|
|
54
|
+
},
|
|
55
|
+
content: {
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
width: {
|
|
59
|
+
default: null,
|
|
60
|
+
parseHTML: (element) => parseDimension(element, 'width'),
|
|
61
|
+
renderHTML: (attributes) => {
|
|
62
|
+
if (!attributes.width) return {}
|
|
63
|
+
return { width: attributes.width }
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
height: {
|
|
67
|
+
default: null,
|
|
68
|
+
parseHTML: (element) => parseDimension(element, 'height'),
|
|
69
|
+
renderHTML: (attributes) => {
|
|
70
|
+
if (!attributes.height) return {}
|
|
71
|
+
return { height: attributes.height }
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
left: {
|
|
75
|
+
default: 0,
|
|
76
|
+
},
|
|
77
|
+
top: {
|
|
78
|
+
default: 0,
|
|
79
|
+
},
|
|
80
|
+
angle: {
|
|
81
|
+
default: null,
|
|
82
|
+
},
|
|
83
|
+
draggable: {
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
rotatable: {
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
equalProportion: {
|
|
90
|
+
default: true,
|
|
91
|
+
},
|
|
92
|
+
flipX: {
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
flipY: {
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
uploaded: {
|
|
99
|
+
default: false,
|
|
100
|
+
},
|
|
101
|
+
error: {
|
|
102
|
+
default: false,
|
|
103
|
+
},
|
|
104
|
+
previewType: {
|
|
105
|
+
default: 'image',
|
|
106
|
+
},
|
|
107
|
+
inline: {
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
parseHTML() {
|
|
113
|
+
return [{ tag: 'img' }]
|
|
114
|
+
},
|
|
115
|
+
addPasteRules() {
|
|
116
|
+
return [
|
|
117
|
+
...(this.parent?.() || []),
|
|
118
|
+
nodePasteRule({
|
|
119
|
+
find: /!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^"]+)"?)?\)/g,
|
|
120
|
+
type: this.type,
|
|
121
|
+
getAttributes: (match) => {
|
|
122
|
+
const [, alt, src, title] = match
|
|
123
|
+
return { src, alt, title }
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
addInputRules() {
|
|
129
|
+
return [
|
|
130
|
+
...(this.parent?.() || []),
|
|
131
|
+
nodeInputRule({
|
|
132
|
+
find: /!\[([\S]+)\]\(([^)\s]+)(?:\s+"([\S]+)"?)?\)/g,
|
|
133
|
+
type: this.type,
|
|
134
|
+
getAttributes: (match) => {
|
|
135
|
+
const [, alt, src, title] = match
|
|
136
|
+
return { src, alt, title }
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
// 节点块级别扩展
|
|
143
|
+
export const BlockImage = customImage.extend({
|
|
144
|
+
addNodeView() {
|
|
145
|
+
return VueNodeViewRenderer(NodeView)
|
|
146
|
+
},
|
|
147
|
+
addCommands() {
|
|
148
|
+
return {
|
|
149
|
+
setImage:
|
|
150
|
+
(options, replace) =>
|
|
151
|
+
({ commands, editor }) => {
|
|
152
|
+
if (replace) {
|
|
153
|
+
return commands.insertContent({
|
|
154
|
+
type: this.name,
|
|
155
|
+
attrs: { ...options, inline: false },
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
return commands.insertContentAt(editor.state.selection.anchor, {
|
|
159
|
+
type: this.name,
|
|
160
|
+
attrs: { ...options, inline: false },
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
// 行内扩展
|
|
167
|
+
export const InlineImage = customImage.extend({
|
|
168
|
+
name: 'inlineImage',
|
|
169
|
+
// 行内元素
|
|
170
|
+
inline: true,
|
|
171
|
+
|
|
172
|
+
// 属于行内组
|
|
173
|
+
group: 'inline',
|
|
174
|
+
addAttributes() {
|
|
175
|
+
return {
|
|
176
|
+
...this.parent?.(),
|
|
177
|
+
inline: {
|
|
178
|
+
default: true,
|
|
179
|
+
},
|
|
180
|
+
equalProportion: {
|
|
181
|
+
default: false,
|
|
182
|
+
},
|
|
183
|
+
width: {
|
|
184
|
+
default: 150,
|
|
185
|
+
},
|
|
186
|
+
height: {
|
|
187
|
+
default: 80,
|
|
188
|
+
},
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
parseHTML() {
|
|
192
|
+
return [{ tag: 'inline-img' }]
|
|
193
|
+
},
|
|
194
|
+
renderHTML({ HTMLAttributes }) {
|
|
195
|
+
return ['inline-img', mergeAttributes(HTMLAttributes)]
|
|
196
|
+
},
|
|
197
|
+
addNodeView() {
|
|
198
|
+
return VueNodeViewRenderer(NodeView)
|
|
199
|
+
},
|
|
200
|
+
addCommands() {
|
|
201
|
+
return {
|
|
202
|
+
setInlineImage:
|
|
203
|
+
(options) =>
|
|
204
|
+
({ commands, editor }) => {
|
|
205
|
+
// return commands.insertContent({
|
|
206
|
+
// type: this.name,
|
|
207
|
+
// attrs: { ...options, inline: true },
|
|
208
|
+
// })
|
|
209
|
+
return commands.insertContentAt(editor.state.selection.anchor, {
|
|
210
|
+
type: this.name,
|
|
211
|
+
attrs: { ...options, inline: true },
|
|
212
|
+
})
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
})
|