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

Disable editor's filters

1 Answer 94 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Nimrod
Top achievements
Rank 1
Nimrod asked on 15 Sep 2008, 07:33 PM
Hi,

I'm using the rad editor on a web page, and in one of the scenarios of user input, the content of the editor id uploaded from a file (html).

When i set the new content through the Content property in the server, and looks at the result showing in the editor afterwards - there are few changes made automatically by the editor's filters.
Since I would like to keep the content identical to the original file, i tried to disable all filters working on the editor.
This is were I encountered the problems - the filters wont go off.
I tried disabling them through server side and client side, but none of them work.
The editor is adding a "title" tag to the html head, adding "tbody" tags to the tables and so on...

How can disable all filters completely and have the editor not to change nothing in the content?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Sep 2008, 03:22 PM
Hello Nimrod,

You can disable the editor's filters by setting

RadEditor1.ContentFilters = EditorFilters.None

Please, note that RadEditor uses the rich text editing engine of the browser which automatically puts the tbody tags to the inserted tables. The only possible way is to strip the tbody tags using a content filter. Here is an example:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:radeditor runat="server" ID="RadEditor1"   
     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 newContent = content;
         //Make changes to the content and return it
         newContent = newContent.replace(/\<TBODY>/gi,"").replace(/\<\/TBODY>/gi,"");
         return newContent;
       },
      
       getDesignContent : function(content)
       {
         var newContent = content;
         //Make changes to the content and return it
         newContent = newContent.replace(/\<TBODY>/gi,"").replace(/\<\/TBODY>/gi,"");
         return newContent;
       }
    }
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);
    </script>


Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Nimrod
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or