diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 8637e0d2..35b20891 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -7,8 +7,6 @@ import Style from './src/Style' import KeyCommand from './src/KeyCommand' import Command from './src/Command' import BatchExecution from './src/BatchExecution' -import Export from './src/Export' -import Select from './src/Select' import { layoutValueList } from './src/utils/constant' import { SVG } from '@svgdotjs/svg.js' import { simpleDeepClone } from './src/utils' @@ -115,16 +113,6 @@ class MindMap { draw: this.draw }) - // 导出类 - this.doExport = new Export({ - mindMap: this - }) - - // 选择类 - this.select = new Select({ - mindMap: this - }) - // 批量执行类 this.batchExecution = new BatchExecution() diff --git a/simple-mind-map/src/Export.js b/simple-mind-map/src/Export.js index 141965ee..df7be3e3 100644 --- a/simple-mind-map/src/Export.js +++ b/simple-mind-map/src/Export.js @@ -215,4 +215,6 @@ class Export { } } +Export.instanceName = 'doExport' + export default Export diff --git a/simple-mind-map/src/Select.js b/simple-mind-map/src/Select.js index 95949c20..98a53c0a 100644 --- a/simple-mind-map/src/Select.js +++ b/simple-mind-map/src/Select.js @@ -167,4 +167,6 @@ class Select { } } +Select.instanceName = 'select' + export default Select diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 71d31470..f9bca6b2 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -301,6 +301,8 @@ view, etc. data ### export(type, isDownload, fileName) +> You need to register the `Export` plugin first + Export `type`: the type to be exported, optional values: png, svg, json, pdf (v0.2.1+), diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index 1a0fa82a..00de7638 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -612,6 +612,9 @@ redo. All commands are as follows:

includes the node tree, if true is passed, it will also include theme, layout, view, etc. data

export(type, isDownload, fileName)

+
+

You need to register the Export plugin first

+

Export

type: the type to be exported, optional values: png, svg, json, pdf (v0.2.1+), smm (essentially also json)

diff --git a/web/src/pages/Doc/en/doExport/index.md b/web/src/pages/Doc/en/doExport/index.md index 9538f9da..a2593306 100644 --- a/web/src/pages/Doc/en/doExport/index.md +++ b/web/src/pages/Doc/en/doExport/index.md @@ -1,7 +1,17 @@ -# DoExport instance +# Export plugin -The `doExport` instance is responsible for exporting and can be obtained through -`mindMap.doExport`. +The `Export` plugin provides the export function. + +## Register + +```js +import MindMap from 'simple-mind-map' +import Export from 'simple-mind-map/src/Export.js' + +MindMap.usePlugin(Export) +``` + +After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.doExport`. ## Methods diff --git a/web/src/pages/Doc/en/doExport/index.vue b/web/src/pages/Doc/en/doExport/index.vue index 0292416d..21e8be1f 100644 --- a/web/src/pages/Doc/en/doExport/index.vue +++ b/web/src/pages/Doc/en/doExport/index.vue @@ -1,8 +1,14 @@