Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Graham Davis 110 posts 376 karma points
    Oct 21, 2020 @ 14:01
    Graham Davis
    0

    Rich Text Editor re-writing HTML Code

    I am upgrading a site to Umbraco 8 and am having difficultly with the Rich Text Editor either not rendering the HTML or rewriting it to the point that it does not function. Escaping the HTML used to work, but this no longer seems to be the case in Version 8. Any suggestions?

    <div>&lt;video style="width:100%;" poster="https://zpmcdn.zbestdata.com/zpm/Videos/BecomeAPartner/BecomeAPartner.jpg" controls&gt; &lt;source src="https://zpmcdn.zbestdata.com/zpm/Videos/BecomeAPartner/BecomeAPartner.mp4" type="video/mp4" /&gt; &lt;/video&gt; <br /><br /><br /></div>
    

    enter image description here

  • Anzal 11 posts 81 karma points
    Oct 21, 2020 @ 17:39
    Anzal
    0

    Hi, While rendering RTE content the code should be as

    @Html.Raw(yourHTMLString)
    

    Is this the same you were using in your code?

  • Graham Davis 110 posts 376 karma points
    Oct 21, 2020 @ 18:25
    Graham Davis
    0

    Yes. The RTE content is part of the umbraco grid and looks like:

    @Html.Raw(Html.GetGridHtml(Model.Content, "content"))
    
  • Anzal 11 posts 81 karma points
    Oct 22, 2020 @ 09:47
    Anzal
    0

    If its a umbraco grid try only with

    Html.GetGridHtml(Model.Content, "content")
    

    No need for @Html.Raw()

  • Graham Davis 110 posts 376 karma points
    Oct 24, 2020 @ 00:29
    Graham Davis
    0

    No Change removing Html.Raw. Right now, I am looking for a way to disable the RTE from reformatting the code. For example, if I don't escape the video tags, RTE completely removes it. If I do escape, it is changing &rt; to &amp;rt;

  • Graham Davis 110 posts 376 karma points
    Oct 25, 2020 @ 14:56
    Graham Davis
    100

    I found my solution. In the file config\tinyMceConfig.config, add the html video tag to the safe list using video[*]. Once this is done, the html no longer has to be escaped.

    For the html Button, I was using i tags for font awesome icons, which tinymce is removing. Changing them to span works

    Change:

    <a id="btnSignIn" href="#" class="btn btn-zpm-default"><i class="fa fa-download"></i> Download</a>

    To

    <a id="btnSignIn" href="#" class="btn btn-zpm-default"><span class="fa fa-download"></span> Download</a>

     <validElements>
            <![CDATA[+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|
    ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],
    -strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],
    img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],
    -sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],
    -tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],
    thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],
    -th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],
    -span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],
    -h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],
    dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],
    param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*],video[*]]]>
        </validElements>
    
Please Sign in or register to post replies

Write your reply to:

Draft