From 455e97074f52c33e04fc40a5a6f3e1e677f99c37 Mon Sep 17 00:00:00 2001
From: wanglin <1013335014@qq.com>
Date: Thu, 5 Aug 2021 00:06:27 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BF=AB=E6=8D=B7=E9=94=AE?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 1 +
index.html | 2 +-
simple-mind-map/src/Command.js | 3 +++
simple-mind-map/src/Render.js | 24 +++++++++++++++++++
web/src/.DS_Store | Bin 6148 -> 6148 bytes
web/src/assets/.DS_Store | Bin 6148 -> 6148 bytes
web/src/assets/icon-font/demo_index.html | 29 ++++++++++++++++++++---
web/src/assets/icon-font/iconfont.css | 10 +++++---
web/src/assets/icon-font/iconfont.js | 2 +-
web/src/assets/icon-font/iconfont.json | 7 ++++++
web/src/assets/icon-font/iconfont.ttf | Bin 10424 -> 10732 bytes
web/src/assets/icon-font/iconfont.woff | Bin 6424 -> 6640 bytes
web/src/assets/icon-font/iconfont.woff2 | Bin 5424 -> 5620 bytes
web/src/config/index.js | 12 +++++++++-
14 files changed, 81 insertions(+), 9 deletions(-)
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 8c11ae993fe0b5d845b7ffc60762a2d49d4171ee..8b8ab42e581a8a4664d6861ecf41d97f3c530844 100644
GIT binary patch
delta 70
zcmZoMXffEJ&ct|PvIbLwhInUW8x|xmRA3p%nFBOCU
delta 71
zcmZoMXffEJ&ct|fvIbLwrbKnMk)@H2f}w?Bt&T#qxw(Okf{B??Z7nBM8XF_ge
bRdr2m-OR}snB*B}ZT`R{#=4oE<1aq|q@FP6>h
H9Dn%%lY|e%
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
+
+
-