Block editor: separate content styles for the iframe#44298
Conversation
|
Size Change: -4.18 kB (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
bc7d529 to
1d48fff
Compare
lib/experimental/content-assets.php
Outdated
|
|
||
| $script_handles = array(); | ||
| $style_handles = array( | ||
| 'wp-edit-blocks', |
There was a problem hiding this comment.
This function has been taken over exactly from core, except for the removal of the wp-block-editor dependency and also wp-block-library that is a dependency of wp-edit-blocks.
gutenberg/lib/compat/wordpress-6.0/client-assets.php
Lines 38 to 112 in 749e412
There was a problem hiding this comment.
Should this file be moved to gutenberg/lib/compact/wordpress-6.2/script-loader.php instead?
There was a problem hiding this comment.
I guess? I'm not familiar with the new structure for PHP code. 😄
youknowriad
left a comment
There was a problem hiding this comment.
This makes sense to me. Do you expect any changes/breakage based on this change?
lib/experimental/content-assets.php
Outdated
|
|
||
| $script_handles = array(); | ||
| $style_handles = array( | ||
| 'wp-edit-blocks', |
There was a problem hiding this comment.
Should this file be moved to gutenberg/lib/compact/wordpress-6.2/script-loader.php instead?
youknowriad
left a comment
There was a problem hiding this comment.
I think there are some styles in BlockPreview that should go into the "content" styles. Like the ones targeting block-editor-block-preview__content-iframe
9ccd60a to
290a0ca
Compare
Moved them also to a content stylesheet. |
|
Hi @ellatrix ! This PR seems to break the styles of the block toolbar when dragged (I can't provide a screenshot 😅 ) It's missing it's dark background and white text color |
|
@corentin-gautier Seems to have been removed by accident! Restored in #46396. |
| $style_handles = array_merge( | ||
| $style_handles, | ||
| $block_type->style_handles, | ||
| $block_type->editor_style_handles | ||
| ); | ||
|
|
||
| $script_handles = array_merge( | ||
| $script_handles, | ||
| $block_type->script_handles | ||
| ); |
There was a problem hiding this comment.
@ellatrix We think that this code is causing a fatal error in WordPress 6.0 with the latest version of the Gutenberg plugin. 🤔
Since these block_type->style_handles, etc. properties were added in WordPress 6.1, this code becomes array_merge( $style_handles, NULL, NULL ), which throws a warning in PHP <8, but a fatal error in PHP 8.
I have a fix here: #46488, which just checks for null values, but just a heads up in case further work is needed to support 6.0 here
…_assets() and wp_default_styles(). This changeset: * Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`). * Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies. Why? These PHP changes are part of the initiative to: * Separate the content styles contained in the block editor package into a separate stylesheet. * Avoid loading all block editor styles into the iframe. References: * [WordPress/gutenberg#44298 Gutenberg PR 44298]. Follow-up to [53160], [50761]. Props ellatrix, youknowriad. Fixes #57550. git-svn-id: https://develop.svn.wordpress.org/trunk@55179 602fd350-edb4-49c9-b593-d223f7449a82
…_assets() and wp_default_styles(). This changeset: * Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`). * Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies. Why? These PHP changes are part of the initiative to: * Separate the content styles contained in the block editor package into a separate stylesheet. * Avoid loading all block editor styles into the iframe. References: * [WordPress/gutenberg#44298 Gutenberg PR 44298]. Follow-up to [53160], [50761]. Props ellatrix, youknowriad. Fixes #57550. Built from https://develop.svn.wordpress.org/trunk@55179 git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…_assets() and wp_default_styles(). This changeset: * Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`). * Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies. Why? These PHP changes are part of the initiative to: * Separate the content styles contained in the block editor package into a separate stylesheet. * Avoid loading all block editor styles into the iframe. References: * [WordPress/gutenberg#44298 Gutenberg PR 44298]. Follow-up to [53160], [50761]. Props ellatrix, youknowriad. Fixes #57550. Built from https://develop.svn.wordpress.org/trunk@55179 git-svn-id: https://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…_assets() and wp_default_styles(). This changeset: * Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`). * Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies. Why? These PHP changes are part of the initiative to: * Separate the content styles contained in the block editor package into a separate stylesheet. * Avoid loading all block editor styles into the iframe. References: * [WordPress/gutenberg#44298 Gutenberg PR 44298]. Follow-up to [53160], [50761]. Props ellatrix, youknowriad. Fixes #57550. Built from https://develop.svn.wordpress.org/trunk@55179 git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Related: #37466.
Separates the content styles contained in the block editor package into a separate style sheet.
Why?
We shouldn't be loading all block editor styles in the iframe.
How?
Testing Instructions
Screenshots or screencast