From f569284007abc531366e0d1515ff0ecd5375721c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 1 Oct 2020 14:33:45 +0100 Subject: [PATCH] Make the line height support flag stable (#25769) --- lib/block-supports/typography.php | 4 ++-- lib/global-styles.php | 2 +- packages/block-editor/README.md | 4 ++++ packages/block-editor/src/components/index.js | 2 +- .../src/components/index.native.js | 2 +- packages/block-editor/src/hooks/line-height.js | 2 +- packages/block-library/src/heading/block.json | 2 +- .../block-library/src/paragraph/block.json | 2 +- .../block-library/src/post-author/block.json | 2 +- .../src/post-comments-count/block.json | 2 +- .../src/post-comments-form/block.json | 2 +- .../block-library/src/post-comments/block.json | 2 +- .../block-library/src/post-date/block.json | 2 +- .../block-library/src/post-excerpt/block.json | 2 +- .../src/post-hierarchical-terms/block.json | 2 +- .../block-library/src/post-tags/block.json | 2 +- .../block-library/src/post-title/block.json | 2 +- .../block-library/src/site-tagline/block.json | 2 +- .../block-library/src/site-title/block.json | 2 +- .../src/components/sidebar/typography-panel.js | 5 +---- phpunit/class-block-supported-styles-test.php | 18 +++++++++--------- 21 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index 586048b9dfc7e..ef33c3249ade1 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -18,7 +18,7 @@ function gutenberg_register_typography_support( $block_type ) { $has_line_height_support = false; if ( property_exists( $block_type, 'supports' ) ) { - $has_line_height_support = gutenberg_experimental_get( $block_type->supports, array( '__experimentalLineHeight' ), false ); + $has_line_height_support = gutenberg_experimental_get( $block_type->supports, array( 'lineHeight' ), false ); } if ( ! $block_type->attributes ) { @@ -56,7 +56,7 @@ function gutenberg_apply_typography_support( $attributes, $block_attributes, $bl $has_line_height_support = false; if ( property_exists( $block_type, 'supports' ) ) { - $has_line_height_support = gutenberg_experimental_get( $block_type->supports, array( '__experimentalLineHeight' ), false ); + $has_line_height_support = gutenberg_experimental_get( $block_type->supports, array( 'lineHeight' ), false ); } // Font Size. diff --git a/lib/global-styles.php b/lib/global-styles.php index a408deea63fe5..e4ec344af7738 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -422,7 +422,7 @@ function gutenberg_experimental_global_styles_get_support_keys() { 'backgroundColor' => array( 'color' ), 'color' => array( 'color' ), 'fontSize' => array( 'fontSize' ), - 'lineHeight' => array( '__experimentalLineHeight' ), + 'lineHeight' => array( 'lineHeight' ), ); } diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index a6cf4764bf57a..45bd67c9e114f 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -400,6 +400,10 @@ _Related_ - +# **LineHeightControl** + +Undocumented declaration. + # **MediaPlaceholder** _Related_ diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index ab75507f8a171..e07cb474f05e6 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -36,7 +36,7 @@ export { default as InnerBlocks } from './inner-blocks'; export { default as InspectorAdvancedControls } from './inspector-advanced-controls'; export { default as InspectorControls } from './inspector-controls'; export { default as __experimentalLinkControl } from './link-control'; -export { default as __experimentalLineHeightControl } from './line-height-control'; +export { default as LineHeightControl } from './line-height-control'; export { default as MediaReplaceFlow } from './media-replace-flow'; export { default as MediaPlaceholder } from './media-placeholder'; export { default as MediaUpload } from './media-upload'; diff --git a/packages/block-editor/src/components/index.native.js b/packages/block-editor/src/components/index.native.js index e15f4b6c252e0..98d527026c8aa 100644 --- a/packages/block-editor/src/components/index.native.js +++ b/packages/block-editor/src/components/index.native.js @@ -13,7 +13,7 @@ export { default as AlignmentToolbar } from './alignment-toolbar'; export { default as InnerBlocks } from './inner-blocks'; export { default as InspectorAdvancedControls } from './inspector-advanced-controls'; export { default as InspectorControls } from './inspector-controls'; -export { default as __experimentalLineHeightControl } from './line-height-control'; +export { default as LineHeightControl } from './line-height-control'; export { default as PlainText } from './plain-text'; export { default as RichText, diff --git a/packages/block-editor/src/hooks/line-height.js b/packages/block-editor/src/hooks/line-height.js index b1390192608b7..d47e5eadf0788 100644 --- a/packages/block-editor/src/hooks/line-height.js +++ b/packages/block-editor/src/hooks/line-height.js @@ -10,7 +10,7 @@ import LineHeightControl from '../components/line-height-control'; import { cleanEmptyObject } from './utils'; import useEditorFeature from '../components/use-editor-feature'; -export const LINE_HEIGHT_SUPPORT_KEY = '__experimentalLineHeight'; +export const LINE_HEIGHT_SUPPORT_KEY = 'lineHeight'; /** * Inspector control panel containing the line height related configuration diff --git a/packages/block-library/src/heading/block.json b/packages/block-library/src/heading/block.json index 3c8234a65042e..4a26759da077d 100644 --- a/packages/block-library/src/heading/block.json +++ b/packages/block-library/src/heading/block.json @@ -27,7 +27,7 @@ "link": true }, "fontSize": true, - "__experimentalLineHeight": true, + "lineHeight": true, "__experimentalSelector": { "core/heading/h1": "h1", "core/heading/h2": "h2", diff --git a/packages/block-library/src/paragraph/block.json b/packages/block-library/src/paragraph/block.json index d114ec7d3476a..b1d566a387962 100644 --- a/packages/block-library/src/paragraph/block.json +++ b/packages/block-library/src/paragraph/block.json @@ -34,7 +34,7 @@ "link": true }, "fontSize": true, - "__experimentalLineHeight": true, + "lineHeight": true, "__experimentalSelector": "p", "__unstablePasteTextInline": true } diff --git a/packages/block-library/src/post-author/block.json b/packages/block-library/src/post-author/block.json index 0dd4efe9e2a3e..344eed28c733b 100644 --- a/packages/block-library/src/post-author/block.json +++ b/packages/block-library/src/post-author/block.json @@ -32,6 +32,6 @@ "gradients": true, "link": true }, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-comments-count/block.json b/packages/block-library/src/post-comments-count/block.json index 8c25fa4b9aad4..b3af9b485bac9 100644 --- a/packages/block-library/src/post-comments-count/block.json +++ b/packages/block-library/src/post-comments-count/block.json @@ -16,6 +16,6 @@ "gradients": true }, "fontSize": true, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-comments-form/block.json b/packages/block-library/src/post-comments-form/block.json index 97cdb2bdcd994..c4cf4f4682d70 100644 --- a/packages/block-library/src/post-comments-form/block.json +++ b/packages/block-library/src/post-comments-form/block.json @@ -18,6 +18,6 @@ "link": true }, "fontSize": true, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-comments/block.json b/packages/block-library/src/post-comments/block.json index a5c18aba43eec..f33765daf86de 100644 --- a/packages/block-library/src/post-comments/block.json +++ b/packages/block-library/src/post-comments/block.json @@ -22,6 +22,6 @@ "gradients": true, "link": true }, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-date/block.json b/packages/block-library/src/post-date/block.json index 739eec6e17cb6..c4c70cc62728d 100644 --- a/packages/block-library/src/post-date/block.json +++ b/packages/block-library/src/post-date/block.json @@ -20,6 +20,6 @@ "gradients": true }, "fontSize": true, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-excerpt/block.json b/packages/block-library/src/post-excerpt/block.json index e91ec302fe206..f47e4a6716e80 100644 --- a/packages/block-library/src/post-excerpt/block.json +++ b/packages/block-library/src/post-excerpt/block.json @@ -29,6 +29,6 @@ "gradients": true, "link": true }, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-hierarchical-terms/block.json b/packages/block-library/src/post-hierarchical-terms/block.json index 7725350daa98d..bb9c58bd3c822 100644 --- a/packages/block-library/src/post-hierarchical-terms/block.json +++ b/packages/block-library/src/post-hierarchical-terms/block.json @@ -21,6 +21,6 @@ "gradients": true, "link": true }, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-tags/block.json b/packages/block-library/src/post-tags/block.json index 81c0f98fa2679..e5eec89336efb 100644 --- a/packages/block-library/src/post-tags/block.json +++ b/packages/block-library/src/post-tags/block.json @@ -15,6 +15,6 @@ "gradients": true, "link": true }, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index 92e659a791011..a35dc9c01f11b 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -34,7 +34,7 @@ "gradients": true }, "fontSize": true, - "__experimentalLineHeight": true, + "lineHeight": true, "__experimentalSelector": { "core/post-title/h1": "h1", "core/post-title/h2": "h2", diff --git a/packages/block-library/src/site-tagline/block.json b/packages/block-library/src/site-tagline/block.json index dcdf6d2a28014..35249c36fdaa4 100644 --- a/packages/block-library/src/site-tagline/block.json +++ b/packages/block-library/src/site-tagline/block.json @@ -13,6 +13,6 @@ "gradients": true }, "fontSize": true, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index bfad06389176d..ababcff0447a5 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -17,6 +17,6 @@ "gradients": true }, "fontSize": true, - "__experimentalLineHeight": true + "lineHeight": true } } diff --git a/packages/edit-site/src/components/sidebar/typography-panel.js b/packages/edit-site/src/components/sidebar/typography-panel.js index 24d6ad07b41a1..d753c8efbe2c1 100644 --- a/packages/edit-site/src/components/sidebar/typography-panel.js +++ b/packages/edit-site/src/components/sidebar/typography-panel.js @@ -1,10 +1,7 @@ /** * WordPress dependencies */ -import { - FontSizePicker, - __experimentalLineHeightControl as LineHeightControl, -} from '@wordpress/block-editor'; +import { FontSizePicker, LineHeightControl } from '@wordpress/block-editor'; import { PanelBody } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; diff --git a/phpunit/class-block-supported-styles-test.php b/phpunit/class-block-supported-styles-test.php index 3485c1b23230a..c57a40e21a6e8 100644 --- a/phpunit/class-block-supported-styles-test.php +++ b/phpunit/class-block-supported-styles-test.php @@ -458,7 +458,7 @@ function test_line_height() { $block_type_settings = array( 'attributes' => array(), 'supports' => array( - '__experimentalLineHeight' => true, + 'lineHeight' => true, ), 'render_callback' => true, ); @@ -570,13 +570,13 @@ function test_all_supported() { $block_type_settings = array( 'attributes' => array(), 'supports' => array( - 'color' => array( + 'color' => array( 'gradients' => true, 'link' => true, ), - 'fontSize' => true, - '__experimentalLineHeight' => true, - 'align' => true, + 'fontSize' => true, + 'lineHeight' => true, + 'align' => true, ), 'render_callback' => true, ); @@ -659,13 +659,13 @@ function test_render_callback_required() { $block_type_settings = array( 'attributes' => array(), 'supports' => array( - 'align' => true, - 'color' => array( + 'align' => true, + 'color' => array( 'gradients' => true, 'link' => true, ), - 'fontSize' => true, - '__experimentalLineHeight' => true, + 'fontSize' => true, + 'lineHeight' => true, ), ); $this->register_block_type( 'core/example', $block_type_settings );