Copied to clipboard

Flag this post as spam?

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


  • Juan Rozo 5 posts 95 karma points
    Jun 21, 2024 @ 20:48
    Juan Rozo
    0

    Umbraco 13.2.2 Allow Scripts on RTE

    i need to use scripts on RTE and i added ,script[*] to the "ValidElements" on appsettings.json but still not working

    when i try to save the script it's empty

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jun 22, 2024 @ 10:53
    Huw Reddick
    0

    try setting this to false in appsettings.json

    "SanitizeTinyMce": true,
    
  • Juan Rozo 5 posts 95 karma points
    Jun 24, 2024 @ 13:40
    Juan Rozo
    0

    Thanks for your answer.

    i tried that too

    "SanitizeTinyMce": false,
    

    and

    "RichTextEditor": {
         "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],-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[*],figure,figcaption,video[*],audio[*],picture[*],source[*],canvas[*],script[*]"
       }
    
  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jun 24, 2024 @ 15:36
    Huw Reddick
    0

    Could you show what the underlying rte src looks like before you save it, and then after saving

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jun 25, 2024 @ 09:10
    Huw Reddick
    0

    I'm on 13.4.0 and am able to add script tags by adding script[*] to the list of validelements

  • Juan Rozo 5 posts 95 karma points
    Jun 25, 2024 @ 20:53
    Juan Rozo
    0

    Thanks for your answers

    i noticed that it works with an RTE on a DoctumentType but what i really need is an RTE on a Element Type that i populate on a Block List

    so this is before submit:

    enter image description here

    and this is after submit enter image description here

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jun 26, 2024 @ 09:25
    Huw Reddick
    0

    i noticed that it works with an RTE on a DoctumentType but what i really need is an RTE on a Element Type

    I can't think of any reason having it in a block element would matter, it is still the same RTE control underneath.

    Just tested it in a block element and that works fine for me as well.

  • Juan Rozo 5 posts 95 karma points
    Jun 27, 2024 @ 14:26
    Juan Rozo
    100

    Hello!! i finally could make it work

    it's weird but in different umbraco project it just works itself but on this project in particular scripts tag must be contained on other tag as p or div:

    enter image description here

    this way it works

    thanks all for your answers

  • Jamie Attwood 208 posts 504 karma points c-trib
    Nov 18, 2024 @ 19:08
    Jamie Attwood
    0

    I had the same issue after modifying the appsettings.json. However, it is important to remember to do something like clean the solution and rebuild after making the updates to appsettings. If you just try a build, the project won't rebuild and bind the new RichTextEditor: ValidElements correctly. I could only make this work by forcing a build. I can now add <script> tags with no issue.

Please Sign in or register to post replies

Write your reply to:

Draft