From 10d92b6bf16fc05e052a5653bb11a0e98dd7be33 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 26 Dec 2014 23:42:00 +0000 Subject: [PATCH 1/3] slightly better attribute selection logic but still pretty b0rked --- src/static/js/ace2_inner.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 5d337735..4fd15b5c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -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'] From 9d66a446dc8c643213ee0bfcbd427425e01a18dc Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 27 Dec 2014 13:18:58 +0100 Subject: [PATCH 2/3] support indentation up to 16 levels and dont go back afterwards --- src/static/css/iframe_editor.css | 93 +++++++++++++++++++++++++++++--- src/static/js/ace2_inner.js | 14 ++--- 2 files changed, 92 insertions(+), 15 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index b88db7a1..575ee1a6 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -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; +} + diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 4fd15b5c..f1fc1160 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -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; @@ -3357,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]); @@ -3409,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]; @@ -5094,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; @@ -5103,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--; @@ -5123,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") { @@ -5191,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]; From 6ac99ab03fc78ff418fd631fa9a630dae2f6135a Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 27 Dec 2014 13:27:07 +0100 Subject: [PATCH 3/3] support for export --- src/node/utils/ExportHtml.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 693cf9cf..85d5e7a2 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -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 + '\n' + '\n') + '';