From 2726634200bf90e711259bcefacf168dd608f30d Mon Sep 17 00:00:00 2001 From: Nils Rokita <0rokita@informatik.uni-hamburg.de> Date: Sat, 10 Dec 2011 14:36:21 +0100 Subject: [PATCH 1/6] Add h1 adn h2, h2 seems not to work jet, menu immage have to be drawn --- node/utils/contentcollector.js | 8 ++++++++ static/js/linestylefilter.js | 4 +++- static/js/linestylefilter_client.js | 4 +++- static/js/pad_editbar.js | 1 + static/pad.html | 13 ++++++++++++- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/node/utils/contentcollector.js b/node/utils/contentcollector.js index 60bd0a6ef..bb9ece834 100644 --- a/node/utils/contentcollector.js +++ b/node/utils/contentcollector.js @@ -472,6 +472,14 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { cc.doAttrib(state, "strikethrough"); } + if (tname == "h1" ) + { + cc.doAttrib(state, "heading1"); + } + if (tname == "h2") + { + cc.doAttrib(state, "heading2"); + } if (tname == "ul") { var type; diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index f6cf9f357..ee9c63914 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -27,7 +27,9 @@ linestylefilter.ATTRIB_CLASSES = { 'bold': 'tag:b', 'italic': 'tag:i', 'underline': 'tag:u', - 'strikethrough': 'tag:s' + 'strikethrough': 'tag:s', + 'heading1': 'tag:h1', + 'heading2': 'tag:h2' }; linestylefilter.getAuthorClassName = function(author) diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index b1bdae6ef..c9a143081 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -25,7 +25,9 @@ linestylefilter.ATTRIB_CLASSES = { 'bold': 'tag:b', 'italic': 'tag:i', 'underline': 'tag:u', - 'strikethrough': 'tag:s' + 'strikethrough': 'tag:s', + 'heading1': 'tag:h1', + 'heading2': 'tag:h2' }; linestylefilter.getAuthorClassName = function(author) diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 97bd7f85b..524be0e68 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -118,6 +118,7 @@ var padeditbar = (function() padeditor.ace.callWithAce(function(ace) { if (cmd == 'bold' || cmd == 'italic' || cmd == 'underline' || cmd == 'strikethrough') ace.ace_toggleAttributeOnSelection(cmd); + else if (cmd == 'heading1' || cmd == 'heading2') ace.ace_toggleAttributeOnSelection(cmd); else if (cmd == 'undo' || cmd == 'redo') ace.ace_doUndoRedo(cmd); else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList(); else if (cmd == 'indent') diff --git a/static/pad.html b/static/pad.html index 35ec559bc..58d83df70 100644 --- a/static/pad.html +++ b/static/pad.html @@ -77,6 +77,17 @@
+
  • +
  • + +
    +
    +
  • +
  • + +
    +
    +
  • From 9944dfc821674b4e464ffccf1696a0345e0e095e Mon Sep 17 00:00:00 2001 From: Nils Rokita <0rokita@informatik.uni-hamburg.de> Date: Wed, 4 Jan 2012 15:38:03 +0100 Subject: [PATCH 4/6] fix little error --- static/js/ace2_inner.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 78f556586..747950046 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -2573,10 +2573,11 @@ function OUTER(gscope) function toggleAttributeOnSelectedLine(attributeName) { + if (!(rep.selStart && rep.selEnd)) return; //set the full line to be selected rep.selStart[1]=0; - rep.selEnd[1]=rep.lines.atIndex(rep.selEnd[0]).text.length - toggleAttributeOnSelection(attributeName) + rep.selEnd[1]=rep.lines.atIndex(rep.selEnd[0]).text.length; + toggleAttributeOnSelection(attributeName); } editorInfo.ace_toggleAttributeOnSelectedLine = toggleAttributeOnSelectedLine; From f4ee2bac03e77a9647c1d38c0f2a8ae7bca279da Mon Sep 17 00:00:00 2001 From: Nils Rokita <0rokita@informatik.uni-hamburg.de> Date: Wed, 4 Jan 2012 16:21:19 +0100 Subject: [PATCH 5/6] fix linehieght in haedings --- static/css/iframe_editor.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 86ca99117..1640aa95b 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -66,6 +66,14 @@ body.grayedout { background-color: #eee !important } line-height: 16px; /* overridden by body.style */ } +span.h1 { + line-height: 30px; +} + +span.h2 { + line-height: 25px; +} + body.doesWrap { white-space: normal; } From 8649be0e56051a9914356f2be804eeaaf0385c18 Mon Sep 17 00:00:00 2001 From: Nils Rokita <0rokita@informatik.uni-hamburg.de> Date: Sat, 7 Jan 2012 14:23:01 +0100 Subject: [PATCH 6/6] fix misspelling from Headline --- static/pad.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/pad.html b/static/pad.html index c65c5c815..df8c53073 100644 --- a/static/pad.html +++ b/static/pad.html @@ -79,12 +79,12 @@
  • - +
  • - +