Hi,
The function that are looking for restoreOriginalPathsAndAttributes is located in the RadEditor\0EditorUtils.js source code file and you can overwrite and modify its regular expressions using the code below:
<telerik:RadEditor ID=
"RadEditor1"
Runat=
"server"
></telerik:RadEditor>
<script type=
"text/javascript"
>
Telerik.Web.UI.Editor.Utils.getStoredOriginalPathsAndAttributes =
function
(content) {
alert(1);
var
matchEvaluator =
function
(match, g1, g2, g3, g4, g5, g6, matchIndex, wholeText) {
//"$1 $2=$3$4$3 originalAttribute=\"$2\" originalPath=\"$4\"$6"
if
(!g3) {
g3 =
""
;
g4 = g4 + g6;
//find first space or > and break g4
var
indmatch = g4.search(/(\s|>)/gi);
if
(indmatch > 0) {
g6 = g4.substring(indmatch, g4.length);
g4 = g4.substring(0, indmatch);
if
(g4 ==
"\"\""
) {
//handle case when href/src is empty
g4 =
""
;
g3 =
"\""
;
}
}
else
{
return
match;
}
}
return
g1 +
" "
+ g2 +
"="
+ g3 + g4 + g3 +
" originalAttribute=\""
+ g2 +
"\" originalPath=\""
+ g4 +
"\""
+ g6;
};
var
pathsRegExp =
new
RegExp(
"(<[^>]*?)\\s(href|src)\\s*=\\s*('|\")?([^>]+?)(\\3)([^>]*?>)"
,
"ig"
);
content = content.replace(pathsRegExp, matchEvaluator);
//do not touch src and hrefs that are inside comments (saved tags)
var
commentsRegExp =
new
RegExp(
"(<!--[\\s\\S]*?) originalAttribute=\"(?:href|src)\" originalPath=\"[^\"]+\"([\\s\\S]*?-->)"
,
"ig"
);
var
contentLength = content.length + 1;
while
(content.length < contentLength) {
contentLength = content.length;
content = content.replace(commentsRegExp,
"$1$2"
);
}
return
content;
}
</script>
Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their
blog feed now.