How to reload data stored for a sever side gutenberg block in the editor

First thing that jumps out is that in: <!– wp:mvc/block-mvc-offer-details {“data_offer”:”2426″} /–> the data_offer value is stored as a string while it’s defined attribute type is number. This could be why it’s stripped after reload. While select(‘core’).getEntityRecords does return IDs as integers it’s possible that after passing that data to <SelectControl> and then receiving the … Read more

HTML block gutenberg templates

Adding it the way you’ve suggested is not possible, and adding inline style attributes would be bad practice. However, what you want is possible by adding CSS classes, e.g. array( ‘core/heading’, array( ‘level’ => 3, ‘className’ => ‘biggerh3’, ‘placeholder’ => ‘Bigger Heading Placeholder’ ) ), Then this CSS: .biggerh3 { font-size: 1.34em; } Or by … Read more

Use core block functionality in a custom block gutenberg

There may be several other issues interacting here, but the big one is here: function onSelectImages(media) { const imagesUrl = values({…media}).map((item, i) => { return ({id: item.id, url:item.url}); }) setAttributes({ selectedImages: (values({…imagesUrl})) }); } When images are picked, you grab the images and set them as the selected images. This is not the same as … Read more

Gutenberg dependencies in package.json

Yes and no, it depends… The WP Scripts package depends on the @wordpress/dependency-extraction-webpack-plugin package at: https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin What this will do is search for packages from @wordpress and list them in a file to make it easy for you to load the list of dependencies when enqueuing. It also adjusts webpack so that it knows not … Read more