summaryrefslogtreecommitdiff
path: root/lib/scripts/edit.js
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2009-08-05 14:35:23 +0200
committerAndreas Gohr <gohr@cosmocode.de>2009-08-05 14:35:23 +0200
commitedfd1f892681cc411c036f9aa877d8c454c72c6b (patch)
tree1e020fcde857684fba373b297824ae7bbde7a503 /lib/scripts/edit.js
parent8f99c3ec15712c974b5a5caf5f40ef9170103f67 (diff)
downloadrpg-edfd1f892681cc411c036f9aa877d8c454c72c6b.tar.gz
rpg-edfd1f892681cc411c036f9aa877d8c454c72c6b.tar.bz2
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
Diffstat (limited to 'lib/scripts/edit.js')
-rw-r--r--lib/scripts/edit.js8
1 files 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){