From 77d03d34731f1ec12d77f82fe4c260c4bb9f559a Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 01:40:34 +0000 Subject: [PATCH] Try to add some sanity to indentation --- src/static/js/ace2_inner.js | 9 +++++---- src/static/js/pad_editbar.js | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 5c0af0f15..151a18068 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3287,7 +3287,7 @@ function Ace2Inner(){ listType = /([a-z]+)([12345678])/.exec(listType); var type = listType[1]; var level = Number(listType[2]); - + //detect empty list item; exclude indentation if(text === '*' && type !== "indent") { @@ -3317,8 +3317,10 @@ function Ace2Inner(){ function doIndentOutdent(isOut) { - if (!(rep.selStart && rep.selEnd) || - ((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) + if (!((rep.selStart && rep.selEnd) || + ((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) && + (isOut != true) + ) { return false; } @@ -3326,7 +3328,6 @@ function Ace2Inner(){ var firstLine, lastLine; firstLine = rep.selStart[0]; lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0)); - var mods = []; for (var n = firstLine; n <= lastLine; n++) { diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 91a07bf96..cc9f8758c 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -156,10 +156,7 @@ var padeditbar = (function() else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList(); else if (cmd == 'indent') { - if (!ace.ace_doIndentOutdent(false)) - { - ace.ace_doInsertUnorderedList(); - } + ace.ace_doIndentOutdent(false); } else if (cmd == 'outdent') {