Hi, [I posted this on stackoverflow, but I guess this is a good place to ask]
I would like to restrict the type of document created by a rich-text-editor. Let’s assume color/styling is handled via CSS, and I only want the content editable document to be of the type:
<p class="r">I am red</p>
<p class="g">I am green</p>
<p class="b">I am blue</p>
<p class="b">I am <b>blue bold</b></p>
The rules are:
All content are in <p> tags.
Every <p> has to have a class assigned to it, which can be ‘r’, ‘g’ or ‘b’.
The content inside the tag can be only styled by <b> or <i>. * No nested <p> tags.
Is it possible to initialize an editor to only allow documents of this types. Note that <p> and <b> are stand-ins… it would be ok if the solution is to use <div> / <strong>. If possible, a simple codepen example or similar would be highly appreciated.