| @@ -25,11 +25,11 @@ | ||
| 25 | 25 | * Retrieves a URL to a file in the gutenberg plugin. |
| 26 | 26 | * |
| 27 | 27 | * @since 0.1.0 |
| 28 | 28 | * |
| 29 | - * @param string $path Relative path of the desired file. | |
| 29 | + * @param string $path Relative path of the desired file. | |
| 30 | 30 | * |
| 31 | - * @return string Fully qualified URL pointing to the desired file. | |
| 31 | + * @return string Fully qualified URL pointing to the desired file. | |
| 32 | 32 | */ |
| 33 | 33 | function gutenberg_url( $path ) { |
| 34 | 34 | return plugins_url( $path, __DIR__ ); |
| 35 | 35 | } |
| @@ -124,10 +124,12 @@ | ||
| 124 | 124 | // else (for development or test) default to use the current time. |
| 125 | 125 | $version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time(); |
| 126 | 126 | $suffix = SCRIPT_DEBUG ? '' : '.min'; |
| 127 | 127 | |
| 128 | - // wp-components: add dashicons (icon font dependency) | |
| 129 | - $styles->query( 'wp-components', 'registered' )->deps[] = 'dashicons'; | |
| 128 | + // wp-components: add dashicons (icon font dependency) and design tokens. | |
| 129 | + $components_style = $styles->query( 'wp-components', 'registered' ); | |
| 130 | + $components_style->deps[] = 'dashicons'; | |
| 131 | + $components_style->deps[] = 'wp-theme'; | |
| 130 | 132 | |
| 131 | 133 | // wp-edit-post: add wp-edit-blocks (custom handle not auto-inferred) |
| 132 | 134 | $styles->query( 'wp-edit-post', 'registered' )->deps[] = 'wp-edit-blocks'; |
| 133 | 135 | |
| @@ -142,12 +144,8 @@ | ||
| 142 | 144 | |
| 143 | 145 | // wp-customize-widgets: add wp-edit-blocks (custom handle not auto-inferred) |
| 144 | 146 | $styles->query( 'wp-customize-widgets', 'registered' )->deps[] = 'wp-edit-blocks'; |
| 145 | 147 | |
| 146 | - // Register wp-theme (Design System tokens from @wordpress/theme) as a | |
| 147 | - // dependency of wp-base-styles so its `:root` token block loads | |
| 148 | - // everywhere wp-base-styles does, including the editor iframe via | |
| 149 | - // $wp_edit_blocks_dependencies below. | |
| 150 | 148 | gutenberg_override_style( |
| 151 | 149 | $styles, |
| 152 | 150 | 'wp-theme', |
| 153 | 151 | gutenberg_url( 'build/styles/theme/design-tokens' . $suffix . '.css' ), |
| @@ -162,9 +160,9 @@ | ||
| 162 | 160 | gutenberg_override_style( |
| 163 | 161 | $styles, |
| 164 | 162 | 'wp-base-styles', |
| 165 | 163 | gutenberg_url( 'build/styles/base-styles/admin-schemes' . $suffix . '.css' ), |
| 166 | - array( 'wp-theme' ), | |
| 164 | + array(), | |
| 167 | 165 | $version |
| 168 | 166 | ); |
| 169 | 167 | $styles->add_data( 'wp-base-styles', 'rtl', 'replace' ); |
| 170 | 168 | $styles->add_data( 'wp-base-styles', 'suffix', $suffix ); |
| @@ -450,8 +448,11 @@ | ||
| 450 | 448 | // Enqueue stored styles. |
| 451 | 449 | add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_stored_styles' ); |
| 452 | 450 | add_action( 'wp_footer', 'gutenberg_enqueue_stored_styles', 1 ); |
| 453 | 451 | |
| 452 | +/** | |
| 453 | + * Enqueues the LaTeX to MathML loader script module in the block editor. | |
| 454 | + */ | |
| 454 | 455 | add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_latex_to_mathml_loader' ); |
| 455 | 456 | function gutenberg_enqueue_latex_to_mathml_loader() { |
| 456 | 457 | wp_enqueue_script_module( '@wordpress/latex-to-mathml/loader' ); |
| 457 | 458 | } |
| @@ -469,8 +470,20 @@ | ||
| 469 | 470 | function gutenberg_enqueue_vips_loader() { |
| 470 | 471 | wp_enqueue_script_module( '@wordpress/vips/loader' ); |
| 471 | 472 | } |
| 472 | 473 | |
| 473 | -add_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_core_abilities' ); | |
| 474 | -function gutenberg_enqueue_core_abilities() { | |
| 475 | - wp_enqueue_script_module( '@wordpress/core-abilities' ); | |
| 474 | +/** | |
| 475 | + * Enqueue the video-conversion loader script module in the block editor. | |
| 476 | + * | |
| 477 | + * This registers @wordpress/video-conversion/worker as a dynamic dependency | |
| 478 | + * in the import map, enabling on-demand loading of the WebCodecs-based | |
| 479 | + * GIF-to-video processing module when animated GIF conversion is triggered | |
| 480 | + * via @wordpress/upload-media. | |
| 481 | + * | |
| 482 | + * @see packages/video-conversion/src/loader.ts | |
| 483 | + */ | |
| 484 | +if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { | |
| 485 | + add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_video_conversion_loader' ); | |
| 486 | +} | |
| 487 | +function gutenberg_enqueue_video_conversion_loader() { | |
| 488 | + wp_enqueue_script_module( '@wordpress/video-conversion/loader' ); | |
| 476 | 489 | } |