To me this seems like a really simple question so my apologies if I've missed something but I did try a search to little avail.
I'm using Bootstrap and want all images added to my content pages via TinyMCE to use the img-responsive class.
I believe I have found what I need regarding the removal of the fixed width and height values at http://www.logikfabrik.se/blog/responsive-images-in-umbraco/ but I need a way to have TinyMCE set the img-responsive class automatically for any images added.
Is this possible or am I going to be stuck manually added what I need via the code view, assuming the code view isnt then going to strip it out as unapproved HTML.
Add CSS Class to All Images via TinyMCE
Hi all,
To me this seems like a really simple question so my apologies if I've missed something but I did try a search to little avail.
I'm using Bootstrap and want all images added to my content pages via TinyMCE to use the img-responsive class.
I believe I have found what I need regarding the removal of the fixed width and height values at http://www.logikfabrik.se/blog/responsive-images-in-umbraco/ but I need a way to have TinyMCE set the img-responsive class automatically for any images added.
Is this possible or am I going to be stuck manually added what I need via the code view, assuming the code view isnt then going to strip it out as unapproved HTML.
Hi Richard,
You can use macros when add new image to RTE, in macro you will have media id as param and custom html of img tag as output.
Thanks,
Alex
Hi Richard,
I would wrap the rte output in a .bodytext div or something and then apply the responsive styles to all images in that div.
.bodytext img { responsive styles }
If you're using less or sass you can probably just extend or include the bootstrap class.
Hi Richard If your rich text editor is inside the grid editor you can do this to make the Rich Text Editor add the class to all image tags.
Open the file in Views > Partials > Grid > Editors > Rte.cshtml
Change this:
To this:
This one worked for me, although I had to slightly change the replace bit to:
Do you know how to get this working in a normal rte that's not in a grid?
Actually, this worked for me in a normal view
and also adding @using Umbraco.Web.Templates
Any of you more experienced Umbraco guys see a reason why this is not a good solution?
is working on a reply...