diff --git a/web/src/config/en.js b/web/src/config/en.js index 2d57e7b6..96cbbf83 100644 --- a/web/src/config/en.js +++ b/web/src/config/en.js @@ -330,6 +330,36 @@ export const shortcutKeyList = [ value: 'Ctrl + i' } ] + }, + { + type: 'Outline Operation', + list: [ + { + icon: 'iconhuanhang', + name: 'Text Wrap', + value: 'Shift + Enter' + }, + { + icon: 'iconshanchu', + name: 'Delete current node', + value: 'Delete' + }, + { + icon: 'icontianjiazijiedian', + name: 'Inert child node', + value: 'Tab' + }, + { + icon: 'iconjiedian', + name: 'Insert sibling node', + value: 'Enter' + }, + { + icon: 'icondodeparent', + name: 'Move up one level', + value: 'Shift + Tab' + }, + ] } ] diff --git a/web/src/config/zh.js b/web/src/config/zh.js index e8036390..f06815f7 100644 --- a/web/src/config/zh.js +++ b/web/src/config/zh.js @@ -397,6 +397,36 @@ export const shortcutKeyList = [ value: 'Ctrl + i' } ] + }, + { + type: '大纲操作', + list: [ + { + icon: 'iconhuanhang', + name: '文本换行', + value: 'Shift + Enter' + }, + { + icon: 'iconshanchu', + name: '删除节点', + value: 'Delete' + }, + { + icon: 'icontianjiazijiedian', + name: '插入下级节点', + value: 'Tab' + }, + { + icon: 'iconjiedian', + name: '插入同级节点', + value: 'Enter' + }, + { + icon: 'icondodeparent', + name: '上移一个层级', + value: 'Shift + Tab' + }, + ] } ] diff --git a/web/src/pages/Edit/components/Outline.vue b/web/src/pages/Edit/components/Outline.vue index 0e7d663e..ef32ed35 100644 --- a/web/src/pages/Edit/components/Outline.vue +++ b/web/src/pages/Edit/components/Outline.vue @@ -99,6 +99,7 @@ export default { // 在大纲里操作节点时不要响应该事件,否则会重新刷新树 if (this.notHandleDataChange) { this.notHandleDataChange = false + this.isAfterCreateNewNode = false return } if (this.isAfterCreateNewNode) { @@ -223,17 +224,30 @@ export default { // 节点输入区域按键事件 onNodeInputKeydown(e) { if (e.keyCode === 13 && !e.shiftKey) { + // 插入兄弟节点 e.preventDefault() this.insertType = 'insertNode' e.target.blur() } if (e.keyCode === 9) { e.preventDefault() - this.insertType = 'insertChildNode' - e.target.blur() + if (e.shiftKey) { + // 节点上升一级 + this.insertType = 'moveUp' + e.target.blur() + } else { + // 插入子节点 + this.insertType = 'insertChildNode' + e.target.blur() + } } }, + // 节点上移一个层级 + moveUp() { + this.mindMap.execCommand('MOVE_UP_ONE_LEVEL') + }, + // 插入兄弟节点 insertNode() { this.notHandleDataChange = true diff --git a/web/src/pages/Edit/components/OutlineEdit.vue b/web/src/pages/Edit/components/OutlineEdit.vue index 1ab514fd..a2a752fe 100644 --- a/web/src/pages/Edit/components/OutlineEdit.vue +++ b/web/src/pages/Edit/components/OutlineEdit.vue @@ -178,7 +178,13 @@ export default { } if (e.keyCode === 9) { e.preventDefault() - this.$refs.tree.append(data, node) + if (e.shiftKey) { + // 上移一个层级 + this.$refs.tree.insertAfter(node.data, node.parent) + this.$refs.tree.remove(node) + } else { + this.$refs.tree.append(data, node) + } } this.save() this.$nextTick(() => {