Ticket #45037: 45037.5.diff
File 45037.5.diff, 5.5 KB (added by , 6 years ago) |
---|
-
src/wp-admin/admin-header.php
175 175 176 176 $admin_body_class .= ' no-customize-support no-svg'; 177 177 178 if ( $current_screen-> is_block_editor() ) {178 if ( $current_screen->get_is_block_editor() ) { 179 179 // Default to is-fullscreen-mode to avoid jumps in the UI. 180 180 $admin_body_class .= ' block-editor-page is-fullscreen-mode wp-embed-responsive'; 181 181 -
src/wp-admin/edit-form-blocks.php
29 29 30 30 // Flag that we're loading the block editor. 31 31 $current_screen = get_current_screen(); 32 $current_screen-> is_block_editor( true );32 $current_screen->set_is_block_editor( true ); 33 33 34 34 /* 35 35 * Emoji replacement is disabled for now, until it plays nicely with React. -
src/wp-admin/includes/class-wp-screen.php
187 187 * @since 5.0.0 188 188 * @var bool 189 189 */ 190 p ublic$is_block_editor = false;190 protected $is_block_editor = false; 191 191 192 192 /** 193 193 * Fetches a screen object. … … 408 408 } 409 409 410 410 /** 411 * Sets or returnswhether the block editor is loading on the current screen.411 * Sets whether the block editor is loading on the current screen. 412 412 * 413 413 * @since 5.0.0 414 414 * 415 * @param bool $set Optional. Sets whether the block editor is loading on the current screen or not. 415 * @param bool $is_block_editor. Sets whether the block editor is loading on the current screen or not. 416 */ 417 public function set_is_block_editor( $is_block_editor ) { 418 $this->is_block_editor = (bool) $is_block_editor; 419 } 420 421 /** 422 * Returns whether the block editor is loading on the current screen. 423 * 424 * @since 5.0.0 425 * 416 426 * @return bool True if the block editor is being loaded, false otherwise. 417 427 */ 418 public function is_block_editor( $set = null ) { 419 if ( $set !== null ) { 420 $this->is_block_editor = (bool) $set; 421 } 422 428 public function get_is_block_editor() { 423 429 return $this->is_block_editor; 424 430 } 425 431 -
src/wp-admin/includes/template.php
1154 1154 $block_compatible = true; 1155 1155 if ( is_array( $box[ 'args' ] ) ) { 1156 1156 // If a meta box is just here for back compat, don't show it in the block editor. 1157 if ( $screen-> is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {1157 if ( $screen->get_is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { 1158 1158 continue; 1159 1159 } 1160 1160 … … 1164 1164 } 1165 1165 1166 1166 // If the meta box is declared as incompatible with the block editor, override the callback function. 1167 if ( ! $block_compatible && $screen-> is_block_editor() ) {1167 if ( ! $block_compatible && $screen->get_is_block_editor() ) { 1168 1168 $box['old_callback'] = $box['callback']; 1169 1169 $box['callback'] = 'do_block_editor_incompatible_meta_box'; 1170 1170 } … … 1177 1177 1178 1178 $i++; 1179 1179 // get_hidden_meta_boxes() doesn't apply in the block editor. 1180 $hidden_class = ( ! $screen-> is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : '';1180 $hidden_class = ( ! $screen->get_is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : ''; 1181 1181 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n"; 1182 1182 if ( 'dashboard_browser_nag' != $box['id'] ) { 1183 1183 $widget_title = $box[ 'title' ]; … … 1196 1196 echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n"; 1197 1197 echo '<div class="inside">' . "\n"; 1198 1198 1199 if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen-> is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) {1199 if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->get_is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { 1200 1200 $plugin = _get_plugin_from_callback( $box['callback'] ); 1201 1201 if ( $plugin ) { 1202 1202 ?> -
src/wp-includes/script-loader.php
2365 2365 function wp_common_block_scripts_and_styles() { 2366 2366 global $current_screen; 2367 2367 2368 if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen-> is_block_editor() ) {2368 if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->get_is_block_editor() ) { 2369 2369 return; 2370 2370 } 2371 2371 … … 2399 2399 function wp_enqueue_registered_block_scripts_and_styles() { 2400 2400 global $current_screen; 2401 2401 2402 $is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen-> is_block_editor() );2402 $is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->get_is_block_editor() ); 2403 2403 2404 2404 $block_registry = WP_Block_Type_Registry::get_instance(); 2405 2405 foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {