Closed bobbingwide closed 3 years ago
Problems I encountered attempting to change the build process.
I copied and cobbled the package.json file from sb-starting-block and reworked with settings for UK-tides.
But I didn't know how to rebuild the node_modules. The following didn't work: npm install
, npm ci
.
Eventually, I ran npm install @wordpress/scripts --save-dev
and the build ran.
But since I'd only changed the import for ServerSideRender and the block was now being registered in the server using the block.json
method the index.assets.php
file didn't list all the dependencies.
I needed to change each const
to the equivalent import
.
eg Change from const { __ } = wp.i18n;
to import { __ } = '@wordpress/i18n';
Once I'd got the block working I then came a problem not being able to select the block. With WordPress 5.7.2 and Gutenberg 10.7.4 ( in blocks.wp-a2z.org ) the block is easily selectable.
But with the new build it's not. It's possible to select the block using the List View, but you can't see the toolbar.
The toolbar is only shown when Top Toolbar is selected.
I have the same problem with the sb-post-edit-block.
For the Post Edit block, I added the textAlign
attribute. This made the block selectable.
Let's see if adding this works for UK tides.
And also see if the change affects the results noted in https://github.com/bobbingwide/sb-post-edit-block/issues/3
Yes. Adding the textAlign toolbar icon group does make the block selectable.
No. It doesn't affect the display of the gradient. That was a block.json
/ theme.json
thing.
Oh great, I've just rebuilt the JavaScript and now I can't choose the fontSize. What did I get wrong?
UK-tides v3.0.0 is now released. Closing therefore
The UK-tides plugin was originally built using webpack. When used in WordPress 5.8 the Widget block editor produces a "doing it wrong" message due to the enqueueing of
wp-editor
. It seems the best solution is to rework the code to build it using wp-scripts which will enable use ofSee https://github.com/bobbingwide/bobbingwide/issues/30#issuecomment-885912962