Make WordPress Core


Ignore:
Timestamp:
01/31/2024 09:09:22 AM (9 months ago)
Author:
gziolo
Message:

Editor: Add viewStyle property to block.json for frontend-only block styles

Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/54491.

For block scripts there was already script, viewScript and editorScript. For block styles there was only style and editorStyle. This brings the parity.

Props gaambo.
Fixes #59673.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block.php

    r56549 r57493  
    281281        }
    282282
     283        if ( ( ! empty( $this->block_type->view_style_handles ) ) ) {
     284            foreach ( $this->block_type->view_style_handles as $view_style_handle ) {
     285                wp_enqueue_style( $view_style_handle );
     286            }
     287        }
     288
    283289        /**
    284290         * Filters the content of a single block.
Note: See TracChangeset for help on using the changeset viewer.