Skip to content

Commit

Permalink
Revert removal of apiVersion for JS code
Browse files Browse the repository at this point in the history
We miss the mapping layer during registration that would transform kyes from PHP to JS.
  • Loading branch information
gziolo committed Feb 10, 2021
1 parent 5b6d8a1 commit 9b01bfd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"core": "WordPress/WordPress",
"plugins": [
"."
".",
"./esnext-exampl"
],
"themes": [
"WordPress/theme-experiments/tt1-blocks#tt1-blocks@0.4.3"
],
"themes": [ "WordPress/theme-experiments/tt1-blocks#tt1-blocks@0.4.3" ],
"env": {
"tests": {
"mappings": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ import save from './save';
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
registerBlockType( '{{namespace}}/{{slug}}', {
/**
* @see https://make.wordpress.org/core/2020/11/18/block-api-version-2/
*/
apiVersion: {{apiVersion}},

/**
* Used to construct a preview for the block to be shown in the block inserter.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/create-block/lib/init-block-json.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
const { isEmpty, omitBy } = require( 'lodash' );
const { omitBy } = require( 'lodash' );
const { join } = require( 'path' );
const { writeFile } = require( 'fs' ).promises;

Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports = async ( {
editorStyle,
style,
},
isEmpty
( value ) => ! value
),
null,
'\t'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import save from './save';
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
registerBlockType( '{{namespace}}/{{slug}}', {
/**
* @see https://make.wordpress.org/core/2020/11/18/block-api-version-2/
*/
apiVersion: {{apiVersion}},

/**
* @see ./edit.js
*/
Expand Down

0 comments on commit 9b01bfd

Please sign in to comment.