<a href="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
When I add the code to the HTML mode, then switch to the Design Mode, then switch back to the HTML mode,
1) the <script> tags disappear, and
2) the <noscript> tags have inserted "originalAttribute=X" and "originalPath=Y" into the anchor tags.
In IE only (I'm using IE 8), both 1 and 2 can be reproduced by pasting the sample code above into the Editor Demo: http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx.
Thanks.
9 Answers, 1 is accepted
Straight to the points:
1) If you would like to keep the <script> tags in the RadEditor's content area, you should disable the RemoveScripts filter of RadEditor, e.g.
RadEditor1.DisableFilter(EditorFilters.RemoveScripts)
This filter is enabled by default strips the <script> tags to reduce the possibility of cross-site scripting and other script-related problems.
2) We are aware of the <noscript> problem. We will add a check in the ConvertToXhtml filter for this case and this will fix the problem for the next Q2 SP1 2010 release.
You can fix the problem in the current build by implementing a custom DOM content filter and execute the following two lines of code in it:
nodeContent = nodeContent.replace(/\soriginalPath="[^"]+"/gi, "");
Here is the whole content filter:
<telerik:radeditor runat=
"server"
ID=
"RadEditor1"
SkinID=
"DefaultSetOfTools"
OnClientLoad=
"OnClientLoad"
>
</telerik:radeditor>
<script type=
"text/javascript"
>
function
OnClientLoad(editor, args) {
editor.get_filtersManager().add(
new
MyFilter());
}
MyFilter =
function
() {
MyFilter.initializeBase(
this
);
this
.set_isDom(
false
);
this
.set_enabled(
true
);
this
.set_name(
"RadEditor filter"
);
this
.set_description(
"RadEditor filter description"
);
}
MyFilter.prototype =
{
getHtmlContent:
function
(content) {
var
nodeContent = content;
//Make changes to the content and return it
nodeContent = nodeContent.replace(/\soriginalAttribute=
"[^"
]+
"/gi, "
");
nodeContent = nodeContent.replace(/\soriginalPath=
"[^"
]+
"/gi, "
");
return
nodeContent;
}
}
MyFilter.registerClass(
'MyFilter'
, Telerik.Web.UI.Editor.Filter);
</script>
Kind regards,
Rumen
the Telerik team
#1 still doesn't work for us. our settings are
EncodeScripts=true
MakeUrlsAbsolute=true
ConvertToXhtml=true
with these all set to true, any javascript pasted into IE gets stripped out. it seems to be the "MakeUrlsAbsolute=true" that is the culprit.
you can replicate this one your demo editor:
http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx
with this code:
<
script
type
=
"text/javascript"
charset
=
"utf-8"
src
=
"http://static.polldaddy.com/p.js"
originalAttribute
=
"src"
originalPath
=
"http://static.polldaddy.com/p.js"
></
script
> <
noscript
>
<
a
href
=
"http://polldaddy.com/poll/"
originalAttribute
=
"href"
originalPath
=
"http://polldaddy.com/poll/"
>Test</
a
><
span
style
=
"font-size:9px;"
>
<
a
href
=
"http://polldaddy.com/features-surveys/"
originalAttribute
=
"href"
originalPath
=
"http://polldaddy.com/features-surveys/"
>test2</
a
></
span
>
</
noscript
>
You are absolutely right that the problem appears only when the MakeUrlsAbsolute filter is enabled. I logged the problem with high priority and we will try to fix it as early as possible. I also updated your Telerik points for reporting this problem.
Currently the only workaround is to put some content before the script tag, for example a simple will do the trick.
The issue is logged in our PITS system with ID: 2871.
Best regards,
Rumen
the Telerik team
It's not longer removing the <script> tags so that's a good start, but it still injects this originalPath/originalAttribute nonsense"
so this:
<
script
type
=
"text/javascript"
charset
=
"utf-8"
src
=
"http://static.polldaddy.com/p.js"
></
script
>
<
noscript
>
<
a
href
=
"http://polldaddy.com/poll/"
>Test</
a
><
span
style
=
"font-size:9px;"
>
<
a
href
=
"http://polldaddy.com/features-surveys/"
>test2</
a
></
span
>
</
noscript
>
becomes:
<
script
type
=
"text/javascript"
charset
=
"utf-8"
src
=
"http://static.polldaddy.com/p.js"
originalAttribute
=
"src"
originalPath
=
"http://static.polldaddy.com/p.js"
></
script
> <
noscript
>
<
a
href
=
"http://polldaddy.com/poll/"
originalAttribute
=
"href"
originalPath
=
"http://polldaddy.com/poll/"
>Test</
a
><
span
style
=
"font-size:9px;"
>
<
a
href
=
"http://polldaddy.com/features-surveys/"
originalAttribute
=
"href"
originalPath
=
"http://polldaddy.com/features-surveys/"
>test2</
a
></
span
>
</
noscript
>
and of course, each time you switch from Design to HTML it keeps appending more and more of these extra attributes!
Thank you for your report. I logged it in our PITS system and we will do our best to fix it as soon as possible. The status of the issue could be checked at http://www.telerik.com/support/pits.aspx#/public/aspnet-ajax/3453.
Best regards,
Rumen
the Telerik team
Hi Telerik,
Was there a solution for this? I am still encountering this issue. In case it makes a difference, I am adding the anchor tag inside a script tag. When I save and reopen the html, the originalAttribute and originalPath attributes get added in.
I have tried Rumen's OnClientLoad script and have tried disabling the MakeUrlsAbsolute but the attributes still get added.
<script>
search.addWidget(
instantsearch.widgets.hierarchicalMenu({
container:
'#categories'
,
attributes: [
'categories.lvl0'
,
'categories.lvl1'
,
'categories.lvl2'
],
operator:
'or'
,
templates: {
header:
'Technology categories'
,
item:
'<a href="javascript:void(0);" originalAttribute="href" originalPath="javascript:void(0);" class="facet-item {{#isRefined}}active{{/isRefined}}"><span class="facet-name"><em class="fa fa-angle-right"></em> {{name}}</span class="facet-name"><span class="ais-hierarchical-menu--count">{{count}}</span></a>'
}
})
);
</scrtpt>
-Tim
Hello Tim,
This is a very old bug that should not exist in the latest version.
Are you able to reproduce the problem in the following demo: http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx? If no, please upgrade to the latest version R1 2017 SP1.
Best regards,Rumen
Telerik by Progress
Hi Rumen,
I was not able to reproduce the issue on the demo page.
Usually all our projects have the most up to date Telerki Dlls. This one project however proves to be tried and true and rarely needs maintenance. As it turns out the Telerik.Web.UI.dll referenced is 2010.3.1109.35. I might be going out on a limb here but it might be time to update this 7 year old dll.
-Tim
Hi Tim,
If you upgrade to the latest version you will not only solve this issue but also provide support for the latest browser versions. Another benefit is the Lightweight rendering of the controls available in the new version.
Best regards,Rumen
Telerik by Progress