enhance(frontend): 開発者モードでメニューからファイルIDをコピー出来るようにする (#15444)
This commit is contained in:
parent
dc608aada0
commit
420365c17f
5 changed files with 47 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue