mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 14:19:13 -04:00
Select whole line by h1 and h2
This commit is contained in:
parent
2726634200
commit
5aff4a030d
2 changed files with 11 additions and 2 deletions
|
@ -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++)
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue