[wp-trac] [WordPress Trac] #57561: Update conditional logic for editor_styles

WordPress Trac noreply at wordpress.org
Thu Jan 26 14:29:45 UTC 2023


#57561: Update conditional logic for editor_styles
---------------------------+-----------------------------
 Reporter:  mikachan       |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Currently the logic for including `editor_styles` is inconsistent in some
 places where it is called. We should make this consistent so that both the
 editor and the front end receive styles using the same logic.

 An example of an inconsistency this is currently causing is the width
 separator block on the homepage of Twenty Twenty-Three. As Twenty Twenty-
 Three does not include any editor styles, the opinionated block styles
 (`wp-block-styles`) are included in the editor but not on the front end.
 This is because the following logic is being used:

 {{{
         if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0
 ) {
                 $wp_edit_blocks_dependencies[] = 'wp-block-library-theme';
         }
 }}}

 But this should also include a check for `wp-block-styles`, for example:


 {{{
         if (
                 current_theme_supports( 'wp-block-styles' ) &&
                 ( ! is_array( $editor_styles ) || count( $editor_styles )
 === 0 )
         ) {
                 $wp_edit_blocks_dependencies[] = 'wp-block-library-theme';
         }
 }}}

 This was originally opened in the editor, but I believe the changes will
 need to be separately merged with Core anyway, so I've opened a ticket
 here as well.

 Editor PR: https://github.com/WordPress/gutenberg/pull/45351

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57561>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list