From 3796da683658f527ecc83bf09bfe620512e03115 Mon Sep 17 00:00:00 2001
From: yupix <yupi0982@outlook.jp>
Date: Sat, 8 Jul 2023 18:45:41 +0900
Subject: feat: フォルダーやファイルでもIDをコピーできるように (#11189)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* feat: フォルダーやファイルでもIDをコピーできるように close #11188

* docs: update CHANGELOG.md
---
 packages/frontend/src/components/MkDrive.folder.vue | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'packages/frontend/src/components/MkDrive.folder.vue')

diff --git a/packages/frontend/src/components/MkDrive.folder.vue b/packages/frontend/src/components/MkDrive.folder.vue
index 3594978729..13f32ff7af 100644
--- a/packages/frontend/src/components/MkDrive.folder.vue
+++ b/packages/frontend/src/components/MkDrive.folder.vue
@@ -33,6 +33,7 @@ import * as os from '@/os';
 import { i18n } from '@/i18n';
 import { defaultStore } from '@/store';
 import { claimAchievement } from '@/scripts/achievements';
+import copyToClipboard from '@/scripts/copy-to-clipboard';
 
 const props = withDefaults(defineProps<{
 	folder: Misskey.entities.DriveFolder;
@@ -244,7 +245,8 @@ function setAsUploadFolder() {
 }
 
 function onContextmenu(ev: MouseEvent) {
-	os.contextMenu([{
+	let menu;
+	menu = [{
 		text: i18n.ts.openInWindow,
 		icon: 'ti ti-app-window',
 		action: () => {
@@ -262,7 +264,17 @@ function onContextmenu(ev: MouseEvent) {
 		icon: 'ti ti-trash',
 		danger: true,
 		action: deleteFolder,
-	}], ev);
+	}];
+	if (defaultStore.state.devMode) {
+		menu = menu.concat([null, {
+			icon: 'ti ti-id',
+			text: i18n.ts.copyFolderId,
+			action: () => {
+				copyToClipboard(props.folder.id);
+			},
+		}]);
+	}
+	os.contextMenu(menu, ev);
 }
 </script>
 
-- 
cgit v1.2.3-freya

