1

When creating content in a RTF field you have the option to insert tables and images. An Image is added to the RTF field with a fixed with of 100%. How can we manipulate that ?

<p>
  <img src="tcm:30-1737" title="320x198" alt="320x198" class="pull-left"/>
  Lorem Ipsum dollar - met nog meer content :)
</p>

Output in HTML

<img src="/media/320x198_tcm30-1737_w1024_n.png" alt="320x198" data-aspect="0" width="100%">
1
  • I would expect there is actually a bit more HTML outputted for that single image, since when I look in the article view there should be a <figure> tag around it too? but I have a feeling this is a defect where DXA fails to support the left, right and center alignment of images in an article RTF as mentioned in the whitelabel HTML design. Commented May 31, 2016 at 12:52

2 Answers 2

1

It is currently logged as a defect https://github.com/sdl/dxa-web-application-java/issues/41 (issue is available in both Java and .NET versions DXA), and we are looking at solving it in the upcoming 1.5 release (but no promises currently about that).

1
  • It's solved in the 1.5 development branch Commented Jun 6, 2016 at 17:03
0

The HTML for (embedded) Images is rendered by the (Core) Image View, so that is where it can be modified. https://github.com/sdl/dxa-modules/blob/master/webapp-java/dxa-module-core/src/main/resources/META-INF/resources/WEB-INF/Views/Core/Entity/Image.jsp

Note that the Image View Model has a property which indicates whether it's embedded in Rich Text or not. This can be used in the View to render different HTML if needed. See, for example: https://github.com/sdl/dxa-modules/blob/master/webapp-java/dxa-module-core/src/main/resources/META-INF/resources/WEB-INF/Views/Core/Entity/YouTubeVideo.jsp

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.