From 420365c17fddbafb898cd83b2973e75ee288db7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8A=E3=81=95=E3=82=80=E3=81=AE=E3=81=B2=E3=81=A8?= <46447427+samunohito@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:20:38 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E9=96=8B=E7=99=BA?= =?UTF-8?q?=E8=80=85=E3=83=A2=E3=83=BC=E3=83=89=E3=81=A7=E3=83=A1=E3=83=8B?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=81=8B=E3=82=89=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=ABID=E3=82=92=E3=82=B3=E3=83=94=E3=83=BC=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= =?UTF-8?q?=20(#15444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + packages/frontend/src/components/MkMediaAudio.vue | 13 ++++++++++++- packages/frontend/src/components/MkMediaImage.vue | 11 +++++++++++ packages/frontend/src/components/MkMediaVideo.vue | 11 +++++++++++ .../frontend/src/components/MkPostFormAttaches.vue | 12 ++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af62232510..b6d6a2590e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Enhance: 投稿フォームの「迷惑になる可能性があります」のダイアログを表示する条件においてCWを考慮するように - Enhance: アンテナ、リスト等の名前をカラム名のデフォルト値にするように `#13992` - Enhance: クライアントエラー画面の多言語対応 +- Enhance: 開発者モードでメニューからファイルIDをコピー出来るように `#15441' ### Server - Fix: `following/invalidate`でフォロワーを解除しようとしているユーザーの情報を返すように diff --git a/packages/frontend/src/components/MkMediaAudio.vue b/packages/frontend/src/components/MkMediaAudio.vue index e409b7fd57..e509cac945 100644 --- a/packages/frontend/src/components/MkMediaAudio.vue +++ b/packages/frontend/src/components/MkMediaAudio.vue @@ -91,10 +91,11 @@ SPDX-License-Identifier: AGPL-3.0-only import { shallowRef, watch, computed, ref, onDeactivated, onActivated, onMounted } from 'vue'; import * as Misskey from 'misskey-js'; import type { MenuItem } from '@/types/menu.js'; +import type { Keymap } from '@/scripts/hotkey.js'; +import { copyToClipboard } from '@/scripts/copy-to-clipboard'; import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import * as os from '@/os.js'; -import type { Keymap } from '@/scripts/hotkey.js'; import bytes from '@/filters/bytes.js'; import { hms } from '@/filters/hms.js'; import MkMediaRange from '@/components/MkMediaRange.vue'; @@ -227,6 +228,16 @@ function showMenu(ev: MouseEvent) { }); } + if (defaultStore.state.devMode) { + menu.push({ type: 'divider' }, { + icon: 'ti ti-id', + text: i18n.ts.copyFileId, + action: () => { + copyToClipboard(props.audio.id); + }, + }); + } + menuShowing.value = true; os.popupMenu(menu, ev.currentTarget ?? ev.target, { align: 'right', diff --git a/packages/frontend/src/components/MkMediaImage.vue b/packages/frontend/src/components/MkMediaImage.vue index ec85569df5..bd6decd082 100644 --- a/packages/frontend/src/components/MkMediaImage.vue +++ b/packages/frontend/src/components/MkMediaImage.vue @@ -54,6 +54,7 @@ SPDX-License-Identifier: AGPL-3.0-only import { watch, ref, computed } from 'vue'; import * as Misskey from 'misskey-js'; import type { MenuItem } from '@/types/menu.js'; +import { copyToClipboard } from '@/scripts/copy-to-clipboard'; import { getStaticImageUrl } from '@/scripts/media-proxy.js'; import bytes from '@/filters/bytes.js'; import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue'; @@ -143,6 +144,16 @@ function showMenu(ev: MouseEvent) { }); } + if (defaultStore.state.devMode) { + menuItems.push({ type: 'divider' }, { + icon: 'ti ti-id', + text: i18n.ts.copyFileId, + action: () => { + copyToClipboard(props.image.id); + }, + }); + } + os.popupMenu(menuItems, ev.currentTarget ?? ev.target); } diff --git a/packages/frontend/src/components/MkMediaVideo.vue b/packages/frontend/src/components/MkMediaVideo.vue index caa93e3f2b..dec190f16c 100644 --- a/packages/frontend/src/components/MkMediaVideo.vue +++ b/packages/frontend/src/components/MkMediaVideo.vue @@ -113,6 +113,7 @@ import { ref, shallowRef, computed, watch, onDeactivated, onActivated, onMounted import * as Misskey from 'misskey-js'; import type { MenuItem } from '@/types/menu.js'; import type { Keymap } from '@/scripts/hotkey.js'; +import { copyToClipboard } from '@/scripts/copy-to-clipboard'; import bytes from '@/filters/bytes.js'; import { hms } from '@/filters/hms.js'; import { defaultStore } from '@/store.js'; @@ -252,6 +253,16 @@ function showMenu(ev: MouseEvent) { }); } + if (defaultStore.state.devMode) { + menu.push({ type: 'divider' }, { + icon: 'ti ti-id', + text: i18n.ts.copyFileId, + action: () => { + copyToClipboard(props.video.id); + }, + }); + } + menuShowing.value = true; os.popupMenu(menu, ev.currentTarget ?? ev.target, { align: 'right', diff --git a/packages/frontend/src/components/MkPostFormAttaches.vue b/packages/frontend/src/components/MkPostFormAttaches.vue index 33fe82b759..f2d6c7e2cd 100644 --- a/packages/frontend/src/components/MkPostFormAttaches.vue +++ b/packages/frontend/src/components/MkPostFormAttaches.vue @@ -36,6 +36,8 @@ SPDX-License-Identifier: AGPL-3.0-only import { defineAsyncComponent, inject } from 'vue'; import * as Misskey from 'misskey-js'; import type { MenuItem } from '@/types/menu'; +import { defaultStore } from '@/store'; +import { copyToClipboard } from '@/scripts/copy-to-clipboard'; import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; import * as os from '@/os.js'; import { misskeyApi } from '@/scripts/misskey-api.js'; @@ -196,6 +198,16 @@ function showFileMenu(file: Misskey.entities.DriveFile, ev: MouseEvent | Keyboar action: () => { detachAndDeleteMedia(file); }, }); + if (defaultStore.state.devMode) { + menuItems.push({ type: 'divider' }, { + icon: 'ti ti-id', + text: i18n.ts.copyFileId, + action: () => { + copyToClipboard(file.id); + }, + }); + } + os.popupMenu(menuItems, ev.currentTarget ?? ev.target).then(() => menuShowing = false); menuShowing = true; }