textarea auto resize

pull/16/head
Martin Zimmermann 11 years ago
parent 80e8ce7e25
commit 75f172f4ae

@ -85,7 +85,16 @@ define(["behave", "app/text/html", "app/dom", "app/utils", "app/api", "app/marku
});
});
var editor = new behave({textarea: $("textarea", el)});
var textarea = $("textarea", el);
new behave({textarea: textarea});
var offset= !window.opera ? (textarea.offsetHeight - textarea.clientHeight) : (textarea.offsetHeight + parseInt(window.getComputedStyle(textarea, null).getPropertyValue('border-top-width')));
$("textarea", el).on("keyup", function() {
if ((textarea.scrollHeight + offset ) > 48) {
textarea.style.height = "auto";
textarea.style.height = (textarea.scrollHeight + offset ) + 'px';
}
});
return el;
};

Loading…
Cancel
Save