admin管理员组文章数量:1305141
I'm trying to understand how you are supposed to use Gutenberg in general, but this is my problem.
I have a UI built on the admin side using the "edit" function. This UI allows you to change block settings, and I store the changes in an attribute as JSON data.
On the front end I render things based on how you wanted them to look in the UI using that JSON data.
Here's my problem, this works the first time around. If you create the block, change nothing about it and press save everything's good to go front end and back end.
However once you change anything the block breaks showing this message: The block has encountered an error and can not be previewed.
How am I supposed to put new data on the front side, if any changes break the block? I've isolated it to the save function, if I remove my front end logic and make the save function return a blank Div I'm fine.
Edit: Here is my front end save function:
export default function save( { attributes, className } ) {
let compositionData = JSON.parse(attributespositionData);
return (
<div class='FM_Composition'>
<div class="FM_Data" style="display: none;">
<pre>
<code>{ JSON.stringify(compositionData, null, 2) }</code>
</pre>
</div>
</div>
);
}
本文标签: plugin developmentGutenberg block breaks when showing new data
版权声明:本文标题:plugin development - Gutenberg block breaks when showing new data 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741799531a2398136.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论