editor-svg 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +9 -0
- package/.eslintrc +46 -0
- package/.prettierrc +8 -0
- package/AGENTS.md +186 -0
- package/CHANGELOG.md +2543 -0
- package/CLAUDE.md +110 -0
- package/LICENSE +21 -0
- package/README.md +110 -0
- package/cypress/e2e/control/checkbox.cy.ts +46 -0
- package/cypress/e2e/control/select.cy.ts +56 -0
- package/cypress/e2e/control/text.cy.ts +43 -0
- package/cypress/e2e/editor.cy.ts +67 -0
- package/cypress/e2e/menus/block.cy.ts +38 -0
- package/cypress/e2e/menus/checkbox.cy.ts +33 -0
- package/cypress/e2e/menus/codeblock.cy.ts +34 -0
- package/cypress/e2e/menus/date.cy.ts +28 -0
- package/cypress/e2e/menus/format.cy.ts +40 -0
- package/cypress/e2e/menus/hyperlink.cy.ts +39 -0
- package/cypress/e2e/menus/image.cy.ts +25 -0
- package/cypress/e2e/menus/latex.cy.ts +34 -0
- package/cypress/e2e/menus/pagebreak.cy.ts +21 -0
- package/cypress/e2e/menus/painter.cy.ts +53 -0
- package/cypress/e2e/menus/print.cy.ts +25 -0
- package/cypress/e2e/menus/row.cy.ts +103 -0
- package/cypress/e2e/menus/search.cy.ts +112 -0
- package/cypress/e2e/menus/separator.cy.ts +32 -0
- package/cypress/e2e/menus/table.cy.ts +25 -0
- package/cypress/e2e/menus/text.cy.ts +304 -0
- package/cypress/e2e/menus/title.cy.ts +43 -0
- package/cypress/e2e/menus/undoRedo.cy.ts +49 -0
- package/cypress/e2e/menus/watermark.cy.ts +64 -0
- package/cypress/fixtures/example.json +3 -0
- package/cypress/fixtures/test.png +0 -0
- package/cypress/global.d.ts +13 -0
- package/cypress/support/commands.ts +5 -0
- package/cypress/support/e2e.ts +1 -0
- package/cypress/tsconfig.json +21 -0
- package/cypress.config.ts +10 -0
- package/docs/.vitepress/config.ts +191 -0
- package/docs/.vitepress/theme/components/DeepWikiBadge.vue +21 -0
- package/docs/.vitepress/theme/components/ZreadBadge.vue +21 -0
- package/docs/.vitepress/theme/index.ts +27 -0
- package/docs/en/guide/api-common.md +49 -0
- package/docs/en/guide/api-instance.md +34 -0
- package/docs/en/guide/command-execute.md +1167 -0
- package/docs/en/guide/command-get.md +355 -0
- package/docs/en/guide/contextmenu-custom.md +44 -0
- package/docs/en/guide/contextmenu-internal.md +61 -0
- package/docs/en/guide/eventbus.md +260 -0
- package/docs/en/guide/i18n.md +112 -0
- package/docs/en/guide/listener.md +126 -0
- package/docs/en/guide/option.md +214 -0
- package/docs/en/guide/override.md +57 -0
- package/docs/en/guide/plugin-custom.md +25 -0
- package/docs/en/guide/plugin-internal.md +125 -0
- package/docs/en/guide/schema.md +237 -0
- package/docs/en/guide/shortcut-custom.md +22 -0
- package/docs/en/guide/shortcut-internal.md +189 -0
- package/docs/en/guide/start.md +97 -0
- package/docs/en/index.md +43 -0
- package/docs/guide/api-common.md +49 -0
- package/docs/guide/api-instance.md +34 -0
- package/docs/guide/command-execute.md +1157 -0
- package/docs/guide/command-get.md +353 -0
- package/docs/guide/contextmenu-custom.md +44 -0
- package/docs/guide/contextmenu-internal.md +61 -0
- package/docs/guide/eventbus.md +260 -0
- package/docs/guide/i18n.md +111 -0
- package/docs/guide/listener.md +126 -0
- package/docs/guide/option.md +214 -0
- package/docs/guide/override.md +57 -0
- package/docs/guide/plugin-custom.md +25 -0
- package/docs/guide/plugin-internal.md +125 -0
- package/docs/guide/schema.md +237 -0
- package/docs/guide/shortcut-custom.md +22 -0
- package/docs/guide/shortcut-internal.md +189 -0
- package/docs/guide/start.md +97 -0
- package/docs/index.md +43 -0
- package/docs/public/favicon.png +0 -0
- package/favicon.png +0 -0
- package/index.html +435 -0
- package/package.json +55 -0
- package/pnpm-lock.yaml +4113 -0
- package/scripts/release.js +41 -0
- package/scripts/verifyCommit.js +19 -0
- package/src/assets/images/alignment.svg +1 -0
- package/src/assets/images/arrow-left.svg +1 -0
- package/src/assets/images/arrow-right.svg +1 -0
- package/src/assets/images/block.svg +1 -0
- package/src/assets/images/bold.svg +1 -0
- package/src/assets/images/catalog.svg +1 -0
- package/src/assets/images/center.svg +1 -0
- package/src/assets/images/checkbox.svg +1 -0
- package/src/assets/images/close.svg +1 -0
- package/src/assets/images/codeblock.svg +1 -0
- package/src/assets/images/color.svg +1 -0
- package/src/assets/images/control.svg +1 -0
- package/src/assets/images/date.svg +1 -0
- package/src/assets/images/exit-fullscreen.svg +1 -0
- package/src/assets/images/format.svg +1 -0
- package/src/assets/images/highlight.svg +1 -0
- package/src/assets/images/hyperlink.svg +1 -0
- package/src/assets/images/image.svg +1 -0
- package/src/assets/images/italic.svg +1 -0
- package/src/assets/images/justify.svg +7 -0
- package/src/assets/images/latex.svg +1 -0
- package/src/assets/images/left.svg +1 -0
- package/src/assets/images/line-dash-dot-dot.svg +1 -0
- package/src/assets/images/line-dash-dot.svg +1 -0
- package/src/assets/images/line-dash-large-gap.svg +1 -0
- package/src/assets/images/line-dash-small-gap.svg +1 -0
- package/src/assets/images/line-dot.svg +1 -0
- package/src/assets/images/line-double.svg +1 -0
- package/src/assets/images/line-single.svg +1 -0
- package/src/assets/images/line-wavy.svg +1 -0
- package/src/assets/images/list.svg +1 -0
- package/src/assets/images/option.svg +1 -0
- package/src/assets/images/page-break.svg +1 -0
- package/src/assets/images/page-mode.svg +1 -0
- package/src/assets/images/page-scale-add.svg +1 -0
- package/src/assets/images/page-scale-minus.svg +1 -0
- package/src/assets/images/painter.svg +1 -0
- package/src/assets/images/paper-direction.svg +1 -0
- package/src/assets/images/paper-margin.svg +1 -0
- package/src/assets/images/paper-size.svg +1 -0
- package/src/assets/images/print.svg +1 -0
- package/src/assets/images/radio.svg +4 -0
- package/src/assets/images/redo.svg +1 -0
- package/src/assets/images/request-fullscreen.svg +1 -0
- package/src/assets/images/right.svg +1 -0
- package/src/assets/images/row-margin.svg +1 -0
- package/src/assets/images/search.svg +1 -0
- package/src/assets/images/separator.svg +1 -0
- package/src/assets/images/signature-undo.svg +1 -0
- package/src/assets/images/signature.svg +1 -0
- package/src/assets/images/size-add.svg +1 -0
- package/src/assets/images/size-minus.svg +1 -0
- package/src/assets/images/strikeout.svg +1 -0
- package/src/assets/images/subscript.svg +1 -0
- package/src/assets/images/superscript.svg +1 -0
- package/src/assets/images/table.svg +1 -0
- package/src/assets/images/title.svg +1 -0
- package/src/assets/images/trash.svg +1 -0
- package/src/assets/images/underline.svg +1 -0
- package/src/assets/images/undo.svg +1 -0
- package/src/assets/images/watermark.svg +1 -0
- package/src/assets/images/word-tool.svg +1 -0
- package/src/assets/snapshots/main_v0.2.1.png +0 -0
- package/src/assets/snapshots/main_v0.2.2.png +0 -0
- package/src/assets/snapshots/main_v0.3.0.png +0 -0
- package/src/assets/snapshots/main_v0.3.1.png +0 -0
- package/src/assets/snapshots/main_v0.5.0.png +0 -0
- package/src/assets/snapshots/main_v0.5.1.png +0 -0
- package/src/assets/snapshots/main_v0.6.0.png +0 -0
- package/src/assets/snapshots/main_v0.6.1.png +0 -0
- package/src/assets/snapshots/main_v0.7.0.png +0 -0
- package/src/assets/snapshots/main_v0.7.1.png +0 -0
- package/src/assets/snapshots/main_v0.7.2.png +0 -0
- package/src/assets/snapshots/main_v0.7.3.png +0 -0
- package/src/assets/snapshots/main_v0.7.4.png +0 -0
- package/src/assets/snapshots/main_v0.7.6.png +0 -0
- package/src/assets/snapshots/main_v0.7.7.png +0 -0
- package/src/assets/snapshots/main_v0.8.0.png +0 -0
- package/src/assets/snapshots/main_v0.8.5.png +0 -0
- package/src/assets/snapshots/main_v0.8.6.png +0 -0
- package/src/assets/snapshots/main_v0.8.7.png +0 -0
- package/src/assets/snapshots/main_v0.8.8.png +0 -0
- package/src/assets/snapshots/main_v0.9.0.png +0 -0
- package/src/assets/snapshots/main_v0.9.1.png +0 -0
- package/src/assets/snapshots/main_v0.9.2.png +0 -0
- package/src/assets/snapshots/main_v0.9.23.png +0 -0
- package/src/assets/snapshots/main_v0.9.28.png +0 -0
- package/src/assets/snapshots/main_v0.9.29.png +0 -0
- package/src/assets/snapshots/main_v0.9.3.png +0 -0
- package/src/assets/snapshots/main_v0.9.30.png +0 -0
- package/src/assets/snapshots/main_v0.9.32.png +0 -0
- package/src/assets/snapshots/main_v0.9.35.png +0 -0
- package/src/assets/snapshots/main_v0.9.4.png +0 -0
- package/src/assets/snapshots/main_v0.9.5.png +0 -0
- package/src/assets/snapshots/main_v0.9.6.png +0 -0
- package/src/assets/snapshots/main_v0.9.8.png +0 -0
- package/src/components/dialog/Dialog.ts +171 -0
- package/src/components/dialog/dialog.css +131 -0
- package/src/components/signature/Signature.ts +340 -0
- package/src/components/signature/signature.css +132 -0
- package/src/editor/assets/css/block/block.css +21 -0
- package/src/editor/assets/css/contextmenu/contextmenu.css +196 -0
- package/src/editor/assets/css/control/calculator.css +85 -0
- package/src/editor/assets/css/control/select.css +44 -0
- package/src/editor/assets/css/date/datePicker.css +233 -0
- package/src/editor/assets/css/hyperlink/hyperlink.css +26 -0
- package/src/editor/assets/css/index.css +78 -0
- package/src/editor/assets/css/previewer/previewer.css +122 -0
- package/src/editor/assets/css/resizer/resizer.css +74 -0
- package/src/editor/assets/css/table/table.css +155 -0
- package/src/editor/assets/css/zone/zone.css +61 -0
- package/src/editor/assets/images/close.svg +1 -0
- package/src/editor/assets/images/delete-col.svg +1 -0
- package/src/editor/assets/images/delete-row-col.svg +1 -0
- package/src/editor/assets/images/delete-row.svg +1 -0
- package/src/editor/assets/images/delete-table.svg +1 -0
- package/src/editor/assets/images/image-change.svg +1 -0
- package/src/editor/assets/images/image-download.svg +1 -0
- package/src/editor/assets/images/image-next.svg +1 -0
- package/src/editor/assets/images/image-pre.svg +1 -0
- package/src/editor/assets/images/image.svg +1 -0
- package/src/editor/assets/images/insert-bottom-row.svg +1 -0
- package/src/editor/assets/images/insert-left-col.svg +1 -0
- package/src/editor/assets/images/insert-right-col.svg +1 -0
- package/src/editor/assets/images/insert-row-col.svg +1 -0
- package/src/editor/assets/images/insert-top-row.svg +1 -0
- package/src/editor/assets/images/merge-cancel-cell.svg +1 -0
- package/src/editor/assets/images/merge-cell.svg +1 -0
- package/src/editor/assets/images/original-size.svg +1 -0
- package/src/editor/assets/images/print.svg +1 -0
- package/src/editor/assets/images/rotate.svg +1 -0
- package/src/editor/assets/images/submenu-dropdown.svg +1 -0
- package/src/editor/assets/images/table-border-all.svg +1 -0
- package/src/editor/assets/images/table-border-dash.svg +1 -0
- package/src/editor/assets/images/table-border-empty.svg +1 -0
- package/src/editor/assets/images/table-border-external.svg +1 -0
- package/src/editor/assets/images/table-border-internal.svg +1 -0
- package/src/editor/assets/images/table-border-td-back.svg +1 -0
- package/src/editor/assets/images/table-border-td-bottom.svg +1 -0
- package/src/editor/assets/images/table-border-td-forward.svg +1 -0
- package/src/editor/assets/images/table-border-td-left.svg +1 -0
- package/src/editor/assets/images/table-border-td-right.svg +1 -0
- package/src/editor/assets/images/table-border-td-top.svg +1 -0
- package/src/editor/assets/images/table-border-td.svg +1 -0
- package/src/editor/assets/images/vertical-align-bottom.svg +1 -0
- package/src/editor/assets/images/vertical-align-middle.svg +1 -0
- package/src/editor/assets/images/vertical-align-top.svg +1 -0
- package/src/editor/assets/images/vertical-align.svg +1 -0
- package/src/editor/assets/images/zoom-in.svg +1 -0
- package/src/editor/assets/images/zoom-out.svg +1 -0
- package/src/editor/core/actuator/Actuator.ts +21 -0
- package/src/editor/core/actuator/handlers/positionContextChange.ts +13 -0
- package/src/editor/core/command/Command.ts +312 -0
- package/src/editor/core/command/CommandAdapt.ts +2733 -0
- package/src/editor/core/contextmenu/ContextMenu.ts +363 -0
- package/src/editor/core/contextmenu/menus/controlMenus.ts +25 -0
- package/src/editor/core/contextmenu/menus/globalMenus.ts +66 -0
- package/src/editor/core/contextmenu/menus/hyperlinkMenus.ts +58 -0
- package/src/editor/core/contextmenu/menus/imageMenus.ts +134 -0
- package/src/editor/core/contextmenu/menus/tableMenus.ts +331 -0
- package/src/editor/core/cursor/Cursor.ts +248 -0
- package/src/editor/core/cursor/CursorAgent.ts +75 -0
- package/src/editor/core/draw/Draw.ts +2934 -0
- package/src/editor/core/draw/control/Control.ts +1767 -0
- package/src/editor/core/draw/control/checkbox/CheckboxControl.ts +154 -0
- package/src/editor/core/draw/control/date/DateControl.ts +363 -0
- package/src/editor/core/draw/control/interactive/ControlSearch.ts +214 -0
- package/src/editor/core/draw/control/number/Calculator.ts +183 -0
- package/src/editor/core/draw/control/number/NumberControl.ts +183 -0
- package/src/editor/core/draw/control/radio/RadioControl.ts +68 -0
- package/src/editor/core/draw/control/richtext/Border.ts +52 -0
- package/src/editor/core/draw/control/select/SelectControl.ts +567 -0
- package/src/editor/core/draw/control/text/TextControl.ts +280 -0
- package/src/editor/core/draw/frame/Background.ts +117 -0
- package/src/editor/core/draw/frame/Badge.ts +88 -0
- package/src/editor/core/draw/frame/Footer.ts +155 -0
- package/src/editor/core/draw/frame/Header.ts +158 -0
- package/src/editor/core/draw/frame/LineNumber.ts +43 -0
- package/src/editor/core/draw/frame/Margin.ts +53 -0
- package/src/editor/core/draw/frame/PageBorder.ts +47 -0
- package/src/editor/core/draw/frame/PageNumber.ts +88 -0
- package/src/editor/core/draw/frame/Placeholder.ts +114 -0
- package/src/editor/core/draw/frame/Watermark.ts +188 -0
- package/src/editor/core/draw/graffiti/Graffiti.ts +125 -0
- package/src/editor/core/draw/interactive/Area.ts +312 -0
- package/src/editor/core/draw/interactive/Group.ts +198 -0
- package/src/editor/core/draw/interactive/Search.ts +527 -0
- package/src/editor/core/draw/particle/CheckboxParticle.ts +111 -0
- package/src/editor/core/draw/particle/HyperlinkParticle.ts +86 -0
- package/src/editor/core/draw/particle/ImageParticle.ts +280 -0
- package/src/editor/core/draw/particle/LabelParticle.ts +79 -0
- package/src/editor/core/draw/particle/LineBreakParticle.ts +55 -0
- package/src/editor/core/draw/particle/ListParticle.ts +255 -0
- package/src/editor/core/draw/particle/PageBreakParticle.ts +54 -0
- package/src/editor/core/draw/particle/RadioParticle.ts +99 -0
- package/src/editor/core/draw/particle/SeparatorParticle.ts +37 -0
- package/src/editor/core/draw/particle/SubscriptParticle.ts +23 -0
- package/src/editor/core/draw/particle/SuperscriptParticle.ts +23 -0
- package/src/editor/core/draw/particle/TextParticle.ts +174 -0
- package/src/editor/core/draw/particle/WhiteSpaceParticle.ts +32 -0
- package/src/editor/core/draw/particle/block/BlockParticle.ts +76 -0
- package/src/editor/core/draw/particle/block/modules/BaseBlock.ts +280 -0
- package/src/editor/core/draw/particle/block/modules/IFrameBlock.ts +47 -0
- package/src/editor/core/draw/particle/block/modules/VideoBlock.ts +61 -0
- package/src/editor/core/draw/particle/date/DateParticle.ts +111 -0
- package/src/editor/core/draw/particle/date/DatePicker.ts +577 -0
- package/src/editor/core/draw/particle/latex/LaTexParticle.ts +43 -0
- package/src/editor/core/draw/particle/latex/utils/LaTexUtils.ts +1196 -0
- package/src/editor/core/draw/particle/latex/utils/hershey.ts +1632 -0
- package/src/editor/core/draw/particle/latex/utils/symbols.ts +318 -0
- package/src/editor/core/draw/particle/previewer/Previewer.ts +582 -0
- package/src/editor/core/draw/particle/table/TableOperate.ts +988 -0
- package/src/editor/core/draw/particle/table/TableParticle.ts +558 -0
- package/src/editor/core/draw/particle/table/TableTool.ts +551 -0
- package/src/editor/core/draw/richtext/AbstractRichText.ts +59 -0
- package/src/editor/core/draw/richtext/Highlight.ts +24 -0
- package/src/editor/core/draw/richtext/Strikeout.ts +28 -0
- package/src/editor/core/draw/richtext/Underline.ts +106 -0
- package/src/editor/core/event/CanvasEvent.ts +215 -0
- package/src/editor/core/event/GlobalEvent.ts +173 -0
- package/src/editor/core/event/eventbus/EventBus.ts +50 -0
- package/src/editor/core/event/handlers/click.ts +234 -0
- package/src/editor/core/event/handlers/composition.ts +45 -0
- package/src/editor/core/event/handlers/copy.ts +72 -0
- package/src/editor/core/event/handlers/cut.ts +47 -0
- package/src/editor/core/event/handlers/drag.ts +66 -0
- package/src/editor/core/event/handlers/drop.ts +28 -0
- package/src/editor/core/event/handlers/input.ts +129 -0
- package/src/editor/core/event/handlers/keydown/backspace.ts +161 -0
- package/src/editor/core/event/handlers/keydown/delete.ts +119 -0
- package/src/editor/core/event/handlers/keydown/end.ts +69 -0
- package/src/editor/core/event/handlers/keydown/enter.ts +126 -0
- package/src/editor/core/event/handlers/keydown/home.ts +69 -0
- package/src/editor/core/event/handlers/keydown/index.ts +85 -0
- package/src/editor/core/event/handlers/keydown/left.ts +162 -0
- package/src/editor/core/event/handlers/keydown/right.ts +178 -0
- package/src/editor/core/event/handlers/keydown/tab.ts +41 -0
- package/src/editor/core/event/handlers/keydown/updown.ts +342 -0
- package/src/editor/core/event/handlers/mousedown.ts +262 -0
- package/src/editor/core/event/handlers/mouseleave.ts +14 -0
- package/src/editor/core/event/handlers/mousemove.ts +133 -0
- package/src/editor/core/event/handlers/mouseup.ts +341 -0
- package/src/editor/core/event/handlers/paste.ts +231 -0
- package/src/editor/core/history/HistoryManager.ts +61 -0
- package/src/editor/core/i18n/I18n.ts +51 -0
- package/src/editor/core/i18n/lang/en.json +92 -0
- package/src/editor/core/i18n/lang/zh-CN.json +92 -0
- package/src/editor/core/listener/Listener.ts +41 -0
- package/src/editor/core/observer/ImageObserver.ts +19 -0
- package/src/editor/core/observer/MouseObserver.ts +56 -0
- package/src/editor/core/observer/ScrollObserver.ts +88 -0
- package/src/editor/core/observer/SelectionObserver.ts +143 -0
- package/src/editor/core/override/Override.ts +14 -0
- package/src/editor/core/plugin/Plugin.ts +17 -0
- package/src/editor/core/position/Position.ts +870 -0
- package/src/editor/core/range/RangeManager.ts +723 -0
- package/src/editor/core/register/Register.ts +28 -0
- package/src/editor/core/shortcut/Shortcut.ts +80 -0
- package/src/editor/core/shortcut/keys/listKeys.ts +22 -0
- package/src/editor/core/shortcut/keys/richtextKeys.ts +102 -0
- package/src/editor/core/shortcut/keys/titleKeys.ts +62 -0
- package/src/editor/core/worker/WorkerManager.ts +96 -0
- package/src/editor/core/worker/works/catalog.ts +189 -0
- package/src/editor/core/worker/works/group.ts +34 -0
- package/src/editor/core/worker/works/value.ts +32 -0
- package/src/editor/core/worker/works/wordCount.ts +132 -0
- package/src/editor/core/zone/Zone.ts +183 -0
- package/src/editor/core/zone/ZoneTip.ts +108 -0
- package/src/editor/dataset/constant/Background.ts +10 -0
- package/src/editor/dataset/constant/Badge.ts +6 -0
- package/src/editor/dataset/constant/Checkbox.ts +12 -0
- package/src/editor/dataset/constant/Common.ts +44 -0
- package/src/editor/dataset/constant/ContextMenu.ts +61 -0
- package/src/editor/dataset/constant/Control.ts +14 -0
- package/src/editor/dataset/constant/Cursor.ts +11 -0
- package/src/editor/dataset/constant/Editor.ts +19 -0
- package/src/editor/dataset/constant/Element.ts +173 -0
- package/src/editor/dataset/constant/Footer.ts +10 -0
- package/src/editor/dataset/constant/Graffiti.ts +6 -0
- package/src/editor/dataset/constant/Group.ts +10 -0
- package/src/editor/dataset/constant/Header.ts +10 -0
- package/src/editor/dataset/constant/ImgCaption.ts +8 -0
- package/src/editor/dataset/constant/Label.ts +8 -0
- package/src/editor/dataset/constant/LineBreak.ts +7 -0
- package/src/editor/dataset/constant/LineNumber.ts +11 -0
- package/src/editor/dataset/constant/List.ts +26 -0
- package/src/editor/dataset/constant/PageBorder.ts +8 -0
- package/src/editor/dataset/constant/PageBreak.ts +7 -0
- package/src/editor/dataset/constant/PageNumber.ts +22 -0
- package/src/editor/dataset/constant/Placeholder.ts +9 -0
- package/src/editor/dataset/constant/Radio.ts +12 -0
- package/src/editor/dataset/constant/Regular.ts +23 -0
- package/src/editor/dataset/constant/Separator.ts +6 -0
- package/src/editor/dataset/constant/Shortcut.ts +3 -0
- package/src/editor/dataset/constant/Table.ts +9 -0
- package/src/editor/dataset/constant/Title.ts +38 -0
- package/src/editor/dataset/constant/Watermark.ts +17 -0
- package/src/editor/dataset/constant/WhiteSpace.ts +7 -0
- package/src/editor/dataset/constant/Zone.ts +5 -0
- package/src/editor/dataset/enum/Area.ts +5 -0
- package/src/editor/dataset/enum/Background.ts +11 -0
- package/src/editor/dataset/enum/Block.ts +4 -0
- package/src/editor/dataset/enum/Common.ts +30 -0
- package/src/editor/dataset/enum/Control.ts +39 -0
- package/src/editor/dataset/enum/Editor.ts +51 -0
- package/src/editor/dataset/enum/Element.ts +21 -0
- package/src/editor/dataset/enum/ElementStyle.ts +12 -0
- package/src/editor/dataset/enum/Event.ts +5 -0
- package/src/editor/dataset/enum/KeyMap.ts +85 -0
- package/src/editor/dataset/enum/LineNumber.ts +4 -0
- package/src/editor/dataset/enum/List.ts +23 -0
- package/src/editor/dataset/enum/Observer.ts +6 -0
- package/src/editor/dataset/enum/Row.ts +7 -0
- package/src/editor/dataset/enum/Text.ts +13 -0
- package/src/editor/dataset/enum/Title.ts +8 -0
- package/src/editor/dataset/enum/VerticalAlign.ts +5 -0
- package/src/editor/dataset/enum/Watermark.ts +4 -0
- package/src/editor/dataset/enum/table/Table.ts +19 -0
- package/src/editor/dataset/enum/table/TableTool.ts +4 -0
- package/src/editor/index.ts +241 -0
- package/src/editor/interface/Area.ts +68 -0
- package/src/editor/interface/Background.ts +9 -0
- package/src/editor/interface/Badge.ts +17 -0
- package/src/editor/interface/Block.ts +18 -0
- package/src/editor/interface/Catalog.ts +11 -0
- package/src/editor/interface/Checkbox.ts +17 -0
- package/src/editor/interface/Command.ts +3 -0
- package/src/editor/interface/Common.ts +43 -0
- package/src/editor/interface/Control.ts +250 -0
- package/src/editor/interface/Cursor.ts +7 -0
- package/src/editor/interface/Draw.ts +86 -0
- package/src/editor/interface/Editor.ts +172 -0
- package/src/editor/interface/Element.ts +273 -0
- package/src/editor/interface/Event.ts +27 -0
- package/src/editor/interface/EventBus.ts +46 -0
- package/src/editor/interface/Footer.ts +9 -0
- package/src/editor/interface/Graffiti.ts +15 -0
- package/src/editor/interface/Group.ts +8 -0
- package/src/editor/interface/Header.ts +9 -0
- package/src/editor/interface/Label.ts +8 -0
- package/src/editor/interface/LineBreak.ts +5 -0
- package/src/editor/interface/LineNumber.ts +10 -0
- package/src/editor/interface/Listener.ts +88 -0
- package/src/editor/interface/Margin.ts +1 -0
- package/src/editor/interface/PageBorder.ts +8 -0
- package/src/editor/interface/PageBreak.ts +5 -0
- package/src/editor/interface/PageNumber.ts +16 -0
- package/src/editor/interface/Placeholder.ts +7 -0
- package/src/editor/interface/Plugin.ts +8 -0
- package/src/editor/interface/Position.ts +113 -0
- package/src/editor/interface/Previewer.ts +15 -0
- package/src/editor/interface/Radio.ts +17 -0
- package/src/editor/interface/Range.ts +61 -0
- package/src/editor/interface/Row.ts +25 -0
- package/src/editor/interface/Search.ts +36 -0
- package/src/editor/interface/Separator.ts +4 -0
- package/src/editor/interface/Text.ts +15 -0
- package/src/editor/interface/Title.ts +32 -0
- package/src/editor/interface/Watermark.ts +16 -0
- package/src/editor/interface/WhiteSpace.ts +5 -0
- package/src/editor/interface/Zone.ts +3 -0
- package/src/editor/interface/contextmenu/ContextMenu.ts +76 -0
- package/src/editor/interface/i18n/I18n.ts +7 -0
- package/src/editor/interface/shortcut/Shortcut.ts +14 -0
- package/src/editor/interface/table/Colgroup.ts +4 -0
- package/src/editor/interface/table/Table.ts +9 -0
- package/src/editor/interface/table/Td.ts +36 -0
- package/src/editor/interface/table/Tr.ts +11 -0
- package/src/editor/types/index.d.ts +5 -0
- package/src/editor/utils/clipboard.ts +94 -0
- package/src/editor/utils/element.ts +1877 -0
- package/src/editor/utils/hotkey.ts +5 -0
- package/src/editor/utils/index.ts +445 -0
- package/src/editor/utils/option.ts +253 -0
- package/src/editor/utils/paragraph.ts +28 -0
- package/src/editor/utils/print.ts +99 -0
- package/src/editor/utils/ua.ts +13 -0
- package/src/main.ts +2053 -0
- package/src/mock.ts +611 -0
- package/src/plugins/copy/index.ts +30 -0
- package/src/plugins/markdown/index.ts +118 -0
- package/src/style.css +1079 -0
- package/src/utils/index.ts +45 -0
- package/src/utils/prism.ts +89 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +46 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# i18n
|
|
2
|
+
|
|
3
|
+
## How to Use
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
import Editor from "@hufe921/canvas-editor"
|
|
7
|
+
|
|
8
|
+
const instance = new Editor(container, <IElement[]>data, options)
|
|
9
|
+
|
|
10
|
+
// register
|
|
11
|
+
instance.register.langMap(locale: string, lang: ILang)
|
|
12
|
+
|
|
13
|
+
// set locale
|
|
14
|
+
instance.command.executeSetLocale(locale)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## ILang
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
interface ILang {
|
|
21
|
+
contextmenu: {
|
|
22
|
+
global: {
|
|
23
|
+
cut: string
|
|
24
|
+
copy: string
|
|
25
|
+
paste: string
|
|
26
|
+
selectAll: string
|
|
27
|
+
print: string
|
|
28
|
+
}
|
|
29
|
+
control: {
|
|
30
|
+
delete: string
|
|
31
|
+
}
|
|
32
|
+
hyperlink: {
|
|
33
|
+
delete: string
|
|
34
|
+
cancel: string
|
|
35
|
+
edit: string
|
|
36
|
+
}
|
|
37
|
+
image: {
|
|
38
|
+
change: string
|
|
39
|
+
saveAs: string
|
|
40
|
+
textWrap: string
|
|
41
|
+
textWrapType: {
|
|
42
|
+
embed: string
|
|
43
|
+
upDown: string
|
|
44
|
+
surround: string
|
|
45
|
+
floatTop: string
|
|
46
|
+
floatBottom: string
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
table: {
|
|
50
|
+
insertRowCol: string
|
|
51
|
+
insertTopRow: string
|
|
52
|
+
insertBottomRow: string
|
|
53
|
+
insertLeftCol: string
|
|
54
|
+
insertRightCol: string
|
|
55
|
+
deleteRowCol: string
|
|
56
|
+
deleteRow: string
|
|
57
|
+
deleteCol: string
|
|
58
|
+
deleteTable: string
|
|
59
|
+
mergeCell: string
|
|
60
|
+
mergeCancelCell: string
|
|
61
|
+
verticalAlign: string
|
|
62
|
+
verticalAlignTop: string
|
|
63
|
+
verticalAlignMiddle: string
|
|
64
|
+
verticalAlignBottom: string
|
|
65
|
+
border: string
|
|
66
|
+
borderAll: string
|
|
67
|
+
borderEmpty: string
|
|
68
|
+
borderDash: string
|
|
69
|
+
borderExternal: string
|
|
70
|
+
borderInternal: string
|
|
71
|
+
borderTd: string
|
|
72
|
+
borderTdTop: string
|
|
73
|
+
borderTdRight: string
|
|
74
|
+
borderTdBottom: string
|
|
75
|
+
borderTdLeft: string
|
|
76
|
+
borderTdForward: string
|
|
77
|
+
borderTdBack: string
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
datePicker: {
|
|
81
|
+
now: string
|
|
82
|
+
confirm: string
|
|
83
|
+
return: string
|
|
84
|
+
timeSelect: string
|
|
85
|
+
weeks: {
|
|
86
|
+
sun: string
|
|
87
|
+
mon: string
|
|
88
|
+
tue: string
|
|
89
|
+
wed: string
|
|
90
|
+
thu: string
|
|
91
|
+
fri: string
|
|
92
|
+
sat: string
|
|
93
|
+
}
|
|
94
|
+
year: string
|
|
95
|
+
month: string
|
|
96
|
+
hour: string
|
|
97
|
+
minute: string
|
|
98
|
+
second: string
|
|
99
|
+
}
|
|
100
|
+
frame: {
|
|
101
|
+
header: string
|
|
102
|
+
footer: string
|
|
103
|
+
}
|
|
104
|
+
pageBreak: {
|
|
105
|
+
displayName: string
|
|
106
|
+
}
|
|
107
|
+
zone: {
|
|
108
|
+
headerTip: string
|
|
109
|
+
footerTip: string
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Event Listening(listener)
|
|
2
|
+
|
|
3
|
+
::: warning
|
|
4
|
+
The listener can only respond to one method, and no new listening methods will be added in the future. It is recommended to use eventBus for event listening.
|
|
5
|
+
:::
|
|
6
|
+
|
|
7
|
+
## How to Use
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import Editor from "@hufe921/canvas-editor"
|
|
11
|
+
|
|
12
|
+
const instance = new Editor(container, <IElement[]>data, options)
|
|
13
|
+
instance.listener.eventName = ()=>{}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## rangeStyleChange
|
|
17
|
+
|
|
18
|
+
Feature: The selection style changes
|
|
19
|
+
|
|
20
|
+
Usage:
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
instance.listener.rangeStyleChange = (payload: IRangeStyle) => {}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## visiblePageNoListChange
|
|
27
|
+
|
|
28
|
+
Feature: The visible page changes
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
instance.listener.visiblePageNoListChange = (payload: number[]) => {}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## intersectionPageNoChange
|
|
37
|
+
|
|
38
|
+
Feature: The current page changes
|
|
39
|
+
|
|
40
|
+
Usage:
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
instance.listener.intersectionPageNoChange = (payload: number) => {}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## pageSizeChange
|
|
47
|
+
|
|
48
|
+
Feature: The current page size has changed
|
|
49
|
+
|
|
50
|
+
Usage:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
instance.listener.pageSizeChange = (payload: number) => {}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## pageScaleChange
|
|
57
|
+
|
|
58
|
+
Feature: The current page scaling has changed
|
|
59
|
+
|
|
60
|
+
Usage:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
instance.listener.pageScaleChange = (payload: number) => {}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## contentChange
|
|
67
|
+
|
|
68
|
+
Feature: The current content has changed
|
|
69
|
+
|
|
70
|
+
Usage:
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
instance.listener.contentChange = () => {}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## controlChange
|
|
77
|
+
|
|
78
|
+
Feature: The control where the current cursor is located changes
|
|
79
|
+
|
|
80
|
+
Usage:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
instance.listener.controlChange = (payload: IControlChangeResult) => {}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## controlContentChange
|
|
87
|
+
|
|
88
|
+
Feature: The control content changes
|
|
89
|
+
|
|
90
|
+
Usage:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
instance.listener.controlContentChange = (
|
|
94
|
+
payload: IControlContentChangeResult
|
|
95
|
+
) => {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## pageModeChange
|
|
99
|
+
|
|
100
|
+
Feature: The page mode changes
|
|
101
|
+
|
|
102
|
+
Usage:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
instance.listener.pageModeChange = (payload: PageMode) => {}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## saved
|
|
109
|
+
|
|
110
|
+
Feature: Document saved
|
|
111
|
+
|
|
112
|
+
Usage:
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
instance.listener.saved = (payload: IEditorResult) => {}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## zoneChange
|
|
119
|
+
|
|
120
|
+
Feature: 区域发生改变
|
|
121
|
+
|
|
122
|
+
Usage:
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
instance.listener.zoneChange = (payload: EditorZone) => {}
|
|
126
|
+
```
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
## How to Use?
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
import Editor from "@hufe921/canvas-editor"
|
|
7
|
+
|
|
8
|
+
new Editor(container, IEditorData | IElement[], {
|
|
9
|
+
// option
|
|
10
|
+
})
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Complete Configuration
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
interface IEditorOption {
|
|
17
|
+
mode?: EditorMode // Editor mode: Edit, Clean (Visual aids are not displayed, For example: page break), ReadOnly, Form (Only editable within the control), Print (Visual aids are not displayed, Unwritten content control), Design (Do not handle configurations such as non deletable and read-only). default: Edit
|
|
18
|
+
locale?: string // Language. default: zhCN
|
|
19
|
+
defaultType?: string // Default element type. default: TEXT
|
|
20
|
+
defaultColor?: string // Default color. default: #000000
|
|
21
|
+
defaultFont?: string // Default font. default: Microsoft YaHei
|
|
22
|
+
defaultSize?: number // Default font size. default: 16
|
|
23
|
+
minSize?: number // Min font size。default: 5
|
|
24
|
+
maxSize?: number // Max font size。default: 72
|
|
25
|
+
defaultBasicRowMarginHeight?: number // Default line height。default: 8
|
|
26
|
+
defaultRowMargin?: number // Default line spacing. default: 1
|
|
27
|
+
defaultTabWidth?: number // Default tab width. default: 32
|
|
28
|
+
width?: number // Paper width. default: 794
|
|
29
|
+
height?: number // Paper height. default: 1123
|
|
30
|
+
scale?: number // scaling. default: 1
|
|
31
|
+
pageGap?: number // Paper spacing. default: 20
|
|
32
|
+
underlineColor?: string // Underline color. default: #000000
|
|
33
|
+
strikeoutColor?: string // Strikeout color. default: #FF0000
|
|
34
|
+
rangeColor?: string // Range color. default: #AECBFA
|
|
35
|
+
rangeAlpha?: number // Range transparency. default: 0.6
|
|
36
|
+
rangeMinWidth?: number // Range min width. default: 5
|
|
37
|
+
searchMatchColor?: string // Search for highlight color. default: #FFFF00
|
|
38
|
+
searchNavigateMatchColor?: string // Search navigation highlighted color.default: #AAD280
|
|
39
|
+
searchMatchAlpha?: number // Search for highlight transparency. default: 0.6
|
|
40
|
+
highlightAlpha?: number // Highlight element transparency. default: 0.6
|
|
41
|
+
highlightMarginHeight?: number // Highlight element margin height. default: 8
|
|
42
|
+
resizerColor?: string // Image sizer color. default: #4182D9
|
|
43
|
+
resizerSize?: number // Image sizer size. default: 5
|
|
44
|
+
marginIndicatorSize?: number // The margin indicator length. default: 35
|
|
45
|
+
marginIndicatorColor?: string // The margin indicator color. default: #BABABA
|
|
46
|
+
margins?: IMargin // Page margins. default: [100, 120, 100, 120]
|
|
47
|
+
pageMode?: PageMode // Paper mode: Linkage, Pagination. default: Pagination
|
|
48
|
+
renderMode?: RenderMode // Render mode: speed(multi words combination rendering), compatibility(word by word rendering:avoid environmental differences such as browse,fonts...). default: speed
|
|
49
|
+
defaultHyperlinkColor?: string // Default hyperlink color. default: #0000FF
|
|
50
|
+
table?: ITableOption // table configuration {tdPadding?:IPadding; defaultTrMinHeight?:number; defaultColMinWidth?:number}
|
|
51
|
+
header?: IHeader // Header information.{top?:number; maxHeightRadio?:MaxHeightRatio;}
|
|
52
|
+
footer?: IFooter // Footer information. {bottom?:number; maxHeightRadio?:MaxHeightRatio;}
|
|
53
|
+
pageNumber?: IPageNumber // Page number information. {bottom:number; size:number; font:string; color:string; rowFlex:RowFlex; format:string; numberType:NumberType;}
|
|
54
|
+
paperDirection?: PaperDirection // Paper orientation: portrait, landscape
|
|
55
|
+
inactiveAlpha?: number // When the body content is out of focus, transparency. default: 0.6
|
|
56
|
+
historyMaxRecordCount?: number // History (undo redo) maximum number of records. default: 100
|
|
57
|
+
printPixelRatio?: number // Print the pixel ratio (larger values are clearer, but larger sizes). default: 3
|
|
58
|
+
maskMargin?: IMargin // Masking margins above the editor(for example: menu bar, bottom toolbar)。default: [0, 0, 0, 0]
|
|
59
|
+
letterClass?: string[] // Alphabet class supported by typesetting. default: a-zA-Z. Built-in alternative alphabet class: LETTER_CLASS
|
|
60
|
+
contextMenuDisableKeys?: string[] // Disable context menu keys. default: []
|
|
61
|
+
shortcutDisableKeys?: string[] // Disable shortcut keys. default: []
|
|
62
|
+
scrollContainerSelector?: string // scroll container selector. default: document
|
|
63
|
+
pageOuterSelectionDisable?: boolean // Disable selection when the mouse moves out of the page. default: false
|
|
64
|
+
wordBreak?: WordBreak // Word and punctuation breaks: No punctuation in the first line of the BREAK_WORD &The word is not split, and the line is folded after BREAK_ALL full according to the width of the character. default: BREAK_WORD
|
|
65
|
+
watermark?: IWatermark // Watermark{data:string; color?:string; opacity?:number; size?:number; font?:string; numberType:NumberType;}
|
|
66
|
+
control?: IControlOption // Control {placeholderColor?:string; bracketColor?:string; prefix?:string; postfix?:string; borderWidth?: number; borderColor?: string; activeBackgroundColor?: string; disabledBackgroundColor?: string; existValueBackgroundColor?: string; noValueBackgroundColor?: string;}
|
|
67
|
+
checkbox?: ICheckboxOption // Checkbox {width?:number; height?:number; gap?:number; lineWidth?:number; fillStyle?:string; strokeStyle?: string; verticalAlign?: VerticalAlign;}
|
|
68
|
+
radio?: IRadioOption // Radio {width?:number; height?:number; gap?:number; lineWidth?:number; fillStyle?:string; strokeStyle?: string; verticalAlign?: VerticalAlign;}
|
|
69
|
+
cursor?: ICursorOption // Cursor style. {width?: number; color?: string; dragWidth?: number; dragColor?: string; dragFloatImageDisabled?: boolean;}
|
|
70
|
+
title?: ITitleOption // Title configuration.{ defaultFirstSize?: number; defaultSecondSize?: number; defaultThirdSize?: number defaultFourthSize?: number; defaultFifthSize?: number; defaultSixthSize?: number;}
|
|
71
|
+
placeholder?: IPlaceholder // Placeholder text
|
|
72
|
+
group?: IGroup // Group option. {opacity?:number; backgroundColor?:string; activeOpacity?:number; activeBackgroundColor?:string; disabled?:boolean; deletable?:boolean;}
|
|
73
|
+
pageBreak?: IPageBreak // PageBreak option。{font?:string; fontSize?:number; lineDash?:number[];}
|
|
74
|
+
zone?: IZoneOption // Zone option。{tipDisabled?:boolean;}
|
|
75
|
+
background?: IBackgroundOption // Background option. {color?:string; image?:string; size?:BackgroundSize; repeat?:BackgroundRepeat; applyPageNumbers?:number[]}。default: {color: '#FFFFFF'}
|
|
76
|
+
lineBreak?: ILineBreakOption // LineBreak option. {disabled?:boolean; color?:string; lineWidth?:number;}
|
|
77
|
+
whiteSpace?: IWhiteSpaceOption // WhiteSpace option. {disabled?:boolean; color?:string; radius?:number;}
|
|
78
|
+
separator?: ISeparatorOption // Separator option. {lineWidth?:number; strokeStyle?:string;}
|
|
79
|
+
lineNumber?: ILineNumberOption // LineNumber option. {size?:number; font?:string; color?:string; disabled?:boolean; right?:number}
|
|
80
|
+
pageBorder?: IPageBorderOption // PageBorder option. {color?:string; lineWidth:number; padding?:IPadding; disabled?:boolean;}
|
|
81
|
+
badge?: IBadgeOption // Badge option. {top?:number; left?:number}
|
|
82
|
+
modeRule?: IModeRule // mode rule option. {print:{imagePreviewerDisabled?: boolean; backgroundDisabled?: boolean;}; readonly:{imagePreviewerDisabled?: boolean}; form:{controlDeletableDisabled?: boolean}}
|
|
83
|
+
graffiti?: IGraffitiOption // graffiti mode option. {defaultLineWidth?: number; defaultLineColor?: string}
|
|
84
|
+
label?: ILabelOption // Label option. {defaultColor?:string; defaultBackgroundColor?:string; defaultBorderRadius?:number; defaultPadding?:IPadding}
|
|
85
|
+
imgCaption?: IImgCaptionOption // Image caption option. {color?:string; font?:string; size?:number; top?:number}
|
|
86
|
+
list?: IListOption // List option. {inheritStyle?:boolean}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Table Configuration
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
interface ITableOption {
|
|
94
|
+
tdPadding?: IPadding // Cell padding. default: [0, 5, 5, 5]
|
|
95
|
+
defaultTrMinHeight?: number // Default table row minimum height. default: 42
|
|
96
|
+
defaultColMinWidth?: number // Default minimum width for table columns (applied if the overall width is sufficient, otherwise
|
|
97
|
+
overflow?: boolean // Is it allowed for the table to exceed the main body. Default: true
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Header Configuration
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
interface IHeader {
|
|
105
|
+
top?: number // Size from the top of the page.default: 30
|
|
106
|
+
inactiveAlpha?: number // Transparency during deactivation. default: 1
|
|
107
|
+
maxHeightRadio?: MaxHeightRatio // Occupies the maximum height ratio of the page.default: HALF
|
|
108
|
+
disabled?: boolean // Whether to disable
|
|
109
|
+
editable?: boolean // Disable the header content from being edited
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Footer Configuration
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
interface IFooter {
|
|
117
|
+
bottom?: number // The size from the bottom of the page.default: 30
|
|
118
|
+
inactiveAlpha?: number // Transparency during deactivation. default: 1
|
|
119
|
+
maxHeightRadio?: MaxHeightRatio // Occupies the maximum height ratio of the page.default: HALF
|
|
120
|
+
disabled?: boolean // Whether to disable
|
|
121
|
+
editable?: boolean // Disable the footer content from being edited
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Page Number Configuration
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
interface IPageNumber {
|
|
129
|
+
bottom?: number // The size from the bottom of the page.default: 60
|
|
130
|
+
size?: number // font size. default: 12
|
|
131
|
+
font?: string // font. default: Microsoft YaHei
|
|
132
|
+
color?: string // font color. default: #000000
|
|
133
|
+
rowFlex?: RowFlex // Line alignment. default: CENTER
|
|
134
|
+
format?: string // Page number format. default: {pageNo}。example:{pageNo}/{pageCount}
|
|
135
|
+
numberType?: NumberType // The numeric type. default: ARABIC
|
|
136
|
+
disabled?: boolean // Whether to disable
|
|
137
|
+
startPageNo?: number // Start page number.default: 1
|
|
138
|
+
fromPageNo?: number // Page numbers appear from page number.default: 0
|
|
139
|
+
maxPageNo?: number | null // Max page number(starting from 0).default: null
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Watermark Configuration
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
interface IWatermark {
|
|
147
|
+
data: string // text.
|
|
148
|
+
type?: WatermarkType
|
|
149
|
+
width?: number
|
|
150
|
+
height?: number
|
|
151
|
+
color?: string // color. default: #AEB5C0
|
|
152
|
+
opacity?: number // transparency. default: 0.3
|
|
153
|
+
size?: number // font size. default: 200
|
|
154
|
+
font?: string // font. default: Microsoft YaHei
|
|
155
|
+
repeat?: boolean // repeat watermark. default: false
|
|
156
|
+
gap?: [horizontal: number, vertical: number] // watermark spacing. default: [10,10]
|
|
157
|
+
numberType?: NumberType // The numeric type. default: ARABIC
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Placeholder Text Configuration
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface IPlaceholder {
|
|
165
|
+
data: string // text.
|
|
166
|
+
color?: string // color. default: #DCDFE6
|
|
167
|
+
opacity?: number // transparency. default: 1
|
|
168
|
+
size?: number // font size. default: 16
|
|
169
|
+
font?: string // font. default: Microsoft YaHei
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## LineNumber Configuration
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface ILineNumberOption {
|
|
177
|
+
size?: number // font size. default: 12
|
|
178
|
+
font?: string // font. default: Microsoft YaHei
|
|
179
|
+
color?: string // color. default: #000000
|
|
180
|
+
disabled?: boolean // Whether to disable. default: false
|
|
181
|
+
right?: number // Distance from the main text. default: 20
|
|
182
|
+
type?: LineNumberType // Number type (renumber each page, consecutive numbering). default: continuity
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## PageBorder Configuration
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
interface IPageBorderOption {
|
|
190
|
+
color?: string // color. default: #000000
|
|
191
|
+
lineWidth?: number // line width. default: 1
|
|
192
|
+
padding?: IPadding // padding. default: [0, 0, 0, 0]
|
|
193
|
+
disabled?: boolean // Whether to disable. default: true
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Label Configuration
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
interface ILabelOption {
|
|
201
|
+
defaultColor?: string // Default label text color
|
|
202
|
+
defaultBackgroundColor?: string // Default label background color
|
|
203
|
+
defaultBorderRadius?: number // Default label border radius
|
|
204
|
+
defaultPadding?: IPadding // Default label padding
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## List Configuration
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
interface IListOption {
|
|
212
|
+
inheritStyle?: boolean // Whether to let the list number inherit the text style. default: false
|
|
213
|
+
}
|
|
214
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Override
|
|
2
|
+
|
|
3
|
+
## How to Use
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
import Editor from "@hufe921/canvas-editor"
|
|
7
|
+
|
|
8
|
+
const instance = new Editor(container, <IElement[]>data, options)
|
|
9
|
+
|
|
10
|
+
instance.override.overrideFunction = () => unknown | IOverrideResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
interface IOverrideResult {
|
|
15
|
+
preventDefault?: boolean // Prevent the execution of internal default method. Default prevent
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## paste
|
|
20
|
+
|
|
21
|
+
Feature: Override internal paste function
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
instance.override.paste = (evt?: ClipboardEvent) => unknown | IOverrideResult
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## pasteImage
|
|
30
|
+
|
|
31
|
+
Feature: Override internal paste image function
|
|
32
|
+
|
|
33
|
+
Usage:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
instance.override.pasteImage = (file: File | Blob) => unknown | IOverrideResult
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## copy
|
|
40
|
+
|
|
41
|
+
Feature: Override internal copy function
|
|
42
|
+
|
|
43
|
+
Usage:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
instance.override.copy = () => unknown | IOverrideResult
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## drop
|
|
50
|
+
|
|
51
|
+
Feature: Override internal drop function
|
|
52
|
+
|
|
53
|
+
Usage:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
instance.override.drop = (evt: DragEvent) => unknown | IOverrideResult
|
|
57
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Custom Plugin
|
|
2
|
+
|
|
3
|
+
::: tip
|
|
4
|
+
Official plugin: https://github.com/Hufe921/canvas-editor-plugin
|
|
5
|
+
:::
|
|
6
|
+
|
|
7
|
+
## Write a Plugin
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
export function myPlugin(editor: Editor, options?: Option) {
|
|
11
|
+
// 1. update,see more:src/plugins/copy
|
|
12
|
+
editor.command.updateFunction = () => {}
|
|
13
|
+
|
|
14
|
+
// 2. add,see more:src/plugins/markdown
|
|
15
|
+
editor.command.addFunction = () => {}
|
|
16
|
+
|
|
17
|
+
// 3. listener, eventbus, shortcut, contextmenu, override...
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use Plugin
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
instance.use(myPlugin, options?: Option)
|
|
25
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Official plugin
|
|
2
|
+
|
|
3
|
+
::: tip
|
|
4
|
+
Official plugin: https://github.com/Hufe921/canvas-editor-plugin
|
|
5
|
+
|
|
6
|
+
Official plugin demo: https://hufe.club/canvas-editor-plugin
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## Barcode1d
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import Editor from "@hufe921/canvas-editor"
|
|
13
|
+
import barcode1DPlugin from "@hufe921/canvas-editor-plugin-barcode1d"
|
|
14
|
+
|
|
15
|
+
const instance = new Editor()
|
|
16
|
+
instance.use(barcode1DPlugin)
|
|
17
|
+
|
|
18
|
+
instance.executeInsertBarcode1D(
|
|
19
|
+
content: string,
|
|
20
|
+
width: number,
|
|
21
|
+
height: number,
|
|
22
|
+
options?: JsBarcode.Options
|
|
23
|
+
)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Barcode2d
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import Editor from "@hufe921/canvas-editor"
|
|
30
|
+
import barcode2DPlugin from "@hufe921/canvas-editor-plugin-barcode2d"
|
|
31
|
+
|
|
32
|
+
const instance = new Editor()
|
|
33
|
+
instance.use(barcode2DPlugin, options?: IBarcode2DOption)
|
|
34
|
+
|
|
35
|
+
instance.executeInsertBarcode2D(
|
|
36
|
+
content: string,
|
|
37
|
+
width: number,
|
|
38
|
+
height: number,
|
|
39
|
+
hints?: Map<EncodeHintType, any>
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Code block
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
import Editor from "@hufe921/canvas-editor"
|
|
47
|
+
import codeblockPlugin from "@hufe921/canvas-editor-plugin-codeblock"
|
|
48
|
+
|
|
49
|
+
const instance = new Editor()
|
|
50
|
+
instance.use(codeblockPlugin)
|
|
51
|
+
|
|
52
|
+
instance.executeInsertCodeblock(content: string)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Word
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import Editor from '@hufe921/canvas-editor'
|
|
59
|
+
import docxPlugin from '@hufe921/canvas-editor-plugin-docx'
|
|
60
|
+
|
|
61
|
+
const instance = new Editor()
|
|
62
|
+
instance.use(docxPlugin)
|
|
63
|
+
|
|
64
|
+
command.executeImportDocx({
|
|
65
|
+
arrayBuffer: buffer
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
instance.executeExportDocx({
|
|
69
|
+
fileName: string
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Excel
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
import Editor from '@hufe921/canvas-editor'
|
|
77
|
+
import excelPlugin from '@hufe921/canvas-editor-plugin-excel'
|
|
78
|
+
|
|
79
|
+
const instance = new Editor()
|
|
80
|
+
instance.use(excelPlugin)
|
|
81
|
+
|
|
82
|
+
command.executeImportExcel({
|
|
83
|
+
arrayBuffer: buffer
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Floating toolbar
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
import Editor from '@hufe921/canvas-editor'
|
|
91
|
+
import floatingToolbarPlugin from '@hufe921/canvas-editor-plugin-floating-toolbar'
|
|
92
|
+
|
|
93
|
+
const instance = new Editor()
|
|
94
|
+
instance.use(floatingToolbarPlugin)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Diagram
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
import Editor from '@hufe921/canvas-editor'
|
|
101
|
+
import diagramPlugin from '@hufe921/canvas-editor-plugin-diagram'
|
|
102
|
+
|
|
103
|
+
const instance = new Editor()
|
|
104
|
+
instance.use(diagramPlugin)
|
|
105
|
+
|
|
106
|
+
command.executeLoadDiagram({
|
|
107
|
+
lang?: Lang
|
|
108
|
+
data?: string
|
|
109
|
+
onDestroy?: (message?: any) => void
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Convert uppercase and lowercase
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import Editor from '@hufe921/canvas-editor'
|
|
117
|
+
import casePlugin from '@hufe921/canvas-editor-plugin-case'
|
|
118
|
+
|
|
119
|
+
const instance = new Editor()
|
|
120
|
+
instance.use(casePlugin)
|
|
121
|
+
|
|
122
|
+
command.executeUpperCase()
|
|
123
|
+
|
|
124
|
+
command.executeLowerCase()
|
|
125
|
+
```
|