Content Filters
Filters in RadEditor are small code snippets, which are called in a sequence
to process the editor content, when the mode (html / design / preview) is switched.
Implementing a Custom Filter
There are two steps that you should take to implement a custom filter:
1. Create a javascript function/class that implements one or more of the three filter methods:
- getDesignContent - Called when the editor is moving from some other
mode to DESIGN mode
- getHtmlContent - Called when the editor is moving from some other
state to HTML mode
2. Register the filter with the editor. The best way to achieve
this is to register an OnClientLoad function that instantiates
the filter and adds it to the filters manager.
Custom Filter Example
The filter modifies the editor content so that in HTML mode it
is presented with capital letters while in Design mode, it is shown
in lower-case letters. This is a fairly simplistic and unrealistic scenario that
is only used to demonstrate what is necessary to create and "hook" a filter into
Telerik RadEditor. In a real life scenario, the filter would likely employ a number
of regular expressions of varying complexity that will make the necessary changes
to the content.