Skip to content

Commit

Permalink
Site Editor - prevent loading state from showing the admin menu. (#36455
Browse files Browse the repository at this point in the history
)

* start with is-fullscreen-mode class on the body

* only add filter if loading edit site page

* remove unnecessary static prefix

* Update lib/full-site-editing/edit-site-page.php
  • Loading branch information
Addison-Stavlo authored and noisysocks committed Dec 13, 2021
1 parent a40c619 commit 9e1d551
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/full-site-editing/edit-site-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ function gutenberg_edit_site_init( $hook ) {
return;
}

// Default to is-fullscreen-mode to avoid rendering wp-admin navigation menu while loading and
// having jumps in the UI.
add_filter(
'admin_body_class',
static function( $classes ) {
return "$classes is-fullscreen-mode";
}
);

/**
* Make the WP Screen object aware that this is a block editor page.
* Since custom blocks check whether the screen is_block_editor,
* this is required for custom blocks to be loaded.
* See wp_enqueue_registered_block_scripts_and_styles in wp-includes/script-loader.php
*/
$current_screen->is_block_editor( true );

$custom_settings = array(
'siteUrl' => site_url(),
'postsPerPage' => get_option( 'posts_per_page' ),
Expand Down

0 comments on commit 9e1d551

Please sign in to comment.