Demo:支持传入父节点和仅删除当前节点

This commit is contained in:
wanglin2 2023-10-13 09:26:36 +08:00
parent 2e4c6bc08e
commit caedfb46a9
9 changed files with 44 additions and 4 deletions

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2479351 */
src: url('iconfont.woff2?t=1695365666344') format('woff2'),
url('iconfont.woff?t=1695365666344') format('woff'),
url('iconfont.ttf?t=1695365666344') format('truetype');
src: url('iconfont.woff2?t=1697073602349') format('woff2'),
url('iconfont.woff?t=1697073602349') format('woff'),
url('iconfont.ttf?t=1697073602349') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icondodeparent:before {
content: "\e70f";
}
.icongongshi:before {
content: "\e617";
}

View File

@ -209,6 +209,11 @@ export const shortcutKeyList = [
name: 'Insert sibling node',
value: 'Enter'
},
{
icon: 'icondodeparent',
name: 'Insert parent node',
value: 'Shift + Tab'
},
{
icon: 'iconshangyi',
name: 'Move up node',
@ -234,6 +239,11 @@ export const shortcutKeyList = [
name: 'Delete node',
value: 'Delete | Backspace'
},
{
icon: 'iconshanchu',
name: 'Delete current node',
value: 'Shift + Backspace'
},
{
icon: 'iconfuzhi',
name: 'Copy node',

View File

@ -276,6 +276,11 @@ export const shortcutKeyList = [
name: '插入同级节点',
value: 'Enter'
},
{
icon: 'icondodeparent',
name: '插入父节点',
value: 'Shift + Tab'
},
{
icon: 'iconshangyi',
name: '上移节点',
@ -301,6 +306,11 @@ export const shortcutKeyList = [
name: '删除节点',
value: 'Delete | Backspace'
},
{
icon: 'iconshanchu',
name: '仅删除当前节点',
value: 'Shift + Backspace'
},
{
icon: 'iconfuzhi',
name: '复制节点',

View File

@ -59,10 +59,12 @@ export default {
contextmenu: {
insertSiblingNode: 'Insert sibling node',
insertChildNode: 'Insert child node',
insertParentNode: 'Insert parent node',
insertSummary: 'Insert summary',
moveUpNode: 'Move up node',
moveDownNode: 'Move down node',
deleteNode: 'Delete node',
deleteCurrentNode: 'Only del cur node',
copyNode: 'Copy node',
cutNode: 'Cut node',
pasteNode: 'Paste node',

View File

@ -59,10 +59,12 @@ export default {
contextmenu: {
insertSiblingNode: '插入同级节点',
insertChildNode: '插入子级节点',
insertParentNode: '插入父节点',
insertSummary: '插入概要',
moveUpNode: '上移节点',
moveDownNode: '下移节点',
deleteNode: '删除节点',
deleteCurrentNode: '仅删除当前节点',
copyNode: '复制节点',
cutNode: '剪切节点',
pasteNode: '粘贴节点',

View File

@ -22,6 +22,14 @@
{{ $t('contextmenu.insertChildNode') }}
<span class="desc">Tab</span>
</div>
<div
class="item"
@click="exec('INSERT_PARENT_NODE')"
:class="{ disabled: insertNodeBtnDisabled }"
>
{{ $t('contextmenu.insertParentNode') }}
<span class="desc">Shift + Tab</span>
</div>
<div
class="item"
@click="exec('ADD_GENERALIZATION')"
@ -50,6 +58,10 @@
{{ $t('contextmenu.deleteNode') }}
<span class="desc">Delete</span>
</div>
<div class="item danger" @click="exec('REMOVE_CURRENT_NODE')">
{{ $t('contextmenu.deleteCurrentNode') }}
<span class="desc">Shift + Backspace</span>
</div>
<div
class="item"
@click="exec('COPY_NODE')"
@ -332,7 +344,7 @@ export default {
<style lang="less" scoped>
.listBox {
width: 200px;
width: 240px;
background: #fff;
box-shadow: 0 4px 12px 0 hsla(0, 0%, 69%, 0.5);
border-radius: 4px;