Skip to content
Snippets Groups Projects
Commit 17b6bb19 authored by Adrian Lang's avatar Adrian Lang
Browse files

Fix textarea scrolling for list editing

parent 7873e757
No related branches found
No related tags found
No related merge requests found
......@@ -166,6 +166,7 @@ function keyHandler(e){
// keep current indention for lists and code
var match = search.match(/(\n +([\*-] ?)?)/);
if(match){
var scroll = field.scrollHeight;
var match2 = search.match(/^\n +[\*-]\s*$/);
// Cancel list if the last item is empty (i. e. two times enter)
if (match2 && field.value.substr(selection.start).match(/^($|\n)/)) {
......@@ -177,7 +178,6 @@ function keyHandler(e){
} else {
insertAtCarret(field.id,match[1]);
}
var scroll = field.scrollHeight;
field.scrollTop += (field.scrollHeight - scroll);
e.preventDefault(); // prevent enter key
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment