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

Plugin: Remove replace_editor filter, extend core editor #13569

Merged
merged 3 commits into from
Mar 13, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 29, 2019

Related: #11015

This pull request seeks to eliminate Gutenberg's replace_editor feature, instead allowing the default core block editor to load, changing Gutenberg's behavior to instead extend the core block editor and replace the core script handles with the Gutenberg latest versions.

Tasks separated out:

Needs confirmation as core aligned:

@aduth aduth added [Status] In Progress Tracking issues with work in progress Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts labels Jan 29, 2019
@mcsf
Copy link
Contributor

mcsf commented Jan 30, 2019

Commented in #5670 (comment)

@aduth aduth mentioned this pull request Feb 27, 2019
5 tasks
@aduth aduth force-pushed the remove/replace-editor branch 2 times, most recently from e6f47f1 to 44351ed Compare March 1, 2019 22:08
@aduth aduth changed the title WIP: Plugin: Remove replace_editor filter, extend core editor Plugin: Remove replace_editor filter, extend core editor Mar 1, 2019
@aduth aduth removed the [Status] In Progress Tracking issues with work in progress label Mar 1, 2019
@aduth aduth force-pushed the remove/replace-editor branch 2 times, most recently from 225d2f6 to a9df08f Compare March 5, 2019 15:18
@aduth
Copy link
Member Author

aduth commented Mar 5, 2019

Build is green now 🎉

For what it's worth, I was having some issues with intermittent failures for the new tags end-to-end tests introduced in #13129 (cc @jorgefilipecosta). It should have been improved with #14219, so I might think it could have just been some caching problem.

aduth added a commit that referenced this pull request Mar 6, 2019
@gziolo gziolo added the Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code label Mar 8, 2019
@aduth aduth mentioned this pull request Mar 12, 2019
@aduth
Copy link
Member Author

aduth commented Mar 12, 2019

@jorgefilipecosta Can you please review this in mind of rebased refactor of widgets interoperability, per changes of #13511.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a set of tests with legacy widgets (including JavaScript ones), and I did not notice any difference of behavior in this version when compared with the previous one. Thank you for applying these changes that isolate the legacy widget mechanism 👍

I also did some tests with metaboxes and everything worked as before.

I left a comment regarding a dependency removal that I did not understand but other than that the changes look good to me.

@@ -299,7 +299,7 @@ function gutenberg_register_scripts_and_styles() {
gutenberg_override_style(
'wp-block-library',
gutenberg_url( 'build/block-library/style.css' ),
current_theme_supports( 'wp-block-styles' ) ? array( 'wp-block-library-theme' ) : array(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not understanding the reason for this change. I think 'wp-block-styles' should still depend on 'wp-block-library-theme' if the theme supports them.
gutenberg_override_style calls wp_register_style with the new dependencies so even if this dependency was set in core as we are registering it again we still need to pass it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have vague memories that it's done in a different way in Core and this might align both approaches. The thing is, it's not possible to call current_theme_supports in the script loader in Core.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's a bit more of an explanation in in the extended comment description for 2282ee4 . It still exists, but it's manually enqueued in core's implementation of the block scripts and styles function:

https://github.com/WordPress/wordpress-develop/blob/e421f26/src/wp-includes/script-loader.php#L2626-L2630

You can confirm this adding the following snippet somewhere in a theme which adds support for wp-block-styles (e.g. Twentynineteen):

add_action( 'enqueue_block_assets', function() {
	var_export( current_theme_supports( 'wp-block-styles' ) );
	var_export( wp_style_is( 'wp-block-library-theme', 'enqueued' ) );
	exit;
} );

Should display "truetrue" on the editor screen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the clarification @youknowriad, and @aduth.

@aduth
Copy link
Member Author

aduth commented Mar 13, 2019

I did another force-push since it seemed Travis became stuck again.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In think we should merge this soon so we have more time to test. In my tests I did not found any regression and the changes make sense to me (althougth I dont' have deep knowlodge in some of the areas).

Thank you for this changes and improvements 👍

@aduth
Copy link
Member Author

aduth commented Mar 13, 2019

Thanks for the reviews @jorgefilipecosta 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Priority] High Used to indicate top priority items that need quick attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants