From 9a35324f1bd06efb6961ee347c9cb48b94b6b313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Wrede?= Date: Thu, 24 Jan 2019 13:49:09 +0100 Subject: [PATCH 1/7] Fix: Categories block: add custom classes only to wrapper (#13439) * add wp-block-categories as prefix * render class names only on the block wrapper * review changes --- packages/block-library/src/categories/edit.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/categories/edit.js b/packages/block-library/src/categories/edit.js index b67eb0982e0bf2..5341ad6ff51682 100644 --- a/packages/block-library/src/categories/edit.js +++ b/packages/block-library/src/categories/edit.js @@ -57,8 +57,7 @@ class CategoriesEdit extends Component { } getCategoryListClassName( level ) { - const { className } = this.props; - return `${ className }__list ${ className }__list-level-${ level }`; + return `wp-block-categories__list wp-block-categories__list-level-${ level }`; } renderCategoryName( category ) { @@ -89,7 +88,7 @@ class CategoriesEdit extends Component {
  • { this.renderCategoryName( category ) } { showPostCounts && - + { ' ' }({ category.count }) } @@ -107,7 +106,7 @@ class CategoriesEdit extends Component { } renderCategoryDropdown() { - const { showHierarchy, instanceId, className } = this.props; + const { showHierarchy, instanceId } = this.props; const parentId = showHierarchy ? 0 : null; const categories = this.getCategories( parentId ); const selectId = `blocks-category-select-${ instanceId }`; @@ -116,7 +115,7 @@ class CategoriesEdit extends Component { - { categories.map( ( category ) => this.renderCategoryDropdownItem( category, 0 ) ) } From 884cabf1af84aa3cc0e07c7b949efeb3daa085ab Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Jan 2019 08:43:15 -0500 Subject: [PATCH 2/7] Plugin: Deprecate gutenberg_remove_wpcom_markdown_support (#13473) --- .../developers/backward-compatibility/deprecations.md | 1 + lib/plugin-compat.php | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index 85e82f25549c67..b6f49917371be4 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -21,6 +21,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_register_post_prepare_functions` has been removed. - The PHP function `gutenberg_silence_rest_errors` has been removed. - The PHP function `gutenberg_filter_post_type_labels` has been removed. +- The PHP function `gutenberg_remove_wpcom_markdown_support` has been removed. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/lib/plugin-compat.php b/lib/plugin-compat.php index 963535624de4c3..74f6dbb2cb0c89 100644 --- a/lib/plugin-compat.php +++ b/lib/plugin-compat.php @@ -21,14 +21,13 @@ * plugins Jetpack, JP-Markdown, and WP Editor.MD * * @since 1.3.0 + * @deprecated 5.0.0 * * @param array $post Post object which contains content to check for block. * @return array $post Post object. */ function gutenberg_remove_wpcom_markdown_support( $post ) { - if ( class_exists( 'WPCom_Markdown' ) && has_blocks( $post['post_content'] ) ) { - WPCom_Markdown::get_instance()->unload_markdown_for_posts(); - } + _deprecated_function( __FUNCTION__, '5.0.0' ); + return $post; } -add_filter( 'wp_insert_post_data', 'gutenberg_remove_wpcom_markdown_support', 9 ); From eab7642a1da9d3e699aeefdee3e467f5c5949302 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Jan 2019 09:43:57 -0500 Subject: [PATCH 3/7] Plugin: Avoid calling deprecated gutenberg_silence_rest_errors (#13446) --- gutenberg.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index 655e883859fda6..29259acfadc277 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -187,10 +187,6 @@ function gutenberg_pre_init() { require_once dirname( __FILE__ ) . '/lib/load.php'; - if ( function_exists( 'gutenberg_silence_rest_errors' ) ) { - gutenberg_silence_rest_errors(); - } - add_filter( 'replace_editor', 'gutenberg_init', 10, 2 ); } From 6f54a83f613563d253fcde75adde75c394e0b58c Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Jan 2019 09:44:28 -0500 Subject: [PATCH 4/7] Plugin: Deprecate gutenberg_bulk_post_updated_messages (#13472) --- .../backward-compatibility/deprecations.md | 1 + lib/register.php | 21 ++++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index b6f49917371be4..d90cbfec03877b 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -22,6 +22,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_silence_rest_errors` has been removed. - The PHP function `gutenberg_filter_post_type_labels` has been removed. - The PHP function `gutenberg_remove_wpcom_markdown_support` has been removed. +- The PHP function `gutenberg_bulk_post_updated_messages` has been removed. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/lib/register.php b/lib/register.php index b86df4fd7a37f0..3dc7264a9dfb0e 100644 --- a/lib/register.php +++ b/lib/register.php @@ -538,31 +538,18 @@ function gutenberg_register_post_types() { * Apply the correct labels for Reusable Blocks in the bulk action updated messages. * * @since 4.3.0 + * @deprecated 5.0.0 * - * @param array $messages Arrays of messages, each keyed by the corresponding post type. - * @param array $bulk_counts Array of item counts for each message, used to build internationalized strings. + * @param array $messages Arrays of messages, each keyed by the corresponding post type. * * @return array */ -function gutenberg_bulk_post_updated_messages( $messages, $bulk_counts ) { - $messages['wp_block'] = array( - // translators: Number of blocks updated. - 'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'], 'gutenberg' ), - // translators: Blocks not updated because they're locked. - 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.', 'gutenberg' ) : _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'], 'gutenberg' ), - // translators: Number of blocks deleted. - 'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'], 'gutenberg' ), - // translators: Number of blocks trashed. - 'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'], 'gutenberg' ), - // translators: Number of blocks untrashed. - 'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'], 'gutenberg' ), - ); +function gutenberg_bulk_post_updated_messages( $messages ) { + _deprecated_function( __FUNCTION__, '5.0.0' ); return $messages; } -add_filter( 'bulk_post_updated_messages', 'gutenberg_bulk_post_updated_messages', 10, 2 ); - /** * Injects a hidden input in the edit form to propagate the information that classic editor is selected. * From 4d8fd5d6539b74cbffa9b2fd5e5f0683ac15db3e Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Jan 2019 10:01:56 -0500 Subject: [PATCH 5/7] Plugin: Deprecate gutenberg_kses_allowedtags (#13460) --- .../developers/backward-compatibility/deprecations.md | 1 + gutenberg.php | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index d90cbfec03877b..5e7d0d7555be4b 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -23,6 +23,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_filter_post_type_labels` has been removed. - The PHP function `gutenberg_remove_wpcom_markdown_support` has been removed. - The PHP function `gutenberg_bulk_post_updated_messages` has been removed. +- The PHP function `gutenberg_kses_allowedtags` has been removed. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/gutenberg.php b/gutenberg.php index 29259acfadc277..990418ebf74a87 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -527,19 +527,17 @@ function gutenberg_add_admin_body_class( $classes ) { * Adds attributes to kses allowed tags that aren't in the default list * and that Gutenberg needs to save blocks such as the Gallery block. * + * @deprecated 5.0.0 + * * @param array $tags Allowed HTML. * @return array (Maybe) modified allowed HTML. */ function gutenberg_kses_allowedtags( $tags ) { - if ( isset( $tags['img'] ) ) { - $tags['img']['data-link'] = true; - $tags['img']['data-id'] = true; - } + _deprecated_function( __FUNCTION__, '5.0.0' ); + return $tags; } -add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowedtags', 10, 2 ); - /** * Adds the wp-embed-responsive class to the body tag if the theme has opted in to * Gutenberg responsive embeds. From c153cc46f94a36b774ea21d88f05a53716d03922 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Thu, 24 Jan 2019 16:16:49 +0100 Subject: [PATCH 6/7] Add speak messages to the feature toggle component. (#13385) * Add speak messages to the feature toggle component. * Use plain props. --- .../components/header/feature-toggle/index.js | 21 ++++++++++++++++--- .../components/header/writing-menu/index.js | 15 ++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/edit-post/src/components/header/feature-toggle/index.js b/packages/edit-post/src/components/header/feature-toggle/index.js index 3b811e653fac41..c2de21f3ba713e 100644 --- a/packages/edit-post/src/components/header/feature-toggle/index.js +++ b/packages/edit-post/src/components/header/feature-toggle/index.js @@ -1,16 +1,30 @@ +/** + * External dependencies + */ +import { flow } from 'lodash'; + /** * WordPress Dependencies */ import { withSelect, withDispatch } from '@wordpress/data'; import { compose } from '@wordpress/compose'; -import { MenuItem } from '@wordpress/components'; +import { MenuItem, withSpokenMessages } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; + +function FeatureToggle( { onToggle, isActive, label, info, messageActivated, messageDeactivated, speak } ) { + const speakMessage = () => { + if ( isActive ) { + speak( messageDeactivated || __( 'Feature deactivated' ) ); + } else { + speak( messageActivated || __( 'Feature activated' ) ); + } + }; -function FeatureToggle( { onToggle, isActive, label, info } ) { return ( + onToggle={ onClose } + messageActivated={ __( 'Top toolbar activated' ) } + messageDeactivated={ __( 'Top toolbar deactivated' ) } + /> + onToggle={ onClose } + messageActivated={ __( 'Spotlight mode activated' ) } + messageDeactivated={ __( 'Spotlight mode deactivated' ) } + /> + onToggle={ onClose } + messageActivated={ __( 'Fullscreen mode activated' ) } + messageDeactivated={ __( 'Fullscreen mode deactivated' ) } + /> ); } From ff9961bd69c34c0caf488276b79c163bc63f94ff Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Jan 2019 10:32:47 -0500 Subject: [PATCH 7/7] Plugin: Deprecate gutenberg_add_responsive_body_class (#13461) --- .../developers/backward-compatibility/deprecations.md | 1 + gutenberg.php | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/designers-developers/developers/backward-compatibility/deprecations.md b/docs/designers-developers/developers/backward-compatibility/deprecations.md index 5e7d0d7555be4b..fe1ca0b4a287e9 100644 --- a/docs/designers-developers/developers/backward-compatibility/deprecations.md +++ b/docs/designers-developers/developers/backward-compatibility/deprecations.md @@ -24,6 +24,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa - The PHP function `gutenberg_remove_wpcom_markdown_support` has been removed. - The PHP function `gutenberg_bulk_post_updated_messages` has been removed. - The PHP function `gutenberg_kses_allowedtags` has been removed. +- The PHP function `gutenberg_add_responsive_body_class` has been removed. ## 4.5.0 - `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed. diff --git a/gutenberg.php b/gutenberg.php index 990418ebf74a87..7e019de8b8a252 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -543,15 +543,13 @@ function gutenberg_kses_allowedtags( $tags ) { * Gutenberg responsive embeds. * * @since 4.1.0 + * @deprecated 5.0.0 * * @param Array $classes Array of classes being added to the body tag. * @return Array The $classes array, with wp-embed-responsive appended. */ function gutenberg_add_responsive_body_class( $classes ) { - if ( current_theme_supports( 'responsive-embeds' ) ) { - $classes[] = 'wp-embed-responsive'; - } + _deprecated_function( __FUNCTION__, '5.0.0' ); + return $classes; } - -add_filter( 'body_class', 'gutenberg_add_responsive_body_class' );