mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 19:29:15 -04:00
extending get attribute on selection
This commit is contained in:
parent
47f43e7094
commit
62be430203
2 changed files with 24 additions and 4 deletions
|
@ -449,6 +449,8 @@ function Ace2Inner(){
|
|||
return oldEvent;
|
||||
}
|
||||
|
||||
if(!evt) var evt = null;
|
||||
|
||||
currentCallStack = {
|
||||
type: type,
|
||||
docTextChanged: false,
|
||||
|
@ -2337,10 +2339,22 @@ function Ace2Inner(){
|
|||
}
|
||||
editorInfo.ace_setAttributeOnSelection = setAttributeOnSelection;
|
||||
|
||||
|
||||
function getAttributeOnSelection(attributeName){
|
||||
// Get the the attribute on selection
|
||||
// prevChar tells the function if it needs to look at the previous character
|
||||
function getAttributeOnSelection(attributeName, prevChar){
|
||||
if (!(rep.selStart && rep.selEnd)) return
|
||||
|
||||
// If we're looking for the caret attribute not the selection
|
||||
if(prevChar){
|
||||
// If it's not the start of the line
|
||||
if(rep.selStart[1] !== 0){
|
||||
rep.selStart[1]--;
|
||||
}else{
|
||||
// It's the start of the line so look at the first character
|
||||
rep.selEnd[1]++;
|
||||
}
|
||||
}
|
||||
|
||||
var withIt = Changeset.makeAttribsString('+', [
|
||||
[attributeName, 'true']
|
||||
], rep.apool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue