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,