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

Fix block widget edit shortcuts #53

Merged
merged 1 commit into from
Sep 13, 2021
Merged

Fix block widget edit shortcuts #53

merged 1 commit into from
Sep 13, 2021

Conversation

chriskmnds
Copy link
Contributor

Changes introduced

An attempt at disabling overriding the default/core shortcut placements for widget controls. Addresses Automattic/wp-calypso#55365

Test

  1. Apply D66741-code to your sandbox
  2. Open a sandboxed site and go the customizer (withe the ?guide parameter) e.g. https://[foo.wordpress.com]/wp-admin/customize.php?guide
  3. Add block widgets in the footer and test it out.

Kapture 2021-09-13 at 14 39 22

Known regressions/follow ups

  1. The styling of the widget shortcut buttons is different from the plugin's (also transitions a little differently). A follow-up could address this in the context of merging the two methods: either introduce title/footer shortcuts in core (?) or use the new partials API in this plugin.
  2. Only tested this on a simple site with a couple of themes - no idea if any regressions in JP or elsewhere.

Screenshot 2021-09-13 at 2 50 03 PM

Comment on lines +25 to +30
const createEditShortcutForPlacement = api.selectiveRefresh.Partial.prototype.createEditShortcutForPlacement;
api.selectiveRefresh.Partial.prototype.createEditShortcutForPlacement = function( ...args ) {
if ( args[ 0 ] && args[ 0 ].partial && args[ 0 ].partial.id.startsWith( 'widget' ) ) {
createEditShortcutForPlacement.apply( this, args );
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this even legal? 😆

Copy link

Choose a reason for hiding this comment

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

As long as it fixes it! 👍

@yansern
Copy link

yansern commented Sep 13, 2021

Tested & working.

2021-09-13_15-48-04.mp4

Copy link

@yansern yansern left a comment

Choose a reason for hiding this comment

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

In the phab patch, I've added another commit for cachebusting timestamp.

This PR is working now. What's going on technically it is preventing this old plugin from overriding the widget editing functionalities, and let core do its thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants