This is a migrated thread and some comments may be shown as answers.

RADEditor & becomes &(&amp)

4 Answers 59 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aslam
Top achievements
Rank 1
Aslam asked on 14 Mar 2012, 12:54 PM
I have a requirement to wants me to disable the switching "&" into "&amp" (happens when I go to HTML mode from design mode)

Scenario:
I would like to use RADEditor to add jQuery pl see attached radeditor.png
(when RadEditor1.EditModes = Telerik.Web.UI.EditModes.Html)

When switching from designmode to HTML, mode & becomes &
(may also apply to "£ converted to &pound")

Check the post(link below)
http://www.telerik.com/support/kb/aspnet-ajax/editor/converting-unicode-symbols-to-numeric-html-entities-using-a-content-filter.aspx

And I tried with Built-in Content Filters.
http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx
But does not stop from converting & to &amp (also £ to &pound)

pl see the attached files contentfilter1.png and contentfilter2.png

Also tried adding code as well as specified in http://www.telerik.com/support/kb/aspnet-ajax/editor/converting-unicode-symbols-to-numeric-html-entities-using-a-content-filter.aspx

pl can someone help
A code example to download would be better.

thanks
ami

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Mar 2012, 01:49 PM
Hi Ami,

My suggestion is to disable the ConvertCharactersToEntities content filter and test the editor.

Best 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.
0
Aslam
Top achievements
Rank 1
answered on 16 Mar 2012, 06:19 PM
Hi Rumen,

thanks for the reply.
If you are asking to play around the demo
http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx

by unchecking "ConvertCharactersToEntities" property, then I have already done and then posted here.
pl see my attachments "contentfilter1.png" and "contentfilter2.png" in previous post.

if it is someother thing then pl make it more clear.

regards
Aslam
0
Aslam
Top achievements
Rank 1
answered on 20 Mar 2012, 03:43 PM
help please?
0
Rumen
Telerik team
answered on 20 Mar 2012, 04:15 PM
Hi,

It appeared that this is a Firefox behavior, which can be reproduced in an editable iframe and div elements as the attached one. To fix it you can implement a custom content filter that will replace the & entity with & when switching to HTML mode and submitting the content, e.g.

<telerik:radeditor id="RadEditor1" ContentFilters="none" onclientload="OnClientLoad" runat="server"></telerik:radeditor>  
    
<script type="text/javascript">   
    function OnClientLoad(editor, args)   
    {   
       editor.get_filtersManager().add(new RadEditorCustomFilter());   
    }   
    RadEditorCustomFilter = function()   
    {   
       RadEditorCustomFilter.initializeBase(this);   
       this.set_isDom(false);   
       this.set_enabled(true);   
       this.set_name("RadEditor filter");   
       this.set_description("RadEditor filter description");   
    }   
    RadEditorCustomFilter.prototype =   
    {   
       getHtmlContent : function(content)   
       {   
            //Make changes to the content and return it   
            //Convert the & symbol to its HTML & entity
             newContent = content.replace(/&amp;/gi, "&");     //you should enhance the regular expression because right now it will replace all & symbols in the content with &
  
         return newContent;   
       
    }   
    RadEditorCustomFilter.registerClass('RadEditorCustomFilter', Telerik.Web.UI.Editor.Filter);   
</script> 


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.
Tags
Editor
Asked by
Aslam
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Aslam
Top achievements
Rank 1
Share this question
or