-
Notifications
You must be signed in to change notification settings - Fork 798
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
Standalone Block Registration/Block Dependencies #10503
Conversation
…ules. Structure for declaring block dependencies.
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 4, 2018. Generated by 🚫 dangerJS |
Beside the minor renaming of things I think this works as expected. I tested this with the JN link above and it worked as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor improvements that I think we could make.
…file only if Gutenberg is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well on my end. 👍
Good for me too. @jeffersonrabb feel free to merge if you're ready to have it land. |
This adds a few pieces needed for the Map block (and similar future ones) to work following recent changes to block building and view script loading in #10405 and Automattic/wp-calypso#28066.
Fixes
modules/
. Here, this is done inmodules/blocks.php
.Testing instructions:
To test the Map block, it will need to be built from the https://github.com/Automattic/wp-calypso/tree/try/map-key branch. The Calypso branch resolves a naming consistency problem (
map
vs.maps-block
) and temporarily adds a hardcoded Google Maps API key so it can be used without the changes in https://github.com/Automattic/wp-calypso/tree/try/map-key. This Calypso branch is meant only for testing with this PR, and will be deleted after this PR merges.To test with Jetpack docker:
wp-calypso
branch try/map-key.jetpack
branchtry/block-dependencies
.wp-calypso
repo:npm run sdk gutenberg client/gutenberg/extensions/presets/jetpack -- --output-dir=PATH_TO_JETPACK_REPO/_inc/blocks
. (Replace PATH_TO_JETPACK_REPO with relevant path)._inc/blocks/map/
exists and containsview.css|view.js|view.rtl.css
.To test with Jurassic Ninja use this link:
https://jurassic.ninja/create/?gutenberg&gutenpack&shortlived&jetpack-beta&calypsobranch=try/map-key&branch=try/block-dependencies
Flows to verify
1: Verify that Map block loads and renders in editor and view. If the view.js or any of the dependencies are missing the block will be completely blank.
2: In view, watch Network tab to verify that all dependent Javascript files are loading. Among others you should see:
/wp-content/plugins/jetpack/_inc/blocks/map/view.js
/wp-content/plugins/gutenberg/vendor/react-dom.min
/wp-content/plugins/gutenberg/vendor/react.min.ab6b06d4.js
(or similar)/wp-content/plugins/gutenberg/build/element/index.js
/wp-content/plugins/gutenberg/build/i18n/index.js
/wp-content/plugins/gutenberg/build/api-fetch/index.js
3: Remove the map block (or create a second post without it), publish and view. In the Network tab none of the above files should be loading.
Proposed changelog entry for your changes: