The RichText
component in the @wordpress/block-editor
package is super powerful in general. But there is once feature that I have not really come across too often. If you want to make elemtns like for example lists editabe you can set the tagName
to ul
and then add the property multiline
with the value of li
.
<RichText
tagName="ul"
multiline="li"
value={ ... }
onChange={ ... }
/>
With that we generate the experience that every time the user hits enter, they get a new list item inserted into the text that they are working with.