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.
This example demonstrates the use of the editor's built-in content filters:
- RemoveScripts: this filter removes
script tags from the editor content. Disable the filter if you want to insert script
tags in the content. You can examine more details about this filter in
Preventing Cross-site Scripting (XSS) article.
- EncodeScripts: this filter encodes
all script tags from the content. You can examine more details about this filter in
Preventing Cross-site Scripting (XSS) article.
- StripCssExpressions: this filter strips CSS expressions to reduce the possibility of cross-site scripting.
You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
- StripDomEventAttributes: this filter removes attribute DOM events from the HTML elements to reduce
the possibility of cross-site scripting. You can examine more details about this filter in Preventing Cross-site Scripting (XSS) article.
- MakeUrlsAbsolute: this filter makes
all URLs in the editor content absolute (e.g. "http://server/page.html"
instead of "page.html"). This filter is DISABLED by default.
- FixUlBoldItalic: this filter changes
the deprecated u tag to a span with CSS style.
- IECleanAnchors Internet Explorer only
- this filter removes the current page url from all anchor(#) links to
the same page.
- FixEnclosingP: this filter removes
a parent paragraph tag if the whole content is inside it.
- MozEmStrong: this filter changes b
to strong and i to em in Mozilla browsers. - This filter is obsolete since Telerik UI version 2013 Q3
- ConvertTags: This filter changes <b>, <i> and <strike>
tags successively to <strong>, <em> and <del>
- ConvertFontToSpan: this filter changes
deprecated font tags to compliant span tags.
- OptimizeSpans: this filter changes
removes unneeded span elements.
- ConvertToXhtml: this filter converts
the HTML from the editor content area to XHTML.
- IndentHTMLContent: this filter indents
the HTML content so it is more readable when you view the code.
- ConvertCharactersToEntities: this
filter converts reserved characters to their html entity names.
- PdfExportFilter: this filter fixes
some pdf export issues.
- ConvertInlineStylesToAttributes: this
filter converts XHTML compliant inline style attributes to Email compliant element
attributes.
-
RemoveExtraBreaks: This filter strips all extra brakes inside some tags like p, h1, etc.
- DefaultFilters: the default editor
behavior. All content filters except MakeUrlsAbsolute are activated.
Filters in RadEditor can be set in the markup:
<
telerik:RadEditor
ID
=
"RadEditor1"
ContentFilters
=
"MakeUrlsAbsolute,FixEnclosingP"
runat
=
"server"
/>
as well as in the code behind:
C#
RadEditor1.ContentFilters
= Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute | Telerik.Web.UI.EditorFilters.FixEnclosingP;
VB.NET
RadEditor1.ContentFilters
= Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute
Or
Telerik.Web.UI.EditorFilters.FixEnclosingP
Filters can also be enabled/disabled individually through EnableFilter() and DisableFilter()
methods (e.g. RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute))
Related Resources