If you're in IE (possibly other browsers too?) and the html starts with a tag, doing a replace will add the replace to the top.
Eg: change nott to not as below
Before replace:
<strong>Bold</strong>
nott bold
After replace:
<strong>not Bold</strong>
not bold
Fix: in FindAndReplace.ascx
_replace: function(search_str, str) {
var newStr = str;
//escape html content (find and replace is not supposed to work in HTML view anyway).
if (newStr)
newStr = newStr.replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">");
if (this.getSelection().getHtml()) {
if ($telerik.isIE) {
//IE selection bug
try {
this.getSelection().getRange().duplicate().pasteHTML(newStr);
}
catch (uspecifiedError) {
//unspecified error is thrown when replacing text inside a textarea element
this.getSelection().getRange().text = newStr;
}
}
else {
this._clientParameters._editor.pasteHtml(newStr, "FindAndReplace");
}
}
},
needs to be changed to (after adding a reference to JQuery):
_replace: function(search_str, str) {
var newStr = str;
//escape html content (find and replace is not supposed to work in HTML view anyway).
if (newStr)
newStr = newStr.replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">");
var html = this.getSelection().getHtml();
if (html && $('<span>' + html + '</span>')[0].innerText) {
if ($telerik.isIE) {
//IE selection bug
try {
this.getSelection().getRange().duplicate().pasteHTML(newStr);
}
catch (uspecifiedError) {
//unspecified error is thrown when replacing text inside a textarea element
this.getSelection().getRange().text = newStr;
}
}
else {
this._clientParameters._editor.pasteHtml(newStr, "FindAndReplace");
}
}
},
Eg: change nott to not as below
Before replace:
<strong>Bold</strong>
nott bold
After replace:
<strong>not Bold</strong>
not bold
Fix: in FindAndReplace.ascx
_replace: function(search_str, str) {
var newStr = str;
//escape html content (find and replace is not supposed to work in HTML view anyway).
if (newStr)
newStr = newStr.replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">");
if (this.getSelection().getHtml()) {
if ($telerik.isIE) {
//IE selection bug
try {
this.getSelection().getRange().duplicate().pasteHTML(newStr);
}
catch (uspecifiedError) {
//unspecified error is thrown when replacing text inside a textarea element
this.getSelection().getRange().text = newStr;
}
}
else {
this._clientParameters._editor.pasteHtml(newStr, "FindAndReplace");
}
}
},
needs to be changed to (after adding a reference to JQuery):
_replace: function(search_str, str) {
var newStr = str;
//escape html content (find and replace is not supposed to work in HTML view anyway).
if (newStr)
newStr = newStr.replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">");
var html = this.getSelection().getHtml();
if (html && $('<span>' + html + '</span>')[0].innerText) {
if ($telerik.isIE) {
//IE selection bug
try {
this.getSelection().getRange().duplicate().pasteHTML(newStr);
}
catch (uspecifiedError) {
//unspecified error is thrown when replacing text inside a textarea element
this.getSelection().getRange().text = newStr;
}
}
else {
this._clientParameters._editor.pasteHtml(newStr, "FindAndReplace");
}
}
},