mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 18:37:43 +08:00
提取导出类作为插件
This commit is contained in:
parent
bd655839cb
commit
97bcc22abd
@ -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()
|
||||
|
||||
|
||||
@ -215,4 +215,6 @@ class Export {
|
||||
}
|
||||
}
|
||||
|
||||
Export.instanceName = 'doExport'
|
||||
|
||||
export default Export
|
||||
|
||||
@ -167,4 +167,6 @@ class Select {
|
||||
}
|
||||
}
|
||||
|
||||
Select.instanceName = 'select'
|
||||
|
||||
export default Select
|
||||
|
||||
@ -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+),
|
||||
|
||||
@ -612,6 +612,9 @@ redo. All commands are as follows:</p>
|
||||
includes the node tree, if <code>true</code> is passed, it will also include theme, layout,
|
||||
view, etc. data</p>
|
||||
<h3>export(type, isDownload, fileName)</h3>
|
||||
<blockquote>
|
||||
<p>You need to register the <code>Export</code> plugin first</p>
|
||||
</blockquote>
|
||||
<p>Export</p>
|
||||
<p><code>type</code>: the type to be exported, optional values: png, svg, json, pdf (v0.2.1+),
|
||||
smm (essentially also json)</p>
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>DoExport instance</h1>
|
||||
<p>The <code>doExport</code> instance is responsible for exporting and can be obtained through
|
||||
<code>mindMap.doExport</code>.</p>
|
||||
<h1>Export plugin</h1>
|
||||
<p>The <code>Export</code> plugin provides the export function.</p>
|
||||
<h2>Register</h2>
|
||||
<pre class="hljs"><code><span class="hljs-keyword">import</span> MindMap <span class="hljs-keyword">from</span> <span class="hljs-string">'simple-mind-map'</span>
|
||||
<span class="hljs-keyword">import</span> Export <span class="hljs-keyword">from</span> <span class="hljs-string">'simple-mind-map/src/Export.js'</span>
|
||||
|
||||
MindMap.usePlugin(Export)
|
||||
</code></pre>
|
||||
<p>After registration and instantiation of <code>MindMap</code>, the instance can be obtained through <code>mindMap.doExport</code>.</p>
|
||||
<h2>Methods</h2>
|
||||
<h3>png()</h3>
|
||||
<p>Exports as <code>png</code>, an async method that returns image data, <code>data:url</code> data which
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
|
||||
export default [{"lang":"zh","children":[{"path":"batchExecution","title":"BatchExecution实例"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"Command实例"},{"path":"constructor","title":"构造函数"},{"path":"doExport","title":"DoExport实例"},{"path":"drag","title":"Drag插件"},{"path":"introduction","title":"简介"},{"path":"keyboardNavigation","title":"KeyboardNavigation插件"},{"path":"keyCommand","title":"KeyCommand实例"},{"path":"miniMap","title":"MiniMap插件"},{"path":"node","title":"Node实例"},{"path":"render","title":"Render实例"},{"path":"select","title":"Select实例"},{"path":"start","title":"开始"},{"path":"translate","title":"参与翻译"},{"path":"utils","title":"内置工具方法"},{"path":"view","title":"View实例"},{"path":"watermark","title":"Watermark插件"},{"path":"xmind","title":"XMind解析"}]},{"lang":"en","children":[{"path":"batchExecution","title":"batchExecution instance"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"command instance"},{"path":"constructor","title":"Constructor"},{"path":"doExport","title":"DoExport instance"},{"path":"drag","title":"Drag plugin"},{"path":"introduction","title":"Introduction"},{"path":"keyboardNavigation","title":"KeyboardNavigation plugin"},{"path":"keyCommand","title":"KeyCommand instance"},{"path":"miniMap","title":"MiniMap plugin"},{"path":"node","title":"Node instance"},{"path":"render","title":"Render instance"},{"path":"select","title":"Select instance"},{"path":"start","title":"Start"},{"path":"translate","title":"Participate in translation"},{"path":"utils","title":"Utility Methods"},{"path":"view","title":"View instance"},{"path":"watermark","title":"Watermark plugin"},{"path":"xmind","title":"XMind parse"}]}]
|
||||
export default [{"lang":"zh","children":[{"path":"batchExecution","title":"BatchExecution实例"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"Command实例"},{"path":"constructor","title":"构造函数"},{"path":"doExport","title":"Export 插件"},{"path":"drag","title":"Drag插件"},{"path":"introduction","title":"简介"},{"path":"keyboardNavigation","title":"KeyboardNavigation插件"},{"path":"keyCommand","title":"KeyCommand实例"},{"path":"miniMap","title":"MiniMap插件"},{"path":"node","title":"Node实例"},{"path":"render","title":"Render实例"},{"path":"select","title":"Select实例"},{"path":"start","title":"开始"},{"path":"translate","title":"参与翻译"},{"path":"utils","title":"内置工具方法"},{"path":"view","title":"View实例"},{"path":"watermark","title":"Watermark插件"},{"path":"xmind","title":"XMind解析"}]},{"lang":"en","children":[{"path":"batchExecution","title":"batchExecution instance"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"command instance"},{"path":"constructor","title":"Constructor"},{"path":"doExport","title":"Export plugin"},{"path":"drag","title":"Drag plugin"},{"path":"introduction","title":"Introduction"},{"path":"keyboardNavigation","title":"KeyboardNavigation plugin"},{"path":"keyCommand","title":"KeyCommand instance"},{"path":"miniMap","title":"MiniMap plugin"},{"path":"node","title":"Node instance"},{"path":"render","title":"Render instance"},{"path":"select","title":"Select instance"},{"path":"start","title":"Start"},{"path":"translate","title":"Participate in translation"},{"path":"utils","title":"Utility Methods"},{"path":"view","title":"View instance"},{"path":"watermark","title":"Watermark plugin"},{"path":"xmind","title":"XMind parse"}]}]
|
||||
|
||||
@ -293,6 +293,8 @@ mindMap.updateConfig({
|
||||
|
||||
### export(type, isDownload, fileName)
|
||||
|
||||
> 需要先注册`Export`插件
|
||||
|
||||
导出
|
||||
|
||||
`type`:要导出的类型,可选值:png、svg、json、pdf(v0.2.1+)、smm(本质也是json)
|
||||
|
||||
@ -604,6 +604,9 @@ mindMap.setTheme(<span class="hljs-string">'主题名称'</span>)
|
||||
<p>获取思维导图数据</p>
|
||||
<p><code>withConfig</code>:<code>Boolean</code>,默认为<code>false</code>,即获取的数据只包括节点树,如果传<code>true</code>则会包含主题、布局、视图等数据</p>
|
||||
<h3>export(type, isDownload, fileName)</h3>
|
||||
<blockquote>
|
||||
<p>需要先注册<code>Export</code>插件</p>
|
||||
</blockquote>
|
||||
<p>导出</p>
|
||||
<p><code>type</code>:要导出的类型,可选值:png、svg、json、pdf(v0.2.1+)、smm(本质也是json)</p>
|
||||
<p><code>isDownload</code>:是否需要直接触发下载,布尔值,默认为<code>false</code></p>
|
||||
|
||||
@ -1,6 +1,17 @@
|
||||
# DoExport实例
|
||||
# Export 插件
|
||||
|
||||
`doExport`实例负责导出,可通过`mindMap.doExport`获取到该实例
|
||||
`Export`插件提供导出的功能。
|
||||
|
||||
## 注册
|
||||
|
||||
```js
|
||||
import MindMap from 'simple-mind-map'
|
||||
import Export from 'simple-mind-map/src/Export.js'
|
||||
|
||||
MindMap.usePlugin(Export)
|
||||
```
|
||||
|
||||
注册完且实例化`MindMap`后可通过`mindMap.doExport`获取到该实例。
|
||||
|
||||
## 方法
|
||||
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>DoExport实例</h1>
|
||||
<p><code>doExport</code>实例负责导出,可通过<code>mindMap.doExport</code>获取到该实例</p>
|
||||
<h1>Export 插件</h1>
|
||||
<p><code>Export</code>插件提供导出的功能。</p>
|
||||
<h2>注册</h2>
|
||||
<pre class="hljs"><code><span class="hljs-keyword">import</span> MindMap <span class="hljs-keyword">from</span> <span class="hljs-string">'simple-mind-map'</span>
|
||||
<span class="hljs-keyword">import</span> Export <span class="hljs-keyword">from</span> <span class="hljs-string">'simple-mind-map/src/Export.js'</span>
|
||||
|
||||
MindMap.usePlugin(Export)
|
||||
</code></pre>
|
||||
<p>注册完且实例化<code>MindMap</code>后可通过<code>mindMap.doExport</code>获取到该实例。</p>
|
||||
<h2>方法</h2>
|
||||
<h3>png()</h3>
|
||||
<p>导出为<code>png</code>,异步方法,返回图片数据,<code>data:url</code>数据,可以自行下载或显示</p>
|
||||
|
||||
@ -25,6 +25,7 @@ import MindMap from 'simple-mind-map'
|
||||
import MiniMap from 'simple-mind-map/src/MiniMap.js'
|
||||
import Watermark from 'simple-mind-map/src/Watermark.js'
|
||||
import KeyboardNavigation from 'simple-mind-map/src/KeyboardNavigation.js'
|
||||
import Export from 'simple-mind-map/src/Export.js'
|
||||
import Drag from 'simple-mind-map/src/Drag.js'
|
||||
import Outline from './Outline'
|
||||
import Style from './Style'
|
||||
@ -49,6 +50,7 @@ MindMap
|
||||
.usePlugin(Watermark)
|
||||
.usePlugin(Drag)
|
||||
.usePlugin(KeyboardNavigation)
|
||||
.usePlugin(Export)
|
||||
|
||||
// 注册自定义主题
|
||||
customThemeList.forEach((item) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user