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

TBODY

1 Answer 40 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sree
Top achievements
Rank 1
sree asked on 03 Oct 2008, 10:27 AM
Hello,

Could you please tell me, the setting where you turn off the auto TBODY adding tag to the html.

For all Table tags ... Editor is adding, TBODY tags automatically, Is there any way to turn off this feature? not to append TBODY tag.

Regards,
Sree

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 03 Oct 2008, 12:07 PM
Hi Sree,

Please, note that RadEditor uses the rich text editing engine of the browser which automatically puts the tbody tags to the inserted tables. One of the possible ways to strip the tbody tags is to implement custom 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>


You can also strip the tbody tags on the server using the String.Replace() method.

Kind regards,
Rumen
the Telerik team

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