This is more a "am I understanding this right" kind of question:
When I create a custum Gutenberg Block that should be used by an user of role Editor(which has no unfiltered_html capability on a multisite), I am limited to whatever html wordpress allows this user to post.
Example:
My save function has jsx like this:
<p style={myStyles}>{props.attributes.text}</p>
which gets rendered to
<p style="opacity:0.5">Hello World</p>
This would get filtered out and the block would not work.
Additionally, this Block would work for a Super-Admin and when he creates a post using this block and an Editor comes in later to adapt it, it would break the block, because it expects the mark-up that was filtered out.
Is this the expected behaviour?
This is more a "am I understanding this right" kind of question:
When I create a custum Gutenberg Block that should be used by an user of role Editor(which has no unfiltered_html capability on a multisite), I am limited to whatever html wordpress allows this user to post.
Example:
My save function has jsx like this:
<p style={myStyles}>{props.attributes.text}</p>
which gets rendered to
<p style="opacity:0.5">Hello World</p>
This would get filtered out and the block would not work.
Additionally, this Block would work for a Super-Admin and when he creates a post using this block and an Editor comes in later to adapt it, it would break the block, because it expects the mark-up that was filtered out.
Is this the expected behaviour?
The recommended way of using RichText Component inside save function is -
<RichText.Content
tagName="p"
style={ styles }
className={ className ? className : undefined }
value={ content }
dir={ direction }
/>
See, how this core paragraph block is doing it. Instead of using normal HTML use RichText Content on text fields