[RNMobile] Shortcode block support#19534
[RNMobile] Shortcode block support#19534koke merged 14 commits intoWordPress:masterfrom chipsnyder:rnmobile/shortcode-support
Conversation
There was a problem hiding this comment.
It's quite a task to coordinate both Gutenberg and WordPress core :)
PHP files without any change are copied to this location in WordPress core:
https://github.com/WordPress/wordpress-develop/tree/master/src/wp-includes/blocks
block.json files aren't copied over in both Gutenberg and WordPress core and with the current folder structure, I don't think it would be possible.
All PHP are whitelisted in WP core in here:
https://github.com/WordPress/wordpress-develop/blob/14376be6e195ce9cc7f4bf237651504777b504fb/tools/webpack/packages.js#L97-L109
I think it wouldn't be that hard to change it to something else and include block.json files there. I guess the simplest approach would be to put PHP file and its JSON file in the same folder to make them easy to reference.
In Gutenberg, PHP files for blocks are copied to the build folder with this logic:
Lines 117 to 151 in 3caee37
@aduth can provide more details for the PHP changes applied in Gutenberg if you need it for anything.
There was a problem hiding this comment.
It's quite a task to coordinate both Gutenberg and WordPress core :)
😄
Thanks for the guidance @gziolo, I'll get to work on including the block.json files in those directories.
There was a problem hiding this comment.
I went ahead and made those adjustments
For Gutenberg the change is here:
https://github.com/WordPress/gutenberg/pull/19534/files#diff-11e9f7f953edc64ba14b0cc350ae7b9dR152-R158
Then in WordPress core, I made the changes here:
https://github.com/chipsnyder/wordpress-develop/blob/rnmobile/shortcode-support/tools/webpack/packages.js#L155-L163
I haven't opened up a PR for the changes to WordPress core yet because I wanted to check to see if this was in line with what you were thinking. I also wasn't sure about the process for that on updating the block-library package then committing the change and so forth.
There was a problem hiding this comment.
Yes, this is more or less what's necessary to get started. There is this question whether the PHP file and block.json file should be put in their own folder:
-- build/block-library/blocks
-- shortcode
-- index.php
-- block.json
There was a problem hiding this comment.
If block.json is renamed to shortcode.json then we'll have to replace the filename to read in the php file as well.
There was a problem hiding this comment.
then we'll have to replace the filename to read in the php file as well.
Is this ( https://github.com/WordPress/gutenberg/pull/19534/files#diff-0272f9f4a31a060e383e4d3cf5d5c7feR24 ) the change you're thinking of?
There was a problem hiding this comment.
Ah yes, I missed that one
No problem 🙂
I opened a PR for the WordPress-develop changes WordPress/wordpress-develop#131
@gziolo or @koke Do either of you know the process for updating the block-library version there?
Should it be part of that PR or should I open a new one after this merges?
There was a problem hiding this comment.
@wordpress/block-library is updated from npm. The changes applied to Gutenberg are released with the plugin release every two weeks and then published to npm.
…converted to block
koke
left a comment
There was a problem hiding this comment.
I tested this and it works fine now, but I'm worried that this could get confusing. The JSON file is named block.json, and the JS file imports block.json, but the PHP imports shortcode.json.
I'm going to approve this one, but we might want to consider an alternative
Description
Adds React Native support for the shortcode block and modifies the shortcode PHP registration so that attributes are exposed to both the javascript and PHP registration.
Implements: wordpress-mobile/gutenberg-mobile#690
How has this been tested?
Add New Shortcode
Edit existing Shortcode
Screenshots
Placeholder
iOS
Android
Static
iOS
Android
Selected
iOS
Android
Types of changes
Checklist: