From d2de72859240ad5c493696793168cc76bf933149 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 31 Jul 2020 02:03:21 +0900 Subject: [PATCH] refs #1647 Adjust status height when attachments are dropped --- src/renderer/components/TimelineSpace.vue | 18 ++++++++++++------ .../TimelineSpace/Modals/NewToot.vue | 6 ++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index f4bdbee5..caee80a7 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -30,6 +30,7 @@ import Mousetrap from 'mousetrap' import ReceiveDrop from './TimelineSpace/ReceiveDrop' import { AccountLoadError } from '@/errors/load' import { TimelineFetchError } from '@/errors/fetch' +import { Event } from '~/src/renderer/components/event' export default { name: 'timeline-space', @@ -46,7 +47,7 @@ export default { collapse: state => state.TimelineSpace.SideMenu.collapse }), ...mapGetters('TimelineSpace/Modals', ['modalOpened']), - shortcutEnabled: function() { + shortcutEnabled: function () { return !this.modalOpened } }, @@ -120,12 +121,17 @@ export default { } this.$store.dispatch('TimelineSpace/Modals/NewToot/openModal') this.$store.dispatch('TimelineSpace/Modals/NewToot/incrementMediaCount') - this.$store.dispatch('TimelineSpace/Modals/NewToot/uploadImage', file).catch(() => { - this.$message({ - message: this.$t('message.attach_error'), - type: 'error' + this.$store + .dispatch('TimelineSpace/Modals/NewToot/uploadImage', file) + .then(() => { + Event.$emit('image-uploaded') + }) + .catch(() => { + this.$message({ + message: this.$t('message.attach_error'), + type: 'error' + }) }) - }) return false }, onDragEnter(e) { diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot.vue b/src/renderer/components/TimelineSpace/Modals/NewToot.vue index 6c79443c..c51a6527 100644 --- a/src/renderer/components/TimelineSpace/Modals/NewToot.vue +++ b/src/renderer/components/TimelineSpace/Modals/NewToot.vue @@ -146,6 +146,7 @@ import Visibility from '~/src/constants/visibility' import Status from './NewToot/Status' import Poll from './NewToot/Poll' import { NewTootTootLength, NewTootAttachLength, NewTootModalOpen, NewTootBlockSubmit, NewTootPollInvalid } from '@/errors/validations' +import { Event } from '~/src/renderer/components/event' export default { name: 'new-toot', @@ -229,6 +230,11 @@ export default { created() { this.$store.dispatch('TimelineSpace/Modals/NewToot/setupLoading') }, + mounted() { + Event.$on('image-uploaded', () => { + this.statusHeight = this.statusHeight - this.$refs.preview.offsetHeight + }) + }, watch: { newTootModal: function (newState, oldState) { if (!oldState && newState) {