correctly resize text input after posting

This commit is contained in:
Nolan Lawson 2018-03-19 20:58:53 -07:00
parent 5f670f6eb3
commit 1786d737bb
1 changed files with 17 additions and 4 deletions

View File

@ -41,10 +41,19 @@
},
methods: {
setupSyncFromStore() {
let textarea = this.refs.textarea
let firstTime = true
this.observe('text', text => {
this.set({rawText: text})
if (firstTime) {
firstTime = false
if (this.get('autoFocus')) {
this.refs.textarea.focus()
textarea.focus()
}
} else {
mark('autosize.update()')
autosize.update(textarea)
stop('autosize.update()')
}
})
},
@ -60,9 +69,10 @@
}, {init: false})
},
setupAutosize() {
let textarea = this.refs.textarea
requestAnimationFrame(() => {
mark('autosize()')
autosize(this.refs.textarea)
autosize(textarea)
stop('autosize()')
})
},
@ -78,6 +88,9 @@
store: () => store,
data: () => ({
rawText: ''
})
}),
computed: {
postedStatusForRealm: ($postedStatusForRealm) => $postedStatusForRealm
}
}
</script>