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

3 posts, 0 answers
  1. Aleksey
    Aleksey avatar
    3 posts
    Member since:
    Aug 2012

    Posted 24 Oct 2012 Link to this post

    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. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 29 Oct 2012 Link to this post

    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.
  3. Aleksey
    Aleksey avatar
    3 posts
    Member since:
    Aug 2012

    Posted 07 Nov 2012 Link to this post

    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
Back to Top