How can I enable or disable content filters on the client-side via javascript and how can I apply an enabled filter to a particular radEditor using javascript?
We have a page with many (>15) radEditors. If we use the default behavior and apply content filters upon submit to insure that our output is XHTML compliant we observe a long delay before the page actually begins to submit. We have attempted to optimize this performance following the guidance provided on your site, but the performace is still not good enough.
What we would like to do is disable content filters in the ASPX markup by setting ContentFilters="None" so they will not be applied upon submit. Then, whenever a user changes the mode of the radEditor from HTML to Design, or during other client-side events that we control, we would like to turn on the filters, apply them to the particular radEditor content, and then turn off the filters. We have attempted to follow the suggestions in your forum (i.e. here and here) and have tried using the following code:
function radEditorControl_OnClientModeChange(editor, args) { |
if (editor.get_mode() == 1) |
ApplyFilters(editor); |
} |
ApplyFilters = function(editor) { |
//1. Enable filter |
if (editor.get_filtersManager().getFilterByName("ConvertToXhtmlFilter") != null) |
editor.get_filtersManager().getFilterByName("ConvertToXhtmlFilter").Enabled = true |
else |
Telerik.Web.UI.Editor["ConvertToXhtmlFilter"].Enabled = true; |
//2. Apply filter |
editor.set_html(editor.get_html(true)); |
//3. Disable filter |
if (editor.get_filtersManager().getFilterByName("ConvertToXhtmlFilter") != null) |
editor.get_filtersManager().getFilterByName("ConvertToXhtmlFilter").Enabled = false; |
else |
Telerik.Web.UI.Editor["ConvertToXhtmlFilter"].Enabled = false; |
} |
I have tried this with a variety of client-side filters (StripScriptsFilter, FixUlBoldItalic, FixEnclosingP, MozEmStrongFilter, ConvertFontToSpanFilter, ConvertToXhtmlFilter). In all cases the javascript code executes fine, but the radEditor content is not modified by the filter.
Do you have any guidance for me? Thanks so much for the help!
Joe