ConvertToXhtml unable to disable for Code snippets

4 posts, 0 answers
  1. Nate
    Nate avatar
    3 posts
    Member since:
    Nov 2017

    Posted 09 Oct 2018 Link to this post

    I am using RadEditor as part of sitecore 8.2  I have used the following Editor.DisableFilter(EditorFilters.ConvertToXhtml);  this works great if i type into the editor but if i use a code snippet the html is changed below is the example html i am using

    This works fine if pasted into the html tab

    <a href="#">
    <h3>Title of Section</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
    </a>     
  2. Nate
    Nate avatar
    3 posts
    Member since:
    Nov 2017

    Posted 09 Oct 2018 in reply to Nate Link to this post

    Sorry it posted before ready

    But if i use a Code snippet to insert the same code i end up with

    <h3><a href="#">Title of Section</a></h3>
    <p><a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </a></p>
  3. Nate
    Nate avatar
    3 posts
    Member since:
    Nov 2017

    Posted 09 Oct 2018 in reply to Nate Link to this post

    Sorry it Posted when i tried to hit enter for a new line

    If I try to use a code snippet with the same example i get the following html

    <h3><a href="#">Title of Section</a></h3>
    <p><a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </a></p>
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5922 posts

    Posted 11 Oct 2018 Link to this post

    Hello Nate,

    The templates actually paste content in the editor and that always has to go through some fixes for the content. They are mostly about nesting block elements, which is what affects this snippet - the heading and the paragraph are both block elements, while anchors are inline text elements by definition, and so, as far as the editor knows, the anchor should not be wrapping the block elements.

    That said, I devised a workaround for you that is basically pasting the following line of JavaScript after the script manager. You can also find attached below a small runnable example of this.

    Telerik.Web.UI.Editor.NestedElementsFix.prototype.applyFix = function () {}


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top