diff options
| author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2023-07-05 06:54:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-05 13:54:40 +0900 |
| commit | ac4245dce1f2b957066ddc3cf10a1444fece7691 (patch) | |
| tree | 4376dd930493f3a4a594b1c38c2d8ea593bd323e /packages/frontend/src/scripts | |
| parent | feat(frontend): deck UIのカラムからアンテナ、リストの編集画... (diff) | |
| download | sharkey-ac4245dce1f2b957066ddc3cf10a1444fece7691.tar.gz sharkey-ac4245dce1f2b957066ddc3cf10a1444fece7691.tar.bz2 sharkey-ac4245dce1f2b957066ddc3cf10a1444fece7691.zip | |
feat(frontend): allow cropping images on drive (#11092)
* feat(frontend): allow cropping images on drive
* nanka iroiro
* folder
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Diffstat (limited to 'packages/frontend/src/scripts')
| -rw-r--r-- | packages/frontend/src/scripts/get-drive-file-menu.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/frontend/src/scripts/get-drive-file-menu.ts b/packages/frontend/src/scripts/get-drive-file-menu.ts index 060c8a1a11..ef0990b326 100644 --- a/packages/frontend/src/scripts/get-drive-file-menu.ts +++ b/packages/frontend/src/scripts/get-drive-file-menu.ts @@ -3,6 +3,7 @@ import { defineAsyncComponent } from 'vue'; import { i18n } from '@/i18n'; import copyToClipboard from '@/scripts/copy-to-clipboard'; import * as os from '@/os'; +import { MenuItem } from '@/types/menu'; function rename(file: Misskey.entities.DriveFile) { os.inputText({ @@ -66,7 +67,8 @@ async function deleteFile(file: Misskey.entities.DriveFile) { }); } -export function getDriveFileMenu(file: Misskey.entities.DriveFile) { +export function getDriveFileMenu(file: Misskey.entities.DriveFile, folder?: Misskey.entities.DriveFolder | null): MenuItem[] { + const isImage = file.type.startsWith('image/'); return [{ text: i18n.ts.rename, icon: 'ti ti-forms', @@ -79,7 +81,14 @@ export function getDriveFileMenu(file: Misskey.entities.DriveFile) { text: i18n.ts.describeFile, icon: 'ti ti-text-caption', action: () => describe(file), - }, null, { + }, ...isImage ? [{ + text: i18n.ts.cropImage, + icon: 'ti ti-crop', + action: () => os.cropImage(file, { + aspectRatio: NaN, + uploadFolder: folder ? folder.id : folder + }), + }] : [], null, { text: i18n.ts.createNoteFromTheFile, icon: 'ti ti-pencil', action: () => os.post({ |