From ee691415c0706c9975901a0e59a533cec283dc89 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Thu, 21 Oct 2021 15:34:49 -0400 Subject: [PATCH 1/4] Move lineHeight and fontSize into typography object as per changes in WordPress 5.8. --- src/schemas/json/block.json | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/schemas/json/block.json b/src/schemas/json/block.json index 0d3d3439d05..36f0fcca14a 100644 --- a/src/schemas/json/block.json +++ b/src/schemas/json/block.json @@ -241,11 +241,6 @@ "description": "When the style picker is shown, a dropdown is displayed so the user can select a default style for this block type. If you prefer not to show the dropdown, set this property to false.", "default": true }, - "fontSize": { - "type": "boolean", - "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, the attributes definition is extended to include two new attributes: fontSize and style", - "default": false - }, "html": { "type": "boolean", "description": "By default, a block’s markup can be edited individually. To disable this behavior, set html to false.", @@ -256,11 +251,6 @@ "description": "By default, all blocks will appear in the inserter. To hide a block so that it can only be inserted programmatically, set inserter to false.", "default": true }, - "lineHeight": { - "type": "boolean", - "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, the attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", - "default": false - }, "multiple": { "type": "boolean", "description": "A non-multiple block can be inserted into each post, one time only. For example, the built-in ‘More’ block cannot be inserted again if it already exists in the post being edited. A non-multiple block’s icon is automatically dimmed (unclickable) to prevent multiple instances.", @@ -352,6 +342,22 @@ } } }, + "typography":{ + "type":"object", + "description": "This value signals that a block supports some of the CSS style properties related to typography. When it does, the block editor will show UI controls for the user to set their values", + "properties": { + "fontSize": { + "type": "boolean", + "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, the attributes definition is extended to include two new attributes: fontSize and style", + "default": false + }, + "lineHeight": { + "type": "boolean", + "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, the attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", + "default": false + } + } + }, "additionalProperties": true }, "styles": { From e71f47c5f8d3824155572451edd86ed3b26dc128 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Wed, 27 Oct 2021 14:51:39 -0400 Subject: [PATCH 2/4] Add back original placement and add deprecated notice to the descriptions. --- src/schemas/json/block.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/schemas/json/block.json b/src/schemas/json/block.json index 36f0fcca14a..425b2b3842a 100644 --- a/src/schemas/json/block.json +++ b/src/schemas/json/block.json @@ -241,6 +241,11 @@ "description": "When the style picker is shown, a dropdown is displayed so the user can select a default style for this block type. If you prefer not to show the dropdown, set this property to false.", "default": true }, + "fontSize": { + "type": "boolean", + "description": "Deprecated. As of WordPress 5.8, fontSize should appear in the supports.typography object.", + "default": false + }, "html": { "type": "boolean", "description": "By default, a block’s markup can be edited individually. To disable this behavior, set html to false.", @@ -251,6 +256,11 @@ "description": "By default, all blocks will appear in the inserter. To hide a block so that it can only be inserted programmatically, set inserter to false.", "default": true }, + "lineHeight": { + "type": "boolean", + "description": "Deprecated. As of WordPress 5.8, lineHeight should appear in the supports.typography object.", + "default": false + }, "multiple": { "type": "boolean", "description": "A non-multiple block can be inserted into each post, one time only. For example, the built-in ‘More’ block cannot be inserted again if it already exists in the post being edited. A non-multiple block’s icon is automatically dimmed (unclickable) to prevent multiple instances.", From e42e172407ee51cbf31279be264783ebbf4751e8 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Wed, 27 Oct 2021 16:05:21 -0400 Subject: [PATCH 3/4] Add block.json entry to schema-validation.json --- src/schema-validation.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/schema-validation.json b/src/schema-validation.json index a4d0b31b894..2b2b72a0c34 100644 --- a/src/schema-validation.json +++ b/src/schema-validation.json @@ -212,6 +212,13 @@ ] } }, + { + "block.json":{ + "unknownKeywords": [ + "typography" + ] + } + }, { "chrome-manifest.json": { "unknownFormat": [ From 7c0d954c862b4df6af460ec762eb815281a20e5a Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Wed, 27 Oct 2021 20:55:02 -0400 Subject: [PATCH 4/4] Fix posiition and remove schema-validation. json entry. --- src/schema-validation.json | 7 ------- src/schemas/json/block.json | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/schema-validation.json b/src/schema-validation.json index 2b2b72a0c34..a4d0b31b894 100644 --- a/src/schema-validation.json +++ b/src/schema-validation.json @@ -212,13 +212,6 @@ ] } }, - { - "block.json":{ - "unknownKeywords": [ - "typography" - ] - } - }, { "chrome-manifest.json": { "unknownFormat": [ diff --git a/src/schemas/json/block.json b/src/schemas/json/block.json index 425b2b3842a..1d31d792b84 100644 --- a/src/schemas/json/block.json +++ b/src/schemas/json/block.json @@ -350,21 +350,21 @@ ] } } - } - }, - "typography":{ - "type":"object", - "description": "This value signals that a block supports some of the CSS style properties related to typography. When it does, the block editor will show UI controls for the user to set their values", - "properties": { - "fontSize": { - "type": "boolean", - "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, the attributes definition is extended to include two new attributes: fontSize and style", - "default": false - }, - "lineHeight": { - "type": "boolean", - "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, the attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", - "default": false + }, + "typography":{ + "type":"object", + "description": "This value signals that a block supports some of the CSS style properties related to typography. When it does, the block editor will show UI controls for the user to set their values", + "properties": { + "fontSize": { + "type": "boolean", + "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, the attributes definition is extended to include two new attributes: fontSize and style", + "default": false + }, + "lineHeight": { + "type": "boolean", + "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, the attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", + "default": false + } } } },