Skip to content

Commit

Permalink
lightBlockWrapper => apiVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Sep 25, 2020
1 parent e22a8dc commit 1375643
Show file tree
Hide file tree
Showing 42 changed files with 59 additions and 71 deletions.
7 changes: 1 addition & 6 deletions packages/block-editor/src/components/block-edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ export const Edit = ( props ) => {
// with which a block is displayed. If `blockType` is valid, assign
// them preferentially as the render value for the block.
const Component = blockType.edit || blockType.save;
const lightBlockWrapper = hasBlockSupport(
blockType,
'lightBlockWrapper',
false
);

if ( lightBlockWrapper ) {
if ( blockType.apiVersion >= 1 ) {
return <Component { ...props } context={ context } />;
}

Expand Down
4 changes: 1 addition & 3 deletions packages/block-editor/src/components/block-edit/test/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ describe( 'Edit', () => {
it( 'should assign context', () => {
const edit = ( { context } ) => context.value;
registerBlockType( 'core/test-block', {
apiVersion: 1,
category: 'text',
title: 'block title',
usesContext: [ 'value' ],
supports: {
lightBlockWrapper: true,
},
edit,
save: noop,
} );
Expand Down
6 changes: 1 addition & 5 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ function BlockListBlock( {
const onBlockError = () => setErrorState( true );

const blockType = getBlockType( name );
const lightBlockWrapper = hasBlockSupport(
blockType,
'lightBlockWrapper',
false
);
const lightBlockWrapper = blockType.apiVersion >= 1;
const isUnregisteredBlock = name === getUnregisteredTypeHandlerName();

// Determine whether the block has props to apply to the wrapper.
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/audio/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/audio",
"category": "media",
"attributes": {
Expand Down Expand Up @@ -37,7 +38,6 @@
},
"supports": {
"anchor": true,
"align": true,
"lightBlockWrapper": true
"align": true
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/button",
"category": "design",
"parent": [
Expand Down Expand Up @@ -57,7 +58,6 @@
"anchor": true,
"align": true,
"alignWide": false,
"reusable": false,
"lightBlockWrapper": true
"reusable": false
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/buttons/block.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"apiVersion": 1,
"name": "core/buttons",
"category": "design",
"supports": {
"anchor": true,
"align": true,
"alignWide": false,
"lightBlockWrapper": true
"alignWide": false
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/code/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/code",
"category": "text",
"attributes": {
Expand All @@ -9,7 +10,6 @@
}
},
"supports": {
"anchor": true,
"lightBlockWrapper": true
"anchor": true
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/column/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/column",
"category": "text",
"parent": [
Expand All @@ -17,7 +18,6 @@
"supports": {
"anchor": true,
"reusable": false,
"html": false,
"lightBlockWrapper": true
"html": false
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/columns/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/columns",
"category": "design",
"attributes": {
Expand All @@ -13,7 +14,6 @@
"full"
],
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true,
"linkColor": true
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/cover",
"category": "media",
"attributes": {
Expand Down Expand Up @@ -49,7 +50,6 @@
"anchor": true,
"align": true,
"html": false,
"lightBlockWrapper": true,
"__experimentalPadding": true
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/group/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/group",
"category": "design",
"attributes": {
Expand All @@ -14,7 +15,6 @@
],
"anchor": true,
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true,
"linkColor": true
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/heading/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/heading",
"category": "text",
"attributes": {
Expand All @@ -22,7 +23,6 @@
"supports": {
"anchor": true,
"className": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"linkColor": true
},
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/image",
"category": "media",
"attributes": {
Expand Down Expand Up @@ -70,7 +71,6 @@
}
},
"supports": {
"anchor": true,
"lightBlockWrapper": true
"anchor": true
}
}
4 changes: 2 additions & 2 deletions packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/list",
"category": "text",
"attributes": {
Expand Down Expand Up @@ -30,7 +31,6 @@
"__experimentalColor": {
"gradients": true
},
"__unstablePasteTextInline": true,
"lightBlockWrapper": true
"__unstablePasteTextInline": true
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/media-text/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/media-text",
"category": "media",
"attributes": {
Expand Down Expand Up @@ -84,7 +85,6 @@
"anchor": true,
"align": [ "wide", "full" ],
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true,
"linkColor": true
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation-link/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/navigation-link",
"category": "design",
"parent": [ "core/navigation" ],
Expand Down Expand Up @@ -40,7 +41,6 @@
],
"supports": {
"reusable": false,
"html": false,
"lightBlockWrapper": true
"html": false
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/navigation",
"category": "design",
"attributes": {
Expand Down Expand Up @@ -48,7 +49,6 @@
"anchor": true,
"html": false,
"inserter": true,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"textColor": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/paragraph",
"category": "text",
"attributes": {
Expand Down Expand Up @@ -29,7 +30,6 @@
"supports": {
"anchor": true,
"className": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"linkColor": true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-author/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-author",
"category": "design",
"attributes": {
Expand Down Expand Up @@ -26,7 +27,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"gradients": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments-count/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-comments-count",
"category": "design",
"attributes": {
Expand All @@ -11,7 +12,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-comments-form",
"category": "design",
"attributes": {
Expand All @@ -12,7 +13,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true,
"linkColor": true
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-comments",
"category": "design",
"attributes": {
Expand All @@ -12,7 +13,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"align": [
"wide",
"full"
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-date/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-date",
"category": "design",
"attributes": {
Expand All @@ -15,7 +16,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-excerpt",
"category": "design",
"attributes": {
Expand All @@ -23,7 +24,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"gradients": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-hierarchical-terms",
"category": "design",
"attributes": {
Expand All @@ -15,7 +16,6 @@
],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"gradients": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-tags/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-tags",
"category": "design",
"attributes": {
Expand All @@ -9,7 +10,6 @@
"usesContext": [ "postId", "postType" ],
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"gradients": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/post-title",
"category": "design",
"usesContext": [
Expand Down Expand Up @@ -29,7 +30,6 @@
},
"supports": {
"html": false,
"lightBlockWrapper": true,
"__experimentalColor": {
"gradients": true
},
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/preformatted/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"apiVersion": 1,
"name": "core/preformatted",
"category": "text",
"attributes": {
Expand All @@ -11,7 +12,6 @@
}
},
"supports": {
"anchor": true,
"lightBlockWrapper": true
"anchor": true
}
}
Loading

0 comments on commit 1375643

Please sign in to comment.