PluginProbe
Gutenberg / 24.0.0
Gutenberg v24.0.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | lib/client-assets.php +47 -12 23.3.124.0.0 View file →
@@ -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,8 +144,19 @@
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
148 + gutenberg_override_style(
149 + $styles,
150 + 'wp-theme',
151 + gutenberg_url( 'build/styles/theme/design-tokens' . $suffix . '.css' ),
152 + array(),
153 + $version
154 + );
155 + $styles->add_data( 'wp-theme', 'rtl', 'replace' );
156 + $styles->add_data( 'wp-theme', 'suffix', $suffix );
157 + $styles->add_data( 'wp-theme', 'path', gutenberg_dir_path() . 'build/styles/theme/design-tokens' . $suffix . '.css' );
158 +
146 159 // Register wp-base-styles and add it to the already registered wp-admin stylesheet
147 160 gutenberg_override_style(
148 161 $styles,
149 162 'wp-base-styles',
@@ -179,8 +192,12 @@
179 192 $styles->add_data( 'wp-block-library', 'path', gutenberg_dir_path() . 'build/styles/block-library/' . $block_library_filename . $suffix . '.css' );
180 193
181 194 // Only add CONTENT styles here that should be enqueued in the iframe!
182 195 $wp_edit_blocks_dependencies = array(
196 + // Design System tokens load first so the `:root` CSS custom
197 + // properties are defined before any consuming stylesheet reads
198 + // them inside the editor iframe.
199 + 'wp-theme',
183 200 'wp-components',
184 201 // This need to be added before the block library styles,
185 202 // The block library styles override the "reset" styles.
186 203 'wp-reset-editor-styles',
@@ -360,12 +377,17 @@
360 377 function gutenberg_register_vendor_scripts( $scripts ) {
361 378 $extension = SCRIPT_DEBUG ? '.js' : '.min.js';
362 379 $vendors_dir = gutenberg_dir_path() . 'build/scripts/vendors/';
363 380
381 + // When the React 19 experiment is enabled, register React 19 vendor
382 + // scripts under the `react`, `react-dom`, and `react-jsx-runtime` handles.
383 + $use_react_19 = gutenberg_is_experiment_enabled( 'gutenberg-react-19' );
384 +
364 385 $vendor_handles = array( 'react', 'react-dom', 'react-jsx-runtime' );
365 386
366 387 foreach ( $vendor_handles as $handle ) {
367 - $asset_file = $vendors_dir . $handle . '.min.asset.php';
388 + $source = $use_react_19 ? $handle . '-19' : $handle;
389 + $asset_file = $vendors_dir . $source . '.min.asset.php';
368 390 $asset = file_exists( $asset_file ) ? require $asset_file : array();
369 391 $dependencies = $asset['dependencies'] ?? array();
370 392 $version = $asset['version'] ?? '0';
371 393
@@ -371,9 +393,9 @@
371 393
372 394 gutenberg_override_script(
373 395 $scripts,
374 396 $handle,
375 - gutenberg_url( 'build/scripts/vendors/' . $handle . $extension ),
397 + gutenberg_url( 'build/scripts/vendors/' . $source . $extension ),
376 398 $dependencies,
377 399 $version
378 400 );
379 401 }
@@ -426,8 +448,11 @@
426 448 // Enqueue stored styles.
427 449 add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_stored_styles' );
428 450 add_action( 'wp_footer', 'gutenberg_enqueue_stored_styles', 1 );
429 451
452 +/**
453 + * Enqueues the LaTeX to MathML loader script module in the block editor.
454 + */
430 455 add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_latex_to_mathml_loader' );
431 456 function gutenberg_enqueue_latex_to_mathml_loader() {
432 457 wp_enqueue_script_module( '@wordpress/latex-to-mathml/loader' );
433 458 }
@@ -440,15 +465,25 @@
440 465 * when client-side media processing is triggered via @wordpress/upload-media.
441 466 *
442 467 * @see packages/vips/src/loader.ts
443 468 */
444 -if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
445 - add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_vips_loader' );
446 -}
469 +add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_vips_loader' );
447 470 function gutenberg_enqueue_vips_loader() {
448 471 wp_enqueue_script_module( '@wordpress/vips/loader' );
449 472 }
450 473
451 -add_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_core_abilities' );
452 -function gutenberg_enqueue_core_abilities() {
453 - 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' );
454 489 }