Tags being stripped from RichHtmlField

6 posts, 0 answers
  1. Klaus
    Klaus avatar
    17 posts
    Member since:
    Mar 2010

    Posted 03 Apr 2012 Link to this post

    Hi.

    I'm working on a migration project, and I have an issue with the WCM radeditor integration. In MOSS 2007 it behaves as expected, but after the upgrade, i have problems with custom tags that are being stripped in a RichHtmlField, which makes resuable content useless.

    If I insert a stadard radeditor webpart on the page, the tags are not being stripped, so it must have something to do with how I have configured the richhtmlfield. The appropriate features are activated "Use RadEditor to edit HTML fields" and "Use RadEditor to edit List" Items.

    Using version 6.1.7.0.

    This is an excerpt of what I have got in a pagelayout:
    ..
    <%@ Register Tagprefix="moss" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>  
    ..
    <moss:RichHtmlField id="RichHtmlField1" FieldName="PublishingPageContent" runat="server" AllowReusableContent="true"></moss:RichHtmlField>

    ConfigFile.xml
    <configuration>
     <property name="ToolbarMode">ShowOnFocus</property>
     <property name="ToolsWidth">560px</property>
     <property name="ContentAreaMode">Div</property>
     <property name="AllowScripts">true</property>
     <property name="ConvertToXHtml">false</property>
     <property name="ContentFilters">None</property>
     <property name="AllowSpecialTags">true</property>
    </configuration>

    Any help would be much appreciated.

    Best regards

    Klaus
  2. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 05 Apr 2012 Link to this post

    Hi,

    You did not share your custom xml tags, but if they are not stripped in WebPart scenario this means that they are stripped by the content filters of SharePoint 2007. You can easily check whether the custom tags are stripped by RadEditor or by MOSS, by switching to HTML mode of RadEditor. If the tags are there, this means that MOSS strips them, if the tags are missing in HTML mode, this means that RadEditor strips them. The content displayed in HTML mode is identical to the content submitted from RadEditor.

    My suggestion is to also test your custom tags with the default MOSS WYSIWYG editor in the same scenario and see whether the tags are saved or stripped.

    All the best,
    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. Klaus
    Klaus avatar
    17 posts
    Member since:
    Mar 2010

    Posted 25 Apr 2012 Link to this post

    Hi Rumen.

    Was caught up in other projects, but now I am digging into this issue again.

    As mentioned we are running a migration project and the mentioned behavior is on a SP 2010 installation with an upgraded MOSS 2007 Content DB with no visual upgrade (UIVersion=3). The 2007 environment which is being migrated works as expected in regards to the custom tags.

    The tags that are being stripped are Sharepoints own which is used for reusable content. A snippet before publishing looks like this:
    <SPAN id=__publishingReusableFragment class="ms-rtestate-read  ms-reusableTextView" contentEditable=false fragmentid="https://mysite/ReusableContent/3_.000">
    <P>test</P></SPAN>

    After the page is published, the html looks like this:
    <div id="ctl00_PlaceHolderMain_ctl01_PublishingPageContent__ControlWrapper_RichHtmlField" class="ms-rtestate-field" style="display:inline" aria-labelledby="ctl00_PlaceHolderMain_ctl01_PublishingPageContent_label"><span id="__publishingReusableFragment" class="ms-rtestate-read  ms-reusableTextView">
    <p>kjkjkj</p></span></div>

    Notice that the fragmentid tag is being stripped, which as an effect disables automatic updates of reusable content. BTW, it is not just the fragmentid tag, but all custom tags are stripped.

    I have created a new SP 2010 site (UIVersion=4) from scratch with the radeditor features enabled, and on this site tags are not being stripped.

    I also followed your suggestion and tried to use the builtin MOSS editor on the existing upgraded site, and this editor doesn't strip the tags. I deactivated the "Use RadEditor to edit HTML fields" feature, and after that things worked again as expected.

    Please let me know if you need more details.

    UPDATE
    : After some more research I looked into the SPEditorTools.js file and started debugging. I notice a difference in the behavior when running the clean SP2010 site (UIVersion=4) and the upgraded MOSS2007->SP2010 site. In the MOSSTemplateManager function, the variable fragment contains the tags. At some point a call to RadEditorGetStorageHtml is made, and here is the difference. In the clean SP2010 site RTE is defined, and the code enters the part of handling reusablecontent. However, in the upgraded site RTE is undefined and thus the script returns editor.get_html(true). Why is the RTE undefined at this point?

    Created a new web with UIVersion=3, RTE still undefined. Performed a visual upgrade (UIVersion=4) for this particular web, and RTE is defined and the tags are not stripped. I then downgraded to UIVersion=3 and again RTE is undefined and tags are stripped.

    Now curious, I created a completely new SP2010 site (UIVersion 4) and verified that everything works as expected OOTB. Created a new web and downgraded that to UIVersion 3. Tags are stripped and RTE is undefined. This should be easily reproducable for you guys.


    Best regads

    - Klaus


  4. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 30 Apr 2012 Link to this post

    Hello,

    Could you please switch to HTML mode of RadEditor and see whether the special attributes are stripped?

    If the attributes are not stripped this means that the problem is SharePoint related, because the same content is submitted from RadEditor without modifications and there is nothing that we can do in this scenario, because we could not control the validation mechanism of SharePoint.

    If the attributes are missing in HTML mode, this means that this is either a bug of RadEditor or a browser problem that we should investigate.

    Best 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.
  5. Klaus
    Klaus avatar
    17 posts
    Member since:
    Mar 2010

    Posted 30 Apr 2012 Link to this post

    Hi Rumen,

    thank you for your reply.

    If you by HTML mode mean, the window where the HTML markup is visible instead of the WYSIWYG window, then the attributes are there. It is when the content is saved by either a checkin or publish, that the tags are removed. When the content is checked in or publish there is a call to RadEditorGetStorageHtml in speditortools.js, and this function behaves differently whether it is UIVersion 3 or 4.

    As I mentioned earlier, I can reproduce this on an OOTB clean Sharepoint 2010 site simply by switching the UIVersion from 4 to 3.

    It is not possible for us to switch to UIVersion 4 of Sharepoint 2010 as part of the migration process, so we really need the reusable content functionality to work in this scenario.

    Best regards
    Klaus
  6. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 03 May 2012 Link to this post

    Hi Klaus,

    I investigated the problem and found that the reusable content scenario is not handled by RadEditor for SharePoint 2010 in UIVersion=3. I tried to workaround it with code from RadEditor for MOSS, but without success. That is why I logged the issue for fixing in our bug tracking system and our developers will research it further and fix it.

    Here you can find the PITS Issue: Public URL and track its progress. Unfortunately, I cannot provide an estimate when it will be fixed.

    I also updated your Telerik points for reporting this problem.


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