diff --git a/README.md b/README.md
index fd95f8ef..e9eccd1c 100644
--- a/README.md
+++ b/README.md
@@ -194,6 +194,7 @@ const mindMap = new MindMap({
| 命令名称 | 描述 | 参数 |
| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
+| SELECT_ALL | 全选 | |
| BACK | 回退指定的步数 | step(要回退的步数,默认为1) |
| FORWARD | 前进指定的步数 | step(要前进的步数,默认为1) |
| INSERT_NODE | 插入同级节点,操作节点为当前激活的节点,如果有多个激活节点,只会对第一个有效 | |
diff --git a/index.html b/index.html
index dae74bcc..f6269343 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/src/Command.js b/simple-mind-map/src/Command.js
index cd84cd95..6ebd846e 100644
--- a/simple-mind-map/src/Command.js
+++ b/simple-mind-map/src/Command.js
@@ -41,6 +41,9 @@ class Command {
this.mindMap.keyCommand.addShortcut('Control+z', () => {
this.mindMap.execCommand('BACK')
})
+ this.mindMap.keyCommand.addShortcut('Control+y', () => {
+ this.mindMap.execCommand('FORWARD')
+ })
}
/**
diff --git a/simple-mind-map/src/Render.js b/simple-mind-map/src/Render.js
index ca7b54e3..2600a51a 100644
--- a/simple-mind-map/src/Render.js
+++ b/simple-mind-map/src/Render.js
@@ -88,6 +88,9 @@ class Render {
* @Desc: 注册命令
*/
registerCommands() {
+ // 全选
+ this.selectAll = this.selectAll.bind(this)
+ this.mindMap.command.add('SELECT_ALL', this.selectAll)
// 回退
this.back = this.back.bind(this)
this.mindMap.command.add('BACK', this.back)
@@ -197,6 +200,10 @@ class Render {
this.mindMap.keyCommand.addShortcut('Del|Backspace', removeNodeWrap)
this.mindMap.keyCommand.addShortcut('Enter', insertNodeWrap)
})
+ // 全选
+ this.mindMap.keyCommand.addShortcut('Control+a', () => {
+ this.mindMap.execCommand('SELECT_ALL')
+ })
}
/**
@@ -284,6 +291,23 @@ class Render {
}) : 0
}
+ /**
+ * @Author: 王林
+ * @Date: 2021-08-04 23:54:52
+ * @Desc: 全选
+ */
+ selectAll() {
+ walk(this.root, null, (node) => {
+ if (!node.nodeData.data.isActive) {
+ node.nodeData.data.isActive = true
+ this.addActiveNode(node)
+ setTimeout(() => {
+ node.renderNode()
+ }, 0);
+ }
+ }, null, true, 0, 0)
+ }
+
/**
* @Author: 王林
* @Date: 2021-07-11 22:34:12
diff --git a/web/src/.DS_Store b/web/src/.DS_Store
index 8c11ae99..8b8ab42e 100644
Binary files a/web/src/.DS_Store and b/web/src/.DS_Store differ
diff --git a/web/src/assets/.DS_Store b/web/src/assets/.DS_Store
index 65a8e8ca..3f852d15 100644
Binary files a/web/src/assets/.DS_Store and b/web/src/assets/.DS_Store differ
diff --git a/web/src/assets/icon-font/demo_index.html b/web/src/assets/icon-font/demo_index.html
index dbfcf888..de1756dc 100644
--- a/web/src/assets/icon-font/demo_index.html
+++ b/web/src/assets/icon-font/demo_index.html
@@ -54,6 +54,12 @@
+ -
+
+
全选
+ 
+
+
-
导入
@@ -252,9 +258,9 @@
@font-face {
font-family: 'iconfont';
- src: url('iconfont.woff2?t=1628001202194') format('woff2'),
- url('iconfont.woff?t=1628001202194') format('woff'),
- url('iconfont.ttf?t=1628001202194') format('truetype');
+ src: url('iconfont.woff2?t=1628093007325') format('woff2'),
+ url('iconfont.woff?t=1628093007325') format('woff'),
+ url('iconfont.ttf?t=1628093007325') format('truetype');
}
第二步:定义使用 iconfont 的样式
@@ -280,6 +286,15 @@
+ -
+
+
+ 全选
+
+ .iconquanxuan
+
+
+
-
@@ -577,6 +592,14 @@
+ -
+
+
全选
+ #iconquanxuan
+
+
-