enhance(frontend): ファイルアップロード処理のリファクタと設定の簡略化
This commit is contained in:
parent
61e09d483e
commit
a25fa62d64
11 changed files with 57 additions and 90 deletions
|
|
@ -759,21 +759,16 @@ export const searchIndexes: SearchIndexItem[] = [
|
|||
},
|
||||
{
|
||||
id: 'goQdtf3dD',
|
||||
label: i18n.ts.keepOriginalUploading,
|
||||
keywords: ['keep', 'original', 'raw', 'upload', i18n.ts.keepOriginalUploadingDescription],
|
||||
},
|
||||
{
|
||||
id: '83xRo0XJl',
|
||||
label: i18n.ts.keepOriginalFilename,
|
||||
keywords: ['keep', 'original', 'filename', i18n.ts.keepOriginalFilenameDescription],
|
||||
},
|
||||
{
|
||||
id: 'wf77yRQQq',
|
||||
id: '83xRo0XJl',
|
||||
label: i18n.ts.alwaysMarkSensitive,
|
||||
keywords: ['always', 'default', 'mark', 'nsfw', 'sensitive', 'media', 'file'],
|
||||
},
|
||||
{
|
||||
id: '3pxwNB8e4',
|
||||
id: 'BrBqZL35E',
|
||||
label: i18n.ts.enableAutoSensitive,
|
||||
keywords: ['auto', 'nsfw', 'sensitive', 'media', 'file', i18n.ts.enableAutoSensitiveDescription],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export function chooseFileFromPc(
|
|||
},
|
||||
): Promise<Misskey.entities.DriveFile[]> {
|
||||
const uploadFolder = options?.uploadFolder ?? prefer.s.uploadFolder;
|
||||
const keepOriginal = options?.keepOriginal ?? prefer.s.keepOriginalUploading;
|
||||
const keepOriginal = options?.keepOriginal ?? false;
|
||||
const nameConverter = options?.nameConverter ?? (() => undefined);
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
|
|
@ -96,19 +96,17 @@ export function chooseFileFromUrl(): Promise<Misskey.entities.DriveFile> {
|
|||
|
||||
function select(src: HTMLElement | EventTarget | null, label: string | null, multiple: boolean): Promise<Misskey.entities.DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
const keepOriginal = ref(prefer.s.keepOriginalUploading);
|
||||
|
||||
os.popupMenu([label ? {
|
||||
text: label,
|
||||
type: 'label',
|
||||
} : undefined, {
|
||||
type: 'switch',
|
||||
text: i18n.ts.keepOriginalUploading,
|
||||
ref: keepOriginal,
|
||||
text: i18n.ts.upload + ' (' + i18n.ts.compress + ')',
|
||||
icon: 'ti ti-upload',
|
||||
action: () => chooseFileFromPc(multiple, { keepOriginal: false }).then(files => res(files)),
|
||||
}, {
|
||||
text: i18n.ts.upload,
|
||||
icon: 'ti ti-upload',
|
||||
action: () => chooseFileFromPc(multiple, { keepOriginal: keepOriginal.value }).then(files => res(files)),
|
||||
action: () => chooseFileFromPc(multiple, { keepOriginal: true }).then(files => res(files)),
|
||||
}, {
|
||||
text: i18n.ts.fromDrive,
|
||||
icon: 'ti ti-cloud',
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export function uploadFile(
|
|||
file: File,
|
||||
folder?: string | Misskey.entities.DriveFolder | null,
|
||||
name?: string,
|
||||
keepOriginal: boolean = prefer.s.keepOriginalUploading,
|
||||
keepOriginal = false,
|
||||
): Promise<Misskey.entities.DriveFile> {
|
||||
if ($i == null) throw new Error('Not logged in');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue