Skip to content

Commit

Permalink
fix loading of preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Jun 27, 2024
1 parent e7e10de commit cdf9efc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
22 changes: 15 additions & 7 deletions lib/experimental/posts/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

add_action( 'admin_menu', 'gutenberg_replace_posts_dashboard' );

// Default to is-fullscreen-mode to avoid jumps in the UI.
add_filter(
'admin_body_class',
static function ( $classes ) {
return "$classes is-fullscreen-mode";
}
);

/**
* Renders the new posts dashboard page.
*/
Expand All @@ -15,13 +23,13 @@ function gutenberg_posts_dashboard() {
// $current_screen = get_current_screen();
// $current_screen->is_block_editor( true );

Check failure on line 25 in lib/experimental/posts/load.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Functions must not contain multiple empty lines in a row; found 3 empty lines
// Default to is-fullscreen-mode to avoid jumps in the UI.
// add_filter(
// 'admin_body_class',
// static function ( $classes ) {
// return "$classes is-fullscreen-mode";
// }
// );


// $indexed_template_types = array();
// foreach ( get_default_block_template_types() as $slug => $template_type ) {
// $template_type['slug'] = (string) $slug;

Check failure on line 30 in lib/experimental/posts/load.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed
// $indexed_template_types[] = $template_type;

Check failure on line 31 in lib/experimental/posts/load.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Spaces must be used for mid-line alignment; tabs are not allowed
// }

$block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) );
$custom_settings = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const postTypesWithoutParentTemplate = [
PATTERN_TYPES.user,
];

const authorizedPostTypes = [ 'page' ];
const authorizedPostTypes = [ 'page', 'post' ];

function useResolveEditedEntityAndContext( { postId, postType } ) {
const {
Expand Down Expand Up @@ -213,7 +213,8 @@ function useResolveEditedEntityAndContext( { postId, postType } ) {
if ( postType && postId && authorizedPostTypes.includes( postType ) ) {
return { postType, postId };
}

// TODO: for post types lists we should probably not render the front page, but maybe a placeholder
// with a message like "Select a page" or something similar.
if ( homepageId ) {
return { postType: 'page', postId: homepageId };
}
Expand Down

0 comments on commit cdf9efc

Please sign in to comment.