Copied to clipboard

Flag this post as spam?

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


  • John DeSpirito 10 posts 80 karma points
    Jul 07, 2022 @ 15:51
    John DeSpirito
    0

    Prevent the richtexteditor from removing the onclick() attribute?

    Hello,

    We're migrating a very large amount of content from our old site to a new Umbraco site. I've noticed that if I save some of this content in the richtexteditor, it removed the "onclick" attribute from a tags, even if I manually change them to a span instead.

    I looked up the documentation to configure the TinyMCE editor so that it allows all tags and attributes by setting ValidElements to *[*], and although that resolved many of the other issues, it still insists on removing onclick from tags.

    Here is my richtexteditor settings:

      "RichTextEditor": {
        "ValidElements": "*[*]",
        "CustomConfig": {
          "cleanup": "false",
          "verify_html": "false"
        }
    

    Has anyone resolved this somehow?

    Thank you!

    John

  • Huw Reddick 1750 posts 6115 karma points MVP c-trib
    Jul 08, 2022 @ 11:05
    Huw Reddick
    0

    The issue relates to the setting "SanitizeTinyMce", if set to true it removes the onclick attribute.

    The setting appears to override the ValidElements settings

  • John DeSpirito 10 posts 80 karma points
    Jul 08, 2022 @ 12:32
    John DeSpirito
    0

    Thanks for pointing me to that setting, don't know how I missed that. Unfortunately, setting it to false still did not allow "onclick" in the richtexteditor. I wonder if this is something new to Umbraco 10?

  • Huw Reddick 1750 posts 6115 karma points MVP c-trib
    Jul 08, 2022 @ 14:12
    Huw Reddick
    0

    It works ok for me, but I am not using *[*] for my valid elements, I have the following, copied from my Umbraco 8 site

            "ValidElements": "+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],i[class|style],-strong/-b[class|style],-em[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[*],figure,figcaption",
    
Please Sign in or register to post replies

Write your reply to:

Draft