Select whole line by h1 and h2

This commit is contained in:
Nils Rokita 2011-12-12 15:28:05 +01:00
parent 2726634200
commit 5aff4a030d
2 changed files with 11 additions and 2 deletions

View file

@ -2571,6 +2571,16 @@ function OUTER(gscope)
}
editorInfo.ace_setAttributeOnSelection = setAttributeOnSelection;
function toggleAttributeOnSelectedLine(attributeName)
{
//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;
@ -2585,7 +2595,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

@ -118,7 +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 == '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')