0

When I add an image through experience editor this is the image tag I get when I inspect the source.

<img src="/sitecore/shell/-/media/image.jpg?h=2796&amp;iar=0&amp;w=4554&amp;la=nb-no" width="4554" height="2796" sc-part-of="field">

When I save, the tag is replaced with this:

<img width="4554" height="2796" class="HeroProdukt-bg-image scEnabledChrome" src="/sitecore/shell/-/jssmedia/image.jpg?h=2796&amp;iar=0&amp;w=4554" sc-part-of="field">

The code for rendering the image is :

<Image className="HeroProdukt-bg-image" field={image} />

How can I get the class on the newly added image?

1

Found a workaround. Simply create a span around the image and style that like this:

<span className="HeroProdukt-bg-image" >
    <Image field={image} />
</span>

Style is then like this:

.HeroProdukt-bg-image img {
  ...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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