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/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; } diff --git a/static/img/etherpad_lite_icons.png b/static/img/etherpad_lite_icons.png index 606612313..d1390f975 100644 Binary files a/static/img/etherpad_lite_icons.png and b/static/img/etherpad_lite_icons.png differ diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index bad0ca346..eb8c91329 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -2588,6 +2588,17 @@ function OUTER(gscope) } editorInfo.ace_setAttributeOnSelection = setAttributeOnSelection; + 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); + } + editorInfo.ace_toggleAttributeOnSelectedLine = toggleAttributeOnSelectedLine; + + function toggleAttributeOnSelection(attributeName) { if (!(rep.selStart && rep.selEnd)) return; @@ -2602,7 +2613,6 @@ function OUTER(gscope) { return withItRegex.test(attribs); } - var selStartLine = rep.selStart[0]; var selEndLine = rep.selEnd[0]; for (var n = selStartLine; n <= selEndLine; n++) diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 9164d42f0..84117ec87 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -33,7 +33,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 69c3f1242..2526f2c33 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -31,7 +31,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 b4b4c1cca..2b1a6e0d4 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -124,6 +124,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_toggleAttributeOnSelectedLine(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 4324544e1..d61f7b0c4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -78,6 +78,17 @@
+ +