2

Is there a way to disable the Rich Text Editor from adding styling to images that are inserted into the field? I am specifically referring to use of the RTE in the administration portal.

For example if I add an image it automatically has:

<figure style="text-align: center;"><img alt="" src="http://www.domain.com/uploads/assets/743280d7.hero2.jpg"></figure>​

Is there a way to have it default to just showing:

<img alt="" src="http://www.domain.com/uploads/assets/743280d7.hero2.jpg">

Thanks!

1 Answer 1

2

This happens in /system/expressionengine/rte_tools/image/rte.image.js around line 75

var $img = $('<figure/>')
                .css('text-align','center')
                .append(
                    $('<img alt=""/>')
                    .attr('src', image_object.thumb.replace(/_thumbs\//, ''))
                );

It would appear the image is being wrapped in a <figure> tag to allow for alignment (left, right) and to add a caption, if present, in a nested <figcaption> tag.

Probably only way to avoid this is to edit the script.

3
  • Sounds like a decent option as long as you dont require RTE in other areas. I will give this a shot and report back in a bit! Thanks Jan 17, 2013 at 22:17
  • That worked great! I changed that line to: var $img = $('<span/>') .append( $('<img alt=""/>') .attr('src', image_object.thumb.replace(/_thumbs\//, '')) ); Jan 29, 2013 at 0:07
  • Cool, glad it worked out for you. Jan 30, 2013 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.