added support for (de)indent of regular text

pull/231/head
Jean-Tiare Le Bigot 2011-11-25 10:29:31 +01:00
parent 6b11ae330d
commit ea2e7d0550
2 changed files with 27 additions and 10 deletions

View File

@ -32,6 +32,23 @@ ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; } ul.list-bullet7 { list-style-type: disc; }
ul.list-bullet8 { list-style-type: circle; } ul.list-bullet8 { list-style-type: circle; }
ul.list-indent1 { margin-left: 1.5em; }
ul.list-indent2 { margin-left: 3em; }
ul.list-indent3 { margin-left: 4.5em; }
ul.list-indent4 { margin-left: 6em; }
ul.list-indent5 { margin-left: 7.5em; }
ul.list-indent6 { margin-left: 9em; }
ul.list-indent7 { margin-left: 10.5em; }
ul.list-indent8 { margin-left: 12em; }
ul.list-indent1 { list-style-type: none; }
ul.list-indent2 { list-style-type: none; }
ul.list-indent3 { list-style-type: none; }
ul.list-indent4 { list-style-type: none; }
ul.list-indent5 { list-style-type: none; }
ul.list-indent6 { list-style-type: none; }
ul.list-indent7 { list-style-type: none; }
ul.list-indent8 { list-style-type: none; }
body { body {
margin: 0; margin: 0;

View File

@ -3548,33 +3548,33 @@ function OUTER(gscope)
lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] == 0) ? 1 : 0)); lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] == 0) ? 1 : 0));
var mods = []; var mods = [];
var foundLists = false;
for (var n = firstLine; n <= lastLine; n++) for (var n = firstLine; n <= lastLine; n++)
{ {
var listType = getLineListType(n); var listType = getLineListType(n);
var t = 'indent';
var level = 0;
if (listType) if (listType)
{ {
listType = /([a-z]+)([12345678])/.exec(listType); listType = /([a-z]+)([12345678])/.exec(listType);
if (listType) if (listType)
{ {
foundLists = true; t = listType[1];
var t = listType[1]; level = Number(listType[2]);
var level = Number(listType[2]); }
}
var newLevel = Math.max(0, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1))); var newLevel = Math.max(0, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1)));
if (level != newLevel) if (level != newLevel)
{ {
mods.push([n, (newLevel > 0) ? t + newLevel : '']); mods.push([n, (newLevel > 0) ? t + newLevel : '']);
} }
} }
}
}
if (mods.length > 0) if (mods.length > 0)
{ {
setLineListTypes(mods); setLineListTypes(mods);
} }
return foundLists; return true;
} }
editorInfo.ace_doIndentOutdent = doIndentOutdent; editorInfo.ace_doIndentOutdent = doIndentOutdent;