WYSIWYG Editor inserting <img> inline style for width and height

Federico Calvo asked on November 18, 2019 22:41

While inserting images from the media library using "Insert/Edit Image or Media", if we change the width and height in the properties, the editor adds inline width and height style to the tag.

This causes the image to deform on mobile devices so I need to change how this ckeditor cms extension to have it not set the inline style. It should definitely set the new image width and height in the url parameters but not in the image tag style attribute.

I can't find how/where to do this Thanks

Federico CAlvo

Recent Answers


rex extreme answered on November 19, 2019 01:30

Hi Frederico,

you can try adding your own style in the ckeditor. Maybe add the class that can make the image responsive. hope this helps

https://docs.kentico.com/k12/configuring-kentico/configuring-the-environment-for-content-editors/configuring-the-editor/defining-styles-for-the-editor

1 votesVote for this answer Mark as a Correct answer

Jon Waataja answered on January 2, 2020 23:04

I have the same problem and would love a better solution. I ended up using a regular expression to replace any inline styles.

{% Content.RegexReplace("style=\".*\"\s?","") %}

0 votesVote for this answer Mark as a Correct answer

James Ison answered on February 19, 2020 19:49

I'm also having this issue I just want to remove the style hgeight and width from the image tags in the WYSYWG editor CKEditor

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.