More in this section

Forums / Bugs & Issues / Missing html tags (wysiwyg editor issue)

Missing html tags (wysiwyg editor issue)

3 posts, 0 answered
  1. Serge G
    Serge G avatar
    9 posts
    10 Jun 2011
    30 Mar 2013
    Link to this post
    Hello Telerik,

    I would like to report of very annoying bug (or maybe feature) that exists in SF for a long time.

    Sometimes your html in content block can be drastically changed if you created it by copying plain html in wysiwyg editor.

    However this issue appears not on first time publishing. When you just create new content block - it uses html exactly as you copied it into editor. But when you try to edit existing content block - you are risking to lose some tags with css classes that could be crucial for markup and javascripts.

    To explain what exactly I mean:
    If you copy html below in wysiwyg editor (using editor's plain html mode)
    <span class="some_class">
      <span class="another_class">
        <span class="and_class_again">
           Some text

    Then save (publish) the page and open content block again for edit, you'll probably will see absolutely different html code there:
    <span class="another_class">Some text</span>

    I suppose the reason is some html validator that checks html and
    corrects it for the greater justice. But on practice it leads to many issues because
    often developers just HAVE to use markup provided by someone who uses that kind of "invalid"

    Of course CMS should help developer to create his product faster correcting his errors. But I would prefer if CMS knows who is in charge and doesn't touch my html, especially if it could lead to removed tags. Probably many developers agree with me.

    Serge G
  2. Jen Peleva
    Jen Peleva avatar
    568 posts
    10 Nov 2016
    03 Apr 2013
    Link to this post
    Hi Serge,

    This behavior comes from content filters, that are applied to the RadEditor, used by our HtmlField.

     To apply or disable content filters map the template of HTML field which is used in all instances of RadEditor in sitefinity and configure content filters from the template code behind.
    To do so follow these steps.
    1. Create .ascx file in your poject and paste the template of Sitefinity html field. (attach code behind to the template to configure content filters in it)

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Extenders" TagPrefix="sf" %>
    <sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
            <sf:ConditionalTemplate Left="DisplayMode" Operator="Equal" Right="Read" runat="server">
                <sf:SitefinityLabel id="titleLabel_read" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfTxtLbl" />
                <sf:SitefinityLabel id="viewControl" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfRTFContent" />
            <sf:ConditionalTemplate Left="DisplayMode" Operator="Equal" Right="Write" runat="server">
                <sf:ResourceLinks id="resourcesLinks2" runat="server">
                    <sf:EmbeddedResourcePropertySetter Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.EditorDialogs.css" Static="true" ControlID="editControl" ControlPropertyName="DialogsCssFile" />
                    <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Default.Styles.Window.css" Static="true" />
                <asp:Label ID="titleLabel_write" runat="server" CssClass="sfTxtLbl" AssociatedControlID="editControl" />
                <asp:LinkButton ID="expandLink" runat="server" OnClientClick="return false;" CssClass="sfOptionalExpander" />
                <%--NewLineBr="False" - removed because of bug 112126. The bug should be fixed in the next release of RadControls.--%>
                <asp:Panel ID="expandableTarget" runat="server" CssClass="sfEditorWrp sfClearfix">
                        StripFormattingOptions="Css,Font,Span" >
                        <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
                    <sf:RadEditorCustomDialogsExtender runat="server" id="editorCustomDialogsExtender" TargetControlID="editControl"/>
                    <sf:SitefinityLabel id="descriptionLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfDescription" />
                    <sf:SitefinityLabel id="exampleLabel" runat="server" WrapperTagName="div" HideIfNoText="true" CssClass="sfExample" />

    2. Map the template from Administration->Settings->Advanced->Controls->ViewMap crete new
    Host: Telerik.Sitefinity.Web.UI.Fields.HtmlField
    Layout: Relative path to to the template created in step 1 ~/HtmlField.ascx

    Restart the application and the template will be in use
    For the editor disable content filters on the Prerender event

    protected void Page_Load(object sender, EventArgs e)
               editControl.PreRender += new EventHandler(editControl_PreRender);
           void editControl_PreRender(object sender, EventArgs e)

    Kind regards,
    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Serge G
    Serge G avatar
    9 posts
    10 Jun 2011
    03 Apr 2013 in reply to Jen Peleva
    Link to this post
    Thanks for your help, Jen, I appreciate it!
    I'll try this solution. Looks simple and effective.

    Best regards,
    Serge G
3 posts, 0 answered