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

how to add a custom content filter

3 Answers 79 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Jean
Top achievements
Rank 1
Jean asked on 03 Dec 2010, 03:15 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Stanimir
Telerik team
answered on 03 Dec 2010, 03:41 PM
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.
0
Jean
Top achievements
Rank 1
answered on 03 Dec 2010, 03:57 PM
Thank you. It works.

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

Kind regards,

Jean
0
Stanimir
Telerik team
answered on 03 Dec 2010, 04:02 PM
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.
Tags
WebParts for SharePoint
Asked by
Jean
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Jean
Top achievements
Rank 1
Share this question
or