parent
36fde67992
commit
32d4c312ef
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: 設定の自動バックアップをオンにした直後に自動バックアップするように
|
- Enhance: 設定の自動バックアップをオンにした直後に自動バックアップするように
|
||||||
|
- Enhance: ファイルアップロード前にキャプション設定を行えるように
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
-
|
-
|
||||||
|
|
|
@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
>
|
>
|
||||||
<template #header>{{ i18n.ts.describeFile }}</template>
|
<template #header>{{ i18n.ts.describeFile }}</template>
|
||||||
<div class="_spacer" style="--MI_SPACER-min: 20px; --MI_SPACER-max: 28px;">
|
<div class="_spacer" style="--MI_SPACER-min: 20px; --MI_SPACER-max: 28px;">
|
||||||
<MkDriveFileThumbnail :file="file" fit="contain" style="height: 100px; margin-bottom: 16px;"/>
|
<MkDriveFileThumbnail v-if="file" :file="file" fit="contain" style="height: 100px; margin-bottom: 16px;"/>
|
||||||
<MkTextarea v-model="caption" autofocus :placeholder="i18n.ts.inputNewDescription">
|
<MkTextarea v-model="caption" autofocus :placeholder="i18n.ts.inputNewDescription">
|
||||||
<template #label>{{ i18n.ts.caption }}</template>
|
<template #label>{{ i18n.ts.caption }}</template>
|
||||||
</MkTextarea>
|
</MkTextarea>
|
||||||
|
@ -33,8 +33,8 @@ import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
file: Misskey.entities.DriveFile;
|
file?: Misskey.entities.DriveFile | null;
|
||||||
default: string;
|
default?: string | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -44,7 +44,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const dialog = useTemplateRef('dialog');
|
const dialog = useTemplateRef('dialog');
|
||||||
|
|
||||||
const caption = ref(props.default);
|
const caption = ref(props.default ?? '');
|
||||||
|
|
||||||
async function ok() {
|
async function ok() {
|
||||||
emit('done', caption.value);
|
emit('done', caption.value);
|
||||||
|
|
|
@ -82,6 +82,7 @@ export type UploaderItem = {
|
||||||
file: File;
|
file: File;
|
||||||
watermarkPresetId: string | null;
|
watermarkPresetId: string | null;
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
|
caption?: string | null;
|
||||||
abort?: (() => void) | null;
|
abort?: (() => void) | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,6 +194,21 @@ export function useUploader(options: {
|
||||||
get: () => item.isSensitive ?? false,
|
get: () => item.isSensitive ?? false,
|
||||||
set: (value) => item.isSensitive = value,
|
set: (value) => item.isSensitive = value,
|
||||||
}),
|
}),
|
||||||
|
}, {
|
||||||
|
text: i18n.ts.describeFile,
|
||||||
|
icon: 'ti ti-text-caption',
|
||||||
|
action: async () => {
|
||||||
|
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkFileCaptionEditWindow.vue').then(x => x.default), {
|
||||||
|
default: item.caption ?? null,
|
||||||
|
}, {
|
||||||
|
done: caption => {
|
||||||
|
if (caption != null) {
|
||||||
|
item.caption = caption.trim().length === 0 ? null : caption;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closed: () => dispose(),
|
||||||
|
});
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
type: 'divider',
|
type: 'divider',
|
||||||
});
|
});
|
||||||
|
@ -408,6 +424,7 @@ export function useUploader(options: {
|
||||||
name: item.uploadName ?? item.name,
|
name: item.uploadName ?? item.name,
|
||||||
folderId: options.folderId,
|
folderId: options.folderId,
|
||||||
isSensitive: item.isSensitive ?? false,
|
isSensitive: item.isSensitive ?? false,
|
||||||
|
caption: item.caption ?? null,
|
||||||
onProgress: (progress) => {
|
onProgress: (progress) => {
|
||||||
if (item.progress == null) {
|
if (item.progress == null) {
|
||||||
item.progress = { max: progress.total, value: progress.loaded };
|
item.progress = { max: progress.total, value: progress.loaded };
|
||||||
|
|
|
@ -33,6 +33,7 @@ export function uploadFile(file: File | Blob, options: {
|
||||||
name?: string;
|
name?: string;
|
||||||
folderId?: string | null;
|
folderId?: string | null;
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
|
caption?: string | null;
|
||||||
onProgress?: (ctx: { total: number; loaded: number; }) => void;
|
onProgress?: (ctx: { total: number; loaded: number; }) => void;
|
||||||
} = {}): UploadReturnType {
|
} = {}): UploadReturnType {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
@ -142,6 +143,7 @@ export function uploadFile(file: File | Blob, options: {
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
formData.append('name', options.name ?? (file instanceof File ? file.name : 'untitled'));
|
formData.append('name', options.name ?? (file instanceof File ? file.name : 'untitled'));
|
||||||
formData.append('isSensitive', options.isSensitive ? 'true' : 'false');
|
formData.append('isSensitive', options.isSensitive ? 'true' : 'false');
|
||||||
|
if (options.caption != null) formData.append('comment', options.caption);
|
||||||
if (options.folderId) formData.append('folderId', options.folderId);
|
if (options.folderId) formData.append('folderId', options.folderId);
|
||||||
|
|
||||||
xhr.send(formData);
|
xhr.send(formData);
|
||||||
|
|
Loading…
Reference in New Issue