This is a migrated thread and some comments may be shown as answers.

Font formatting not being applied FONT tag vs SPAN tag in Design/HTML view

2 Answers 98 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aleksey
Top achievements
Rank 1
Aleksey asked on 24 Oct 2012, 02:33 PM
Hi All,

After installing the new version of editor (Telerik.Web.UI, Version=2012.2.912.40) hoping to fix some of the formatting issues I seem to have introduced more formatting issues. The problem is that if I type some text and try to change the font it does not change at all. When switching to HTML view I see following which appears to be properly formatted and all:
<span style="font-family: Courier New;">dfasdf asdf asdf asdf</span>

I have defined the editor as following:
<telerik:RadEditor runat="server" ID="richText" EditModes="Design" ToolsFile="EditorTools.xml" ContentAreaMode="Div" ContentFilters="ConvertFontToSpan,ConvertToXhtml,ConvertCharactersToEntities,IndentHTMLContent" StripFormattingOptions="All" Width="935px">
</telerik:RadEditor>

When inspecting html code using F12 Developer Tools I noticed that the content is still using FONT tag:
<FONT face="Courier New">dfasdf asdf asdf asdf</FONT>

Can anyone advise on this behavior? Has anything changed or have I missed anything?

Thanks

PS: I am on Win7 and IE9. Also see code discrepancy in the screenshot of the F12 tools

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Oct 2012, 07:32 AM
Hi,

The browser's commands (that some of RadEditor's tools use to avoid problems with production of nested tags and other side effects) work with <font> tags and for this reason  RadEditor converts the span tags to font tags in Design mode. When switching to HTML mode or submitting the content the font tags are converted to valid XHTML <span> tags.

The conversion of font to span tags and vice versa is done by the content filter. If you disable it, the font tags will remain in HTML mode and will be submitted to the server. This is the default behavior of the filter since its creation long years ago.

As to the reported issue: The problem is that if I type some text and try to change the font it does not change at all - It could be due to some global css class on the page that is overriding the font tag priority. You can fix it by setting the ContentAreaMode to iframe and the CssFiles property to point to an empty CSS file as shown in this article: Content Area Appearance Problems.

Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Aleksey
Top achievements
Rank 1
answered on 07 Nov 2012, 02:26 PM
Hi Rumen,

Yes indeed. A while back I had changed style of some parent tag to use .radEditor * { } to set default values. And I was assuming the specific font style for any internal tags would override that setting.

Thanks
Tags
Editor
Asked by
Aleksey
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Aleksey
Top achievements
Rank 1
Share this question
or