keydown: function(args) {
var loc = this._getRange();
offset = loc.startOffset; //get cursor position
var texto = this.getHtml();
var nuevotexto = texto.replace(/{:(.*?)\}/g, '<span style="color:blue">{:$1}</span>');
txt = $(this.getDocument()).find("body p")[0]; // get the first paragraph in RTE content
if (txt.children[0] && txt.children[0].nodeName == "SPAN" && txt.children[0].style.color == "blue") {
return;
}
else {
this.setHtml(nuevotexto);
range = this.createRange();
range.setStart(txt.lastChild, offset);
range.setEnd(txt.lastChild, offset);
this.selectRange(range); //set cursror position
}
} |
|