From 1286c42d4cfc0cd6a5839f60a3ac61e0242c3add Mon Sep 17 00:00:00 2001 From: "xiaoqi.cxq" Date: Mon, 25 Dec 2023 11:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=8D=E5=88=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ExplorerNode.vue | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/ExplorerNode.vue b/src/components/ExplorerNode.vue index 19a08b4d..abbcea11 100644 --- a/src/components/ExplorerNode.vue +++ b/src/components/ExplorerNode.vue @@ -14,6 +14,7 @@ + @@ -23,6 +24,7 @@ import workspaceSvc from '../services/workspaceSvc'; import explorerSvc from '../services/explorerSvc'; import store from '../store'; import badgeSvc from '../services/badgeSvc'; +import utils from '../services/utils'; export default { name: 'explorer-node', // Required for recursivity @@ -80,6 +82,9 @@ export default { ...mapActions('explorer', [ 'setDragTarget', ]), + ...mapActions('notification', [ + 'info', + ]), select(id = this.node.item.id, doOpen = true) { const node = store.getters['explorer/nodeMap'][id]; if (!node) { @@ -144,6 +149,11 @@ export default { // See https://stackoverflow.com/a/3977637/1333165 evt.dataTransfer.setData('Text', ''); }, + copyPath() { + let path = utils.getAbsoluteDir(this.node).replaceAll(' ', '%20'); + path = path.indexOf('/') === 0 ? path : `/${path}`; + return this.node.isFolder ? path : `${path}.md`; + }, onDrop() { const sourceNode = store.getters['explorer/dragSourceNode']; const targetNode = store.getters['explorer/dragTargetNodeFolder']; @@ -169,22 +179,26 @@ export default { top: evt.clientY, }, items: [{ - name: 'New file', + name: '新建文件', disabled: !this.node.isFolder || this.node.isTrash, perform: () => explorerSvc.newItem(false), }, { - name: 'New folder', + name: '新建文件夹', disabled: !this.node.isFolder || this.node.isTrash || this.node.isTemp, perform: () => explorerSvc.newItem(true), }, { type: 'separator', }, { - name: 'Rename', + name: '重命名', disabled: this.node.isTrash || this.node.isTemp, perform: () => this.setEditingId(this.node.item.id), }, { - name: 'Delete', + name: '删除', perform: () => explorerSvc.deleteItem(), + }, { + name: '复制路径', + disabled: this.node.isTrash || this.node.isTemp, + perform: () => this.$refs.copyId.click(), }], }); if (item) {