Feature: add inner text / html support
Feature
This adds support for content & text attribute used by most low-level blocks (like heading, paragraph, button...) and so it keeps content inside them (some html tags are filtered, like RichText component does it).
It fixes this issue: #5 , it lacks some features still (like button link...) but still better than nothing
Test
Used this HTML gutenberg code to test the feature:
<!-- wp:heading -->
<h2 class="wp-block-heading">Default title</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">H3 title</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Paragraph text</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><strong>Bold paragraph text</strong></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><em>Italic text</em></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><s>Strikethrough text</s></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><code>Code text</code></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><sup>Superscript text</sup></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><sub>Subscript text</sub></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><mark style="background-color:var(--wp--custom--color--primary--vert-macif)" class="has-inline-color has-contrast-color">Highlight text</mark></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><a href="#link">Link text</a></p>
<!-- /wp:paragraph -->
<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="#button-link">Button text</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
Result
Works for both PHP formatting and JS formatting:
Before:
After:
Actually, i still need to work on it to add some html support (because text formatting wont be saved, like tags: <strong>, <em>...)
Updated screenshots + description, should be good now
Thanks @DamChtlv - I'm hoping to take a look at this soon. We've had a wild couple months. :)