From edfd1f892681cc411c036f9aa877d8c454c72c6b Mon Sep 17 00:00:00 2001 From: Andreas Gohr <gohr@cosmocode.de> Date: Wed, 5 Aug 2009 14:35:23 +0200 Subject: [PATCH] fixes another IE weirdnes when handling list items Ignore-this: d5a0f9671af3607796332a1afcc8de79 Fixes a problem where list mode couldn't easily be left by removing a bullet. Hitting enter would readd a bullet always. note: development was part of the ICKE 2.0 project see http://www.icke-projekt.de for info darcs-hash:20090805123523-6e07b-46570b10a1422d04ad3c7251323568c712037864.gz --- lib/scripts/edit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index fe9057898..5320c9419 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -196,19 +196,19 @@ function addBtnActionAutohead(btn, props, edid, id) * * @author Andreas Gohr <andi@splitbrain.org> * @fixme handle tabs - * @fixme IE compatibility not tested yet */ function keyHandler(e){ if(e.keyCode != 13 && e.keyCode != 8 && - e.keyCode != 32) return; //FIXME IE + e.keyCode != 32) return; var field = e.target; var selection = getSelection(field); var search = "\n"+field.value.substr(0,selection.start); - var linestart = search.lastIndexOf("\n"); + var linestart = Math.max(search.lastIndexOf("\n"), + search.lastIndexOf("\r")); //IE workaround search = search.substr(linestart); - if(e.keyCode == 13){ // Enter //FIXME IE + if(e.keyCode == 13){ // Enter // keep current indention for lists and code var match = search.match(/(\n +([\*-] ?)?)/); if(match){ -- GitLab