From 6bdcec0fcaa6b424ee1641fac2cae409512b8eb7 Mon Sep 17 00:00:00 2001
From: wanglin2 <1013335014@qq.com>
Date: Sat, 5 Aug 2023 18:38:22 +0800
Subject: [PATCH] =?UTF-8?q?Demo:=E6=94=AF=E6=8C=81=E5=85=A8=E5=B1=8F?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E5=A4=A7=E7=BA=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/src/pages/Edit/components/Edit.vue | 11 ++-
web/src/pages/Edit/components/Outline.vue | 74 ++++++---------
web/src/pages/Edit/components/OutlineEdit.vue | 91 +++++++++++++++++++
.../pages/Edit/components/OutlineSidebar.vue | 56 ++++++++++++
web/src/store.js | 6 ++
5 files changed, 190 insertions(+), 48 deletions(-)
create mode 100644 web/src/pages/Edit/components/OutlineEdit.vue
create mode 100644 web/src/pages/Edit/components/OutlineSidebar.vue
diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue
index 2f4405b4..61bbae82 100644
--- a/web/src/pages/Edit/components/Edit.vue
+++ b/web/src/pages/Edit/components/Edit.vue
@@ -4,7 +4,7 @@
-
+
@@ -21,6 +21,7 @@
+
@@ -40,7 +41,7 @@ import TouchEvent from 'simple-mind-map/src/plugins/TouchEvent.js'
import NodeImgAdjust from 'simple-mind-map/src/plugins/NodeImgAdjust.js'
import SearchPlugin from 'simple-mind-map/src/plugins/Search.js'
import Painter from 'simple-mind-map/src/plugins/Painter.js'
-import Outline from './Outline'
+import OutlineSidebar from './OutlineSidebar'
import Style from './Style'
import BaseStyle from './BaseStyle'
import Theme from './Theme'
@@ -67,6 +68,7 @@ import i18n from '../../../i18n'
import Search from './Search.vue'
import NodeIconSidebar from './NodeIconSidebar.vue'
import NodeIconToolbar from './NodeIconToolbar.vue'
+import OutlineEdit from './OutlineEdit.vue'
// 注册插件
MindMap
@@ -97,7 +99,7 @@ customThemeList.forEach((item) => {
export default {
name: 'Edit',
components: {
- Outline,
+ OutlineSidebar,
Style,
BaseStyle,
Theme,
@@ -113,7 +115,8 @@ export default {
SidebarTrigger,
Search,
NodeIconSidebar,
- NodeIconToolbar
+ NodeIconToolbar,
+ OutlineEdit
},
data() {
return {
diff --git a/web/src/pages/Edit/components/Outline.vue b/web/src/pages/Edit/components/Outline.vue
index c106e08e..0b24cb43 100644
--- a/web/src/pages/Edit/components/Outline.vue
+++ b/web/src/pages/Edit/components/Outline.vue
@@ -1,35 +1,32 @@
-
-
+
-
-
-
-
+ class="nodeEdit"
+ :key="getKey()"
+ contenteditable="true"
+ @keydown.stop="onKeydown($event, node)"
+ @keyup.stop
+ @blur="onBlur($event, node)"
+ @paste="onPaste($event, node)"
+ v-html="node.label"
+ >
+
+
+
+
diff --git a/web/src/pages/Edit/components/OutlineSidebar.vue b/web/src/pages/Edit/components/OutlineSidebar.vue
new file mode 100644
index 00000000..1414d702
--- /dev/null
+++ b/web/src/pages/Edit/components/OutlineSidebar.vue
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/store.js b/web/src/store.js
index 5b88645f..160ce417 100644
--- a/web/src/store.js
+++ b/web/src/store.js
@@ -19,6 +19,7 @@ const store = new Vuex.Store({
},
activeSidebar: '', // 当前显示的侧边栏
isDark: false,// 是否是暗黑模式
+ isOutlineEdit: false// 是否是大纲编辑模式
},
mutations: {
/**
@@ -67,6 +68,11 @@ const store = new Vuex.Store({
// 设置暗黑模式
setIsDark(state, data) {
state.isDark = data
+ },
+
+ // 设置大纲编辑模式
+ setIsOutlineEdit(state, data) {
+ state.isOutlineEdit = data
}
},
actions: {