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

@ -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++)

View file

@ -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)

View file

@ -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)

View file

@ -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')