This commit is contained in:
GitHub Merge Button 2012-01-08 07:30:12 -08:00
commit f6ffb384a6
8 changed files with 45 additions and 3 deletions

View file

@ -472,6 +472,14 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
{ {
cc.doAttrib(state, "strikethrough"); cc.doAttrib(state, "strikethrough");
} }
if (tname == "h1" )
{
cc.doAttrib(state, "heading1");
}
if (tname == "h2")
{
cc.doAttrib(state, "heading2");
}
if (tname == "ul") if (tname == "ul")
{ {
var type; var type;

View file

@ -66,6 +66,14 @@ body.grayedout { background-color: #eee !important }
line-height: 16px; /* overridden by body.style */ line-height: 16px; /* overridden by body.style */
} }
span.h1 {
line-height: 30px;
}
span.h2 {
line-height: 25px;
}
body.doesWrap { body.doesWrap {
white-space: normal; white-space: normal;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

@ -2588,6 +2588,17 @@ function OUTER(gscope)
} }
editorInfo.ace_setAttributeOnSelection = setAttributeOnSelection; 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) function toggleAttributeOnSelection(attributeName)
{ {
if (!(rep.selStart && rep.selEnd)) return; if (!(rep.selStart && rep.selEnd)) return;
@ -2602,7 +2613,6 @@ function OUTER(gscope)
{ {
return withItRegex.test(attribs); return withItRegex.test(attribs);
} }
var selStartLine = rep.selStart[0]; var selStartLine = rep.selStart[0];
var selEndLine = rep.selEnd[0]; var selEndLine = rep.selEnd[0];
for (var n = selStartLine; n <= selEndLine; n++) for (var n = selStartLine; n <= selEndLine; n++)

View file

@ -33,7 +33,9 @@ linestylefilter.ATTRIB_CLASSES = {
'bold': 'tag:b', 'bold': 'tag:b',
'italic': 'tag:i', 'italic': 'tag:i',
'underline': 'tag:u', 'underline': 'tag:u',
'strikethrough': 'tag:s' 'strikethrough': 'tag:s',
'heading1': 'tag:h1',
'heading2': 'tag:h2'
}; };
linestylefilter.getAuthorClassName = function(author) linestylefilter.getAuthorClassName = function(author)

View file

@ -31,7 +31,9 @@ linestylefilter.ATTRIB_CLASSES = {
'bold': 'tag:b', 'bold': 'tag:b',
'italic': 'tag:i', 'italic': 'tag:i',
'underline': 'tag:u', 'underline': 'tag:u',
'strikethrough': 'tag:s' 'strikethrough': 'tag:s',
'heading1': 'tag:h1',
'heading2': 'tag:h2'
}; };
linestylefilter.getAuthorClassName = function(author) linestylefilter.getAuthorClassName = function(author)

View file

@ -124,6 +124,7 @@ var padeditbar = (function()
padeditor.ace.callWithAce(function(ace) padeditor.ace.callWithAce(function(ace)
{ {
if (cmd == 'bold' || cmd == 'italic' || cmd == 'underline' || cmd == 'strikethrough') ace.ace_toggleAttributeOnSelection(cmd); 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 == 'undo' || cmd == 'redo') ace.ace_doUndoRedo(cmd);
else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList(); else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList();
else if (cmd == 'indent') else if (cmd == 'indent')

View file

@ -78,6 +78,17 @@
<div class="buttonicon" style="background-position:0px -86px"></div> <div class="buttonicon" style="background-position:0px -86px"></div>
</a> </a>
</li> </li>
<li class="separator"></li>
<li onClick="window.pad&&pad.editbarClick('heading1');return false;" >
<a title="Headline Level 1">
<div class="buttonicon" style="background-position:0px -452px"></div>
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('heading2');return false;" >
<a title="Headline Level 2">
<div class="buttonicon" style="background-position:0px -436px"></div>
</a>
</li>
</ul> </ul>
<ul id="menu_right"> <ul id="menu_right">