Not set a Height/Width of embedded image within WYSIWYG

birwin's Avatar

birwin

28 Jun, 2016 05:37 PM

Hi there, not sure if this is possible, but we're setting up some responsive templates within Cascade and found that when you use the WYSIWYG to embed an image, it auto adds in a height and width attribute into the HTML.

While in theory this is not a bug, - on a responsive page, we need the image to more or less not have that height and width set so it can assume 100% of the space available to it. Is there a way to make it so that the WYSIWYG does not add these attributes.

Currently we use the HTML view remove them, but hoping to automate the process.

  1. 1 Posted by Wing Ming Chan on 28 Jun, 2016 07:27 PM

    Wing Ming Chan's Avatar

    Hi Brendon,

    Before we moved onto file choosers in data definition blocks, I used the template-level format to remove the width and height attributes of img. I could also use web services to modify pages directly. Now we teach users not to insert images directly into a WYSIWYG, the main reason being that we want to use srcset.

    Wing

  2. 2 Posted by Ryan Griffith on 28 Jun, 2016 08:12 PM

    Ryan Griffith's Avatar

    Hi,

    The issue is the TinyMCE plugin adds these dimensions, and I am pretty sure does not allow for percentages either. Wing's proposed solution is what I generally recommend. To go a step further, you could use XPath to further target specific images.

    Please let me know if you have any questions.

    Thanks!

  3. 3 Posted by birwin on 28 Jun, 2016 08:51 PM

    birwin's Avatar

    I thought this may be the case.

    It’s a bit of a catch because there are instances where we will want to set this attribute.

    As Wing suggested, I think we’ll have to go the teaching route. Many thanks!

    Brendon

  4. Tim closed this discussion on 28 Jun, 2016 09:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac