From 883be3d48d3a35e41ac8cff60ad42330d24e1950 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 5 Apr 2013 02:21:56 +0100 Subject: [PATCH 1/9] begin by adding some template css --- src/static/css/iframe_editor.css | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 1d9b61bea..8041d90e6 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -17,6 +17,7 @@ ul, ol, li { padding: 0; margin: 0; } + ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 1.5em; } @@ -38,6 +39,7 @@ 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.9em; } ol.list-number2 { margin-left: 3em; } ol.list-number3 { margin-left: 4.5em; } @@ -56,6 +58,7 @@ 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; } @@ -186,3 +189,39 @@ p { overflow:hidden; } */ + +ol { + display: list-item; +} + +ol > li { + display:inline; +} + +/* Set the indentation */ +ol.list-number1{ + text-indent: 20px; +} +ol.list-number2{ + text-indent: 30px; +} + +/* Add styling to the first item in a list */ +ol.list1-start{ + counter-reset: first; +} +ol.list2-start{ + counter-reset: second; +} + +/* The behavior for incrementing and the prefix */ +ol.list-number1:before { + content: counter(first) ". " ; + counter-increment: first; +} + +ol.list-number2:before { + content: counter(second) ". " ; + counter-increment: second; +} + From 49cff88a480a0a261191a8c4e11f1ab5ff5c37d3 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 8 Apr 2013 23:03:19 +0100 Subject: [PATCH 2/9] semi working --- src/static/css/iframe_editor.css | 42 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 8041d90e6..395bfe5a3 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -205,13 +205,23 @@ ol.list-number1{ ol.list-number2{ text-indent: 30px; } +ol.list-number3{ + text-indent: 40px; +} +ol.list-number4{ + text-indent: 50px; +} +ol.list-number5{ + text-indent: 60px; +} +ol.list-number6{ + text-indent: 70px; +} + /* Add styling to the first item in a list */ -ol.list1-start{ - counter-reset: first; -} -ol.list2-start{ - counter-reset: second; +body{ + counter-reset:first 0 second 0 third 0 fourth 0 fifth 0 sixth 0; } /* The behavior for incrementing and the prefix */ @@ -225,3 +235,25 @@ ol.list-number2:before { counter-increment: second; } +/* The behavior for incrementing and the prefix */ +ol.list-number3:before { + content: counter(third) ". " ; + counter-increment: third; +} + +ol.list-number4:before { + content: counter(fourth) ". " ; + counter-increment: fourth; +} + +/* The behavior for incrementing and the prefix */ +ol.list-number5:before { + content: counter(fifth) ". " ; + counter-increment: fifth; +} + +ol.list-number6:before { + content: counter(sixth) ". " ; + counter-increment: sixth; +} + From 70a25964b6dcadb06ae6a8979f939dd7598a1793 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 8 Apr 2013 23:32:04 +0100 Subject: [PATCH 3/9] make sure elements are supported, still doesn't assign numbers properly --- src/static/css/iframe_editor.css | 41 +++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 395bfe5a3..668843cf3 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -199,29 +199,18 @@ ol > li { } /* Set the indentation */ -ol.list-number1{ - text-indent: 20px; -} -ol.list-number2{ - text-indent: 30px; -} -ol.list-number3{ - text-indent: 40px; -} -ol.list-number4{ - text-indent: 50px; -} -ol.list-number5{ - text-indent: 60px; -} -ol.list-number6{ - text-indent: 70px; -} - +ol.list-number1{ text-indent: 20px; } +ol.list-number2{ text-indent: 30px; } +ol.list-number3{ text-indent: 40px; } +ol.list-number4{ text-indent: 50px; } +ol.list-number5{ text-indent: 60px; } +ol.list-number6{ text-indent: 70px; } +ol.list-number7{ text-indent: 80px; } +ol.list-number8{ text-indent: 90px; } /* Add styling to the first item in a list */ body{ - counter-reset:first 0 second 0 third 0 fourth 0 fifth 0 sixth 0; + counter-reset:first 0 second 0 third 0 fourth 0 fifth 0 sixth 0 seventh 0 eighth 0; } /* The behavior for incrementing and the prefix */ @@ -235,7 +224,6 @@ ol.list-number2:before { counter-increment: second; } -/* The behavior for incrementing and the prefix */ ol.list-number3:before { content: counter(third) ". " ; counter-increment: third; @@ -246,7 +234,6 @@ ol.list-number4:before { counter-increment: fourth; } -/* The behavior for incrementing and the prefix */ ol.list-number5:before { content: counter(fifth) ". " ; counter-increment: fifth; @@ -257,3 +244,13 @@ ol.list-number6:before { counter-increment: sixth; } +ol.list-number7:before { + content: counter(seventh) ". " ; + counter-increment: seventh; +} + +ol.list-number8:before { + content: counter(eighth) ". " ; + counter-increment: eighth; +} + From bfa233ba04ad2e9773441b9473496385f9cd0b90 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 9 Apr 2013 00:46:13 +0100 Subject: [PATCH 4/9] kudos to quenenni for some working CSS --- src/static/css/iframe_editor.css | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 668843cf3..1ae906c4d 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -210,47 +210,56 @@ ol.list-number8{ text-indent: 90px; } /* Add styling to the first item in a list */ body{ - counter-reset:first 0 second 0 third 0 fourth 0 fifth 0 sixth 0 seventh 0 eighth 0; + counter-reset:first 1 second 1 third 1 fourth 1 fifth 1 sixth 1 seventh 1 eighth 1; } /* The behavior for incrementing and the prefix */ ol.list-number1:before { content: counter(first) ". " ; - counter-increment: first; + counter-increment: first 1; } ol.list-number2:before { content: counter(second) ". " ; - counter-increment: second; + counter-increment: second 1; } ol.list-number3:before { content: counter(third) ". " ; - counter-increment: third; + counter-increment: third 1; } ol.list-number4:before { content: counter(fourth) ". " ; - counter-increment: fourth; + counter-increment: fourth 1; } ol.list-number5:before { content: counter(fifth) ". " ; - counter-increment: fifth; + counter-increment: fifth 1; } ol.list-number6:before { content: counter(sixth) ". " ; - counter-increment: sixth; + counter-increment: sixth 1; } ol.list-number7:before { content: counter(seventh) ". " ; - counter-increment: seventh; + counter-increment: seventh 1; } ol.list-number8:before { content: counter(eighth) ". " ; - counter-increment: eighth; + counter-increment: eighth 1; } +ol.list-start1:before{ counter-reset: first 0; } +ol.list-start2:before{ counter-reset: second 0; } +ol.list-start3:before{ counter-reset: third 0; } +ol.list-start4:before{ counter-reset: fourth 0; } +ol.list-start5:before{ counter-reset: fifth 0; } +ol.list-start6:before{ counter-reset: sixth 0; } +ol.list-start7:before{ counter-reset: seventh 0; } +ol.list-start8:before{ counter-reset: eighth 0; } + From 2e76bd4e5070875343cf4ac7aa7817294d9ee372 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 9 Apr 2013 01:22:09 +0100 Subject: [PATCH 5/9] working but then create a second list, it will be stupid, SIGH --- src/static/css/iframe_editor.css | 16 ++++++++-------- src/static/js/domline.js | 9 +++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 1ae906c4d..7ae680dc7 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -254,12 +254,12 @@ ol.list-number8:before { counter-increment: eighth 1; } -ol.list-start1:before{ counter-reset: first 0; } -ol.list-start2:before{ counter-reset: second 0; } -ol.list-start3:before{ counter-reset: third 0; } -ol.list-start4:before{ counter-reset: fourth 0; } -ol.list-start5:before{ counter-reset: fifth 0; } -ol.list-start6:before{ counter-reset: sixth 0; } -ol.list-start7:before{ counter-reset: seventh 0; } -ol.list-start8:before{ counter-reset: eighth 0; } +ol.list-start-number1:before{ counter-reset: first 0; } +ol.list-start-number2:before{ counter-reset: second 0; } +ol.list-start-number3:before{ counter-reset: third 0; } +ol.list-start-number4:before{ counter-reset: fourth 0; } +ol.list-start-number5:before{ counter-reset: fifth 0; } +ol.list-start-number6:before{ counter-reset: sixth 0; } +ol.list-start-number7:before{ counter-reset: seventh 0; } +ol.list-start-number8:before{ counter-reset: eighth 0; } diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 43b5f21a3..1e700c757 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -104,7 +104,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (listType) { listType = listType[1]; - start = start?'start="'+Security.escapeHTMLAttribute(start[1])+'"':''; if (listType) { if(listType.indexOf("number") < 0) @@ -114,7 +113,13 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) } else { - preHtml = '
  1. '; + if(start){ // is it a start of a list with more than one item in? + if(start[1] == 1){ // if its the first one + preHtml = '
    1. '; + }else{ // its the second+ item in this list level + preHtml = '
      1. '; + } + } postHtml = '
      '; } } From 90c5b26e892a2711949b0fa26ba49c912e3dfb03 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 9 Apr 2013 14:29:55 +0100 Subject: [PATCH 6/9] keep integrity on paste and better styling but new lists dont reset counter --- src/static/css/iframe_editor.css | 18 ++++++++++-------- src/static/js/domline.js | 10 ++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 7ae680dc7..c2cc14530 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -192,21 +192,23 @@ p { ol { display: list-item; + list-style-type: decimal; } ol > li { + display:list-item; display:inline; } /* Set the indentation */ -ol.list-number1{ text-indent: 20px; } -ol.list-number2{ text-indent: 30px; } -ol.list-number3{ text-indent: 40px; } -ol.list-number4{ text-indent: 50px; } -ol.list-number5{ text-indent: 60px; } -ol.list-number6{ text-indent: 70px; } -ol.list-number7{ text-indent: 80px; } -ol.list-number8{ text-indent: 90px; } +ol.list-number1{ text-indent: 0px; } +ol.list-number2{ text-indent: 10px; } +ol.list-number3{ text-indent: 20px; } +ol.list-number4{ text-indent: 30px; } +ol.list-number5{ text-indent: 40px; } +ol.list-number6{ text-indent: 50px; } +ol.list-number7{ text-indent: 60px; } +ol.list-number8{ text-indent: 70px; } /* Add styling to the first item in a list */ body{ diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 1e700c757..ee558a645 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -114,11 +114,13 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) else { if(start){ // is it a start of a list with more than one item in? - if(start[1] == 1){ // if its the first one - preHtml = '
      1. '; - }else{ // its the second+ item in this list level - preHtml = '
        1. '; + if(start[1] == 1){ // if its the first one at this level? + preHtml = '
          1. '; + }else{ // its not the first item in this list level + preHtml = '
            1. '; } + }else{ + preHtml = '
              1. '; // Handles pasted contents into existing lists } postHtml = '
              '; } From e712f7665da817c7e5678285c26ec25b5f327659 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 11 Apr 2013 16:33:03 +0100 Subject: [PATCH 7/9] working solution props to dmitryu for making me not be scared of modifying div clases --- src/static/css/iframe_editor.css | 49 +++++++++++++++++--------------- src/static/js/domline.js | 5 ++-- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index c2cc14530..2b72aa1b1 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -191,12 +191,12 @@ p { */ ol { - display: list-item; +/* display: list-item; */ list-style-type: decimal; } ol > li { - display:list-item; +/* display:list-item;*/ display:inline; } @@ -211,57 +211,60 @@ ol.list-number7{ text-indent: 60px; } ol.list-number8{ text-indent: 70px; } /* Add styling to the first item in a list */ +/* body{ counter-reset:first 1 second 1 third 1 fourth 1 fifth 1 sixth 1 seventh 1 eighth 1; } +*/ + +.list-start-number1 { counter-reset: first second; } +.list-start-number2 { counter-reset: second; } +/* +.list-start-number3 { counter-reset: third 0; } +.list-start-number4 { counter-reset: fourth 0; } +.list-start-number5 { counter-reset: fifth 0; } +.list-start-number6 { counter-reset: sixth 0; } +.list-start-number7 { counter-reset: seventh 0; } +.list-start-number8 { counter-reset: eighth 0; } +*/ /* The behavior for incrementing and the prefix */ -ol.list-number1:before { +.list-number1 li:before { content: counter(first) ". " ; - counter-increment: first 1; + counter-increment: first; } -ol.list-number2:before { - content: counter(second) ". " ; - counter-increment: second 1; +.list-number2 li:before { + content: counter(first) ". " counter(second) ". "; + counter-increment: second; } -ol.list-number3:before { +.list-number3 li:before { content: counter(third) ". " ; counter-increment: third 1; } -ol.list-number4:before { +.list-number4 li:before { content: counter(fourth) ". " ; counter-increment: fourth 1; } -ol.list-number5:before { +.list-number5 li:before { content: counter(fifth) ". " ; counter-increment: fifth 1; } -ol.list-number6:before { +.list-number6 li:before { content: counter(sixth) ". " ; counter-increment: sixth 1; } -ol.list-number7:before { +.list-number7 li:before { content: counter(seventh) ". " ; counter-increment: seventh 1; } -ol.list-number8:before { +.list-number8 li:before { content: counter(eighth) ". " ; counter-increment: eighth 1; } - -ol.list-start-number1:before{ counter-reset: first 0; } -ol.list-start-number2:before{ counter-reset: second 0; } -ol.list-start-number3:before{ counter-reset: third 0; } -ol.list-start-number4:before{ counter-reset: fourth 0; } -ol.list-start-number5:before{ counter-reset: fifth 0; } -ol.list-start-number6:before{ counter-reset: sixth 0; } -ol.list-start-number7:before{ counter-reset: seventh 0; } -ol.list-start-number8:before{ counter-reset: eighth 0; } - diff --git a/src/static/js/domline.js b/src/static/js/domline.js index ee558a645..7b9e31ae9 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -115,10 +115,9 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if(start){ // is it a start of a list with more than one item in? if(start[1] == 1){ // if its the first one at this level? - preHtml = '
              1. '; - }else{ // its not the first item in this list level - preHtml = '
                1. '; + lineClass = lineClass + " " + "list-start-" + listType; // Add start class to DIV node } + preHtml = '
                  1. '; }else{ preHtml = '
                    1. '; // Handles pasted contents into existing lists } From 1fc906017cdacee342a42c0fdf7e9a16bf730501 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 11 Apr 2013 16:38:41 +0100 Subject: [PATCH 8/9] final css --- src/static/css/iframe_editor.css | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 2b72aa1b1..b25f7e074 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -219,14 +219,12 @@ body{ .list-start-number1 { counter-reset: first second; } .list-start-number2 { counter-reset: second; } -/* -.list-start-number3 { counter-reset: third 0; } -.list-start-number4 { counter-reset: fourth 0; } -.list-start-number5 { counter-reset: fifth 0; } -.list-start-number6 { counter-reset: sixth 0; } -.list-start-number7 { counter-reset: seventh 0; } -.list-start-number8 { counter-reset: eighth 0; } -*/ +.list-start-number3 { counter-reset: third; } +.list-start-number4 { counter-reset: fourth; } +.list-start-number5 { counter-reset: fifth; } +.list-start-number6 { counter-reset: sixth; } +.list-start-number7 { counter-reset: seventh; } +.list-start-number8 { counter-reset: eighth; } /* The behavior for incrementing and the prefix */ .list-number1 li:before { @@ -235,36 +233,36 @@ body{ } .list-number2 li:before { - content: counter(first) ". " counter(second) ". "; + content: counter(first) "." counter(second) ". "; counter-increment: second; } .list-number3 li:before { - content: counter(third) ". " ; + content: counter(first) "." counter(second) "." counter(third) ". "; counter-increment: third 1; } .list-number4 li:before { - content: counter(fourth) ". " ; + content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) ". "; counter-increment: fourth 1; } .list-number5 li:before { - content: counter(fifth) ". " ; + content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) ". "; counter-increment: fifth 1; } .list-number6 li:before { - content: counter(sixth) ". " ; + content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) ". "; counter-increment: sixth 1; } .list-number7 li:before { - content: counter(seventh) ". " ; + content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) ". "; counter-increment: seventh 1; } .list-number8 li:before { - content: counter(eighth) ". " ; + content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(eighth) ". " ; counter-increment: eighth 1; } From 9581097dc7ec0c052455d9a11964b33bb7b972bf Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 11 Apr 2013 16:39:25 +0100 Subject: [PATCH 9/9] remove cruft --- src/static/css/iframe_editor.css | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index b25f7e074..3ed5322dc 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -39,27 +39,6 @@ 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.9em; } -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: decimal; } -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; } @@ -191,12 +170,10 @@ p { */ ol { -/* display: list-item; */ list-style-type: decimal; } ol > li { -/* display:list-item;*/ display:inline; } @@ -211,11 +188,6 @@ ol.list-number7{ text-indent: 60px; } ol.list-number8{ text-indent: 70px; } /* Add styling to the first item in a list */ -/* -body{ - counter-reset:first 1 second 1 third 1 fourth 1 fifth 1 sixth 1 seventh 1 eighth 1; -} -*/ .list-start-number1 { counter-reset: first second; } .list-start-number2 { counter-reset: second; }