fix: fix autosizing of delete/redraft (#1338)

fixes #1334
This commit is contained in:
Nolan Lawson 2019-07-17 21:34:53 -07:00 committed by GitHub
parent a16bc30f21
commit a6235ded8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View file

@ -68,12 +68,14 @@
} from '../../_actions/autosuggest' } from '../../_actions/autosuggest'
import { observe } from 'svelte-extras' import { observe } from 'svelte-extras'
import { get } from '../../_utils/lodash-lite' import { get } from '../../_utils/lodash-lite'
import { on } from '../../_utils/eventBus'
export default { export default {
oncreate () { oncreate () {
this.setupSyncFromStore() this.setupSyncFromStore()
this.setupSyncToStore() this.setupSyncToStore()
this.setupAutosize() this.setupAutosize()
this.setupResize()
}, },
ondestroy () { ondestroy () {
this.teardownAutosize() this.teardownAutosize()
@ -225,6 +227,13 @@
}) })
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
},
setupResize () {
on('resizeComposeInput', this, realm => {
if (realm === this.get().realm) {
autosize.update(this.refs.textarea)
}
})
} }
}, },
store: () => store, store: () => store,

View file

@ -3,13 +3,14 @@
{label} {label}
{title} {title}
background="var(--main-bg)" background="var(--main-bg)"
on:show="onShow()"
> >
<ComposeBox realm="dialog" autoFocus={true} dialogId={id} /> <ComposeBox {realm} autoFocus={true} dialogId={id} />
</ModalDialog> </ModalDialog>
<script> <script>
import ModalDialog from './ModalDialog.html' import ModalDialog from './ModalDialog.html'
import ComposeBox from '../../compose/ComposeBox.html' import ComposeBox from '../../compose/ComposeBox.html'
import { on } from '../../../_utils/eventBus' import { on, emit } from '../../../_utils/eventBus'
import { show } from '../helpers/showDialog' import { show } from '../helpers/showDialog'
import { oncreate as onCreateDialog } from '../helpers/onCreateDialog' import { oncreate as onCreateDialog } from '../helpers/onCreateDialog'
import { close } from '../helpers/closeDialog' import { close } from '../helpers/closeDialog'
@ -20,16 +21,20 @@
onCreateDialog.call(this) onCreateDialog.call(this)
}, },
data: () => ({ data: () => ({
title: void 0 title: void 0,
realm: 'dialog'
}), }),
methods: { methods: {
show, show,
close, close,
onPostedStatus (realm) { onPostedStatus (realm) {
if (realm !== 'dialog') { if (realm !== this.get().realm) {
return return
} }
this.close() this.close()
},
onShow () {
emit('resizeComposeInput', this.get().realm)
} }
}, },
components: { components: {