From 239742e80cbc5d11218a82416500b5992ab42f49 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 1 Dec 2011 11:50:17 +0100 Subject: [PATCH 01/17] added internal ordered list support. Numbering increment is not yet handled. small code factorisation. Added related CSS --- static/css/iframe_editor.css | 19 +++++++++++++++++++ static/js/ace2_inner.js | 14 +++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 86ca99117..4385fff0c 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -32,6 +32,25 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } +ul.list-number1 { margin-left: 1.5em; } +ul.list-number2 { margin-left: 3em; } +ul.list-number3 { margin-left: 4.5em; } +ul.list-number4 { margin-left: 6em; } +ul.list-number5 { margin-left: 7.5em; } +ul.list-number6 { margin-left: 9em; } +ul.list-number7 { margin-left: 10.5em; } +ul.list-number8 { margin-left: 12em; } + +ul { list-style-type: disc; } +ul.list-number1 { list-style-type: decimal; } +ul.list-number2 { list-style-type: lower-latin; } +ul.list-number3 { list-style-type: lower-roman; } +ul.list-number4 { list-style-type: decimal; } +ul.list-number5 { list-style-type: lower-latin; } +ul.list-number6 { list-style-type: lower-roman; } +ul.list-number7 { list-style-type: decimal; } +ul.list-number8 { list-style-type: lower-latin; } + ul.list-indent1 { margin-left: 1.5em; } ul.list-indent2 { margin-left: 3em; } ul.list-indent3 { margin-left: 4.5em; } diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 6c8ec60e0..34b43a3cb 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5218,7 +5218,7 @@ function OUTER(gscope) } } - function doInsertUnorderedList() + function doInsertUnorderedList(type) { if (!(rep.selStart && rep.selEnd)) { @@ -5233,7 +5233,7 @@ function OUTER(gscope) for (var n = firstLine; n <= lastLine; n++) { var listType = getLineListType(n); - if (!listType || listType.slice(0, 'bullet'.length) != 'bullet') + if (!listType || listType.slice(0, type.length) != type) { allLinesAreList = false; break; @@ -5252,11 +5252,19 @@ function OUTER(gscope) level = Number(listType[2]); } var t = getLineListType(n); - mods.push([n, allLinesAreList ? 'indent' + level : (t ? 'bullet' + level : 'bullet1')]); + mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]); } setLineListTypes(mods); } + + function doInsertUnorderedList(){ + doInsertList('bullet'); + } + function doInsertOrderedList(){ + doInsertList('number'); + } editorInfo.ace_doInsertUnorderedList = doInsertUnorderedList; + editorInfo.ace_doInsertOrderedList = doInsertOrderedList; var mozillaFakeArrows = (browser.mozilla && (function() { From 5027ad4c9218485d3abbd7625a077094d9ce13ff Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 1 Dec 2011 11:59:12 +0100 Subject: [PATCH 02/17] fixed typo, added initial interface with still bullet button --- static/js/ace2_inner.js | 2 +- static/js/pad_editbar.js | 1 + static/pad.html | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 34b43a3cb..1e2701f21 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5218,7 +5218,7 @@ function OUTER(gscope) } } - function doInsertUnorderedList(type) + function doInsertList(type) { if (!(rep.selStart && rep.selEnd)) { diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 97bd7f85b..3818db871 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -120,6 +120,7 @@ var padeditbar = (function() if (cmd == 'bold' || cmd == 'italic' || cmd == 'underline' || cmd == 'strikethrough') ace.ace_toggleAttributeOnSelection(cmd); else if (cmd == 'undo' || cmd == 'redo') ace.ace_doUndoRedo(cmd); else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList(); + else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList(); else if (cmd == 'indent') { if (!ace.ace_doIndentOutdent(false)) diff --git a/static/pad.html b/static/pad.html index e56e4f169..74ed1dad4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -44,6 +44,11 @@
  • +
  • + +
    +
    +
  • From b8e9131158441aced71f19f1a1c6a86ea6685697 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 1 Dec 2011 15:09:50 +0100 Subject: [PATCH 03/17] added an icon for ordered list --- static/img/etherpad_lite_icons.png | Bin 2307 -> 2322 bytes static/pad.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/static/img/etherpad_lite_icons.png b/static/img/etherpad_lite_icons.png index 606612313dd64b158a7ad0007a56271346aa53ac..d3fb106698bd4eea630821d92196da7df6ae1be5 100644 GIT binary patch delta 1907 zcmZn`nj|zqT=578GXnzy``4&@3=E950X`wFzkmN;eSG2W-Mb@lPfeXVb)!cfBa4fU zo#NzOjF$C0jC@>rPmi&rGcd68dAc};L>zt^!5w_tLO|@;M&3FRo|)VHY_2?DDqN=a z^x^{x&AFVM{g)Q&>Mou8?bnVk>xzrdKYO6}_+q_%{9_EMZ{e`mE{Dd{Zrnt-&cu|In7xb>d%Z*iKx(TwkU7cyhDAv;(4|r+w}n z-f3LC^rpx2Y7Rjg1=9~}vZ~Iy%kSd0sAb;!HLI8D(rxJ*WzOuTce&#GKg!JZ_;80E3#{-e`D zo4m!}U)i*_ySz$~DN?dNZE}QL@2|Z__9Z=56ib-VpQ9fy`0}Reb@nH}8e;wkolaP= z-}6{z&h*m~O~&ODr3D^{vwtm3%8>G&@3e1S=GPf~XW7>uymRZ8Oogt{waNo)?;Uz{ zYliU_^K6&>{}0p%Z#r7I=KS4R8xQZ2J^bnJ-0BydVs(*8UpD&9WD1d=d`hGKcaNRe zvi)|Y$*+DM;nfLNERVL{SeJZUX~}=%!0Gd|OH!zfu=%RZjd?X0xu%hl9P z3(F4uTI0N8X+xgWg()^Z+X_2>7(^V{G=aaBF-gj^A?VWjDeVDVe=}YlIA?oE+iB;@ z^_$y%tiJriY$LYxY4UDQuf-E9JObCXXR0X1gl8TzLP&!-mNZR|}Ot zG){4z(RGa5{nf^DHXY91aL$0UdT9k*3^E*Zb6A&L`DR$(a{Nrh=PAElH2ho=^ zVkB-X){wOH=w{zn8dEpS=GvDKYqPZE_1Cz z#{^ZUdk>@+`YsoCaj3uWQlUO+0t4eNzCu~C7X=5VY6NiFtB7X^CbaCk7_xP>gn-D> zh6!2HBCC#Mujkp}ux8OtaSnkmfBH1qx+~+d1deb^3CZ=Vni|NPNeRu})}&yTvs;m? zHO1}rtZRBPFM8T$*G;rrth(Iwd`7tcymS_o88+v6L<|&Fo||quHbc2SM*RKnm(nvz zx9R>Aij*_9N%}QIcHw)cGhh5v`J9zbPn~4Q^g{Jk*&_#5uVXihdzDjy!_M*rd%iYW z!?UnPaQ@rVWq&5KyU(1rQ>Hj*>T|u)_$PDaM0YW(zj-6L#Qkby0LMgEC2ei(%}3HE z*4bY)>HMiwvBhHV&x~C+S)S!EGS_!^&ktKBZ|Z({ZEwVy95eITmltno7u|3($IN}U zy~+Wv&zI9aUv^5sx-hzwxMEc`#5_vTptJ58*FZs^9Hl`0%&G zYF*zR78Csk4zU&$zuru(a`?Py>A$^Ozn4^2I@WrAGAb(0fB*8`!^h`eah&Yl^`SDq zy8ipGudmHRFQwEx{P^zIyT^w=wiYt2;6A_Y`t|zCdh<;Zf$_5I*6-iHy0715@12@$ zduvy$dL`ET$su(4vbf&W?1eW}F0IX1(dTr?RXXq{dbx`J%GPYYxRcC`exH^u>Xfr% ztl1Y}Qn9Z?PU69vX%U|*Zm;fSV^i74niX?8Agh6)zN=YhLjpIui0!@5isR2jr>h?> zFFjvabF|Rruh&ymA-mb)T^0w{cB<&J6rPzpS$O7?qlJbA&)2Jq9C$l-{=L22jB~_! zB=U9cFRMJrFze-`&KV`0^*2lN#FZV6O+IqhOld)F)A!yRkM6Y#f4O_+)3^6Ke} zs9kYk^)^wyQ;%Sm|2P8RL1zbls)s3W#E zVBME}`CFpbPCGN_`I=qNE8kS!;Huv)GQ&B|Qk))-lHa(uh(7Xnz7hC{Zs0~ zGYUo9EusUW8gn)sJfk&rfzfHDwCSe{Up$DPBz)v-aoWVcxyM4^DaTx$}4h56eA z?avt^XHMQMx~LFwfT3%dp`OF)ch@i4+E>TVbuU_WJM`X5XEuhH)n)%q`)!VEtqEJd oWbQX}%l(%HJgm>omwUB8FQVZ!o4^?<1_lNOPgg&ebxsLQ00?@RssI20 delta 1892 zcmbOv)GRbX+;9sAGXnzy&-HM51_lPk;vjb?hIQv;UNSH+HU#*DxPJTgZT0bmyLa!7 z$UQZ6>eS!Ae{ZzNV`Nb*d=Wf(6{BT62fsL@dZn8V3j+h&drud~kch)iBYORBTZot| zW(l1*t`LyxEw#~s&E%@n@#9{z%6znR<&%$_nH^j9_FLiIyCu8Me|@m7>(BQ2$=02d zFZI54c(jGx>rMQ;`Sbt&soTbVV5aLN6=i0QfEni*q|TTN7Bh%!`YLp0mW;_ojb{x> z%JtFfpXC$@95ULmBq=)6a+dY#fO);IYvdK1_?M{73-w*k{$go$!)5b;mGSwrR@}RJ zV3)Mjiq~Z!Hphx{c9sTweErB~!>biLudaA4)g&6bok?8u2=BZvN#A^IXBD6GliAqB zEmwL{GnJ9uDnoaP(Tb0in$}N0n`c>n`zdWJ-nfRR{<5d(W4Gooq3F&}0=x!i-1bdh z|KZD=9GtmZW6q-o>Fi%ilQN{d=R0j&nAzLHx3*gU z;GJ8yWGXa;uI)U&_TGU$2vci@tiK-{%(PK)DO|l zmHnmKA`8A6u57AbbpFcmMIX$Ut@E{=yQ3{t>rq~{`pWp*8#!P8_gQt?-_&Z;+?A;z zb8i`5I;$oX6DVQ#$N0m9L*`O8;_3yzBaUxc=sm-$iFYr9^A~pRU3$u^t{yfx!cZmd z#9dO#arlXUc!T`1s|Hsp4;V`sT$-@bGfOP6xItiz+|^VcE7v8>w)HCmy^1F=`|gv@ zUoRT|efKeOJ-*HkqY2Yrw%zLew3%_?G{&k(hu|)QyT??M4ks|)b~6)U^T<$PJ(amX zNYF`h)8bUw-;V_2gif8UIj8-|fBvJ}Aso3dpGdkL*=Y|NG z`u5!Gu>T;vUN&mc+QR|@-Z~8Rh6Wc{Od=Qi*0gx;Hg!BE{JtriC4BW&CALL6A*Bm7 zIt8j2XO>8IJ+<&OcwpsXxS+w&f0>hv`oXhb111+WOzKY;J!N^M@RPgpi;zXU4nCi@ zy*c#wmSKrynof=HqjR-wG91SDeq8jZ{dTTFb?HYb#;l)5dF&V&#GTCNGtSI#B?1 zpBluN-BP4|LzlNPItKc*T(LT^MsW3Ct_MyV+n&WKINadhwMatuS>;Mk0s9=U3Y%?L zj?~=9@hZ9HGGrWJ*$_WH)ay@nV-()%Grm+Hs!#8Fq>85)}f*d!v2tOgK@rG^K~3syO{J1y?E(8b&VLhC|9P@`vCsLKKFgKIip6*7f6ANBb+<9N>>KB$ zoH})C7J9U(49CRj_yJ z*=uRpRa3rgU^0tddoAO2yGTT4?Twt;86J(-)PiPtFoYbLWFqOSQn>qk-Hx!p9C}daV?qDD#yskbWcapCfF+bNHzqcmCaZby5De`$Sb99bMbq_M3N= zY$=(~Q2zaS$1j;Yqs?EQN2xvkcXR)5-?#e9Kh8K-?L0 zEO<`b;su6lw>VsJ{x(7TbB4&7lQ+LzP>49d(6!7^&0)8o$ptz4>iD_tMisk%i677} W*JaC&NM&GPVDNPHb6Mw<&;$T)YLU4B diff --git a/static/pad.html b/static/pad.html index 74ed1dad4..7565993a4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -46,7 +46,7 @@
  • -
    +
  • From 68a01cc603473036619305964680117a7bbd3232 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 1 Dec 2011 18:35:26 +0100 Subject: [PATCH 04/17] added numbrering logic + trigger on style update + visual render --- static/js/ace2_inner.js | 71 +++++++++++++++++++++++++++++++++++- static/js/domline.js | 4 +- static/js/linestylefilter.js | 4 ++ 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 1e2701f21..282c42fdc 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5169,7 +5169,74 @@ function OUTER(gscope) [lineNum, listType] ]); } - + + function renumberList(lineNum){ + //1-check we are in a list + if(!getLineListType(lineNum)) + { + return null; + } + + //2-find the first line of the list + while(lineNum-1 >= 0 && getLineListType(lineNum-1)) + { + lineNum--; + } + + //3-renumber every list item of the same level from the beginning, level 1 + //IMPORTANT: never skip a level because there imbrication may be arbitrary + var builder = Changeset.builder(rep.lines.totalWidth()); + loc = [0,0]; + function applyNumberList(line, level) + { + //init + var position = 1; + var curLevel = level; + var listType; + //loop over the lines + while(listType = getLineListType(line)) + { + //apply new num + curLevel = /[a-z]+([12345678])/.exec(listType); + curLevel = Number(curLevel[1]); + if(isNaN(curLevel)) + { + return line; + } + else if(curLevel == level) + { + buildKeepRange(builder, loc, (loc = [line, 0])); + buildKeepRange(builder, loc, (loc = [line, 1]), [ + ['start', position] + ], rep.apool); + + position++; + line++; + } + else if(curLevel < level) + { + return line;//back to parent + } + else + { + line = applyNumberList(line, level+1);//recursive call + } + } + return line; + } + + applyNumberList(lineNum, 1); + var cs = builder.toString(); + if (!Changeset.isIdentity(cs)) + { + performDocumentApplyChangeset(cs); + } + + //4-apply the modifications + + + } + function setLineListTypes(lineNumTypePairsInOrder) { var loc = [0, 0]; @@ -5216,6 +5283,8 @@ function OUTER(gscope) { performDocumentApplyChangeset(cs); } + + renumberList(lineNum); } function doInsertList(type) diff --git a/static/js/domline.js b/static/js/domline.js index 7732805fd..dce45f48a 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -89,12 +89,14 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (cls.indexOf('list') >= 0) { var listType = /(?:^| )list:(\S+)/.exec(cls); + var start = /(?:^| )start:(\S+)/.exec(cls); if (listType) { listType = listType[1]; + start = start?'start="'+start[1]+'"':''; if (listType) { - preHtml = '
    • '; + preHtml = '
      • '; postHtml = '
      '; } result.lineMarker += txt.length; diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index f6cf9f357..ace55f38d 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -84,6 +84,10 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun { classes += ' list:' + value; } + else if (key == 'start') + { + classes += ' start:' + value; + } else if (linestylefilter.ATTRIB_CLASSES[key]) { classes += ' ' + linestylefilter.ATTRIB_CLASSES[key]; From cd15ad24abbb50f8db2a6de42ff537776c8c3a18 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 2 Dec 2011 09:34:17 +0100 Subject: [PATCH 05/17] trivial, quick and dirty chrome fix --- README.md | 1 - static/css/iframe_editor.css | 34 +++++++++++++++++----------------- static/js/domline.js | 12 ++++++++++-- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 6b4e1e956..b21cd8e82 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
    • Move into the node folder cd node-v0.6* and build node with ./configure && make && make install
    • -
    • Install npm curl http://npmjs.org/install.sh | sh
    • **As any user (we recommend creating a separate user called etherpad-lite):** diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 4385fff0c..f6366f3b9 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -32,24 +32,24 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } -ul.list-number1 { margin-left: 1.5em; } -ul.list-number2 { margin-left: 3em; } -ul.list-number3 { margin-left: 4.5em; } -ul.list-number4 { margin-left: 6em; } -ul.list-number5 { margin-left: 7.5em; } -ul.list-number6 { margin-left: 9em; } -ul.list-number7 { margin-left: 10.5em; } -ul.list-number8 { margin-left: 12em; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } -ul { list-style-type: disc; } -ul.list-number1 { list-style-type: decimal; } -ul.list-number2 { list-style-type: lower-latin; } -ul.list-number3 { list-style-type: lower-roman; } -ul.list-number4 { list-style-type: decimal; } -ul.list-number5 { list-style-type: lower-latin; } -ul.list-number6 { list-style-type: lower-roman; } -ul.list-number7 { list-style-type: decimal; } -ul.list-number8 { list-style-type: lower-latin; } +ol { list-style-type: disc; } +ol.list-number1 { list-style-type: decimal; } +ol.list-number2 { list-style-type: lower-latin; } +ol.list-number3 { list-style-type: lower-roman; } +ol.list-number4 { list-style-type: decimal; } +ol.list-number5 { list-style-type: lower-latin; } +ol.list-number6 { list-style-type: lower-roman; } +ol.list-number7 { list-style-type: decimal; } +ol.list-number8 { list-style-type: lower-latin; } ul.list-indent1 { margin-left: 1.5em; } ul.list-indent2 { margin-left: 3em; } diff --git a/static/js/domline.js b/static/js/domline.js index dce45f48a..f081f7df3 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -96,8 +96,16 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) start = start?'start="'+start[1]+'"':''; if (listType) { - preHtml = '
      • '; - postHtml = '
      '; + if(listType.indexOf("number") < 0) + { + preHtml = '
      • '; + postHtml = '
      '; + } + else + { + preHtml = '
      1. '; + postHtml = '
      '; + } } result.lineMarker += txt.length; return; // don't append any text From 308a20bf11e9768f096d2d842a07988642f81c22 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 16:21:38 +0100 Subject: [PATCH 06/17] bring indentation and ordered list support to timeslider. Still miss numbering :/ --- static/css/timeslider.css | 39 +++++++++++++++++++++++++++++++++++++ static/js/domline_client.js | 21 ++++++++++++++++---- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/static/css/timeslider.css b/static/css/timeslider.css index f03f70c92..e84e5bac3 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -195,6 +195,8 @@ float:right; color: #222; } +ul { margin-left: 1.5em; } +ul ul { margin-left: 0 !important; } ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 1.5em; } @@ -216,3 +218,40 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } + +ol { list-style-type: disc; } +ol.list-number1 { list-style-type: decimal; } +ol.list-number2 { list-style-type: lower-latin; } +ol.list-number3 { list-style-type: lower-roman; } +ol.list-number4 { list-style-type: decimal; } +ol.list-number5 { list-style-type: lower-latin; } +ol.list-number6 { list-style-type: lower-roman; } +ol.list-number7 { list-style-type: decimal; } +ol.list-number8 { list-style-type: lower-latin; } + +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; } + diff --git a/static/js/domline_client.js b/static/js/domline_client.js index d4dd4606d..b37996d92 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -88,13 +88,23 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (cls.indexOf('list') >= 0) { var listType = /(?:^| )list:(\S+)/.exec(cls); + var start = /(?:^| )start:(\S+)/.exec(cls); if (listType) { listType = listType[1]; + start = start?'start="'+start[1]+'"':''; if (listType) { - preHtml = '
      • '; - postHtml = '
      '; + if(listType.indexOf("number") < 0) + { + preHtml = '
      • '; + postHtml = '
      '; + } + else + { + preHtml = '
      1. '; + postHtml = '
      '; + } } result.lineMarker += txt.length; return; // don't append any text @@ -135,8 +145,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) plugins_.callHook("aceCreateDomLine", { domline: domline, - cls: cls, - document: document + cls: cls }).map(function(modifier) { cls = modifier.cls; @@ -152,6 +161,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if (href) { + if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it. + { + href = "http://"+href; + } extraOpenTags = extraOpenTags + ''; extraCloseTags = '' + extraCloseTags; } From 0888bc94e101fd05c1e6eb210d1556cbe403feaa Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 16:28:47 +0100 Subject: [PATCH 07/17] fixed duplicated css rule --- static/css/timeslider.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/css/timeslider.css b/static/css/timeslider.css index e84e5bac3..7494c3220 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -195,8 +195,6 @@ float:right; color: #222; } -ul { margin-left: 1.5em; } -ul ul { margin-left: 0 !important; } ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 1.5em; } From 226898eff0f444f9e51a5ec9ad7f5b2ffb2836d8 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 16:31:02 +0100 Subject: [PATCH 08/17] bring back numbering increment --- static/js/linestylefilter_client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index b1bdae6ef..9c3ae01c9 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -82,6 +82,10 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun { classes += ' list:' + value; } + else if (key == 'start') + { + classes += ' start:' + value; + } else if (linestylefilter.ATTRIB_CLASSES[key]) { classes += ' ' + linestylefilter.ATTRIB_CLASSES[key]; @@ -235,7 +239,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag) linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/; linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')'); -linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); +linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); linestylefilter.getURLFilter = linestylefilter.getRegexpFilter( linestylefilter.REGEX_URL, 'url'); From 9fd50b3e9faf2c43952f49a31e2329019fdf1fd5 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 16:56:23 +0100 Subject: [PATCH 09/17] fix suggestion for the list theming --- static/css/iframe_editor.css | 48 ++++++++++++++++++------------------ static/css/timeslider.css | 48 ++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index f6366f3b9..0e986332e 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -13,14 +13,14 @@ ul, ol, li { } ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } -ul.list-bullet1 { margin-left: 1.5em; } -ul.list-bullet2 { margin-left: 3em; } -ul.list-bullet3 { margin-left: 4.5em; } -ul.list-bullet4 { margin-left: 6em; } -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-bullet1 { margin-left: 3em; } +ul.list-bullet2 { margin-left: 4.5em; } +ul.list-bullet3 { margin-left: 6em; } +ul.list-bullet3 { margin-left: 7.5em; } +ul.list-bullet5 { margin-left: 9em; } +ul.list-bullet6 { margin-left: 10.5em; } +ul.list-bullet7 { margin-left: 12em; } +ul.list-bullet8 { margin-left: 13.5em; } ul { list-style-type: disc; } ul.list-bullet1 { list-style-type: disc; } @@ -32,14 +32,14 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } -ol.list-number1 { margin-left: 1.5em; } -ol.list-number2 { margin-left: 3em; } -ol.list-number3 { margin-left: 4.5em; } -ol.list-number4 { margin-left: 6em; } -ol.list-number5 { margin-left: 7.5em; } -ol.list-number6 { margin-left: 9em; } -ol.list-number7 { margin-left: 10.5em; } -ol.list-number8 { margin-left: 12em; } +ol.list-number1 { margin-left: 3em; } +ol.list-number2 { margin-left: 4.5em; } +ol.list-number3 { margin-left: 6em; } +ol.list-number3 { margin-left: 7.5em; } +ol.list-number5 { margin-left: 9em; } +ol.list-number6 { margin-left: 10.5em; } +ol.list-number7 { margin-left: 12em; } +ol.list-number8 { margin-left: 13.5em; } ol { list-style-type: disc; } ol.list-number1 { list-style-type: decimal; } @@ -51,14 +51,14 @@ ol.list-number6 { list-style-type: lower-roman; } ol.list-number7 { list-style-type: decimal; } ol.list-number8 { list-style-type: lower-latin; } -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-number1 { margin-left: 3em; } +ul.list-number2 { margin-left: 4.5em; } +ul.list-number3 { margin-left: 6em; } +ul.list-number3 { margin-left: 7.5em; } +ul.list-number5 { margin-left: 9em; } +ul.list-number6 { margin-left: 10.5em; } +ul.list-number7 { margin-left: 12em; } +ul.list-number8 { margin-left: 13.5em; } ul.list-indent1 { list-style-type: none; } ul.list-indent2 { list-style-type: none; } diff --git a/static/css/timeslider.css b/static/css/timeslider.css index 7494c3220..e18169eec 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -197,14 +197,14 @@ float:right; ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } -ul.list-bullet1 { margin-left: 1.5em; } -ul.list-bullet2 { margin-left: 3em; } -ul.list-bullet3 { margin-left: 4.5em; } -ul.list-bullet4 { margin-left: 6em; } -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-bullet1 { margin-left: 3em; } +ul.list-bullet2 { margin-left: 4.5em; } +ul.list-bullet3 { margin-left: 6em; } +ul.list-bullet3 { margin-left: 7.5em; } +ul.list-bullet5 { margin-left: 9em; } +ul.list-bullet6 { margin-left: 10.5em; } +ul.list-bullet7 { margin-left: 12em; } +ul.list-bullet8 { margin-left: 13.5em; } ul { list-style-type: disc; } ul.list-bullet1 { list-style-type: disc; } @@ -216,14 +216,14 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } -ol.list-number1 { margin-left: 1.5em; } -ol.list-number2 { margin-left: 3em; } -ol.list-number3 { margin-left: 4.5em; } -ol.list-number4 { margin-left: 6em; } -ol.list-number5 { margin-left: 7.5em; } -ol.list-number6 { margin-left: 9em; } -ol.list-number7 { margin-left: 10.5em; } -ol.list-number8 { margin-left: 12em; } +ol.list-number1 { margin-left: 3em; } +ol.list-number2 { margin-left: 4.5em; } +ol.list-number3 { margin-left: 6em; } +ol.list-number3 { margin-left: 7.5em; } +ol.list-number5 { margin-left: 9em; } +ol.list-number6 { margin-left: 10.5em; } +ol.list-number7 { margin-left: 12em; } +ol.list-number8 { margin-left: 13.5em; } ol { list-style-type: disc; } ol.list-number1 { list-style-type: decimal; } @@ -235,14 +235,14 @@ ol.list-number6 { list-style-type: lower-roman; } ol.list-number7 { list-style-type: decimal; } ol.list-number8 { list-style-type: lower-latin; } -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-number1 { margin-left: 3em; } +ul.list-number2 { margin-left: 4.5em; } +ul.list-number3 { margin-left: 6em; } +ul.list-number3 { margin-left: 7.5em; } +ul.list-number5 { margin-left: 9em; } +ul.list-number6 { margin-left: 10.5em; } +ul.list-number7 { margin-left: 12em; } +ul.list-number8 { margin-left: 13.5em; } ul.list-indent1 { list-style-type: none; } ul.list-indent2 { list-style-type: none; } From 06d5e345c0a11cc722d737b2fe33d79fbfa90ece Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 17:48:49 +0100 Subject: [PATCH 10/17] fix renumbering when indented text is mixed with regular lists --- static/js/ace2_inner.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 282c42fdc..3fa494f31 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5178,8 +5178,11 @@ function OUTER(gscope) } //2-find the first line of the list - while(lineNum-1 >= 0 && getLineListType(lineNum-1)) + while(lineNum-1 >= 0 && (type=getLineListType(lineNum-1))) { + type = /([a-z]+)[12345678]/.exec(type); + if(type[1] == "indent") + break; lineNum--; } @@ -5197,9 +5200,9 @@ function OUTER(gscope) while(listType = getLineListType(line)) { //apply new num - curLevel = /[a-z]+([12345678])/.exec(listType); - curLevel = Number(curLevel[1]); - if(isNaN(curLevel)) + listType = /([a-z]+)([12345678])/.exec(listType); + curLevel = Number(listType[2]); + if(isNaN(curLevel) || listType[0] == "indent") { return line; } From ff047146149b55004c3380c5ae53446f5ce23527 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 17:50:27 +0100 Subject: [PATCH 11/17] fix typo in both CSS --- static/css/iframe_editor.css | 6 +++--- static/css/timeslider.css | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 0e986332e..676753051 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -16,7 +16,7 @@ ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 3em; } ul.list-bullet2 { margin-left: 4.5em; } ul.list-bullet3 { margin-left: 6em; } -ul.list-bullet3 { margin-left: 7.5em; } +ul.list-bullet4 { margin-left: 7.5em; } ul.list-bullet5 { margin-left: 9em; } ul.list-bullet6 { margin-left: 10.5em; } ul.list-bullet7 { margin-left: 12em; } @@ -35,7 +35,7 @@ ul.list-bullet8 { list-style-type: circle; } ol.list-number1 { margin-left: 3em; } ol.list-number2 { margin-left: 4.5em; } ol.list-number3 { margin-left: 6em; } -ol.list-number3 { margin-left: 7.5em; } +ol.list-number4 { margin-left: 7.5em; } ol.list-number5 { margin-left: 9em; } ol.list-number6 { margin-left: 10.5em; } ol.list-number7 { margin-left: 12em; } @@ -54,7 +54,7 @@ ol.list-number8 { list-style-type: lower-latin; } ul.list-number1 { margin-left: 3em; } ul.list-number2 { margin-left: 4.5em; } ul.list-number3 { margin-left: 6em; } -ul.list-number3 { margin-left: 7.5em; } +ul.list-number4 { margin-left: 7.5em; } ul.list-number5 { margin-left: 9em; } ul.list-number6 { margin-left: 10.5em; } ul.list-number7 { margin-left: 12em; } diff --git a/static/css/timeslider.css b/static/css/timeslider.css index e18169eec..4d71be6e3 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -200,7 +200,7 @@ ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 3em; } ul.list-bullet2 { margin-left: 4.5em; } ul.list-bullet3 { margin-left: 6em; } -ul.list-bullet3 { margin-left: 7.5em; } +ul.list-bullet4 { margin-left: 7.5em; } ul.list-bullet5 { margin-left: 9em; } ul.list-bullet6 { margin-left: 10.5em; } ul.list-bullet7 { margin-left: 12em; } @@ -219,7 +219,7 @@ ul.list-bullet8 { list-style-type: circle; } ol.list-number1 { margin-left: 3em; } ol.list-number2 { margin-left: 4.5em; } ol.list-number3 { margin-left: 6em; } -ol.list-number3 { margin-left: 7.5em; } +ol.list-number4 { margin-left: 7.5em; } ol.list-number5 { margin-left: 9em; } ol.list-number6 { margin-left: 10.5em; } ol.list-number7 { margin-left: 12em; } @@ -238,7 +238,7 @@ ol.list-number8 { list-style-type: lower-latin; } ul.list-number1 { margin-left: 3em; } ul.list-number2 { margin-left: 4.5em; } ul.list-number3 { margin-left: 6em; } -ul.list-number3 { margin-left: 7.5em; } +ul.list-number4 { margin-left: 7.5em; } ul.list-number5 { margin-left: 9em; } ul.list-number6 { margin-left: 10.5em; } ul.list-number7 { margin-left: 12em; } From a5ec736b4c2cd12b90448074ed7bb52a1bea9c4a Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Thu, 8 Dec 2011 19:23:21 +0100 Subject: [PATCH 12/17] improved return key behaviour in lists when on empty item --- static/js/ace2_inner.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 3fa494f31..b7e8055a4 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -3518,16 +3518,36 @@ function OUTER(gscope) var lineNum = rep.selStart[0]; var listType = getLineListType(lineNum); - performDocumentReplaceSelection('\n'); if (listType) { - if (lineNum + 1 < rep.lines.length()) + var text = rep.lines.atIndex(lineNum).text; + 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") { - setLineListType(lineNum + 1, listType); + //if not already on the highest level + if(level > 1) + { + setLineListType(lineNum, type+(level-1));//automatically decrease the level + } + else + { + setLineListType(lineNum, '');//remove the list + renumberList(lineNum + 1);//trigger renumbering of list that may be right after + } + } + else if (lineNum + 1 < rep.lines.length()) + { + performDocumentReplaceSelection('\n'); + setLineListType(lineNum + 1, type+level); } } else { + performDocumentReplaceSelection('\n'); handleReturnIndentation(); } } From 4078ad83da21ae8004a1078eded5f7b2ad2eee5c Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 9 Dec 2011 13:23:05 +0100 Subject: [PATCH 13/17] fixed ordered list disapearing when typing --- node/utils/contentcollector.js | 4 ++-- static/js/contentcollector.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node/utils/contentcollector.js b/node/utils/contentcollector.js index 60bd0a6ef..a7fa940a6 100644 --- a/node/utils/contentcollector.js +++ b/node/utils/contentcollector.js @@ -472,10 +472,10 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { cc.doAttrib(state, "strikethrough"); } - if (tname == "ul") + if (tname == "ul" || tname == "ol") { 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'); } diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index 577b24c6c..ac7e34028 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -470,7 +470,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { cc.doAttrib(state, "strikethrough"); } - if (tname == "ul") + if (tname == "ul" || tname == "ol") { var type; var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls); From 4715900eebf8d54d000079304bb9c2c9e7a29661 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 9 Dec 2011 17:23:32 +0100 Subject: [PATCH 14/17] renumbering should be OK in most situations now :). It is automatically triggered on delete and return key and executed only when necessary --- static/js/ace2_inner.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index b7e8055a4..7b0aa89f9 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -3691,6 +3691,15 @@ function OUTER(gscope) } } } + //if the list has been removed, it is necessary to renumber + //starting from the *next* line because the list may have been + //separated. If it returns null, it means that the list was not cut, try + //from the current one. + var line = caretLine(); + if(line != -1 && renumberList(line+1)==null) + { + renumberList(line); + } } // set of "letter or digit" chars is based on section 20.5.16 of the original Java Language Spec @@ -5192,7 +5201,13 @@ function OUTER(gscope) function renumberList(lineNum){ //1-check we are in a list - if(!getLineListType(lineNum)) + var type = getLineListType(lineNum); + if(!type) + { + return null; + } + type = /([a-z]+)[12345678]/.exec(type); + if(type[1] == "indent") { return null; } @@ -5307,7 +5322,14 @@ function OUTER(gscope) performDocumentApplyChangeset(cs); } - renumberList(lineNum); + //if the list has been removed, it is necessary to renumber + //starting from the *next* line because the list may have been + //separated. If it returns null, it means that the list was not cut, try + //from the current one. + if(renumberList(lineNum+1)==null) + { + renumberList(lineNum); + } } function doInsertList(type) From 7f34334eaf279a244a9ffbc44515af07f15d82ed Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 9 Dec 2011 19:49:46 +0100 Subject: [PATCH 15/17] added ordered list support to HTML exporter. Was not that easy :). Also added a few comments to help the next guy --- node/utils/ExportHtml.js | 71 +++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js index 782bb7016..0d64f6823 100644 --- a/node/utils/ExportHtml.js +++ b/node/utils/ExportHtml.js @@ -306,13 +306,14 @@ function getHTMLFromAtext(pad, atext) // People might use weird indenting, e.g. skip a level, // so we want to do something reasonable there. We also // want to deal gracefully with blank lines. + // => keeps track of the parents level of indentation var lists = []; // e.g. [[1,'bullet'], [3,'bullet'], ...] for (var i = 0; i < textLines.length; i++) { var line = _analyzeLine(textLines[i], attribLines[i], apool); var lineContent = getLineHTML(line.text, line.aline); - - if (line.listLevel || lists.length > 0) + + if (line.listLevel)//If we are inside a list { // do list stuff var whichList = -1; // index into lists or -1 @@ -328,41 +329,89 @@ function getHTMLFromAtext(pad, atext) } } - if (whichList >= lists.length) + if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line { lists.push([line.listLevel, line.listTypeName]); - pieces.push('
      • ', lineContent || '
        '); + if(line.listTypeName == "number") + { + pieces.push('
        1. ', lineContent || '
          '); + } + else + { + pieces.push('
          • ', lineContent || '
            '); + } } - else if (whichList == -1) + //the following code *seems* dead after my patch. + //I keep it just in case I'm wrong... + /*else if (whichList == -1)//means we are not inside a list { if (line.text) { + console.log('trace 1'); // non-blank line, end all lists - pieces.push(new Array(lists.length + 1).join('
          • ')); + if(line.listTypeName == "number") + { + pieces.push(new Array(lists.length + 1).join('
        ')); + } + else + { + pieces.push(new Array(lists.length + 1).join('
      ')); + } lists.length = 0; pieces.push(lineContent, '
      '); } else { + console.log('trace 2'); pieces.push('

      '); } - } - else + }*/ + else//means we are getting closer to the lowest level of indentation { while (whichList < lists.length - 1) { - pieces.push('
    '); + if(lists[lists.length - 1][1] == "number") + { + pieces.push('
  • '); + } + else + { + pieces.push(''); + } lists.length--; } pieces.push('
  • ', lineContent || '
    '); } } - else + else//outside any list { + while (lists.length > 0)//if was in a list: close it before + { + if(lists[lists.length - 1][1] == "number") + { + pieces.push('
  • '); + } + else + { + pieces.push(''); + } + lists.length--; + } pieces.push(lineContent, '
    '); } } - pieces.push(new Array(lists.length + 1).join('')); + + for (var k = lists.length - 1; k >= 0; k--) + { + if(lists[k][1] == "number") + { + pieces.push(''); + } + else + { + pieces.push(''); + } + } return pieces.join(''); } From 0a513bc1d7c57ce20dfb7ba2be9e1ecbdb85f24a Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Sat, 10 Dec 2011 10:33:33 +0100 Subject: [PATCH 16/17] editor CSS proposal --- static/css/iframe_editor.css | 52 ++++++++++++++++++------------------ static/css/timeslider.css | 50 +++++++++++++++++----------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 676753051..2faaae065 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -13,14 +13,14 @@ ul, ol, li { } ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } -ul.list-bullet1 { margin-left: 3em; } -ul.list-bullet2 { margin-left: 4.5em; } -ul.list-bullet3 { margin-left: 6em; } -ul.list-bullet4 { margin-left: 7.5em; } -ul.list-bullet5 { margin-left: 9em; } -ul.list-bullet6 { margin-left: 10.5em; } -ul.list-bullet7 { margin-left: 12em; } -ul.list-bullet8 { margin-left: 13.5em; } +ul.list-bullet1 { margin-left: 1.5em; } +ul.list-bullet2 { margin-left: 3em; } +ul.list-bullet3 { margin-left: 4.5em; } +ul.list-bullet4 { margin-left: 6em; } +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-style-type: disc; } ul.list-bullet1 { list-style-type: disc; } @@ -32,16 +32,16 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } -ol.list-number1 { margin-left: 3em; } -ol.list-number2 { margin-left: 4.5em; } -ol.list-number3 { margin-left: 6em; } -ol.list-number4 { margin-left: 7.5em; } -ol.list-number5 { margin-left: 9em; } -ol.list-number6 { margin-left: 10.5em; } -ol.list-number7 { margin-left: 12em; } -ol.list-number8 { margin-left: 13.5em; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } -ol { list-style-type: disc; } +ol { list-style-type: decimal; } ol.list-number1 { list-style-type: decimal; } ol.list-number2 { list-style-type: lower-latin; } ol.list-number3 { list-style-type: lower-roman; } @@ -51,14 +51,14 @@ ol.list-number6 { list-style-type: lower-roman; } ol.list-number7 { list-style-type: decimal; } ol.list-number8 { list-style-type: lower-latin; } -ul.list-number1 { margin-left: 3em; } -ul.list-number2 { margin-left: 4.5em; } -ul.list-number3 { margin-left: 6em; } -ul.list-number4 { margin-left: 7.5em; } -ul.list-number5 { margin-left: 9em; } -ul.list-number6 { margin-left: 10.5em; } -ul.list-number7 { margin-left: 12em; } -ul.list-number8 { margin-left: 13.5em; } +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; } @@ -93,7 +93,7 @@ body.doesWrap { padding-top: 1px; /* important for some reason? */ padding-right: 10px; padding-bottom: 8px; - padding-left: 1px /* prevents characters from looking chopped off in FF3 */; + padding-left: 10px /* prevents characters from looking chopped off in FF3 */; overflow: hidden; /* blank 1x1 gif, so that IE8 doesn't consider the body transparent */ background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==); diff --git a/static/css/timeslider.css b/static/css/timeslider.css index 4d71be6e3..c808a65c3 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -197,14 +197,14 @@ float:right; ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } -ul.list-bullet1 { margin-left: 3em; } -ul.list-bullet2 { margin-left: 4.5em; } -ul.list-bullet3 { margin-left: 6em; } -ul.list-bullet4 { margin-left: 7.5em; } -ul.list-bullet5 { margin-left: 9em; } -ul.list-bullet6 { margin-left: 10.5em; } -ul.list-bullet7 { margin-left: 12em; } -ul.list-bullet8 { margin-left: 13.5em; } +ul.list-bullet1 { margin-left: 1.5em; } +ul.list-bullet2 { margin-left: 3em; } +ul.list-bullet3 { margin-left: 4.5em; } +ul.list-bullet4 { margin-left: 6em; } +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-style-type: disc; } ul.list-bullet1 { list-style-type: disc; } @@ -216,16 +216,16 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } -ol.list-number1 { margin-left: 3em; } -ol.list-number2 { margin-left: 4.5em; } -ol.list-number3 { margin-left: 6em; } -ol.list-number4 { margin-left: 7.5em; } -ol.list-number5 { margin-left: 9em; } -ol.list-number6 { margin-left: 10.5em; } -ol.list-number7 { margin-left: 12em; } -ol.list-number8 { margin-left: 13.5em; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } -ol { list-style-type: disc; } +ol { list-style-type: decimal; } ol.list-number1 { list-style-type: decimal; } ol.list-number2 { list-style-type: lower-latin; } ol.list-number3 { list-style-type: lower-roman; } @@ -235,14 +235,14 @@ ol.list-number6 { list-style-type: lower-roman; } ol.list-number7 { list-style-type: decimal; } ol.list-number8 { list-style-type: lower-latin; } -ul.list-number1 { margin-left: 3em; } -ul.list-number2 { margin-left: 4.5em; } -ul.list-number3 { margin-left: 6em; } -ul.list-number4 { margin-left: 7.5em; } -ul.list-number5 { margin-left: 9em; } -ul.list-number6 { margin-left: 10.5em; } -ul.list-number7 { margin-left: 12em; } -ul.list-number8 { margin-left: 13.5em; } +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; } From 3248ca4cbba2d56f186c6e10d4dbbb8b95de04a5 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Sat, 10 Dec 2011 11:01:14 +0100 Subject: [PATCH 17/17] added minimal CSS support to HTMLexport --- node/utils/ExportHtml.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js index 0d64f6823..fe5ee9e46 100644 --- a/node/utils/ExportHtml.js +++ b/node/utils/ExportHtml.js @@ -334,11 +334,11 @@ function getHTMLFromAtext(pad, atext) lists.push([line.listLevel, line.listTypeName]); if(line.listTypeName == "number") { - pieces.push('
    1. ', lineContent || '
      '); + pieces.push('
      1. ', lineContent || '
        '); } else { - pieces.push('
        • ', lineContent || '
          '); + pieces.push('
          • ', lineContent || '
            '); } } //the following code *seems* dead after my patch. @@ -465,7 +465,24 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) return; } - var head = (noDocType ? '' : '\n') + '\n' + (noDocType ? '' : '\n' + '\n' + '\n' + '\n') + ''; + var head = + (noDocType ? '' : '\n') + + '\n' + (noDocType ? '' : '\n' + + '\n' + + '\n' + '\n') + + ''; var foot = '\n\n';