Content Element Filtering
The ASPxHtmlEditor allows you to automatically filter the content elements using the following properties:
- The ASPxHtmlEditorHtmlEditingSettings.PasteFiltering property enables filtering only the content that a user pastes in the editor (without affecting the existing content).
- The HtmlEditorHtmlEditingSettings.ContentElementFiltering property allows you to filter the editor’s entire content.
You can specify filter rules for the following elements: tags, attributes, and style attributes.
The ASPxHtmlEditor control provides a property listing filtered elements and a property specifying the filter mode for every element type.
Set the filter mode properties to one of the following values:
- WhiteList - Allow and maintain specified elements; other elements are removed.
- BlackList - Prohibit and remove specified elements; other elements are maintained.
Example
This code sample demonstrates how to specify the following content element filtering settings:
- All cellspacing and cellpadding attributes should be removed from the editor’s content.
- All tags except a, p, span, img, ul, li, table, tr, and td, should be removed from the editor content.
<dx:ASPxHtmlEditor ID="HtmlEditor" runat="server">
<SettingsHtmlEditing>
<ContentElementFiltering AttributeFilterMode="BlackList" Attributes="cellspacing, cellpadding" TagFilterMode="WhiteList" Tags="a, p, span, img, ul, li, table, tr, td" />
</SettingsHtmlEditing>