Fix editor auto-expansion (#293)

This commit is contained in:
Baptiste Gelez
2018-10-30 18:16:24 +01:00
committed by GitHub
parent e26a150164
commit 2e072affb5
3 changed files with 10 additions and 12 deletions
+6 -8
View File
@@ -1,9 +1,7 @@
function autosize () {
const el = this
el.style.height = 'auto'
el.style.height = `${el.scrollHeight}px`
}
const articleContent = document.querySelector('#plume-editor')
const offset = articleContent.offsetHeight - articleContent.clientHeight
const articleContent = document.querySelector('#content')
autosize.bind(articleContent)()
articleContent.addEventListener('keyup', autosize)
articleContent.addEventListener('keydown', () => {
articleContent.style.height = 'auto'
articleContent.style.height = `${articleContent.scrollHeight - offset}px`
})