Mark Davis
Top achievements
Rank 1
Mark Davis
asked on 09 Dec 2008, 02:24 AM
Is there any reason why, when I set the content of the RadEditor, using set_html(), that all the <SPAN> tags in that content are being changed to <FONT>?
Here is my declaration:
Here is my declaration:
<telerik:RadEditor ID="MTRadEditor"
Enabled="true"
EditModes="Design"
Height="120"
NewLineBr="false"
Skin="Vista"
StripFormattingOptions="All"
Width="100%"
runat="server">
</telerik:RadEditor>
4 Answers, 1 is accepted
0
Hi Mark,
The font tag is deprecated and not XHTML compliant tag. For that reason the ConvertFontToSpan filter of RadEditor replace the font tags with spans.
If you would like you can easily disable the ConvertFontToSpan filter, by setting the DisableFilter method below in the codebehind:
RadEditor1.DisableFilter(EditorFilters.ConvertFontToSpan);
You can find more information about the built-in content filters of RadEditor here.
Kind regards,
Rumen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The font tag is deprecated and not XHTML compliant tag. For that reason the ConvertFontToSpan filter of RadEditor replace the font tags with spans.
If you would like you can easily disable the ConvertFontToSpan filter, by setting the DisableFilter method below in the codebehind:
RadEditor1.DisableFilter(EditorFilters.ConvertFontToSpan);
You can find more information about the built-in content filters of RadEditor here.
Kind regards,
Rumen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark Davis
Top achievements
Rank 1
answered on 12 Dec 2008, 02:36 AM
Thanks for the response. I think you misunderstand my issue - when I set the HTML content in the editor, all the SPAN elements are replaced with FONT elements (not the other way around). Any reason why this would be happening? Many thanks.
0
Accepted
Hello Mark,
We believe we understood you correctly.
As you know, many IE commands, such as FontName, FontSize, ForeColor, BackColor, etc, are ultimately built to work with FONT tags. They produce FONT tags when executed. They are able optimize teh number of font tags generated, etc. However, when you start executing these commands over SPAN elements, a real mess begins. The commands are not able to optimize the tags, reduce the nestign of span and font elements, and soon formatting becomes difficult due to the big number of nested font and spans.
So, what the editor does is convert all spans to fonts when in design mode, and all fonts to spans when content is submitted to the server. This way the content is handled efficiently by the browser.
Did you try our suggestion to disable this filter, and see what happens to the <span>s pasted?
Best regards,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
We believe we understood you correctly.
As you know, many IE commands, such as FontName, FontSize, ForeColor, BackColor, etc, are ultimately built to work with FONT tags. They produce FONT tags when executed. They are able optimize teh number of font tags generated, etc. However, when you start executing these commands over SPAN elements, a real mess begins. The commands are not able to optimize the tags, reduce the nestign of span and font elements, and soon formatting becomes difficult due to the big number of nested font and spans.
So, what the editor does is convert all spans to fonts when in design mode, and all fonts to spans when content is submitted to the server. This way the content is handled efficiently by the browser.
Did you try our suggestion to disable this filter, and see what happens to the <span>s pasted?
Best regards,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brian Jones
Top achievements
Rank 1
answered on 20 May 2009, 06:08 PM
I am seeing the exact same behavior. In design mode, all of the span tags are being converted to font tags. If I execute the Javascript function get_html() while the editor is in design view, the resulting string contains the undesirable font tags. If I execute get_html() while the editor is in html view the span tags are correctly persisted.
This behavior happens even when creating new content without calling set_html() first. Is there a work around?
##### Nevermind ######
editor.get_html(true) resolves this problem
This behavior happens even when creating new content without calling set_html() first. Is there a work around?
##### Nevermind ######
editor.get_html(true) resolves this problem
