151 - Make the editor bigger and autosize it

This commit is contained in:
Kevin "Ilphrin" Pellet
2018-08-30 22:47:25 +02:00
parent b1c1ba151d
commit ce289b79fa
3 changed files with 19 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
function autosize(){
const el = this;
el.style.height = 'auto';
el.style.height = (el.scrollHeight ) + 'px';
}
const articleContent = document.querySelector('#content');
let offset = 0;
let style = window.getComputedStyle(articleContent, null);
offset += parseInt(style['paddingTop']) + parseInt(style['paddingBottom']);
autosize.bind(articleContent)();
articleContent.addEventListener('keyup', autosize);