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

View file

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