In the classic editor I had found a plugin with which I created customised templates to be added to each individual post and to be modified as needed, without losing anything: classes, attributes and properties.
In Gutenberg I created custom HTML code that I saved as a pattern, so that I could add it to each post as and when needed. The problem occurs when I change the pattern for the individual post because Gutenberg overwrites some of my custom HTML code.
For example, I create a block by adding custom HTML code for a custom button and then save it as a pattern, like this one:
<a href="#" target="_blank" class="btn">My anchor text</a>
When I create a new post and need my customised button, I search for the pattern, add it and display it correctly. But when I change the anchor text and the hyperlink, the HTML code changes like this:
<p><a href="; target="_blank" rel="noreferrer noopener">Go to the website</a></p>
My btn
class is practically removed.
Is there any way to prevent this?