enhance(frontend): アイコン画像・バナー画像を外せるように
This commit is contained in:
parent
3c3decc0ff
commit
7c45dc1cdd
3 changed files with 42 additions and 8 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { useStream } from '@/stream.js';
|
||||
|
|
@ -80,7 +81,7 @@ export function chooseFileFromUrl(): Promise<Misskey.entities.DriveFile> {
|
|||
});
|
||||
}
|
||||
|
||||
function select(src: any, label: string | null, multiple: boolean, excludeSensitive: boolean): Promise<Misskey.entities.DriveFile[]> {
|
||||
function select(src: any, label: string | null, multiple: boolean, excludeSensitive: boolean, additionalMenu: MenuItem[] = []): Promise<Misskey.entities.DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
||||
|
||||
|
|
@ -116,14 +117,14 @@ function select(src: any, label: string | null, multiple: boolean, excludeSensit
|
|||
text: i18n.ts.fromUrl,
|
||||
icon: 'ti ti-link',
|
||||
action: () => chooseFileFromUrl().then(file => _resolve([file])),
|
||||
}], src);
|
||||
}, ...additionalMenu], src);
|
||||
});
|
||||
}
|
||||
|
||||
export function selectFile(src: any, label: string | null = null, excludeSensitive = false): Promise<Misskey.entities.DriveFile> {
|
||||
return select(src, label, false, excludeSensitive).then(files => files[0]);
|
||||
export function selectFile(src: any, label: string | null = null, excludeSensitive = false, additionalMenu?: MenuItem[]): Promise<Misskey.entities.DriveFile> {
|
||||
return select(src, label, false, excludeSensitive, additionalMenu).then(files => files[0]);
|
||||
}
|
||||
|
||||
export function selectFiles(src: any, label: string | null = null, excludeSensitive = false): Promise<Misskey.entities.DriveFile[]> {
|
||||
return select(src, label, true, excludeSensitive);
|
||||
export function selectFiles(src: any, label: string | null = null, excludeSensitive = false, additionalMenu?: MenuItem[]): Promise<Misskey.entities.DriveFile[]> {
|
||||
return select(src, label, true, excludeSensitive, additionalMenu);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue