-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Minor updates to @wordpress/edit-widgets for easier Core integration #26136
Minor updates to @wordpress/edit-widgets for easier Core integration #26136
Conversation
Size Change: -16 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
Testing the plugin without the Core changes, item 3 is causing problems with the legacy widget previews. Instead of previewing the widget, the previews are rendering the widgets screen and throwing the browser into a loop which crashes it after a while. Is it not possible at all to use the plain site URL in Core? |
Hey @tellthemachines thanks for testing. I improved how the plugin handles the I'd really prefer to do it this way as it lets us, in Core, keep all of the logic for handling this param nice and compartmentalised in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working well now! Also tested that users without necessary privileges can't access the Widgets screen. ✅
…26136) * Widgets editor: Reset .widgets-php styling * Widgets editor: Register blocks in all Gutenberg phases * Widgets editor: Use ?widget-preview= instead of /?widgetPreview= * Widgets editor: Remove hasPermissionsToManageWidgets * Widget editor: Fix handling of widget-preview param
Four smallish changes which will make it easier to add this package to Core (see WordPress/wordpress-develop#603).
Update the CSS to target
body.widgets-php
as well asbody.appearance_page_gutenberg-widgets
. This is the class name that the screen will have in Core.Have
@wordpress/edit-widgets
register the Legacy Widget block and the Widget Area block whenGUTENBERG_PHASE
is 1. This prevents those blocks from not being registered in Core.Use
example.com/wp-admin/widgets.php?widget-preview=
instead ofexample.com/?widgetPreview=
for Legacy Widget block previewing. This means that the code for handling this query param can be co-located with the rest ofwidgets.php
in Core.Remove
hasPermissionsToManageWidgets
. This isn't necessary as the Legacy Widget block is only ever registered in the widgets editor which can only be accessed when the logged-in user has permission to customise the site.I've tested this by copying the built packages over into Core and running it against my WIP integration branch (WordPress/wordpress-develop#603).
Need to test that these changes do not cause any regressions in the plugin, though.