Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Add block directory styles to script-loader #406

Closed
wants to merge 2 commits into from

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Jul 14, 2020

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

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


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@TimothyBJacobs
Copy link
Member

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

@ryelle
Copy link
Contributor Author

ryelle commented Jul 14, 2020

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
Copy link
Member

I'm not sure. Maybe @tellyworth knows?

@tellyworth
Copy link
Contributor

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

This allows the assets to be removed with one `remove_action`, as a method for disabling the block directory.
@ryelle ryelle force-pushed the fix/block-directory-styles branch from 9953936 to 65c5c22 Compare July 17, 2020 16:23
@ryelle
Copy link
Contributor Author

ryelle commented Jul 17, 2020

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:

add_action(
	'plugins_loaded',
	function() {
		remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_block_editor_assets_block_directory' );
	}
);

See WordPress/gutenberg#23961

@desrosj
Copy link
Contributor

desrosj commented Jul 21, 2020

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.

@desrosj desrosj closed this Jul 21, 2020
@ryelle ryelle deleted the fix/block-directory-styles branch November 3, 2020 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants