Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#50661 closed defect (bug) (fixed)

Block Editor: Missing styles for block directory

Reported by: ryelle's profile ryelle Owned by: desrosj's profile desrosj
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description

It looks like the styles for the block directory aren't being loaded in the editor. They're correctly bundled into the dist file, but never enqueued.

Attachments (1)

Screen Shot 2020-07-14 at 1.33.58 PM.png (44.6 KB) - added by ryelle 5 years ago.
screenshot of current block directory result, missing styles

Download all attachments as: .zip

Change History (11)

@ryelle
5 years ago

screenshot of current block directory result, missing styles

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.5

This ticket was mentioned in PR #406 on WordPress/wordpress-develop by ryelle.


5 years ago
#2

  • Keywords has-patch added

This adds the block directory styles as a dependency of the edit-post style.

Fixed screenshot:

![Screen Shot 2020-07-14 at 1 34 27 PM](https://user-images.githubusercontent.com/541093/87458438-fc508f80-c5d7-11ea-8c06-1f6144d0b206.png)

Trac ticket: https://core.trac.wordpress.org/ticket/50661

TimothyBJacobs commented on PR #406:


5 years ago
#3

Do we need to remove the manual enqueues from edit-form-blocks.php.

ryelle commented on PR #406:


5 years ago
#4

What's the reason for enqueueing in that file, instead of setting up dependencies in script-loader? If I were to follow the JS, I'd remove the dependency here, but I'm not sure which is the preferred method.

TimothyBJacobs commented on PR #406:


5 years ago
#5

I'm not sure. Maybe @tellyworth knows?

tellyworth commented on PR #406:


5 years ago
#6

It was just a silly oversight on my part while backporting, it wasn't intentional.

ryelle commented on PR #406:


5 years ago
#7

I've moved the enqueue calls to new function, wp_enqueue_block_editor_assets_block_directory, hooked into enqueue_block_editor_assets, so script & style are both added together now.

This also provides a method for disabling the block directory, by unhooking that function:

{{{php
add_action(

'plugins_loaded',
function() {

remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_block_editor_assets_block_directory' );

}

);
}}}

See https://github.com/WordPress/gutenberg/issues/23961

#8 @desrosj
5 years ago

  • Keywords commit added
  • Owner set to desrosj
  • Status changed from new to assigned

#9 @desrosj
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 48537:

Editor: Ensure the required assets for the block directory are enqueued.

This fixes an issue where the block directory appears unstyled due to the stylesheets not being enqueued.

Props ryelle, timothyblynjacobs, earnjam.
Fixes #50661.

desrosj commented on PR #406:


5 years ago
#10

This was committed in https://core.trac.wordpress.org/changeset/48537. For reference, I went with a different function name, wp_enqueue_editor_block_directory_assets(). It read a bit more clear to me.

Note: See TracTickets for help on using tickets.