From 487a3079cd38e6332fd970ab825c569f9f660822 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 14 Apr 2019 17:12:04 +0900 Subject: [PATCH] Improve post form attaches; Fix #4673, Resolve #2327, Resolve #2145 [v11] (#4674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * improve post form attaches * Fix * chain * 右クリックでも反応するように --- locales/ja-JP.yml | 6 +- src/client/app/admin/views/drive.vue | 18 +-- .../views/components/drive-file-thumbnail.vue | 4 +- .../views/components/post-form-attaches.vue | 139 ++++++++++++++++++ .../app/common/views/widgets/post-form.vue | 45 +----- .../app/desktop/views/components/drive.vue | 1 - .../desktop/views/components/post-form.vue | 58 +------- .../app/mobile/views/components/post-form.vue | 42 +----- src/models/repositories/drive-file.ts | 8 +- src/server/web/feed.ts | 2 +- 10 files changed, 169 insertions(+), 154 deletions(-) create mode 100644 src/client/app/common/views/components/post-form-attaches.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index abfe37416..cc6fe2b08 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -964,7 +964,6 @@ desktop/views/components/post-form.vue: posting: "投稿中" attach-media-from-local: "PCからメディアを添付" attach-media-from-drive: "ドライブからメディアを添付" - attach-cancel: "添付取り消し" insert-a-kao: "v('ω')v" create-poll: "アンケートを作成" text-remain: "残り{}文字" @@ -1070,6 +1069,11 @@ common/views/components/password-settings.vue: changed: "パスワードを変更しました" failed: "パスワード変更に失敗しました" +common/views/components/post-form-attaches.vue: + attach-cancel: "添付取り消し" + mark-as-sensitive: "閲覧注意に設定" + unmark-as-sensitive: "閲覧注意を解除" + desktop/views/components/sub-note-content.vue: private: "この投稿は非公開です" deleted: "この投稿は削除されました" diff --git a/src/client/app/admin/views/drive.vue b/src/client/app/admin/views/drive.vue index 1f35de100..e4565b78f 100644 --- a/src/client/app/admin/views/drive.vue +++ b/src/client/app/admin/views/drive.vue @@ -38,7 +38,7 @@
-
+
@@ -75,10 +75,15 @@ import Vue from 'vue'; import i18n from '../../i18n'; import { faCloud, faTerminal, faSearch } from '@fortawesome/free-solid-svg-icons'; import { faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; +import XFileThumbnail from '../../common/views/components/drive-file-thumbnail.vue'; export default Vue.extend({ i18n: i18n('admin/views/drive.vue'), + components: { + XFileThumbnail + }, + data() { return { file: null, @@ -151,13 +156,6 @@ export default Vue.extend({ }); }, - thumbnail(file: any): any { - return { - 'background-color': file.properties.avgColor || 'transparent', - 'background-image': `url(${file.thumbnailUrl})` - }; - }, - async del(file: any) { const process = async () => { await this.$root.api('drive/files/delete', { fileId: file.id }); @@ -179,9 +177,9 @@ export default Vue.extend({ this.$root.api('drive/files/update', { fileId: file.id, isSensitive: !file.isSensitive + }).then(() => { + file.isSensitive = !file.isSensitive; }); - - file.isSensitive = !file.isSensitive; }, async show() { diff --git a/src/client/app/common/views/components/drive-file-thumbnail.vue b/src/client/app/common/views/components/drive-file-thumbnail.vue index c432de172..1a3ef3719 100644 --- a/src/client/app/common/views/components/drive-file-thumbnail.vue +++ b/src/client/app/common/views/components/drive-file-thumbnail.vue @@ -105,9 +105,7 @@ export default Vue.extend({ }, isThumbnailAvailable(): boolean { return this.file.thumbnailUrl - ? this.file.thumbnailUrl.endsWith('?thumbnail') - ? (this.is === 'image' || this.is === 'video') - : true + ? (this.is === 'image' || this.is === 'video') : false; }, background(): string { diff --git a/src/client/app/common/views/components/post-form-attaches.vue b/src/client/app/common/views/components/post-form-attaches.vue new file mode 100644 index 000000000..467e430cc --- /dev/null +++ b/src/client/app/common/views/components/post-form-attaches.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/src/client/app/common/views/widgets/post-form.vue b/src/client/app/common/views/widgets/post-form.vue index f1826cc59..b30168b87 100644 --- a/src/client/app/common/views/widgets/post-form.vue +++ b/src/client/app/common/views/widgets/post-form.vue @@ -21,14 +21,7 @@
-
- -
-
- -
-
-
+
@@ -45,7 +38,7 @@ import define from '../../../common/define-widget'; import i18n from '../../../i18n'; import insertTextAtCursor from 'insert-text-at-cursor'; -import * as XDraggable from 'vuedraggable'; +import XPostFormAttaches from '../components/post-form-attaches.vue'; export default define({ name: 'post-form', @@ -56,7 +49,7 @@ export default define({ i18n: i18n('desktop/views/widgets/post-form.vue'), components: { - XDraggable + XPostFormAttaches }, data() { @@ -249,38 +242,6 @@ export default define({ & + .emoji opacity 0.7 - > .files - > div - padding 4px - - &:after - content "" - display block - clear both - - > div - float left - border solid 4px transparent - cursor move - - &:hover > .remove - display block - - > .img - width 64px - height 64px - background-size cover - background-position center center - - > .remove - display none - position absolute - top -6px - right -6px - width 16px - height 16px - cursor pointer - > input[type=file] display none diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue index 7513f002a..fcabb4b8e 100644 --- a/src/client/app/desktop/views/components/drive.vue +++ b/src/client/app/desktop/views/components/drive.vue @@ -769,7 +769,6 @@ export default Vue.extend({ > .mk-uploader height 100px padding 16px - background #fff > input display none diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 6ba4d4708..fe39a17e6 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -27,15 +27,7 @@ -
- -
-
- -
-
-

{{ 4 - files.length }}/4

-
+
@@ -65,7 +57,6 @@ import Vue from 'vue'; import i18n from '../../../i18n'; import insertTextAtCursor from 'insert-text-at-cursor'; -import * as XDraggable from 'vuedraggable'; import getFace from '../../../common/scripts/get-face'; import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue'; import { parse } from '../../../../../mfm/parse'; @@ -74,13 +65,14 @@ import { erase, unique } from '../../../../../prelude/array'; import { length } from 'stringz'; import { toASCII } from 'punycode'; import extractMentions from '../../../../../misc/extract-mentions'; +import XPostFormAttaches from '../../../common/views/components/post-form-attaches.vue'; export default Vue.extend({ i18n: i18n('desktop/views/components/post-form.vue'), components: { - XDraggable, - MkVisibilityChooser + MkVisibilityChooser, + XPostFormAttaches }, props: { @@ -513,7 +505,7 @@ export default Vue.extend({ kao() { this.text += getFace(); - } + }, } }); @@ -618,46 +610,6 @@ export default Vue.extend({ border-bottom solid 1px var(--primaryAlpha01) !important border-radius 0 - > .remain - display block - position absolute - top 8px - right 8px - margin 0 - padding 0 - color var(--primaryAlpha04) - - > div - padding 4px - - &:after - content "" - display block - clear both - - > div - float left - border solid 4px transparent - cursor move - - &:hover > .remove - display block - - > .img - width 64px - height 64px - background-size cover - background-position center center - - > .remove - display none - position absolute - top -6px - right -6px - width 16px - height 16px - cursor pointer - > .mk-poll-editor background var(--desktopPostFormTextareaBg) border solid 1px var(--primaryAlpha01) diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index 9c1072b4a..6b26cdf89 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -21,13 +21,7 @@ -
- -
-
-
-
-
+