how to add a custom content filter

4 posts, 1 answers
  1. Jean
    Jean avatar
    6 posts
    Member since:
    Oct 2009

    Posted 03 Dec 2010 Link to this post

    Hi,

    I would like to know how to add a custom content filter in the RAD editor for MOSS.
    I understodd that I need to add a property in the ConfigFile.xml:

    <property  name="OnClientLoad">OnClientLoad</property>

    Then I need to add a javascript function OnClientLoad and call another function that implements a few standard methods. OK but where should I put this javascript code. Is the MOSSEditorTools.js file suited for this ?

    Could you please give me an example of a custom content filter that works with MOSS and RAD Editor full version.

    Kind regards,

    Jean
  2. Answer
    Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 03 Dec 2010 Link to this post

    Hello Jean,

    The MOSSEditorTools.js file is the best place for the javascript. You can find example of a custom content filter in the following online help article:
    http://www.telerik.com/help/aspnet-ajax/contentfilters.html.

    Here is the javascript form it:
    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.toUpperCase();
         return newContent;
       },
       
       getDesignContent : function(content)
       {
         var newContent = content;
         //Make changes to the content and return it
         newContent = newContent.toUpperCase();
         return newContent;
       }
    }
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);



    All the best,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Jean
    Jean avatar
    6 posts
    Member since:
    Oct 2009

    Posted 03 Dec 2010 Link to this post

    Thank you. It works.

    Can you just confirm that this does not disable all the other default content filters?

    Kind regards,

    Jean
  4. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 03 Dec 2010 Link to this post

    Hello Jean,

    If you are asking if this will not disable all default filters, you are right. All the filters will work along with the custom ones.

    Greetings,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top