From 349b73977bfebf8320400b1e7a349441ef001768 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 2 Mar 2012 16:57:37 +0100 Subject: [PATCH] CSS adaptations + added 'normal' style in dropdown --- static/css/iframe_editor.css | 20 ++++++++++++++++++++ static/css/pad.css | 9 +++++++++ static/js/ace2_inner.js | 36 +++++++++++++++++++++++++----------- static/js/pad_editbar.js | 10 +++++++--- static/pad.html | 35 ++++++++++++++++++----------------- static/timeslider.html | 2 +- 6 files changed, 80 insertions(+), 32 deletions(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index d2d2f9774..d776dcaef 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -155,6 +155,26 @@ body.doesWrap { padding-right: 1px; } +h1{ + font-size: 30px; + line-height: 35px; +} + +h2{ + font-size: 25px; + line-height: 30px; +} + +h3{ + font-size: 20px; + line-height: 25px; +} + +h4{ + font-size: 15px; + line-height: 20px; +} + p { margin: 0; } diff --git a/static/css/pad.css b/static/css/pad.css index 969d00276..a711e070b 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -58,9 +58,18 @@ a img margin-left: 2px; overflow: hidden; padding: 4px 5px; +} + +#editbar ul li.button +{ width: 18px; } +#editbar ul li.dropdown +{ + padding: 2px 0 8px; +} + #editbar ul li a { text-decoration: none; diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 8b325e344..505daddb8 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5235,21 +5235,34 @@ function Ace2Inner(){ //apply the list type. If a specific level is requested, force it if(requestLevel) { - if(type+level == type+requestLevel) - { - type = 'indent'; - level = 0; - } - else - { - level = requestLevel; - } - } - mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]); + mods.push([n, type+requestLevel]); + } + else + { + mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]); + } } setLineListTypes(mods); } + function doRevertBlockStyle(){ + if (!(rep.selStart && rep.selEnd)) + { + return; + } + + var firstLine, lastLine; + firstLine = rep.selStart[0]; + lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0)); + + var mods = []; + for (var n = firstLine; n <= lastLine; n++) + { + mods.push([n, '']); + } + setLineListTypes(mods); + } + function doInsertUnorderedList(){ doInsertList('bullet'); } @@ -5268,6 +5281,7 @@ function Ace2Inner(){ editorInfo.ace_doInsertUnorderedList = doInsertUnorderedList; editorInfo.ace_doInsertOrderedList = doInsertOrderedList; editorInfo.ace_doInsertTitle = doInsertTitle; + editorInfo.ace_doRevertBlockStyle = doRevertBlockStyle; var mozillaFakeArrows = (browser.mozilla && (function() { diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 0aee6938a..3bc521f6e 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -157,10 +157,14 @@ var padeditbar = (function() else if (cmd == "style") { var value = document.getElementById("style-select").value; - var style = /([a-z]+)-([12345678])/.exec(value); - if(style[1]=="title") + var style = value.split('-'); + if(style[0]=="title") { - ace.ace_doInsertTitle(Number(style[2])); + ace.ace_doInsertTitle(Number(style[1])); + } + else if(style[0]=="normal") + { + ace.ace_doRevertBlockStyle(); } } else if (cmd == 'clearauthorship') diff --git a/static/pad.html b/static/pad.html index 5f8dac1d9..c63275d4c 100644 --- a/static/pad.html +++ b/static/pad.html @@ -15,21 +15,22 @@