PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.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 All 404 releases
← All changes | lib/client-assets.php +39 -7 23.4.0 → trunk 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',
@@ -431,8 +448,11 @@
431 448 // Enqueue stored styles.
432 449 add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_stored_styles' );
433 450 add_action( 'wp_footer', 'gutenberg_enqueue_stored_styles', 1 );
434 451
452 +/**
453 + * Enqueues the LaTeX to MathML loader script module in the block editor.
454 + */
435 455 add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_latex_to_mathml_loader' );
436 456 function gutenberg_enqueue_latex_to_mathml_loader() {
437 457 wp_enqueue_script_module( '@wordpress/latex-to-mathml/loader' );
438 458 }
@@ -450,8 +470,20 @@
450 470 function gutenberg_enqueue_vips_loader() {
451 471 wp_enqueue_script_module( '@wordpress/vips/loader' );
452 472 }
453 473
454 -add_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_core_abilities' );
455 -function gutenberg_enqueue_core_abilities() {
456 - 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' );
457 489 }