Skip to content
Snippets Groups Projects
Commit 4ca2a94b authored by Andreas Gohr's avatar Andreas Gohr
Browse files

fixed scrolling issue in new list editing FS#1790

Ignore-this: 404026c070f3a0764cd3b20363333509

darcs-hash:20091102103712-6e07b-7fa6e59b7cac031e166af4b002bd1c40ba06c777.gz
parent a460bc23
No related branches found
No related tags found
No related merge requests found
...@@ -160,7 +160,9 @@ function keyHandler(e){ ...@@ -160,7 +160,9 @@ function keyHandler(e){
// keep current indention for lists and code // keep current indention for lists and code
var match = search.match(/(\n +([\*-] ?)?)/); var match = search.match(/(\n +([\*-] ?)?)/);
if(match){ if(match){
var scroll = field.scrollHeight;
insertAtCarret(field.id,match[1]); insertAtCarret(field.id,match[1]);
field.scrollTop += (field.scrollHeight - scroll);
e.preventDefault(); // prevent enter key e.preventDefault(); // prevent enter key
} }
}else if(e.keyCode == 8){ // Backspace }else if(e.keyCode == 8){ // Backspace
...@@ -201,7 +203,7 @@ function keyHandler(e){ ...@@ -201,7 +203,7 @@ function keyHandler(e){
addInitEvent(function(){ addInitEvent(function(){
var field = $('wiki__text'); var field = $('wiki__text');
if(!field) return; if(!field) return;
addEvent(field,'keydown',keyHandler); addEvent(field,'keypress',keyHandler);
}); });
/** /**
......
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