Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions static/css/iframe_editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; }
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 {
margin: 0;
Expand Down
36 changes: 23 additions & 13 deletions static/js/ace2_inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3538,7 +3538,8 @@ function OUTER(gscope)

function doIndentOutdent(isOut)
{
if (!(rep.selStart && rep.selEnd))
if (!(rep.selStart && rep.selEnd) ||
((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1))
{
return false;
}
Expand All @@ -3548,33 +3549,33 @@ function OUTER(gscope)
lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] == 0) ? 1 : 0));

var mods = [];
var foundLists = false;
for (var n = firstLine; n <= lastLine; n++)
{
var listType = getLineListType(n);
var t = 'indent';
var level = 0;
if (listType)
{
listType = /([a-z]+)([12345678])/.exec(listType);
if (listType)
{
foundLists = true;
var t = listType[1];
var level = Number(listType[2]);
var newLevel = Math.max(1, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1)));
if (level != newLevel)
{
mods.push([n, t + newLevel]);
}
t = listType[1];
level = Number(listType[2]);
}
}
var newLevel = Math.max(0, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1)));
if (level != newLevel)
{
mods.push([n, (newLevel > 0) ? t + newLevel : '']);
}
}

if (mods.length > 0)
{
setLineListTypes(mods);
}

return foundLists;
return true;
}
editorInfo.ace_doIndentOutdent = doIndentOutdent;

Expand Down Expand Up @@ -5235,7 +5236,8 @@ function OUTER(gscope)
var allLinesAreList = true;
for (var n = firstLine; n <= lastLine; n++)
{
if (!getLineListType(n))
var listType = getLineListType(n);
if (!listType || listType.slice(0, 'bullet'.length) != 'bullet')
{
allLinesAreList = false;
break;
Expand All @@ -5245,8 +5247,16 @@ function OUTER(gscope)
var mods = [];
for (var n = firstLine; n <= lastLine; n++)
{
var t = '';
var level = 0;
var listType = /([a-z]+)([12345678])/.exec(getLineListType(n));
if (listType)
{
t = listType[1];
level = Number(listType[2]);
}
var t = getLineListType(n);
mods.push([n, allLinesAreList ? '' : (t ? t : 'bullet1')]);
mods.push([n, allLinesAreList ? 'indent' + level : (t ? 'bullet' + level : 'bullet1')]);
}
setLineListTypes(mods);
}
Expand Down
2 changes: 1 addition & 1 deletion static/js/contentcollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
if (tname == "ul")
{
var type;
var rr = cls && /(?:^| )list-(bullet[12345678])\b/.exec(cls);
var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls);
type = rr && rr[1] || "bullet" + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1));
oldListTypeOrNull = (_enterList(state, type) || 'none');
}
Expand Down
4 changes: 2 additions & 2 deletions static/pad.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('indent');return false;" >
<a title="Indent List">
<a title="Indent">
<div class="buttonicon" style="background-position:0px -52px"></div>
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('outdent');return false;" >
<a title="Unindent List">
<a title="Unindent">
<div class="buttonicon" style="background-position:0px -134px"></div>
</a>
</li>
Expand Down