Skip to content

Commit

Permalink
Merge branch 'master' into deprecate/gutenberg_content_block_version
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 24, 2019
2 parents 1537d5e + ff9961b commit f02357c
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ 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_content_block_version` has been removed. Use [`block_version`](https://developer.wordpress.org/reference/functions/block_version/) instead.
- 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.
Expand Down
22 changes: 7 additions & 15 deletions gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -531,33 +527,29 @@ 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.
*
* @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' );
7 changes: 3 additions & 4 deletions lib/plugin-compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
21 changes: 4 additions & 17 deletions lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,31 +541,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.
*
Expand Down
9 changes: 4 additions & 5 deletions packages/block-library/src/categories/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -89,7 +88,7 @@ class CategoriesEdit extends Component {
<li key={ category.id }>
<a href={ category.link } target="_blank">{ this.renderCategoryName( category ) }</a>
{ showPostCounts &&
<span className={ `${ this.props.className }__post-count` }>
<span className="wp-block-categories__post-count">
{ ' ' }({ category.count })
</span>
}
Expand All @@ -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 }`;
Expand All @@ -116,7 +115,7 @@ class CategoriesEdit extends Component {
<label htmlFor={ selectId } className="screen-reader-text">
{ __( 'Categories' ) }
</label>
<select id={ selectId } className={ `${ className }__dropdown` }>
<select id={ selectId } className="wp-block-categories__dropdown">
{ categories.map( ( category ) => this.renderCategoryDropdownItem( category, 0 ) ) }
</select>
</Fragment>
Expand Down
21 changes: 18 additions & 3 deletions packages/edit-post/src/components/header/feature-toggle/index.js
Original file line number Diff line number Diff line change
@@ -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 (
<MenuItem
icon={ isActive && 'yes' }
isSelected={ isActive }
onClick={ onToggle }
onClick={ flow( onToggle, speakMessage ) }
role="menuitemcheckbox"
label={ label }
info={ info }
Expand All @@ -30,4 +44,5 @@ export default compose( [
ownProps.onToggle();
},
} ) ),
withSpokenMessages,
] )( FeatureToggle );
15 changes: 12 additions & 3 deletions packages/edit-post/src/components/header/writing-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,26 @@ function WritingMenu( { onClose } ) {
feature="fixedToolbar"
label={ __( 'Top Toolbar' ) }
info={ __( 'Access all block and document tools in a single place' ) }
onToggle={ onClose } />
onToggle={ onClose }
messageActivated={ __( 'Top toolbar activated' ) }
messageDeactivated={ __( 'Top toolbar deactivated' ) }
/>
<FeatureToggle
feature="focusMode"
label={ __( 'Spotlight Mode' ) }
info={ __( 'Focus on one block at a time' ) }
onToggle={ onClose } />
onToggle={ onClose }
messageActivated={ __( 'Spotlight mode activated' ) }
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
/>
<FeatureToggle
feature="fullscreenMode"
label={ __( 'Fullscreen Mode' ) }
info={ __( 'Work without distraction' ) }
onToggle={ onClose } />
onToggle={ onClose }
messageActivated={ __( 'Fullscreen mode activated' ) }
messageDeactivated={ __( 'Fullscreen mode deactivated' ) }
/>
</MenuGroup>
);
}
Expand Down

0 comments on commit f02357c

Please sign in to comment.