-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update blocks to build using wp-scripts and register with block.json - starting with oik-bw/wp #42
Comments
Before starting this work I decided to commit the changes I'd made.
Before I make the other changes, I'm going update the server logic to support the additional attributes that could be expected |
I updated the server logic. It took a bit of time finding the right values for {"code":"rest_invalid_param","message":"Invalid parameter(s): attributes","data":{"status":400,"params":{"attributes":"fontSize is not a valid property of Object."},"details":{"attributes":{"code":"rest_additional_properties_forbidden","message":"fontSize is not a valid property of Object.","data":null}}}} So far I've had to add |
And {"code":"rest_invalid_param","message":"Invalid parameter(s): attributes","data":{"status":400,"params":{"attributes":"[style] is not of type string."},"details":{"attributes":{"code":"rest_invalid_type","message":"[style] is not of type string.","data":{"param":"[style]"}}}}} |
Another problem that I had was with the CSS associated with the The values were being set at the block level.
The My initial solution was to change the tags used to
|
I've implemented This may cause problems in the future:
Notes:
|
The oik-bob-bing-wide 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. import ServerSideRender from '@wordpress/server-side-render'; See bobbingwide/bobbingwide#30 (comment) Requirements
Proposed solution
Process for updating node_modules
See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/ |
While refactoring the blocks I came across the following message for a number of the blocks.
This was when I'd changed the JavaScript to register the block using just the block name and not the metadata from The solution is to register the block from |
While updating the oik-bbw/dashicon block I found a method that enabled me to use the Typography controls to set the font size. I also found it fairly easy to set the foreground colour, but not the background colour. I also discovered, by reading the documentation, that in the save method you need to call
I may need to use this technique for some other blocks. |
As determined when updating oik for Internationalization and Localization, the From:
To:
Other changes are needed in the code to:
|
After updating the makepot command it failed with an out of memory fatal error.
Increasing the memory did not resolve the problem. It took longer to fail, in a different line of code Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/d_drive/dos/wp-cli.phar/vendor/mck89/peast/lib/Peast/Syntax/ParserAbstract.php on line 235 ExplanationThe problem occurred when parsing the files in shortcodes/jquery: vis.js and vis-public.js
|
wp-scripts is now v22.1.0. While refactoring the Dashicon block in issue #46, to be delivered in oik-bob-bing-wide v2.2.1, I've finally discovered how to build each block as a separately deliverable unit. I want to revisit the method I'd used to deliver multiple internationalized blocks in The official documentation at https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#build states
The documentation shows a custom build where the entry points and custom This has been a long journey! Requirements
Proposed solution
Each block's
|
Delivered in v2.2.1. Closing therefore. |
I want to be able to style the output of the "oik-bbw/wp" block using the global styles solution.
The blocks in oik-bob-bing-wide are currently:
const { __ } = wp.i18n;
rather than the package methodimport { __ } from '@wordpress/i18n';
I believe that in order to be able to allow the blocks to support typography, colours and so on, that I need to change them:
wp-scripts
block.json
- similar tosb-post-edit-block
Requirements
Proposed solution
I know that the sb-post-edit-block allows this customisation, so I'll aim to build the blocks using the same method.
block.json
...register_block_type_from_metadata()
or whatever's the flavour of the month.metadata
loaded fromblock.json
.get_block_wrapper_attributes()
If the solution doesn't work then I'll be mystified, but at least I'll be better prepared for the future.
The text was updated successfully, but these errors were encountered: