use option
This commit is contained in:
parent
7c45dc1cdd
commit
ec79544efd
|
@ -204,23 +204,26 @@ function save() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeAvatar(ev) {
|
function changeAvatar(ev) {
|
||||||
selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar, true, $i.avatarId ? [
|
selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar, {
|
||||||
{ type: 'divider' },
|
excludeSensitive: true,
|
||||||
{
|
additionalMenu: $i.avatarId ? [
|
||||||
type: 'button',
|
{ type: 'divider' },
|
||||||
text: i18n.ts.detach,
|
{
|
||||||
icon: 'ti ti-circle-x',
|
type: 'button',
|
||||||
action: () => {
|
text: i18n.ts.detach,
|
||||||
os.apiWithDialog('i/update', {
|
icon: 'ti ti-circle-x',
|
||||||
avatarId: null,
|
action: () => {
|
||||||
}).then(() => {
|
os.apiWithDialog('i/update', {
|
||||||
$i.avatarId = null;
|
avatarId: null,
|
||||||
$i.avatarUrl = null;
|
}).then(() => {
|
||||||
globalEvents.emit('requestClearPageCache');
|
$i.avatarId = null;
|
||||||
});
|
$i.avatarUrl = null;
|
||||||
|
globalEvents.emit('requestClearPageCache');
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
] : undefined,
|
||||||
] : undefined).then(async (file) => {
|
}).then(async (file) => {
|
||||||
let originalOrCropped = file;
|
let originalOrCropped = file;
|
||||||
|
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
|
@ -247,23 +250,26 @@ function changeAvatar(ev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeBanner(ev) {
|
function changeBanner(ev) {
|
||||||
selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner, true, $i.bannerId ? [
|
selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner, {
|
||||||
{ type: 'divider' },
|
excludeSensitive: true,
|
||||||
{
|
additionalMenu: $i.bannerId ? [
|
||||||
type: 'button',
|
{ type: 'divider' },
|
||||||
text: i18n.ts.detach,
|
{
|
||||||
icon: 'ti ti-circle-x',
|
type: 'button',
|
||||||
action: () => {
|
text: i18n.ts.detach,
|
||||||
os.apiWithDialog('i/update', {
|
icon: 'ti ti-circle-x',
|
||||||
bannerId: null,
|
action: () => {
|
||||||
}).then(() => {
|
os.apiWithDialog('i/update', {
|
||||||
$i.bannerId = null;
|
bannerId: null,
|
||||||
$i.bannerUrl = null;
|
}).then(() => {
|
||||||
globalEvents.emit('requestClearPageCache');
|
$i.bannerId = null;
|
||||||
});
|
$i.bannerUrl = null;
|
||||||
|
globalEvents.emit('requestClearPageCache');
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
] : undefined,
|
||||||
] : undefined).then(async (file) => {
|
}).then(async (file) => {
|
||||||
let originalOrCropped = file;
|
let originalOrCropped = file;
|
||||||
|
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
|
|
|
@ -81,7 +81,7 @@ export function chooseFileFromUrl(): Promise<Misskey.entities.DriveFile> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function select(src: any, label: string | null, multiple: boolean, excludeSensitive: boolean, additionalMenu: MenuItem[] = []): Promise<Misskey.entities.DriveFile[]> {
|
function select(src: any, label: string | null, multiple: boolean, excludeSensitive = false, additionalMenu: MenuItem[] = []): Promise<Misskey.entities.DriveFile[]> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
||||||
|
|
||||||
|
@ -121,10 +121,10 @@ function select(src: any, label: string | null, multiple: boolean, excludeSensit
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectFile(src: any, label: string | null = null, excludeSensitive = false, additionalMenu?: MenuItem[]): Promise<Misskey.entities.DriveFile> {
|
export function selectFile(src: any, label: string | null = null, options?: { excludeSensitive?: boolean; additionalMenu?: MenuItem[]; }): Promise<Misskey.entities.DriveFile> {
|
||||||
return select(src, label, false, excludeSensitive, additionalMenu).then(files => files[0]);
|
return select(src, label, false, options?.excludeSensitive, options?.additionalMenu).then(files => files[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectFiles(src: any, label: string | null = null, excludeSensitive = false, additionalMenu?: MenuItem[]): Promise<Misskey.entities.DriveFile[]> {
|
export function selectFiles(src: any, label: string | null = null, options?: { excludeSensitive?: boolean; additionalMenu?: MenuItem[]; }): Promise<Misskey.entities.DriveFile[]> {
|
||||||
return select(src, label, true, excludeSensitive, additionalMenu);
|
return select(src, label, true, options?.excludeSensitive, options?.additionalMenu);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue