From bfd857ec4bca5500ee39190d6f6e95476bad3e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=A0=E7=9A=84=E6=98=8E=E6=98=8E=E5=91=90=E4=B8=B6?= <75105302+2327972001@users.noreply.github.com> Date: Mon, 24 Apr 2023 18:21:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=8A=9F=E8=83=BD=20(#749)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: blank --- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + .../src/views/host/file-management/index.vue | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 4169da11a..c0ee585e4 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -789,6 +789,7 @@ const message = { theme: 'Theme', language: 'Language', eol: 'End Of Line', + copyDir: 'Copy Dir', }, setting: { all: 'All', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 412edde53..5e1812bba 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -796,6 +796,7 @@ const message = { theme: '主题', language: '语言', eol: '行尾符', + copyDir: '复制路径', }, setting: { all: '全部', diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 74bc7024a..5da4d319d 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -297,6 +297,18 @@ const open = async (row: File.File) => { } }; +const copyDir = (row: File.File) => { + if (row?.path) { + const input = document.createElement('textarea'); + input.value = row?.path; + document.body.appendChild(input); + input.select(); + document.execCommand('copy'); + document.body.removeChild(input); + MsgSuccess('复制成功'); + } +}; + const handlePath = () => { if (breadCrumbRef.value.offsetWidth > pathWidth.value) { paths.value.splice(0, 1); @@ -549,6 +561,10 @@ const buttons = [ label: i18n.global.t('file.open'), click: open, }, + { + label: i18n.global.t('file.copyDir'), + click: copyDir, + }, { label: i18n.global.t('file.mode'), click: openMode,