Make WordPress Core


Ignore:
Timestamp:
01/31/2024 09:09:22 AM (16 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/blocks.php

    r57372 r57493  
    6565        'editorStyle'  => 'editor-style',
    6666        'style'        => 'style',
     67        'viewStyle'    => 'view-style',
    6768    );
    6869    $asset_handle   = str_replace( '/', '-', $block_name ) .
     
    327328 * @since 6.3.0 Added `selectors` field.
    328329 * @since 6.4.0 Added support for `blockHooks` field.
     330 * @since 6.5.0 Added support for `viewStyle` field.
    329331 *
    330332 * @param string $file_or_folder Path to the JSON file with metadata definition for
     
    504506        'editorStyle' => 'editor_style_handles',
    505507        'style'       => 'style_handles',
     508        'viewStyle'   => 'view_style_handles',
    506509    );
    507510    foreach ( $style_fields as $metadata_field_name => $settings_field_name ) {
Note: See TracChangeset for help on using the changeset viewer.