Docs: Further correct placement for wp_editor_expand filter DocBlock.

This ensures that the filter is only applied if the conditions before it are evaluated to true.

Follow-up to [48714].

Props johnbillion.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48942


git-svn-id: http://core.svn.wordpress.org/trunk@48704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-09-04 21:48:07 +00:00
parent d0a32c5111
commit dd03a5a156
2 changed files with 15 additions and 17 deletions

View File

@ -44,6 +44,10 @@ wp_enqueue_script( 'post' );
$_wp_editor_expand = false; $_wp_editor_expand = false;
$_content_editor_dfw = false; $_content_editor_dfw = false;
if ( post_type_supports( $post_type, 'editor' )
&& ! wp_is_mobile()
&& ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) )
) {
/** /**
* Filters whether to enable the 'expand' functionality in the post editor. * Filters whether to enable the 'expand' functionality in the post editor.
* *
@ -53,18 +57,12 @@ $_content_editor_dfw = false;
* @param bool $expand Whether to enable the 'expand' functionality. Default true. * @param bool $expand Whether to enable the 'expand' functionality. Default true.
* @param string $post_type Post type. * @param string $post_type Post type.
*/ */
$_wp_editor_expand_enabled = apply_filters( 'wp_editor_expand', true, $post_type ); if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {
if ( post_type_supports( $post_type, 'editor' )
&& ! wp_is_mobile()
&& ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) )
&& $_wp_editor_expand_enabled
) {
wp_enqueue_script( 'editor-expand' ); wp_enqueue_script( 'editor-expand' );
$_content_editor_dfw = true; $_content_editor_dfw = true;
$_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) ); $_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
} }
}
if ( wp_is_mobile() ) { if ( wp_is_mobile() ) {
wp_enqueue_script( 'jquery-touch-punch' ); wp_enqueue_script( 'jquery-touch-punch' );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-alpha-48941'; $wp_version = '5.6-alpha-48942';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.