From 9644ba0c8dc692cedd3873904f08b2db6f3f2522 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sat, 8 Apr 2023 21:09:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=850.5.3-fix.1=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=E5=88=9D=E5=A7=8B=E6=A0=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E4=BD=8D=E7=BD=AE=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=E6=96=87=E6=A1=A3=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=95=99=E7=A8=8B=E7=AB=A0=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 + index.html | 2 +- simple-mind-map/index.js | 2 +- simple-mind-map/package.json | 2 +- web/src/pages/Doc/catalogList.js | 11 ++ web/src/pages/Doc/en/changelog/index.md | 4 + web/src/pages/Doc/en/constructor/index.md | 2 +- web/src/pages/Doc/en/constructor/index.vue | 2 +- web/src/pages/Doc/en/introduction/index.vue | 36 ++-- web/src/pages/Doc/en/start/index.md | 14 +- web/src/pages/Doc/en/start/index.vue | 12 +- web/src/pages/Doc/routerList.js | 2 +- web/src/pages/Doc/zh/changelog/index.md | 4 + web/src/pages/Doc/zh/constructor/index.md | 2 +- web/src/pages/Doc/zh/constructor/index.vue | 2 +- web/src/pages/Doc/zh/course1/index.md | 60 +++++++ web/src/pages/Doc/zh/course1/index.vue | 63 +++++++ web/src/pages/Doc/zh/course2/index.md | 183 ++++++++++++++++++++ web/src/pages/Doc/zh/course2/index.vue | 131 ++++++++++++++ web/src/pages/Doc/zh/introduction/index.vue | 36 ++-- web/src/pages/Doc/zh/start/index.md | 14 +- web/src/pages/Doc/zh/start/index.vue | 12 +- 22 files changed, 555 insertions(+), 50 deletions(-) create mode 100644 web/src/pages/Doc/zh/course1/index.md create mode 100644 web/src/pages/Doc/zh/course1/index.vue create mode 100644 web/src/pages/Doc/zh/course2/index.md create mode 100644 web/src/pages/Doc/zh/course2/index.vue diff --git a/README.md b/README.md index 434ee328..1d2a11b9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,15 @@ npm i simple-mind-map
``` +另外再设置一下`css`样式: + +```css +#mindMapContainer * { + margin: 0; + padding: 0; +} +``` + 然后创建一个实例: ```js diff --git a/index.html b/index.html index 93783010..75fab367 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -一个简单的web思维导图实现
\ No newline at end of file +一个简单的web思维导图实现
\ No newline at end of file diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 6bad7092..bb99095c 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -90,7 +90,7 @@ const defaultOpt = { // 如果开启节点动画过渡,可以通过该属性设置过渡的时间,单位ms nodeTransitionMoveDuration: 300, // 初始根节点的位置 - initRootNodePosition: [CONSTANTS.INIT_ROOT_NODE_POSITION.CENTER, CONSTANTS.INIT_ROOT_NODE_POSITION.CENTER] + initRootNodePosition: null } // 思维导图 diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index 995945b6..7be104b9 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -1,6 +1,6 @@ { "name": "simple-mind-map", - "version": "0.5.3", + "version": "0.5.3-fix.1", "description": "一个简单的web在线思维导图", "authors": [ { diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index 3f4b4d07..6df78bde 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -11,6 +11,9 @@ let langList = [ } ] let StartList = ['introduction', 'start', 'translate', 'changelog'] +let CourseList = new Array(2).fill(0).map((_, index) => { + return 'course' + (index + 1) +}) let APIList = [ 'constructor', 'node', @@ -59,6 +62,10 @@ export default { groupName: '开始', list: createList('zh', StartList) }, + { + groupName: '教程', + list: createList('zh', CourseList) + }, { groupName: 'API', list: createList('zh', APIList) @@ -69,6 +76,10 @@ export default { groupName: 'Start', list: createList('en', StartList) }, + { + groupName: 'Course', + list: createList('zh', CourseList) + }, { groupName: 'API', list: createList('en', APIList) diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index a3cd9fd6..b6447756 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -6,6 +6,10 @@ Fix: 1.Fixed the issue of setting the text style when multiple nodes were select New: 1.Support setting the position of the initial central node. +### 0.5.3-fix.1 + +Fix: 1.Fix the issue where setting the position of the initial central node does not take effect. + ## 0.5.2 Fix: 1.Remove `uid` from exported `JSON` data; 2.Clear the node cache pool when re rendering. diff --git a/web/src/pages/Doc/en/constructor/index.md b/web/src/pages/Doc/en/constructor/index.md index 82f66047..0df8aa82 100644 --- a/web/src/pages/Doc/en/constructor/index.md +++ b/web/src/pages/Doc/en/constructor/index.md @@ -51,7 +51,7 @@ const mindMap = new MindMap({ | enableShortcutOnlyWhenMouseInSvg(v0.5.1+) | Boolean | true | Only respond to shortcut key events when the mouse is inside the canvas | | | enableNodeTransitionMove(v0.5.1+) | Boolean | true | Whether to enable node animation transition | | | nodeTransitionMoveDuration(v0.5.1+) | Number | 300 | If node animation transition is enabled, the transition time can be set using this attribute, in milliseconds | | -| initRootNodePosition(v0.5.3+) | Array | ['center', 'center'] | The position of the initial root node can be passed as an array, default is `['center', 'center']`, Represents the root node at the center of the canvas, In addition to `center`, keywords can also be set to `left`, `top`, `right`, and `bottom`, In addition to passing keywords, each item in the array can also pass a number representing a specific pixel, Can pass a percentage string, such as `['40%', '60%']`, Represents a horizontal position at `40%` of the canvas width, and a vertical position at `60%` of the canvas height | | +| initRootNodePosition(v0.5.3+) | Array | null | The position of the initial root node can be passed as an array, default is `['center', 'center']`, Represents the root node at the center of the canvas, In addition to `center`, keywords can also be set to `left`, `top`, `right`, and `bottom`, In addition to passing keywords, each item in the array can also pass a number representing a specific pixel, Can pass a percentage string, such as `['40%', '60%']`, Represents a horizontal position at `40%` of the canvas width, and a vertical position at `60%` of the canvas height | | ### Watermark config diff --git a/web/src/pages/Doc/en/constructor/index.vue b/web/src/pages/Doc/en/constructor/index.vue index 859de9e8..2767aec4 100644 --- a/web/src/pages/Doc/en/constructor/index.vue +++ b/web/src/pages/Doc/en/constructor/index.vue @@ -220,7 +220,7 @@ initRootNodePosition(v0.5.3+) Array -['center', 'center'] +null The position of the initial root node can be passed as an array, default is ['center', 'center'], Represents the root node at the center of the canvas, In addition to center, keywords can also be set to left, top, right, and bottom, In addition to passing keywords, each item in the array can also pass a number representing a specific pixel, Can pass a percentage string, such as ['40%', '60%'], Represents a horizontal position at 40% of the canvas width, and a vertical position at 60% of the canvas height diff --git a/web/src/pages/Doc/en/introduction/index.vue b/web/src/pages/Doc/en/introduction/index.vue index 265e7cbc..dfa906e1 100644 --- a/web/src/pages/Doc/en/introduction/index.vue +++ b/web/src/pages/Doc/en/introduction/index.vue @@ -7,21 +7,21 @@

Features

Repository Catalog Introduction

1.simple-mind-map

@@ -31,16 +31,16 @@ frameworks such as Vue and React, or without a framework.

This is an online mind map built using the simple-mind-map library and based on Vue2.x and ElementUI. Features include:

diff --git a/web/src/pages/Doc/en/start/index.md b/web/src/pages/Doc/en/start/index.md index 63e1e872..b89c6a41 100644 --- a/web/src/pages/Doc/en/start/index.md +++ b/web/src/pages/Doc/en/start/index.md @@ -37,6 +37,15 @@ Firstly, provide a container element with a width and height not equal to 0:
``` +Also, set the `CSS` style again: + +```css +#mindMapContainer * { + margin: 0; + padding: 0; +} +``` + Then introduce the `simple-mind-map` library and create an instance: ```js @@ -61,9 +70,10 @@ If you want to implement a complete mind map, you usually need to develop some U The non-packaged 'ES' module is introduced by default, and only contains core functions, not unregistered plugin content, which can effectively reduce the size. However, you need to configure the `babel` compilation `simple mind-map` in your project to prevent some newer `js` syntax some browsers not supporting it. -If you need a file in the format of `umd` module, such as `CDN` in the browser, Then you can find the `simpleMindMap.umd.min.js` file in the `/simple-mind-map/dist/` directory, copy it to your project, and then import it into the page: +If you need a file in the format of `umd` module, such as `CDN` in the browser, Then you can find the `simpleMindMap.umd.min.js` file and `simpleMindMap.css` file in the `/simple-mind-map/dist/` directory, copy it to your project, and then import it into the page: ```html + ``` @@ -71,6 +81,8 @@ A global variable `window.simpleMindMap` will be created. The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large. +(v0.5.4+)If you want to use the `ES` module directly on the browser side, you can find the `simpleMindMap.esm.js` and `simpleMindMap.esm.css` files in the `/simple-mind-map/dist/` directory. + ## Development If you only use library, you don't need to read this section. diff --git a/web/src/pages/Doc/en/start/index.vue b/web/src/pages/Doc/en/start/index.vue index 18132352..e91ada19 100644 --- a/web/src/pages/Doc/en/start/index.vue +++ b/web/src/pages/Doc/en/start/index.vue @@ -30,6 +30,12 @@ compile this dependency:

Firstly, provide a container element with a width and height not equal to 0:

<div id="mindMapContainer"></div>
 
+

Also, set the CSS style again:

+
#mindMapContainer * {
+  margin: 0;
+  padding: 0;
+}
+

Then introduce the simple-mind-map library and create an instance:

import MindMap from "simple-mind-map";
 
@@ -47,11 +53,13 @@ compile this dependency:

If you want to implement a complete mind map, you usually need to develop some UI interfaces to achieve more functions through the interfaces provided by the simple-mind-map library.

simple-mind-map supports rich configurations, events, commands, and some additional plugin extensions. Read the subsequent documentation to learn more.

The non-packaged 'ES' module is introduced by default, and only contains core functions, not unregistered plugin content, which can effectively reduce the size. However, you need to configure the babel compilation simple mind-map in your project to prevent some newer js syntax some browsers not supporting it.

-

If you need a file in the format of umd module, such as CDN in the browser, Then you can find the simpleMindMap.umd.min.js file in the /simple-mind-map/dist/ directory, copy it to your project, and then import it into the page:

-
<script scr="simpleMindMap.umd.min.js"></script>
+

If you need a file in the format of umd module, such as CDN in the browser, Then you can find the simpleMindMap.umd.min.js file and simpleMindMap.css file in the /simple-mind-map/dist/ directory, copy it to your project, and then import it into the page:

+
<link rel="stylesheet" href="simpleMindMap.css">
+<script scr="simpleMindMap.umd.min.js"></script>
 

A global variable window.simpleMindMap will be created.

The disadvantage of this method is that it will contain all the content, including the plugins you have not registered, so the overall volume will be relatively large.

+

(v0.5.4+)If you want to use the ES module directly on the browser side, you can find the simpleMindMap.esm.js and simpleMindMap.esm.css files in the /simple-mind-map/dist/ directory.

Development

If you only use library, you don't need to read this section.

Local Development

diff --git a/web/src/pages/Doc/routerList.js b/web/src/pages/Doc/routerList.js index dfb7372f..16946338 100644 --- a/web/src/pages/Doc/routerList.js +++ b/web/src/pages/Doc/routerList.js @@ -1,3 +1,3 @@ - export default [{"lang":"zh","children":[{"path":"associativeLine","title":"AssociativeLine 插件"},{"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":"richText","title":"RichText插件"},{"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解析"},{"path":"markdown","title":"Markdown解析"}]},{"lang":"en","children":[{"path":"associativeLine","title":"AssociativeLine plugin"},{"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":"richText","title":"RichText plugin"},{"path":"select","title":"Select plugin"},{"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"},{"path":"markdown","title":"Markdown parse"}]}] + export default [{"lang":"zh","children":[{"path":"associativeLine","title":"AssociativeLine 插件"},{"path":"batchExecution","title":"BatchExecution实例"},{"path":"changelog","title":"Changelog"},{"path":"command","title":"Command实例"},{"path":"constructor","title":"构造函数"},{"path":"course1","title":"基本使用"},{"path":"course2","title":"操作节点内容"},{"path":"doExport","title":"Export 插件"},{"path":"drag","title":"Drag插件"},{"path":"introduction","title":"简介"},{"path":"keyCommand","title":"KeyCommand实例"},{"path":"keyboardNavigation","title":"KeyboardNavigation插件"},{"path":"markdown","title":"Markdown解析"},{"path":"miniMap","title":"MiniMap插件"},{"path":"node","title":"Node实例"},{"path":"render","title":"Render实例"},{"path":"richText","title":"RichText插件"},{"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":"associativeLine","title":"AssociativeLine plugin"},{"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":"keyCommand","title":"KeyCommand instance"},{"path":"keyboardNavigation","title":"KeyboardNavigation plugin"},{"path":"markdown","title":"Markdown parse"},{"path":"miniMap","title":"MiniMap plugin"},{"path":"node","title":"Node instance"},{"path":"render","title":"Render instance"},{"path":"richText","title":"RichText plugin"},{"path":"select","title":"Select plugin"},{"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"}]}] \ No newline at end of file diff --git a/web/src/pages/Doc/zh/changelog/index.md b/web/src/pages/Doc/zh/changelog/index.md index ee2db01a..482f8167 100644 --- a/web/src/pages/Doc/zh/changelog/index.md +++ b/web/src/pages/Doc/zh/changelog/index.md @@ -6,6 +6,10 @@ 新增:1.支持设置初始中心节点的位置。 +### 0.5.3-fix.1 + +修复:1.修复设置初始中心节点的位置不生效的问题。 + ## 0.5.2 修复:1.导出的`json`数据中去除`uid`;2.重新渲染时清空节点缓存池。 diff --git a/web/src/pages/Doc/zh/constructor/index.md b/web/src/pages/Doc/zh/constructor/index.md index d3b69053..56be19c5 100644 --- a/web/src/pages/Doc/zh/constructor/index.md +++ b/web/src/pages/Doc/zh/constructor/index.md @@ -51,7 +51,7 @@ const mindMap = new MindMap({ | enableShortcutOnlyWhenMouseInSvg(v0.5.1+) | Boolean | true | 是否只有当鼠标在画布内才响应快捷键事件 | | | enableNodeTransitionMove(v0.5.1+) | Boolean | true | 是否开启节点动画过渡 | | | nodeTransitionMoveDuration(v0.5.1+) | Number | 300 | 如果开启节点动画过渡,可以通过该属性设置过渡的时间,单位ms | | -| initRootNodePosition(v0.5.3+) | Array | ['center', 'center'] | 初始根节点的位置,可传一个数组,默认为`['center', 'center']`,代表根节点处于画布中心位置,除了`center`,关键词还可以设置`left`、`top`、`right`、`bottom`,除了可以传关键词,数组的每项还可以传递一个数字,代表具体的像素,可以传递一个百分比字符串,比如`['40%', '60%']`,代表水平位置在画布宽度的`40%`的位置,垂直位置在画布高度的`60%`的位置 | | +| initRootNodePosition(v0.5.3+) | Array | null | 初始根节点的位置,可传一个数组,默认为`['center', 'center']`,代表根节点处于画布中心位置,除了`center`,关键词还可以设置`left`、`top`、`right`、`bottom`,除了可以传关键词,数组的每项还可以传递一个数字,代表具体的像素,可以传递一个百分比字符串,比如`['40%', '60%']`,代表水平位置在画布宽度的`40%`的位置,垂直位置在画布高度的`60%`的位置 | | ### 水印配置 diff --git a/web/src/pages/Doc/zh/constructor/index.vue b/web/src/pages/Doc/zh/constructor/index.vue index 5048e4ee..14aed26a 100644 --- a/web/src/pages/Doc/zh/constructor/index.vue +++ b/web/src/pages/Doc/zh/constructor/index.vue @@ -220,7 +220,7 @@ initRootNodePosition(v0.5.3+) Array -['center', 'center'] +null 初始根节点的位置,可传一个数组,默认为['center', 'center'],代表根节点处于画布中心位置,除了center,关键词还可以设置lefttoprightbottom,除了可以传关键词,数组的每项还可以传递一个数字,代表具体的像素,可以传递一个百分比字符串,比如['40%', '60%'],代表水平位置在画布宽度的40%的位置,垂直位置在画布高度的60%的位置 diff --git a/web/src/pages/Doc/zh/course1/index.md b/web/src/pages/Doc/zh/course1/index.md new file mode 100644 index 00000000..71806718 --- /dev/null +++ b/web/src/pages/Doc/zh/course1/index.md @@ -0,0 +1,60 @@ +# 基本使用 + +> 重要说明:本教程中的在线编辑器中使用的是完整版的simple-mind-map,即包含所有插件,如果你是通过`npm`方式使用的话,需要自己手动注册相关插件。 + +`simple-mind-map`的使用非常简单,提供一个宽高不为0的元素,然后创建一个实例即可: + +