Update the dependencies so that we can use the viewModule block.json entry, which wp-scripts will correctly build as a module (required by the interactivity API script).
The updated wp-scripts requires a more modern node version, so I've also updated the version for this project to 20 (see https://github.com/WordPress/wporg-parent-2021/issues/122, we'll want to do this across all projects). I've pushed the package and node version updates to main, so this PR only contains the Interactivity API updates.
The changes for the Interactivity API are mostly following the changelog recommendations. The exception is the change to how the screenshots are rendered. Rather than directly manipulating the DOM, the new method uses a combination of directives and state values to show/hide the image once it's loaded. This is more in line with expected behavior from the Interactivity API.
Fixes #267.
To test
Update composer packages so you have the latest Gutenberg: composer update
Update node: nvm install
Update yarn deps: yarn
Build the theme: yarn build:theme
Start the env: yarn wp-env start
Click through the site, all the screenshots should show up correctly— if no local image is attached, there should be a loading spinner, and then load in the mshots image.
Merge alongside https://github.com/WordPress/wporg-mu-plugins/pull/561, so that production has current Gutenberg version.
Update the dependencies so that we can use the
viewModule
block.json entry, which wp-scripts will correctly build as a module (required by the interactivity API script).The updated wp-scripts requires a more modern node version, so I've also updated the version for this project to 20 (see https://github.com/WordPress/wporg-parent-2021/issues/122, we'll want to do this across all projects). I've pushed the package and node version updates to
main
, so this PR only contains the Interactivity API updates.The changes for the Interactivity API are mostly following the changelog recommendations. The exception is the change to how the screenshots are rendered. Rather than directly manipulating the DOM, the new method uses a combination of directives and state values to show/hide the image once it's loaded. This is more in line with expected behavior from the Interactivity API.
Fixes #267.
To test
composer update
nvm install
yarn
yarn build:theme
yarn wp-env start