Merge pull request #1651 from h3poteto/iss-1647

closes #1647 Adjust status height when attachments are dropped
This commit is contained in:
AkiraFukushima 2020-07-31 20:22:14 +09:00 committed by GitHub
commit 9e49e6915f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -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) {

View File

@ -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) {