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>
This commit is contained in:

committed by
GitHub

parent
1ab9f096c3
commit
ac4245dce1
@@ -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({
|
||||
|
Reference in New Issue
Block a user