Copied to clipboard

Flag this post as spam?

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


  • Mark 255 posts 612 karma points
    Jul 14, 2014 @ 13:48
    Mark
    0

    Tiny MCE img tag - responsive issues

    Umbraco 7.1.4

    Is there some way to stop Tiny MCE from generating inline styles? When I insert an image, I'd like to see:

    <img src="/media/1005/testImg.png" alt="" />

    Instead of:

    <img style="width: 374px; height:49px;" src="/media/1005/testImg.png?width=374&height=49" alt="testImg.png" rel="1076" />

    I can understand if there was a "Media Picker" option that allowed you to choose a width and height to use, but putting these values in there by default causes big headaches for responsive web developers who want to specify generic styles (e.g. percentage width and auto height). I suppose I can add the "!important" rule for now...

     

  • Connie DeCinko 931 posts 1160 karma points
    Apr 21, 2016 @ 17:34
    Connie DeCinko
    0

    What is the resolution for this?

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Apr 21, 2016 @ 18:05
    Nicholas Westby
    0

    I recommend using a widget system using something like Archetype rather than inserting images in the rich text editor.

    A clunky workaround, however, would be to have some JavaScript run on page load to strip out the things you don't want (e.g., the inline styles and the width/height query sting parameters).

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Apr 21, 2016 @ 18:06
    Nicholas Westby
    0

    Or instead of JavaScript, you could also process the markup on the server side to strip that out too. There are libraries in NuGet that help with this.

Please Sign in or register to post replies

Write your reply to:

Draft