-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modules API: Script Modules add deregister option. (#58830)
* Add deregister module function * Sync with core PR
- Loading branch information
1 parent
ac64d16
commit b0aa007
Showing
5 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Interactivity API functions specific for the Gutenberg editor plugin. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Deregisters the Core Interactivity API Modules and replace them | ||
* with the ones from the Gutenberg plugin. | ||
*/ | ||
function gutenberg_reregister_interactivity_script_modules() { | ||
$default_version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time(); | ||
wp_deregister_script_module( '@wordpress/interactivity' ); | ||
wp_deregister_script_module( '@wordpress/interactivity-router' ); | ||
|
||
wp_register_script_module( | ||
'@wordpress/interactivity', | ||
gutenberg_url( '/build/interactivity/index.min.js' ), | ||
array(), | ||
$default_version | ||
); | ||
|
||
wp_register_script_module( | ||
'@wordpress/interactivity-router', | ||
gutenberg_url( '/build/interactivity/router.min.js' ), | ||
array( '@wordpress/interactivity' ), | ||
$default_version | ||
); | ||
} | ||
|
||
add_action( 'init', 'gutenberg_reregister_interactivity_script_modules' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b0aa007
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.
Flaky tests detected in b0aa007.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7956561545
📝 Reported issues:
/test/e2e/specs/editor/blocks/navigation.spec.js