Skip to content

Commit

Permalink
Enqueue commands on widget editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jbardo-godaddy committed Sep 20, 2023
1 parent 2873f18 commit a3c3e48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,17 @@ function gutenberg_register_packages_scripts( $scripts ) {
break;

case 'wp-edit-post':
array_push( $dependencies, 'media-models', 'media-views', 'postbox' );
array_push( $dependencies, 'media-models', 'media-views', 'postbox', 'wp-core-commands' );
break;

case 'wp-edit-site':
array_push( $dependencies, 'wp-dom-ready' );
array_push( $dependencies, 'wp-dom-ready', 'wp-core-commands' );
break;

case 'wp-edit-widgets':
array_push($dependencies, 'wp-core-commands');

Check failure on line 224 in lib/client-assets.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 224 in lib/client-assets.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Expected 1 spaces before closing parenthesis; 0 found
break;

case 'wp-preferences':
array_push( $dependencies, 'wp-preferences-persistence' );
break;
Expand Down Expand Up @@ -418,7 +423,7 @@ function gutenberg_register_packages_styles( $styles ) {
$styles,
'wp-edit-widgets',
gutenberg_url( 'build/edit-widgets/style.css' ),
array( 'wp-components', 'wp-block-editor', 'wp-editor', 'wp-edit-blocks', 'wp-patterns', 'wp-reusable-blocks', 'wp-widgets' ),
array( 'wp-components', 'wp-block-editor', 'wp-editor', 'wp-edit-blocks', 'wp-patterns', 'wp-reusable-blocks', 'wp-widgets', 'wp-commands' ),
$version
);
$styles->add_data( 'wp-edit-widgets', 'rtl', 'replace' );
Expand Down
4 changes: 3 additions & 1 deletion lib/experimental/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function gutenberg_enqueue_commands() {

wp_enqueue_style( 'wp-commands' );
wp_enqueue_script( 'wp-core-commands' );

wp_add_inline_script(
'wp-core-commands',
<<<'EOT'
Expand All @@ -30,7 +31,8 @@ function gutenberg_enqueue_commands() {
const root = wp.element.createRoot(mountPoint);
function CommandMenuWrapper() {
useCommands();
useCommands();
return (
wp.element.createElement(
RouterProvider,
Expand Down

0 comments on commit a3c3e48

Please sign in to comment.