image icon indicating copy to clipboard operation
image copied to clipboard

should not use `div` wrapper

Open willin opened this issue 3 years ago • 2 comments

When i use the component in markdown or mdx, the generated codes a bit like:

<p>
    <div class="rc-image" style="width: 200px;">
        <img class="rc-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
    </div>
</p>

However, the P element represents a paragraph. It cannot contain block-level elements (including P itself).

willin avatar Jan 31 '22 04:01 willin

another downside of the current wrapper handling is that the classnames are trapped on the <img> instead of transferred to the wrapper, so the styling is difficult - especially if you use tailwindcss, you'll need to add another wrapper yourself

image

rickyzhangca avatar Mar 21 '22 04:03 rickyzhangca

How about adding a component="div" for customization?

afc163 avatar Aug 08 '22 05:08 afc163