From 689411c19a267630855251f7d54999250faabbf7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 21 Dec 2022 16:00:00 +0900 Subject: refactor(client): refacotr MkMediaCaption --- packages/client/src/components/MkDrive.file.vue | 18 +- .../src/components/MkFileCaptionEditWindow.vue | 175 ++++++++++++++ packages/client/src/components/MkMediaCaption.vue | 263 --------------------- .../client/src/components/MkPostFormAttaches.vue | 17 +- 4 files changed, 187 insertions(+), 286 deletions(-) create mode 100644 packages/client/src/components/MkFileCaptionEditWindow.vue delete mode 100644 packages/client/src/components/MkMediaCaption.vue (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/MkDrive.file.vue b/packages/client/src/components/MkDrive.file.vue index 11bd9e9e3b..8c17c0530a 100644 --- a/packages/client/src/components/MkDrive.file.vue +++ b/packages/client/src/components/MkDrive.file.vue @@ -71,7 +71,7 @@ function getMenu() { action: toggleSensitive, }, { text: i18n.ts.describeFile, - icon: 'ti ti-forms', + icon: 'ti ti-text-caption', action: describe, }, null, { text: i18n.ts.copyUrl, @@ -134,20 +134,14 @@ function rename() { } function describe() { - os.popup(defineAsyncComponent(() => import('@/components/MkMediaCaption.vue')), { - title: i18n.ts.describeFile, - input: { - placeholder: i18n.ts.inputNewDescription, - default: props.file.comment != null ? props.file.comment : '', - }, - image: props.file, + os.popup(defineAsyncComponent(() => import('@/components/MkFileCaptionEditWindow.vue')), { + default: props.file.comment != null ? props.file.comment : '', + file: props.file, }, { - done: result => { - if (!result || result.canceled) return; - let comment = result.result; + done: caption => { os.api('drive/files/update', { fileId: props.file.id, - comment: comment.length === 0 ? null : comment, + comment: caption.length === 0 ? null : caption, }); }, }, 'closed'); diff --git a/packages/client/src/components/MkFileCaptionEditWindow.vue b/packages/client/src/components/MkFileCaptionEditWindow.vue new file mode 100644 index 0000000000..73875251f0 --- /dev/null +++ b/packages/client/src/components/MkFileCaptionEditWindow.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/packages/client/src/components/MkMediaCaption.vue b/packages/client/src/components/MkMediaCaption.vue deleted file mode 100644 index c25755d762..0000000000 --- a/packages/client/src/components/MkMediaCaption.vue +++ /dev/null @@ -1,263 +0,0 @@ - - - - - diff --git a/packages/client/src/components/MkPostFormAttaches.vue b/packages/client/src/components/MkPostFormAttaches.vue index 955d835f25..2e16cc52a7 100644 --- a/packages/client/src/components/MkPostFormAttaches.vue +++ b/packages/client/src/components/MkPostFormAttaches.vue @@ -70,17 +70,12 @@ async function rename(file) { } async function describe(file) { - os.popup(defineAsyncComponent(() => import('@/components/MkMediaCaption.vue')), { - title: i18n.ts.describeFile, - input: { - placeholder: i18n.ts.inputNewDescription, - default: file.comment !== null ? file.comment : '', - }, - image: file, + os.popup(defineAsyncComponent(() => import('@/components/MkFileCaptionEditWindow.vue')), { + default: file.comment !== null ? file.comment : '', + file: file, }, { - done: result => { - if (!result || result.canceled) return; - let comment = result.result.length === 0 ? null : result.result; + done: caption => { + let comment = caption.length === 0 ? null : caption; os.api('drive/files/update', { fileId: file.id, comment: comment, @@ -103,7 +98,7 @@ function showFileMenu(file, ev: MouseEvent) { action: () => { toggleSensitive(file); }, }, { text: i18n.ts.describeFile, - icon: 'ti ti-forms', + icon: 'ti ti-text-caption', action: () => { describe(file); }, }, { text: i18n.ts.attachCancel, -- cgit v1.2.3-freya