Doc: update

This commit is contained in:
街角小林 2024-03-28 19:31:49 +08:00
parent c6f8f38648
commit 1ca6a34edf
14 changed files with 262 additions and 44 deletions

View File

@ -11,19 +11,17 @@
本项目包含两部分: 本项目包含两部分:
1.一个 js 思维导图库,不依赖任何框架,可以使用它来快速完成 Web 思维导图产品的开发。 1.一个 js 思维导图库,不依赖任何框架,可以使用它来快速完成 Web 思维导图产品的开发。
开发文档:[https://wanglin2.github.io/mind-map/#/doc/zh/](https://wanglin2.github.io/mind-map/#/doc/zh/)。 开发文档:[https://wanglin2.github.io/mind-map/#/doc/zh/](https://wanglin2.github.io/mind-map/#/doc/zh/)。
2.一个 Web 思维导图基于思维导图库、Vue2.x、ElementUI 开发,可以操作电脑本地文件,所以你可以直接把它当做一个在线版思维导图应用使用,如果觉得 github 的响应速度慢,你也可以部署到你的服务器上 2.一个 Web 思维导图基于思维导图库、Vue2.x、ElementUI 开发,可以操作电脑本地文件,可以当做一个在线版思维导图应用使用,也可以自部署和二次开发
在线地址:[https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-map/)。 在线地址:[https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-map/)。
外也提供了客户端可供下载使用,支持`Windows``Mac``Linux`,下载地址: 外也提供了客户端可供下载使用,支持`Windows``Mac``Linux`,下载地址:
Github[releases](https://github.com/wanglin2/mind-map/releases)。 Github[releases](https://github.com/wanglin2/mind-map/releases)。百度云盘:[地址](https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3)。
百度云盘:[地址](https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3)。
> 客户端版本会落后于在线版本,尝试最新功能请优先使用在线版。 > 客户端版本会落后于在线版本,尝试最新功能请优先使用在线版。
@ -310,4 +308,12 @@ const mindMap = new MindMap({
<img src="./web/src/assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;" /> <img src="./web/src/assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;" />
<span>逆水行舟</span> <span>逆水行舟</span>
</span> </span>
<span>
<img src="./web/src/assets/avatar/default.png" style="width: 50px;height: 50px;" />
<span>LiuJL</span>
</span>
<span>
<img src="./web/src/assets/avatar/L.jpg" style="width: 50px;height: 50px;" />
<span>L</span>
</span>
</p> </p>

BIN
web/src/assets/avatar/L.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -23,12 +23,16 @@ New:
> 7.Adding mouse events to personnel avatars during collaborative editing; > 7.Adding mouse events to personnel avatars during collaborative editing;
> >
> 8.Instantiation and setData methods support passing in empty data; > 8.Instantiation and setData methods support passing in empty data;
>
> 9.Add an instantiation option for adding custom content when exporting images;
Demo: Demo:
> 1.Support configuration of rainbow lines; > 1.Support configuration of rainbow lines;
> >
> 2.Add source code editing mode; > 2.Add source code editing mode;
>
> 3.Exporting PNG, PDF, and SVG supports setting custom text at the bottom;
Client: Client:

View File

@ -16,11 +16,13 @@
<p>6.Add the getAncestorNodes method to the node instance to obtain the list of ancestor nodes;</p> <p>6.Add the getAncestorNodes method to the node instance to obtain the list of ancestor nodes;</p>
<p>7.Adding mouse events to personnel avatars during collaborative editing;</p> <p>7.Adding mouse events to personnel avatars during collaborative editing;</p>
<p>8.Instantiation and setData methods support passing in empty data;</p> <p>8.Instantiation and setData methods support passing in empty data;</p>
<p>9.Add an instantiation option for adding custom content when exporting images;</p>
</blockquote> </blockquote>
<p>Demo:</p> <p>Demo:</p>
<blockquote> <blockquote>
<p>1.Support configuration of rainbow lines;</p> <p>1.Support configuration of rainbow lines;</p>
<p>2.Add source code editing mode;</p> <p>2.Add source code editing mode;</p>
<p>3.Exporting PNG, PDF, and SVG supports setting custom text at the bottom;</p>
</blockquote> </blockquote>
<p>Client:</p> <p>Client:</p>
<blockquote> <blockquote>

View File

@ -114,8 +114,10 @@ const mindMap = new MindMap({
| isOnlySearchCurrentRenderNodesv0.9.8+ | Boolean | false | Is it necessary to only search for the current rendered node, and nodes that have been collapsed will not be searched for | | | isOnlySearchCurrentRenderNodesv0.9.8+ | Boolean | false | Is it necessary to only search for the current rendered node, and nodes that have been collapsed will not be searched for | |
| onlyOneEnableActiveNodeOnCooperatev0.9.8+ | Boolean | false | During collaborative editing, the same node cannot be selected by multiple people at the same time | | | onlyOneEnableActiveNodeOnCooperatev0.9.8+ | Boolean | false | During collaborative editing, the same node cannot be selected by multiple people at the same time | |
| beforeCooperateUpdatev0.9.8+ | Function、null | null | During collaborative editing, node operations are about to be updated to the lifecycle functions of other clients. The function takes an object as a parameter:{ type: 【createOrUpdateCreate or update nodes、deleteDelete node】, list: 【Array type, 1.When type=createOrUpdate, it represents the node data that has been created or updated, which will be synchronized to other clients, so you can modify the data; 2.When type=delete, represents the deleted node data】 } | | | beforeCooperateUpdatev0.9.8+ | Function、null | null | During collaborative editing, node operations are about to be updated to the lifecycle functions of other clients. The function takes an object as a parameter:{ type: 【createOrUpdateCreate or update nodes、deleteDelete node】, list: 【Array type, 1.When type=createOrUpdate, it represents the node data that has been created or updated, which will be synchronized to other clients, so you can modify the data; 2.When type=delete, represents the deleted node data】 } | |
| beforeShortcutRunv0.9.9+ | Function、null | null | The lifecycle function before the shortcut operation is about to be executed, returning true can prevent the operation from executing. The function takes two parameters: keyShortcut key、activeNodeListList of currently activated nodes | | beforeShortcutRunv0.9.9+ | Function、null | null | The lifecycle function before the shortcut operation is about to be executed, returning true can prevent the operation from executing. The function takes two parameters: keyShortcut key、activeNodeListList of currently activated nodes | |
| rainbowLinesConfigv0.9.9+ | Object | { open: false, colorsList: [] } | Rainbow line configuration requires registering the RainbowLines plugin first. Object type, Structure: { open: false【Is turn on rainbow lines】, colorsList: []【Customize the color list for rainbow lines. If not set, the default color list will be used】 } | | rainbowLinesConfigv0.9.9+ | Object | { open: false, colorsList: [] } | Rainbow line configuration requires registering the RainbowLines plugin first. Object type, Structure: { open: false【Is turn on rainbow lines】, colorsList: []【Customize the color list for rainbow lines. If not set, the default color list will be used】 } | |
| addContentToHeaderv0.9.9+ | Function、null | null | Add custom content to the header when exporting PNG, SVG, and PDF. Can pass a function that can return null to indicate no content is added, or it can return an object, For a detailed introduction, please refer to section 【How to add custom content when exporting】 below | |
| addContentToFooterv0.9.9+ | Function、null | null | The basic definition is the same as addContentToHeader, adding custom content at the end | |
### Data structure ### Data structure
@ -177,6 +179,41 @@ If you want to add custom fields, you can add them to the same level as 'data' a
| type | String | | Values for icon grouping | | type | String | | Values for icon grouping |
| list | Array | | A list of icons under grouping, with each item in the array being an object, `{ name: '', icon: '' }``name`represents the name of the icon, `icon`represents the icon, Can be an `svg` icon, such as `<svg ...><path></path></svg>`, also can be a image `url`, or `base64` icon, such as `data:image/png;base64,...` | | list | Array | | A list of icons under grouping, with each item in the array being an object, `{ name: '', icon: '' }``name`represents the name of the icon, `icon`represents the icon, Can be an `svg` icon, such as `<svg ...><path></path></svg>`, also can be a image `url`, or `base64` icon, such as `data:image/png;base64,...` |
### How to add custom content when exporting
The two instantiation options `addContentToHeader` and `addContentToFooter` can be used to add custom content at the beginning and end when exporting `png``svg``pdf`, The default value is `null`, which means no configuration. A function can be passed and can return `null`, which means no content will be added. If you want to add content, you need to return the following structure:
```
{
el,// Custom DOM node to be added, styles can be inline
cssText,// Optional, if the style does not want to be inlined, you can pass this value as a CSS string
height: 50// The height of the returned DOM node must be passed
}
```
A simple example:
```js
new MindMap({
addContentToFooter: () => {
const el = document.createElement('div')
el.className = 'footer'
el.innerHTML = 'From: simple-mind-map'
const cssText = `
.footer {
width: 100%;
height: 30px;
}
`
return {
el,
cssText,
height: 30
}
}
})
```
## Static methods ## Static methods
### defineTheme(name, config) ### defineTheme(name, config)
@ -334,7 +371,7 @@ Clear `lineDraw`、`associativeLineDraw`、`nodeDraw`、`otherDraw` containers.
Destroy mind maps. It will remove registered plugins, remove listening events, and delete all nodes on the canvas. Destroy mind maps. It will remove registered plugins, remove listening events, and delete all nodes on the canvas.
### getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false }) ### getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false, addContentToHeader, addContentToFooter })
> v0.3.0+ > v0.3.0+
@ -344,6 +381,10 @@ Destroy mind maps. It will remove registered plugins, remove listening events, a
`ignoreWatermark`v0.8.0+, Do not draw watermarks. If you do not need to draw watermarks, you can pass 'true' because drawing watermarks is very slow `ignoreWatermark`v0.8.0+, Do not draw watermarks. If you do not need to draw watermarks, you can pass 'true' because drawing watermarks is very slow
`addContentToHeader`v0.9.9+, Function, You can return the custom content to be added to the header, as detailed in the configuration in 【Instantiation options】
`addContentToFooter`v0.9.9+, Function, You can return the custom content to be added to the tail, as detailed in the configuration in 【Instantiation options】
Get the `svg` data and return an object. The detailed structure is as follows: Get the `svg` data and return an object. The detailed structure is as follows:
```js ```js

View File

@ -672,6 +672,20 @@
<td>Rainbow line configuration requires registering the RainbowLines plugin first. Object type, Structure: { open: falseIs turn on rainbow lines, colorsList: []Customize the color list for rainbow lines. If not set, the default color list will be used }</td> <td>Rainbow line configuration requires registering the RainbowLines plugin first. Object type, Structure: { open: falseIs turn on rainbow lines, colorsList: []Customize the color list for rainbow lines. If not set, the default color list will be used }</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>addContentToHeaderv0.9.9+</td>
<td>Functionnull</td>
<td>null</td>
<td>Add custom content to the header when exporting PNG, SVG, and PDF. Can pass a function that can return null to indicate no content is added, or it can return an object, For a detailed introduction, please refer to section How to add custom content when exporting below</td>
<td></td>
</tr>
<tr>
<td>addContentToFooterv0.9.9+</td>
<td>Functionnull</td>
<td>null</td>
<td>The basic definition is the same as addContentToHeader, adding custom content at the end</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
<h3>Data structure</h3> <h3>Data structure</h3>
@ -790,6 +804,34 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>How to add custom content when exporting</h3>
<p>The two instantiation options <code>addContentToHeader</code> and <code>addContentToFooter</code> can be used to add custom content at the beginning and end when exporting <code>png</code><code>svg</code><code>pdf</code>, The default value is <code>null</code>, which means no configuration. A function can be passed and can return <code>null</code>, which means no content will be added. If you want to add content, you need to return the following structure:</p>
<pre class="hljs"><code>{
el,// Custom DOM node to be added, styles can be inline
cssText,// Optional, if the style does not want to be inlined, you can pass this value as a CSS string
height: 50// The height of the returned DOM node must be passed
}
</code></pre>
<p>A simple example:</p>
<pre class="hljs"><code><span class="hljs-keyword">new</span> MindMap({
<span class="hljs-attr">addContentToFooter</span>: <span class="hljs-function">() =&gt;</span> {
<span class="hljs-keyword">const</span> el = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">&#x27;div&#x27;</span>)
el.className = <span class="hljs-string">&#x27;footer&#x27;</span>
el.innerHTML = <span class="hljs-string">&#x27;From: simple-mind-map&#x27;</span>
<span class="hljs-keyword">const</span> cssText = <span class="hljs-string">`
.footer {
width: 100%;
height: 30px;
}
`</span>
<span class="hljs-keyword">return</span> {
el,
cssText,
<span class="hljs-attr">height</span>: <span class="hljs-number">30</span>
}
}
})
</code></pre>
<h2>Static methods</h2> <h2>Static methods</h2>
<h3>defineTheme(name, config)</h3> <h3>defineTheme(name, config)</h3>
<blockquote> <blockquote>
@ -901,13 +943,15 @@ mindMap.setTheme(<span class="hljs-string">&#x27;Theme name&#x27;</span>)
<p>v0.6.0+</p> <p>v0.6.0+</p>
</blockquote> </blockquote>
<p>Destroy mind maps. It will remove registered plugins, remove listening events, and delete all nodes on the canvas.</p> <p>Destroy mind maps. It will remove registered plugins, remove listening events, and delete all nodes on the canvas.</p>
<h3>getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false })</h3> <h3>getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false, addContentToHeader, addContentToFooter })</h3>
<blockquote> <blockquote>
<p>v0.3.0+</p> <p>v0.3.0+</p>
</blockquote> </blockquote>
<p><code>paddingX</code>: Padding x</p> <p><code>paddingX</code>: Padding x</p>
<p><code>paddingY</code>: Padding y</p> <p><code>paddingY</code>: Padding y</p>
<p><code>ignoreWatermark</code>v0.8.0+, Do not draw watermarks. If you do not need to draw watermarks, you can pass 'true' because drawing watermarks is very slow</p> <p><code>ignoreWatermark</code>v0.8.0+, Do not draw watermarks. If you do not need to draw watermarks, you can pass 'true' because drawing watermarks is very slow</p>
<p><code>addContentToHeader</code>v0.9.9+, Function, You can return the custom content to be added to the header, as detailed in the configuration in Instantiation options</p>
<p><code>addContentToFooter</code>v0.9.9+, Function, You can return the custom content to be added to the tail, as detailed in the configuration in Instantiation options</p>
<p>Get the <code>svg</code> data and return an object. The detailed structure is as follows:</p> <p>Get the <code>svg</code> data and return an object. The detailed structure is as follows:</p>
<pre class="hljs"><code>{ <pre class="hljs"><code>{
svg, <span class="hljs-comment">// Element, the overall svg element of the mind map graphics, including: svg (canvas container), g (actual mind map group)</span> svg, <span class="hljs-comment">// Element, the overall svg element of the mind map graphics, including: svg (canvas container), g (actual mind map group)</span>

View File

@ -343,4 +343,12 @@ Open source is not easy. If this project is helpful to you, you can invite the a
<img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" /> <img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>逆水行舟</p> <p>逆水行舟</p>
</div> </div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>LiuJL</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/L.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>L</p>
</div>
</div> </div>

View File

@ -8,17 +8,17 @@
</blockquote> </blockquote>
<h2>Features</h2> <h2>Features</h2>
<ul> <ul>
<li><input type="checkbox" id="checkbox16" checked="true" /><label for="checkbox16">Pluggable architecture, in addition to core functions, other functions are provided as plugins, which can be used as needed to reduce packaging volume</label></li> <li><input type="checkbox" id="checkbox48" checked="true" /><label for="checkbox48">Pluggable architecture, in addition to core functions, other functions are provided as plugins, which can be used as needed to reduce packaging volume</label></li>
<li><input type="checkbox" id="checkbox17" checked="true" /><label for="checkbox17">Support logical structure chart, mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures</label></li> <li><input type="checkbox" id="checkbox49" checked="true" /><label for="checkbox49">Support logical structure chart, mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures</label></li>
<li><input type="checkbox" id="checkbox18" checked="true" /><label for="checkbox18">Built-in multiple themes, allowing for highly customizable styles, and supporting registration of new themes</label></li> <li><input type="checkbox" id="checkbox50" checked="true" /><label for="checkbox50">Built-in multiple themes, allowing for highly customizable styles, and supporting registration of new themes</label></li>
<li><input type="checkbox" id="checkbox19" checked="true" /><label for="checkbox19">Node content supports text (regular text, rich text), images, icons, hyperlinks, notes, labels, summaries, and math formulas</label></li> <li><input type="checkbox" id="checkbox51" checked="true" /><label for="checkbox51">Node content supports text (regular text, rich text), images, icons, hyperlinks, notes, labels, summaries, and math formulas</label></li>
<li><input type="checkbox" id="checkbox20" checked="true" /><label for="checkbox20">Nodes support drag and drop (drag and move, freely adjust), multiple node shapes, and fully customize node content using DDM</label></li> <li><input type="checkbox" id="checkbox52" checked="true" /><label for="checkbox52">Nodes support drag and drop (drag and move, freely adjust), multiple node shapes, and fully customize node content using DDM</label></li>
<li><input type="checkbox" id="checkbox21" checked="true" /><label for="checkbox21">Support canvas dragging and scaling</label></li> <li><input type="checkbox" id="checkbox53" checked="true" /><label for="checkbox53">Support canvas dragging and scaling</label></li>
<li><input type="checkbox" id="checkbox22" checked="true" /><label for="checkbox22">Supports two multi node selection methods: mouse button drag selection and Ctrl+left button selection</label></li> <li><input type="checkbox" id="checkbox54" checked="true" /><label for="checkbox54">Supports two multi node selection methods: mouse button drag selection and Ctrl+left button selection</label></li>
<li><input type="checkbox" id="checkbox23" checked="true" /><label for="checkbox23">Supoorts to export as </label><code>json</code><code>png</code><code>svg</code><code>pdf</code><code>markdown</code><code>xmind</code>, support import from <code>json</code><code>xmind</code><code>markdown</code></li> <li><input type="checkbox" id="checkbox55" checked="true" /><label for="checkbox55">Supoorts to export as </label><code>json</code><code>png</code><code>svg</code><code>pdf</code><code>markdown</code><code>xmind</code>, support import from <code>json</code><code>xmind</code><code>markdown</code></li>
<li><input type="checkbox" id="checkbox24" checked="true" /><label for="checkbox24">Support shortcut keys, forward and backward, correlation lines, search and replacement, small maps, watermarks, and scrollbar</label></li> <li><input type="checkbox" id="checkbox56" checked="true" /><label for="checkbox56">Support shortcut keys, forward and backward, correlation lines, search and replacement, small maps, watermarks, and scrollbar</label></li>
<li><input type="checkbox" id="checkbox25" checked="true" /><label for="checkbox25">Provide rich configurations to meet various scenarios and usage habits</label></li> <li><input type="checkbox" id="checkbox57" checked="true" /><label for="checkbox57">Provide rich configurations to meet various scenarios and usage habits</label></li>
<li><input type="checkbox" id="checkbox26" checked="true" /><label for="checkbox26">Support collaborative editing</label></li> <li><input type="checkbox" id="checkbox58" checked="true" /><label for="checkbox58">Support collaborative editing</label></li>
</ul> </ul>
<blockquote> <blockquote>
<p>Features that will not be implemented:</p> <p>Features that will not be implemented:</p>
@ -34,16 +34,16 @@ frameworks such as Vue and React, or without a framework.</p>
<p>This is an online mind map built using the <code>simple-mind-map</code> library and based <p>This is an online mind map built using the <code>simple-mind-map</code> library and based
on <code>Vue2.x</code> and <code>ElementUI</code>. Features include:</p> on <code>Vue2.x</code> and <code>ElementUI</code>. Features include:</p>
<ul> <ul>
<li><input type="checkbox" id="checkbox27" checked="true" /><label for="checkbox27">Toolbar, which supports inserting and deleting nodes, and editing node</label> <li><input type="checkbox" id="checkbox59" checked="true" /><label for="checkbox59">Toolbar, which supports inserting and deleting nodes, and editing node</label>
images, icons, hyperlinks, notes, tags, and summaries</li> images, icons, hyperlinks, notes, tags, and summaries</li>
<li><input type="checkbox" id="checkbox28" checked="true" /><label for="checkbox28">Sidebar, with panels for basic style settings, node style settings,</label> <li><input type="checkbox" id="checkbox60" checked="true" /><label for="checkbox60">Sidebar, with panels for basic style settings, node style settings,</label>
outline, theme selection, and structure selection</li> outline, theme selection, and structure selection</li>
<li><input type="checkbox" id="checkbox29" checked="true" /><label for="checkbox29">Import and export functionality; data is saved in the browser's local</label> <li><input type="checkbox" id="checkbox61" checked="true" /><label for="checkbox61">Import and export functionality; data is saved in the browser's local</label>
storage by default, but it also supports creating, opening, and editing storage by default, but it also supports creating, opening, and editing
local files on the computer directly</li> local files on the computer directly</li>
<li><input type="checkbox" id="checkbox30" checked="true" /><label for="checkbox30">Right-click menu, which supports operations such as expanding, collapsing,</label> <li><input type="checkbox" id="checkbox62" checked="true" /><label for="checkbox62">Right-click menu, which supports operations such as expanding, collapsing,</label>
and organizing layout</li> and organizing layout</li>
<li><input type="checkbox" id="checkbox31" checked="true" /><label for="checkbox31">Bottom bar, which supports node and word count statistics, switching</label> <li><input type="checkbox" id="checkbox63" checked="true" /><label for="checkbox63">Bottom bar, which supports node and word count statistics, switching</label>
between edit and read-only modes, zooming in and out, and switching to between edit and read-only modes, zooming in and out, and switching to
full screen, support mini map</li> full screen, support mini map</li>
</ul> </ul>
@ -297,6 +297,14 @@ full screen, support mini map</li>
<img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" /> <img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>逆水行舟</p> <p>逆水行舟</p>
</div> </div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>LiuJL</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/L.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>L</p>
</div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -23,12 +23,16 @@
> 7.协同编辑时的人员头像增加鼠标事件; > 7.协同编辑时的人员头像增加鼠标事件;
> >
> 8.实例化及setData方法支持传入空的data > 8.实例化及setData方法支持传入空的data
>
> 9.新增导出图片时添加自定义内容的实例化选项;
Demo Demo
> 1.支持配置彩虹线条; > 1.支持配置彩虹线条;
> >
> 2.新增源码编辑模式; > 2.新增源码编辑模式;
>
> 3.导出png、pdf、svg支持设置底部自定义文字
客户端: 客户端:

View File

@ -16,11 +16,13 @@
<p>6.节点实例新增getAncestorNodes方法用于获取祖先节点列表</p> <p>6.节点实例新增getAncestorNodes方法用于获取祖先节点列表</p>
<p>7.协同编辑时的人员头像增加鼠标事件</p> <p>7.协同编辑时的人员头像增加鼠标事件</p>
<p>8.实例化及setData方法支持传入空的data</p> <p>8.实例化及setData方法支持传入空的data</p>
<p>9.新增导出图片时添加自定义内容的实例化选项</p>
</blockquote> </blockquote>
<p>Demo</p> <p>Demo</p>
<blockquote> <blockquote>
<p>1.支持配置彩虹线条</p> <p>1.支持配置彩虹线条</p>
<p>2.新增源码编辑模式</p> <p>2.新增源码编辑模式</p>
<p>3.导出pngpdfsvg支持设置底部自定义文字</p>
</blockquote> </blockquote>
<p>客户端:</p> <p>客户端:</p>
<blockquote> <blockquote>

View File

@ -115,6 +115,8 @@ const mindMap = new MindMap({
| beforeCooperateUpdatev0.9.8+ | Function、null | null | 协同编辑时,节点操作即将更新到其他客户端前的生命周期函数。函数接收一个对象作为参数:{ type: 【createOrUpdate创建节点或更新节点、delete删除节点】, list: 【数组类型1.当type=createOrUpdate时代表被创建或被更新的节点数据即将同步到其他客户端所以你可以修改该数据2.当type=delete时代表被删除的节点数据】 } | | beforeCooperateUpdatev0.9.8+ | Function、null | null | 协同编辑时,节点操作即将更新到其他客户端前的生命周期函数。函数接收一个对象作为参数:{ type: 【createOrUpdate创建节点或更新节点、delete删除节点】, list: 【数组类型1.当type=createOrUpdate时代表被创建或被更新的节点数据即将同步到其他客户端所以你可以修改该数据2.当type=delete时代表被删除的节点数据】 } |
| beforeShortcutRunv0.9.9+ | Function、null | null | 快捷键操作即将执行前的生命周期函数返回true可以阻止操作执行。函数接收两个参数key快捷键、activeNodeList当前激活的节点列表 | | beforeShortcutRunv0.9.9+ | Function、null | null | 快捷键操作即将执行前的生命周期函数返回true可以阻止操作执行。函数接收两个参数key快捷键、activeNodeList当前激活的节点列表 |
| rainbowLinesConfigv0.9.9+ | Object | { open: false, colorsList: [] } | 彩虹线条配置需要先注册RainbowLines插件。对象类型结构{ open: false【是否开启彩虹线条】, colorsList: []【自定义彩虹线条的颜色列表,如果不设置,会使用默认颜色列表】 } | | rainbowLinesConfigv0.9.9+ | Object | { open: false, colorsList: [] } | 彩虹线条配置需要先注册RainbowLines插件。对象类型结构{ open: false【是否开启彩虹线条】, colorsList: []【自定义彩虹线条的颜色列表,如果不设置,会使用默认颜色列表】 } |
| addContentToHeaderv0.9.9+ | Function、null | null | 导出png、svg、pdf时在头部添加自定义内容。可传递一个函数这个函数可以返回null代表不添加内容也可以返回一个对象详细介绍请参考下方【导出时如何添加自定义内容】 |
| addContentToFooterv0.9.9+ | Function、null | null | 基本释义同addContentToHeader在尾部添加自定义内容 |
### 数据结构 ### 数据结构
@ -177,6 +179,41 @@ const mindMap = new MindMap({
| type | String | | 图标分组的值 | | type | String | | 图标分组的值 |
| list | Array | | 分组下的图标列表,数组的每一项为一个对象,`{ name: '', icon: '' }``name`代表图标的名称,`icon`代表图标,可以是`svg`图标,比如`<svg ...><path></path></svg>`,也可以是图片`url`,或者是`base64`图标,比如`data:image/png;base64,...` | | list | Array | | 分组下的图标列表,数组的每一项为一个对象,`{ name: '', icon: '' }``name`代表图标的名称,`icon`代表图标,可以是`svg`图标,比如`<svg ...><path></path></svg>`,也可以是图片`url`,或者是`base64`图标,比如`data:image/png;base64,...` |
### 导出时如何添加自定义内容
`addContentToHeader``addContentToFooter`两个实例化选项可以用于在导出`png``svg``pdf`时在头部和尾部添加自定义的内容,默认为`null`,代表不配置,可以传递一个函数,函数可以返回`null`,代表不添加内容,如果要添加内容那么需要返回如下的结构:
```
{
el,// 要追加的自定义DOM节点样式可内联
cssText,// 可选如果样式不想内联可以传递该值一个css字符串
height: 50// 返回的DOM节点的高度必须传递
}
```
一个简单的示例:
```js
new MindMap({
addContentToFooter: () => {
const el = document.createElement('div')
el.className = 'footer'
el.innerHTML = '来自simple-mind-map'
const cssText = `
.footer {
width: 100%;
height: 30px;
}
`
return {
el,
cssText,
height: 30
}
}
})
```
## 静态方法 ## 静态方法
### defineTheme(name, config) ### defineTheme(name, config)
@ -334,7 +371,7 @@ mindMap.setTheme('主题名称')
销毁思维导图。会移除注册的插件、移除监听的事件、删除画布的所有节点。 销毁思维导图。会移除注册的插件、移除监听的事件、删除画布的所有节点。
### getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false }) ### getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false, addContentToHeader, addContentToFooter })
> v0.3.0+ > v0.3.0+
@ -344,6 +381,10 @@ mindMap.setTheme('主题名称')
`ignoreWatermark`v0.8.0+,不要绘制水印,如果不需要绘制水印的场景可以传`true`,因为绘制水印非常慢 `ignoreWatermark`v0.8.0+,不要绘制水印,如果不需要绘制水印的场景可以传`true`,因为绘制水印非常慢
`addContentToHeader`v0.9.9+Function可以返回要追加到头部的自定义内容详细介绍见【实例化选项】中的该配置
`addContentToFooter`v0.9.9+Function可以返回要追加到尾部的自定义内容详细介绍见【实例化选项】中的该配置
获取`svg`数据,返回一个对象,详细结构如下: 获取`svg`数据,返回一个对象,详细结构如下:
```js ```js

View File

@ -573,6 +573,18 @@
<td>{ open: false, colorsList: [] }</td> <td>{ open: false, colorsList: [] }</td>
<td>彩虹线条配置需要先注册RainbowLines插件对象类型结构{ open: false是否开启彩虹线条, colorsList: []自定义彩虹线条的颜色列表如果不设置会使用默认颜色列表 }</td> <td>彩虹线条配置需要先注册RainbowLines插件对象类型结构{ open: false是否开启彩虹线条, colorsList: []自定义彩虹线条的颜色列表如果不设置会使用默认颜色列表 }</td>
</tr> </tr>
<tr>
<td>addContentToHeaderv0.9.9+</td>
<td>Functionnull</td>
<td>null</td>
<td>导出pngsvgpdf时在头部添加自定义内容可传递一个函数这个函数可以返回null代表不添加内容也可以返回一个对象详细介绍请参考下方导出时如何添加自定义内容</td>
</tr>
<tr>
<td>addContentToFooterv0.9.9+</td>
<td>Functionnull</td>
<td>null</td>
<td>基本释义同addContentToHeader在尾部添加自定义内容</td>
</tr>
</tbody> </tbody>
</table> </table>
<h3>数据结构</h3> <h3>数据结构</h3>
@ -691,6 +703,34 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>导出时如何添加自定义内容</h3>
<p><code>addContentToHeader</code><code>addContentToFooter</code>两个实例化选项可以用于在导出<code>png</code><code>svg</code><code>pdf</code>时在头部和尾部添加自定义的内容默认为<code>null</code>代表不配置可以传递一个函数函数可以返回<code>null</code>代表不添加内容如果要添加内容那么需要返回如下的结构</p>
<pre class="hljs"><code>{
el,// DOM
cssText,// css
height: 50// DOM
}
</code></pre>
<p>一个简单的示例</p>
<pre class="hljs"><code><span class="hljs-keyword">new</span> MindMap({
<span class="hljs-attr">addContentToFooter</span>: <span class="hljs-function">() =&gt;</span> {
<span class="hljs-keyword">const</span> el = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">&#x27;div&#x27;</span>)
el.className = <span class="hljs-string">&#x27;footer&#x27;</span>
el.innerHTML = <span class="hljs-string">&#x27;来自simple-mind-map&#x27;</span>
<span class="hljs-keyword">const</span> cssText = <span class="hljs-string">`
.footer {
width: 100%;
height: 30px;
}
`</span>
<span class="hljs-keyword">return</span> {
el,
cssText,
<span class="hljs-attr">height</span>: <span class="hljs-number">30</span>
}
}
})
</code></pre>
<h2>静态方法</h2> <h2>静态方法</h2>
<h3>defineTheme(name, config)</h3> <h3>defineTheme(name, config)</h3>
<blockquote> <blockquote>
@ -802,13 +842,15 @@ mindMap.setTheme(<span class="hljs-string">&#x27;主题名称&#x27;</span>)
<p>v0.6.0+</p> <p>v0.6.0+</p>
</blockquote> </blockquote>
<p>销毁思维导图会移除注册的插件移除监听的事件删除画布的所有节点</p> <p>销毁思维导图会移除注册的插件移除监听的事件删除画布的所有节点</p>
<h3>getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false })</h3> <h3>getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false, addContentToHeader, addContentToFooter })</h3>
<blockquote> <blockquote>
<p>v0.3.0+</p> <p>v0.3.0+</p>
</blockquote> </blockquote>
<p><code>paddingX</code>水平内边距</p> <p><code>paddingX</code>水平内边距</p>
<p><code>paddingY</code>垂直内边距</p> <p><code>paddingY</code>垂直内边距</p>
<p><code>ignoreWatermark</code>v0.8.0+不要绘制水印如果不需要绘制水印的场景可以传<code>true</code>因为绘制水印非常慢</p> <p><code>ignoreWatermark</code>v0.8.0+不要绘制水印如果不需要绘制水印的场景可以传<code>true</code>因为绘制水印非常慢</p>
<p><code>addContentToHeader</code>v0.9.9+Function可以返回要追加到头部的自定义内容详细介绍见实例化选项中的该配置</p>
<p><code>addContentToFooter</code>v0.9.9+Function可以返回要追加到尾部的自定义内容详细介绍见实例化选项中的该配置</p>
<p>获取<code>svg</code>数据返回一个对象详细结构如下</p> <p>获取<code>svg</code>数据返回一个对象详细结构如下</p>
<pre class="hljs"><code>{ <pre class="hljs"><code>{
svg, <span class="hljs-comment">// Elementsvgsvgg</span> svg, <span class="hljs-comment">// Elementsvgsvgg</span>

View File

@ -336,4 +336,12 @@
<img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" /> <img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>逆水行舟</p> <p>逆水行舟</p>
</div> </div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>LiuJL</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/L.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>L</p>
</div>
</div> </div>

View File

@ -8,17 +8,17 @@
</blockquote> </blockquote>
<h2>特性</h2> <h2>特性</h2>
<ul> <ul>
<li><input type="checkbox" id="checkbox0" checked="true" /><label for="checkbox0">插件化架构除核心功能外其他功能作为插件提供按需使用减小打包体积</label></li> <li><input type="checkbox" id="checkbox32" checked="true" /><label for="checkbox32">插件化架构除核心功能外其他功能作为插件提供按需使用减小打包体积</label></li>
<li><input type="checkbox" id="checkbox1" checked="true" /><label for="checkbox1">支持逻辑结构图思维导图组织结构图目录组织图时间轴横向竖向鱼骨图等结构</label></li> <li><input type="checkbox" id="checkbox33" checked="true" /><label for="checkbox33">支持逻辑结构图思维导图组织结构图目录组织图时间轴横向竖向鱼骨图等结构</label></li>
<li><input type="checkbox" id="checkbox2" checked="true" /><label for="checkbox2">内置多种主题允许高度自定义样式支持注册新主题</label></li> <li><input type="checkbox" id="checkbox34" checked="true" /><label for="checkbox34">内置多种主题允许高度自定义样式支持注册新主题</label></li>
<li><input type="checkbox" id="checkbox3" checked="true" /><label for="checkbox3">节点内容支持文本普通文本富文本图片图标超链接备注标签概要数学公式</label></li> <li><input type="checkbox" id="checkbox35" checked="true" /><label for="checkbox35">节点内容支持文本普通文本富文本图片图标超链接备注标签概要数学公式</label></li>
<li><input type="checkbox" id="checkbox4" checked="true" /><label for="checkbox4">节点支持拖拽拖拽移动自由调整多种节点形状支持使用 DDM 完全自定义节点内容</label></li> <li><input type="checkbox" id="checkbox36" checked="true" /><label for="checkbox36">节点支持拖拽拖拽移动自由调整多种节点形状支持使用 DDM 完全自定义节点内容</label></li>
<li><input type="checkbox" id="checkbox5" checked="true" /><label for="checkbox5">支持画布拖动缩放</label></li> <li><input type="checkbox" id="checkbox37" checked="true" /><label for="checkbox37">支持画布拖动缩放</label></li>
<li><input type="checkbox" id="checkbox6" checked="true" /><label for="checkbox6">支持鼠标按键拖动选择和Ctrl+左键两种多选节点方式</label></li> <li><input type="checkbox" id="checkbox38" checked="true" /><label for="checkbox38">支持鼠标按键拖动选择和Ctrl+左键两种多选节点方式</label></li>
<li><input type="checkbox" id="checkbox7" checked="true" /><label for="checkbox7">支持导出为</label><code>json</code><code>png</code><code>svg</code><code>pdf</code><code>markdown</code><code>xmind</code>支持从<code>json</code><code>xmind</code><code>markdown</code>导入</li> <li><input type="checkbox" id="checkbox39" checked="true" /><label for="checkbox39">支持导出为</label><code>json</code><code>png</code><code>svg</code><code>pdf</code><code>markdown</code><code>xmind</code>支持从<code>json</code><code>xmind</code><code>markdown</code>导入</li>
<li><input type="checkbox" id="checkbox8" checked="true" /><label for="checkbox8">支持快捷键前进后退关联线搜索替换小地图水印滚动条</label></li> <li><input type="checkbox" id="checkbox40" checked="true" /><label for="checkbox40">支持快捷键前进后退关联线搜索替换小地图水印滚动条</label></li>
<li><input type="checkbox" id="checkbox9" checked="true" /><label for="checkbox9">提供丰富的配置满足各种场景各种使用习惯</label></li> <li><input type="checkbox" id="checkbox41" checked="true" /><label for="checkbox41">提供丰富的配置满足各种场景各种使用习惯</label></li>
<li><input type="checkbox" id="checkbox10" checked="true" /><label for="checkbox10">支持协同编辑</label></li> <li><input type="checkbox" id="checkbox42" checked="true" /><label for="checkbox42">支持协同编辑</label></li>
</ul> </ul>
<blockquote> <blockquote>
<p>不会实现的特性</p> <p>不会实现的特性</p>
@ -32,11 +32,11 @@
<p>2.<code>web</code></p> <p>2.<code>web</code></p>
<p>使用<code>simple-mind-map</code>基于<code>vue2.x</code><code>ElementUI</code>搭建的在线思维导图特性</p> <p>使用<code>simple-mind-map</code>基于<code>vue2.x</code><code>ElementUI</code>搭建的在线思维导图特性</p>
<ul> <ul>
<li><input type="checkbox" id="checkbox11" checked="true" /><label for="checkbox11">工具栏支持插入节点删除节点编辑节点图片图标超链接备注标签概要</label></li> <li><input type="checkbox" id="checkbox43" checked="true" /><label for="checkbox43">工具栏支持插入节点删除节点编辑节点图片图标超链接备注标签概要</label></li>
<li><input type="checkbox" id="checkbox12" checked="true" /><label for="checkbox12">侧边栏基础样式设置面板节点样式设置面板大纲面板主题选择面板结构选择面板</label></li> <li><input type="checkbox" id="checkbox44" checked="true" /><label for="checkbox44">侧边栏基础样式设置面板节点样式设置面板大纲面板主题选择面板结构选择面板</label></li>
<li><input type="checkbox" id="checkbox13" checked="true" /><label for="checkbox13">导入导出功能数据默认保存在浏览器本地存储也支持直接创建打开编辑电脑本地文件</label></li> <li><input type="checkbox" id="checkbox45" checked="true" /><label for="checkbox45">导入导出功能数据默认保存在浏览器本地存储也支持直接创建打开编辑电脑本地文件</label></li>
<li><input type="checkbox" id="checkbox14" checked="true" /><label for="checkbox14">右键菜单支持展开收起整理布局等操作</label></li> <li><input type="checkbox" id="checkbox46" checked="true" /><label for="checkbox46">右键菜单支持展开收起整理布局等操作</label></li>
<li><input type="checkbox" id="checkbox15" checked="true" /><label for="checkbox15">底部栏支持节点数量字数统计支持切换编辑和只读模式支持放大缩小支持全屏切换支持小地图</label></li> <li><input type="checkbox" id="checkbox47" checked="true" /><label for="checkbox47">底部栏支持节点数量字数统计支持切换编辑和只读模式支持放大缩小支持全屏切换支持小地图</label></li>
</ul> </ul>
<p>提供文档页面服务</p> <p>提供文档页面服务</p>
<p>3.<code>dist</code></p> <p>3.<code>dist</code></p>
@ -291,6 +291,14 @@
<img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" /> <img src="../../../../assets/avatar/逆水行舟.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>逆水行舟</p> <p>逆水行舟</p>
</div> </div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>LiuJL</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/L.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>L</p>
</div>
</div> </div>
</div> </div>
</template> </template>