Merge pull request #2398 from ether/indentLevels

Indent levels
This commit is contained in:
John McLear 2014-12-27 23:27:11 +01:00
commit dd09f6144b
3 changed files with 120 additions and 16 deletions

View File

@ -456,7 +456,15 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback)
'ol ol ol ol ol { list-style-type: lower-latin; }' +
'ol ol ol ol ol ol{ list-style-type: lower-roman; }' +
'ol ol ol ol ol ol ol { list-style-type: decimal; }' +
'ol ol ol ol ol ol ol ol{ list-style-type: lower-latin; }' +
'ol ol ol ol ol ol ol ol{ list-style-type: lower-latin; }' +
'ol ol ol ol ol ol ol ol ol { list-style-type: decimal; }' +
'ol ol ol ol ol ol ol ol ol ol { list-style-type: lower-latin; }' +
'ol ol ol ol ol ol ol ol ol ol ol { list-style-type: lower-roman; }' +
'ol ol ol ol ol ol ol ol ol ol ol ol { list-style-type: decimal; }' +
'ol ol ol ol ol ol ol ol ol ol ol ol ol { list-style-type: lower-latin; }' +
'ol ol ol ol ol ol ol ol ol ol ol ol ol ol{ list-style-type: lower-roman; }' +
'ol ol ol ol ol ol ol ol ol ol ol ol ol ol ol { list-style-type: decimal; }' +
'ol ol ol ol ol ol ol ol ol ol ol ol ol ol ol ol{ list-style-type: lower-latin; }' +
stylesForExportCSS +
'</style>\n' + '</head>\n') +
'<body>';

View File

@ -28,6 +28,14 @@ ul.list-bullet5 { margin-left: 7.5em; }
ul.list-bullet6 { margin-left: 9em; }
ul.list-bullet7 { margin-left: 10.5em; }
ul.list-bullet8 { margin-left: 12em; }
ul.list-bullet9 { margin-left: 13.5em; }
ul.list-bullet10 { margin-left: 15em; }
ul.list-bullet11 { margin-left: 16.5em; }
ul.list-bullet12 { margin-left: 18em; }
ul.list-bullet13 { margin-left: 19.5em; }
ul.list-bullet14 { margin-left: 21em; }
ul.list-bullet15 { margin-left: 22.5em; }
ul.list-bullet16 { margin-left: 24em; }
ul { list-style-type: disc; }
ul.list-bullet1 { list-style-type: disc; }
@ -38,6 +46,14 @@ ul.list-bullet5 { list-style-type: circle; }
ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; }
ul.list-bullet8 { list-style-type: circle; }
ul.list-bullet9 { list-style-type: disc; }
ul.list-bullet10 { list-style-type: circle; }
ul.list-bullet11 { list-style-type: square; }
ul.list-bullet12 { list-style-type: disc; }
ul.list-bullet13 { list-style-type: circle; }
ul.list-bullet14 { list-style-type: square; }
ul.list-bullet15 { list-style-type: disc; }
ul.list-bullet16 { list-style-type: circle; }
ul.list-indent1 { margin-left: 1.5em; }
ul.list-indent2 { margin-left: 3em; }
@ -47,15 +63,19 @@ 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-indent9 { margin-left: 13.5em; }
ul.list-indent10 { margin-left: 15em; }
ul.list-indent11 { margin-left: 16.5em; }
ul.list-indent12 { margin-left: 18em; }
ul.list-indent13 { margin-left: 19.5em; }
ul.list-indent14 { margin-left: 21em; }
ul.list-indent15 { margin-left: 22.5em; }
ul.list-indent16 { margin-left: 24em; }
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; }
ul.list-indent1, ul.list-indent2, ul.list-indent3, ul.list-indent4, ul.list-indent5,
ul.list-indent6, ul.list-indent7, ul.list-indent8, ul.list-indent9, ul.list-indent10,
ul.list-indent11, ul.list-indent12, ul.list-indent13,
ul.list-indent14, ul.list-indent15, ul.list-indent16 { list-style-type: none; }
body {
margin: 0;
@ -184,6 +204,14 @@ ol.list-number5{ text-indent: 40px; }
ol.list-number6{ text-indent: 50px; }
ol.list-number7{ text-indent: 60px; }
ol.list-number8{ text-indent: 70px; }
ol.list-number9{ text-indent: 80px; }
ol.list-number10{ text-indent: 90px; }
ol.list-number11{ text-indent: 100px; }
ol.list-number12{ text-indent: 110px; }
ol.list-number13{ text-indent: 120px; }
ol.list-number14{ text-indent: 130px; }
ol.list-number15{ text-indent: 140px; }
ol.list-number16{ text-indent: 150px; }
/* Add styling to the first item in a list */
@ -195,6 +223,14 @@ ol.list-number8{ text-indent: 70px; }
.list-start-number6 { counter-reset: sixth; }
.list-start-number7 { counter-reset: seventh; }
.list-start-number8 { counter-reset: eighth; }
.list-start-number9 { counter-reset: ninth; }
.list-start-number10 { counter-reset: tenth; }
.list-start-number11 { counter-reset: eleventh; }
.list-start-number12 { counter-reset: twelth; }
.list-start-number13 { counter-reset: thirteenth; }
.list-start-number14 { counter-reset: fourteenth; }
.list-start-number15 { counter-reset: fifteenth; }
.list-start-number16 { counter-reset: sixteenth; }
/* The behavior for incrementing and the prefix */
.list-number1 li:before {
@ -236,3 +272,44 @@ ol.list-number8{ text-indent: 70px; }
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) ". " ;
counter-increment: eighth 1;
}
.list-number9 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) ". ";
counter-increment: ninth 1;
}
.list-number10 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) ". ";
counter-increment: tenth 1;
}
.list-number11 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) ". ";
counter-increment: eleventh 1;
}
.list-number12 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) ". ";
counter-increment: twelth 1;
}
.list-number13 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) ". ";
counter-increment: thirteenth 1;
}
.list-number14 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) ". ";
counter-increment: fourteenth 1;
}
.list-number15 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) "." counter(fifteenth) ". ";
counter-increment: fifteenth 1;
}
.list-number16 li:before {
content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) "." counter(fifteenth) "." counter(sixteenth) ". ";
counter-increment: fixteenth 1;
}

View File

@ -57,7 +57,7 @@ function Ace2Inner(){
var isSetUp = false;
var THE_TAB = ' '; //4
var MAX_LIST_LEVEL = 8;
var MAX_LIST_LEVEL = 16;
var LINE_NUMBER_PADDING_RIGHT = 4;
var LINE_NUMBER_PADDING_LEFT = 4;
@ -2313,6 +2313,25 @@ function Ace2Inner(){
function getAttributeOnSelection(attributeName){
if (!(rep.selStart && rep.selEnd)) return;
// get the previous/next characters formatting when we have nothing selected
// To fix this we just change the focus area, we don't actually check anything yet.
if(rep.selStart[1] == rep.selEnd[1]){
// if we're at the beginning of a line bump end forward so we get the right attribute
if(rep.selStart[1] == 0 && rep.selEnd[1] == 0){
rep.selEnd[1] = 1;
}
if(rep.selStart[1] < 0){
rep.selStart[1] = 0;
}
var line = rep.lines.atIndex(rep.selStart[0]);
// if we're at the end of the line bmp the start back 1 so we get hte attribute
if(rep.selEnd[1] == line.text.length){
rep.selStart[1] = rep.selStart[1] -1;
}
}
// Do the detection
var selectionAllHasIt = true;
var withIt = Changeset.makeAttribsString('+', [
[attributeName, 'true']
@ -3338,7 +3357,7 @@ function Ace2Inner(){
if (listType)
{
var text = rep.lines.atIndex(lineNum).text;
listType = /([a-z]+)([12345678])/.exec(listType);
listType = /([a-z]+)([0-9]+)/.exec(listType);
var type = listType[1];
var level = Number(listType[2]);
@ -3390,7 +3409,7 @@ function Ace2Inner(){
var level = 0;
if (listType)
{
listType = /([a-z]+)([12345678])/.exec(listType);
listType = /([a-z]+)([0-9]+)/.exec(listType);
if (listType)
{
t = listType[1];
@ -5075,7 +5094,7 @@ function Ace2Inner(){
{
return null;
}
type = /([a-z]+)[12345678]/.exec(type);
type = /([a-z]+)[0-9+]/.exec(type);
if(type[1] == "indent")
{
return null;
@ -5084,7 +5103,7 @@ function Ace2Inner(){
//2-find the first line of the list
while(lineNum-1 >= 0 && (type=getLineListType(lineNum-1)))
{
type = /([a-z]+)[12345678]/.exec(type);
type = /([a-z]+)[0-9+]/.exec(type);
if(type[1] == "indent")
break;
lineNum--;
@ -5104,7 +5123,7 @@ function Ace2Inner(){
while(listType = getLineListType(line))
{
//apply new num
listType = /([a-z]+)([12345678])/.exec(listType);
listType = /([a-z]+)([0-9+])/.exec(listType);
curLevel = Number(listType[2]);
if(isNaN(curLevel) || listType[0] == "indent")
{
@ -5172,7 +5191,7 @@ function Ace2Inner(){
{
var t = '';
var level = 0;
var listType = /([a-z]+)([12345678])/.exec(getLineListType(n));
var listType = /([a-z]+)([0-9]+)/.exec(getLineListType(n));
if (listType)
{
t = listType[1];