wp core update 6.6
This commit is contained in:
@@ -470,13 +470,19 @@ class Cookie {
|
||||
* @param \WpOrg\Requests\Iri|null $origin URI for comparing cookie origins
|
||||
* @param int|null $time Reference time for expiration calculation
|
||||
* @return array
|
||||
*
|
||||
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $origin argument is not null or an instance of the Iri class.
|
||||
*/
|
||||
public static function parse_from_headers(Headers $headers, Iri $origin = null, $time = null) {
|
||||
public static function parse_from_headers(Headers $headers, $origin = null, $time = null) {
|
||||
$cookie_headers = $headers->getValues('Set-Cookie');
|
||||
if (empty($cookie_headers)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if ($origin !== null && !($origin instanceof Iri)) {
|
||||
throw InvalidArgument::create(2, '$origin', Iri::class . ' or null', gettype($origin));
|
||||
}
|
||||
|
||||
$cookies = [];
|
||||
foreach ($cookie_headers as $header) {
|
||||
$parsed = self::parse($header, '', $time);
|
||||
|
||||
@@ -148,7 +148,7 @@ class Requests {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '2.0.9';
|
||||
const VERSION = '2.0.11';
|
||||
|
||||
/**
|
||||
* Selected transport name
|
||||
|
||||
@@ -144,7 +144,15 @@ final class Fsockopen implements Transport {
|
||||
$verifyname = false;
|
||||
}
|
||||
|
||||
stream_context_set_option($context, ['ssl' => $context_options]);
|
||||
// Handle the PHP 8.4 deprecation (PHP 9.0 removal) of the function signature we use for stream_context_set_option().
|
||||
// Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#stream_context_set_option
|
||||
if (function_exists('stream_context_set_options')) {
|
||||
// PHP 8.3+.
|
||||
stream_context_set_options($context, ['ssl' => $context_options]);
|
||||
} else {
|
||||
// PHP < 8.3.
|
||||
stream_context_set_option($context, ['ssl' => $context_options]);
|
||||
}
|
||||
} else {
|
||||
$remote_socket = 'tcp://' . $host;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||
array(
|
||||
'parent' => 'site-name',
|
||||
'id' => 'edit-site',
|
||||
'title' => __( 'Edit Site' ),
|
||||
'title' => __( 'Manage Site' ),
|
||||
'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ),
|
||||
)
|
||||
);
|
||||
@@ -455,6 +455,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
|
||||
* @since 6.6.0 Added the `canvas` query arg to the Site Editor link.
|
||||
*
|
||||
* @global string $_wp_current_template_id
|
||||
*
|
||||
@@ -481,6 +482,7 @@ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
|
||||
array(
|
||||
'postType' => 'wp_template',
|
||||
'postId' => $_wp_current_template_id,
|
||||
'canvas' => 'edit',
|
||||
),
|
||||
admin_url( 'site-editor.php' )
|
||||
),
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -75,19 +75,19 @@
|
||||
* @param array $source_properties {
|
||||
* The array of arguments that are used to register a source.
|
||||
*
|
||||
* @type string $label The label of the source.
|
||||
* @type callback $get_value_callback A callback executed when the source is processed during block rendering.
|
||||
* The callback should have the following signature:
|
||||
* @type string $label The label of the source.
|
||||
* @type callable $get_value_callback A callback executed when the source is processed during block rendering.
|
||||
* The callback should have the following signature:
|
||||
*
|
||||
* `function ($source_args, $block_instance,$attribute_name): mixed`
|
||||
* - @param array $source_args Array containing source arguments
|
||||
* used to look up the override value,
|
||||
* i.e. {"key": "foo"}.
|
||||
* - @param WP_Block $block_instance The block instance.
|
||||
* - @param string $attribute_name The name of an attribute .
|
||||
* The callback has a mixed return type; it may return a string to override
|
||||
* the block's original value, null, false to remove an attribute, etc.
|
||||
* @type array $uses_context (optional) Array of values to add to block `uses_context` needed by the source.
|
||||
* `function( $source_args, $block_instance, $attribute_name ): mixed`
|
||||
* - @param array $source_args Array containing source arguments
|
||||
* used to look up the override value,
|
||||
* i.e. {"key": "foo"}.
|
||||
* - @param WP_Block $block_instance The block instance.
|
||||
* - @param string $attribute_name The name of an attribute.
|
||||
* The callback has a mixed return type; it may return a string to override
|
||||
* the block's original value, null, false to remove an attribute, etc.
|
||||
* @type string[] $uses_context Optional. Array of values to add to block `uses_context` needed by the source.
|
||||
* }
|
||||
* @return WP_Block_Bindings_Source|false Source when the registration was successful, or `false` on failure.
|
||||
*/
|
||||
|
||||
@@ -814,6 +814,7 @@ function get_block_editor_theme_styles() {
|
||||
* Returns the classic theme supports settings for block editor.
|
||||
*
|
||||
* @since 6.2.0
|
||||
* @since 6.6.0 Add support for 'editor-spacing-sizes' theme support.
|
||||
*
|
||||
* @return array The classic theme supports settings.
|
||||
*/
|
||||
@@ -844,5 +845,10 @@ function get_classic_theme_supports_block_editor_settings() {
|
||||
$theme_settings['gradients'] = $gradient_presets;
|
||||
}
|
||||
|
||||
$spacing_sizes = current( (array) get_theme_support( 'editor-spacing-sizes' ) );
|
||||
if ( false !== $spacing_sizes ) {
|
||||
$theme_settings['spacingSizes'] = $spacing_sizes;
|
||||
}
|
||||
|
||||
return $theme_settings;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ function wp_register_background_support( $block_type ) {
|
||||
*
|
||||
* @since 6.4.0
|
||||
* @since 6.5.0 Added support for `backgroundPosition` and `backgroundRepeat` output.
|
||||
* @since 6.6.0 Removed requirement for `backgroundImage.source`. A file/url is the default.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
@@ -54,52 +56,27 @@ function wp_render_background_support( $block_content, $block ) {
|
||||
|
||||
if (
|
||||
! $has_background_image_support ||
|
||||
wp_should_skip_block_supports_serialization( $block_type, 'background', 'backgroundImage' )
|
||||
wp_should_skip_block_supports_serialization( $block_type, 'background', 'backgroundImage' ) ||
|
||||
! isset( $block_attributes['style']['background'] )
|
||||
) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$background_image_source = isset( $block_attributes['style']['background']['backgroundImage']['source'] )
|
||||
? $block_attributes['style']['background']['backgroundImage']['source']
|
||||
: null;
|
||||
$background_image_url = isset( $block_attributes['style']['background']['backgroundImage']['url'] )
|
||||
? $block_attributes['style']['background']['backgroundImage']['url']
|
||||
: null;
|
||||
$background_styles = array();
|
||||
$background_styles['backgroundImage'] = isset( $block_attributes['style']['background']['backgroundImage'] ) ? $block_attributes['style']['background']['backgroundImage'] : array();
|
||||
|
||||
if ( ! $background_image_source && ! $background_image_url ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$background_size = isset( $block_attributes['style']['background']['backgroundSize'] )
|
||||
? $block_attributes['style']['background']['backgroundSize']
|
||||
: 'cover';
|
||||
$background_position = isset( $block_attributes['style']['background']['backgroundPosition'] )
|
||||
? $block_attributes['style']['background']['backgroundPosition']
|
||||
: null;
|
||||
$background_repeat = isset( $block_attributes['style']['background']['backgroundRepeat'] )
|
||||
? $block_attributes['style']['background']['backgroundRepeat']
|
||||
: null;
|
||||
|
||||
$background_block_styles = array();
|
||||
|
||||
if (
|
||||
'file' === $background_image_source &&
|
||||
$background_image_url
|
||||
) {
|
||||
// Set file based background URL.
|
||||
$background_block_styles['backgroundImage']['url'] = $background_image_url;
|
||||
// Only output the background size and repeat when an image url is set.
|
||||
$background_block_styles['backgroundSize'] = $background_size;
|
||||
$background_block_styles['backgroundRepeat'] = $background_repeat;
|
||||
$background_block_styles['backgroundPosition'] = $background_position;
|
||||
if ( ! empty( $background_styles['backgroundImage'] ) ) {
|
||||
$background_styles['backgroundSize'] = isset( $block_attributes['style']['background']['backgroundSize'] ) ? $block_attributes['style']['background']['backgroundSize'] : 'cover';
|
||||
$background_styles['backgroundPosition'] = isset( $block_attributes['style']['background']['backgroundPosition'] ) ? $block_attributes['style']['background']['backgroundPosition'] : null;
|
||||
$background_styles['backgroundRepeat'] = isset( $block_attributes['style']['background']['backgroundRepeat'] ) ? $block_attributes['style']['background']['backgroundRepeat'] : null;
|
||||
|
||||
// If the background size is set to `contain` and no position is set, set the position to `center`.
|
||||
if ( 'contain' === $background_size && ! isset( $background_position ) ) {
|
||||
$background_block_styles['backgroundPosition'] = 'center';
|
||||
if ( 'contain' === $background_styles['backgroundSize'] && ! $background_styles['backgroundPosition'] ) {
|
||||
$background_styles['backgroundPosition'] = 'center';
|
||||
}
|
||||
}
|
||||
|
||||
$styles = wp_style_engine_get_styles( array( 'background' => $background_block_styles ) );
|
||||
$styles = wp_style_engine_get_styles( array( 'background' => $background_styles ) );
|
||||
|
||||
if ( ! empty( $styles['css'] ) ) {
|
||||
// Inject background styles to the first element, presuming it's the wrapper, if it exists.
|
||||
|
||||
312
wp/wp-includes/block-supports/block-style-variations.php
Normal file
312
wp/wp-includes/block-supports/block-style-variations.php
Normal file
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
/**
|
||||
* Block support to enable per-section styling of block types via
|
||||
* block style variations.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 6.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate block style variation instance name.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $block Block object.
|
||||
* @param string $variation Slug for the block style variation.
|
||||
*
|
||||
* @return string The unique variation name.
|
||||
*/
|
||||
function wp_create_block_style_variation_instance_name( $block, $variation ) {
|
||||
return $variation . '--' . md5( serialize( $block ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the block style variation names within a CSS class string.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param string $class_string CSS class string to look for a variation in.
|
||||
*
|
||||
* @return array|null The block style variation name if found.
|
||||
*/
|
||||
function wp_get_block_style_variation_name_from_class( $class_string ) {
|
||||
if ( ! is_string( $class_string ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
preg_match_all( '/\bis-style-(?!default)(\S+)\b/', $class_string, $matches );
|
||||
return $matches[1] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively resolves any `ref` values within a block style variation's data.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $variation_data Reference to the variation data being processed.
|
||||
* @param array $theme_json Theme.json data to retrieve referenced values from.
|
||||
*/
|
||||
function wp_resolve_block_style_variation_ref_values( &$variation_data, $theme_json ) {
|
||||
foreach ( $variation_data as $key => &$value ) {
|
||||
// Only need to potentially process arrays.
|
||||
if ( is_array( $value ) ) {
|
||||
// If ref value is set, attempt to find its matching value and update it.
|
||||
if ( array_key_exists( 'ref', $value ) ) {
|
||||
// Clean up any invalid ref value.
|
||||
if ( empty( $value['ref'] ) || ! is_string( $value['ref'] ) ) {
|
||||
unset( $variation_data[ $key ] );
|
||||
}
|
||||
|
||||
$value_path = explode( '.', $value['ref'] ?? '' );
|
||||
$ref_value = _wp_array_get( $theme_json, $value_path );
|
||||
|
||||
// Only update the current value if the referenced path matched a value.
|
||||
if ( null === $ref_value ) {
|
||||
unset( $variation_data[ $key ] );
|
||||
} else {
|
||||
$value = $ref_value;
|
||||
}
|
||||
} else {
|
||||
// Recursively look for ref instances.
|
||||
wp_resolve_block_style_variation_ref_values( $value, $theme_json );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Render the block style variation's styles.
|
||||
*
|
||||
* In the case of nested blocks with variations applied, we want the parent
|
||||
* variation's styles to be rendered before their descendants. This solves the
|
||||
* issue of a block type being styled in both the parent and descendant: we want
|
||||
* the descendant style to take priority, and this is done by loading it after,
|
||||
* in the DOM order. This is why the variation stylesheet generation is in a
|
||||
* different filter.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $parsed_block The parsed block.
|
||||
*
|
||||
* @return array The parsed block with block style variation classname added.
|
||||
*/
|
||||
function wp_render_block_style_variation_support_styles( $parsed_block ) {
|
||||
$classes = $parsed_block['attrs']['className'] ?? null;
|
||||
$variations = wp_get_block_style_variation_name_from_class( $classes );
|
||||
|
||||
if ( ! $variations ) {
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
$tree = WP_Theme_JSON_Resolver::get_merged_data();
|
||||
$theme_json = $tree->get_raw_data();
|
||||
|
||||
// Only the first block style variation with data is supported.
|
||||
$variation_data = array();
|
||||
foreach ( $variations as $variation ) {
|
||||
$variation_data = $theme_json['styles']['blocks'][ $parsed_block['blockName'] ]['variations'][ $variation ] ?? array();
|
||||
|
||||
if ( ! empty( $variation_data ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $variation_data ) ) {
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Recursively resolve any ref values with the appropriate value within the
|
||||
* theme_json data.
|
||||
*/
|
||||
wp_resolve_block_style_variation_ref_values( $variation_data, $theme_json );
|
||||
|
||||
$variation_instance = wp_create_block_style_variation_instance_name( $parsed_block, $variation );
|
||||
$class_name = "is-style-$variation_instance";
|
||||
$updated_class_name = $parsed_block['attrs']['className'] . " $class_name";
|
||||
|
||||
/*
|
||||
* Even though block style variations are effectively theme.json partials,
|
||||
* they can't be processed completely as though they are.
|
||||
*
|
||||
* Block styles support custom selectors to direct specific types of styles
|
||||
* to inner elements. For example, borders on Image block's get applied to
|
||||
* the inner `img` element rather than the wrapping `figure`.
|
||||
*
|
||||
* The following relocates the "root" block style variation styles to
|
||||
* under an appropriate blocks property to leverage the preexisting style
|
||||
* generation for simple block style variations. This way they get the
|
||||
* custom selectors they need.
|
||||
*
|
||||
* The inner elements and block styles for the variation itself are
|
||||
* still included at the top level but scoped by the variation's selector
|
||||
* when the stylesheet is generated.
|
||||
*/
|
||||
$elements_data = $variation_data['elements'] ?? array();
|
||||
$blocks_data = $variation_data['blocks'] ?? array();
|
||||
unset( $variation_data['elements'] );
|
||||
unset( $variation_data['blocks'] );
|
||||
|
||||
_wp_array_set(
|
||||
$blocks_data,
|
||||
array( $parsed_block['blockName'], 'variations', $variation_instance ),
|
||||
$variation_data
|
||||
);
|
||||
|
||||
$config = array(
|
||||
'version' => WP_Theme_JSON::LATEST_SCHEMA,
|
||||
'styles' => array(
|
||||
'elements' => $elements_data,
|
||||
'blocks' => $blocks_data,
|
||||
),
|
||||
);
|
||||
|
||||
// Turn off filter that excludes block nodes. They are needed here for the variation's inner block types.
|
||||
if ( ! is_admin() ) {
|
||||
remove_filter( 'wp_theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
|
||||
}
|
||||
|
||||
// Temporarily prevent variation instance from being sanitized while processing theme.json.
|
||||
$styles_registry = WP_Block_Styles_Registry::get_instance();
|
||||
$styles_registry->register( $parsed_block['blockName'], array( 'name' => $variation_instance ) );
|
||||
|
||||
$variation_theme_json = new WP_Theme_JSON( $config, 'blocks' );
|
||||
$variation_styles = $variation_theme_json->get_stylesheet(
|
||||
array( 'styles' ),
|
||||
array( 'custom' ),
|
||||
array(
|
||||
'include_block_style_variations' => true,
|
||||
'skip_root_layout_styles' => true,
|
||||
'scope' => ".$class_name",
|
||||
)
|
||||
);
|
||||
|
||||
// Clean up temporary block style now instance styles have been processed.
|
||||
$styles_registry->unregister( $parsed_block['blockName'], $variation_instance );
|
||||
|
||||
// Restore filter that excludes block nodes.
|
||||
if ( ! is_admin() ) {
|
||||
add_filter( 'wp_theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
|
||||
}
|
||||
|
||||
if ( empty( $variation_styles ) ) {
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
wp_register_style( 'block-style-variation-styles', false, array( 'global-styles', 'wp-block-library' ) );
|
||||
wp_add_inline_style( 'block-style-variation-styles', $variation_styles );
|
||||
|
||||
/*
|
||||
* Add variation instance class name to block's className string so it can
|
||||
* be enforced in the block markup via render_block filter.
|
||||
*/
|
||||
_wp_array_set( $parsed_block, array( 'attrs', 'className' ), $updated_class_name );
|
||||
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the variation block support class name generated and added to
|
||||
* block attributes in the `render_block_data` filter gets applied to the
|
||||
* block's markup.
|
||||
*
|
||||
* @see wp_render_block_style_variation_support_styles
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @param array $block Block object.
|
||||
*
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
function wp_render_block_style_variation_class_name( $block_content, $block ) {
|
||||
if ( ! $block_content || empty( $block['attrs']['className'] ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
/*
|
||||
* Matches a class prefixed by `is-style`, followed by the
|
||||
* variation slug, then `--`, and finally a hash.
|
||||
*
|
||||
* See `wp_create_block_style_variation_instance_name` for class generation.
|
||||
*/
|
||||
preg_match( '/\bis-style-(\S+?--\w+)\b/', $block['attrs']['className'], $matches );
|
||||
|
||||
if ( empty( $matches ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$tags = new WP_HTML_Tag_Processor( $block_content );
|
||||
|
||||
if ( $tags->next_tag() ) {
|
||||
/*
|
||||
* Ensure the variation instance class name set in the
|
||||
* `render_block_data` filter is applied in markup.
|
||||
* See `wp_render_block_style_variation_support_styles`.
|
||||
*/
|
||||
$tags->add_class( $matches[0] );
|
||||
}
|
||||
|
||||
return $tags->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues styles for block style variations.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*/
|
||||
function wp_enqueue_block_style_variation_styles() {
|
||||
wp_enqueue_style( 'block-style-variation-styles' );
|
||||
}
|
||||
|
||||
// Register the block support.
|
||||
WP_Block_Supports::get_instance()->register( 'block-style-variation', array() );
|
||||
|
||||
add_filter( 'render_block_data', 'wp_render_block_style_variation_support_styles', 10, 2 );
|
||||
add_filter( 'render_block', 'wp_render_block_style_variation_class_name', 10, 2 );
|
||||
add_action( 'wp_enqueue_scripts', 'wp_enqueue_block_style_variation_styles', 1 );
|
||||
|
||||
/**
|
||||
* Registers block style variations read in from theme.json partials.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $variations Shared block style variations.
|
||||
*/
|
||||
function wp_register_block_style_variations_from_theme_json_partials( $variations ) {
|
||||
if ( empty( $variations ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$registry = WP_Block_Styles_Registry::get_instance();
|
||||
|
||||
foreach ( $variations as $variation ) {
|
||||
if ( empty( $variation['blockTypes'] ) || empty( $variation['styles'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variation_name = $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] );
|
||||
$variation_label = $variation['title'] ?? $variation_name;
|
||||
|
||||
foreach ( $variation['blockTypes'] as $block_type ) {
|
||||
$registered_styles = $registry->get_registered_styles_for_block( $block_type );
|
||||
|
||||
// Register block style variation if it hasn't already been registered.
|
||||
if ( ! array_key_exists( $variation_name, $registered_styles ) ) {
|
||||
register_block_style(
|
||||
$block_type,
|
||||
array(
|
||||
'name' => $variation_name,
|
||||
'label' => $variation_label,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ WP_Block_Supports::get_instance()->register(
|
||||
|
||||
// Add classnames to blocks using duotone support.
|
||||
add_filter( 'render_block', array( 'WP_Duotone', 'render_duotone_support' ), 10, 3 );
|
||||
add_filter( 'render_block_core/image', array( 'WP_Duotone', 'restore_image_outer_container' ), 10, 1 );
|
||||
|
||||
// Enqueue styles.
|
||||
// Block styles (core-block-supports-inline-css) before the style engine (wp_enqueue_stored_styles).
|
||||
|
||||
@@ -20,29 +20,23 @@ function wp_get_elements_class_name( $block ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the block content with elements class names.
|
||||
* Determines whether an elements class name should be added to the block.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @since 6.4.0 Added support for button and heading element styling.
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @param array $block Block object.
|
||||
* @return string Filtered block content.
|
||||
* @param array $block Block object.
|
||||
* @param array $options Per element type options e.g. whether to skip serialization.
|
||||
* @return boolean Whether the block needs an elements class name.
|
||||
*/
|
||||
function wp_render_elements_support( $block_content, $block ) {
|
||||
if ( ! $block_content || ! isset( $block['attrs']['style']['elements'] ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
|
||||
if ( ! $block_type ) {
|
||||
return $block_content;
|
||||
function wp_should_add_elements_class_name( $block, $options ) {
|
||||
if ( ! isset( $block['attrs']['style']['elements'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$element_color_properties = array(
|
||||
'button' => array(
|
||||
'skip' => wp_should_skip_block_supports_serialization( $block_type, 'color', 'button' ),
|
||||
'skip' => isset( $options['button']['skip'] ) ? $options['button']['skip'] : false,
|
||||
'paths' => array(
|
||||
array( 'button', 'color', 'text' ),
|
||||
array( 'button', 'color', 'background' ),
|
||||
@@ -50,14 +44,14 @@ function wp_render_elements_support( $block_content, $block ) {
|
||||
),
|
||||
),
|
||||
'link' => array(
|
||||
'skip' => wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' ),
|
||||
'skip' => isset( $options['link']['skip'] ) ? $options['link']['skip'] : false,
|
||||
'paths' => array(
|
||||
array( 'link', 'color', 'text' ),
|
||||
array( 'link', ':hover', 'color', 'text' ),
|
||||
),
|
||||
),
|
||||
'heading' => array(
|
||||
'skip' => wp_should_skip_block_supports_serialization( $block_type, 'color', 'heading' ),
|
||||
'skip' => isset( $options['heading']['skip'] ) ? $options['heading']['skip'] : false,
|
||||
'paths' => array(
|
||||
array( 'heading', 'color', 'text' ),
|
||||
array( 'heading', 'color', 'background' ),
|
||||
@@ -84,14 +78,6 @@ function wp_render_elements_support( $block_content, $block ) {
|
||||
),
|
||||
);
|
||||
|
||||
$skip_all_element_color_serialization = $element_color_properties['button']['skip'] &&
|
||||
$element_color_properties['link']['skip'] &&
|
||||
$element_color_properties['heading']['skip'];
|
||||
|
||||
if ( $skip_all_element_color_serialization ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$elements_style_attributes = $block['attrs']['style']['elements'];
|
||||
|
||||
foreach ( $element_color_properties as $element_config ) {
|
||||
@@ -101,31 +87,16 @@ function wp_render_elements_support( $block_content, $block ) {
|
||||
|
||||
foreach ( $element_config['paths'] as $path ) {
|
||||
if ( null !== _wp_array_get( $elements_style_attributes, $path, null ) ) {
|
||||
/*
|
||||
* It only takes a single custom attribute to require that the custom
|
||||
* class name be added to the block, so once one is found there's no
|
||||
* need to continue looking for others.
|
||||
*
|
||||
* As is done with the layout hook, this code assumes that the block
|
||||
* contains a single wrapper and that it's the first element in the
|
||||
* rendered output. That first element, if it exists, gets the class.
|
||||
*/
|
||||
$tags = new WP_HTML_Tag_Processor( $block_content );
|
||||
if ( $tags->next_tag() ) {
|
||||
$tags->add_class( wp_get_elements_class_name( $block ) );
|
||||
}
|
||||
|
||||
return $tags->get_updated_html();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If no custom attributes were found then there's nothing to modify.
|
||||
return $block_content;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the elements stylesheet.
|
||||
* Render the elements stylesheet and adds elements class name to block as required.
|
||||
*
|
||||
* In the case of nested blocks we want the parent element styles to be rendered before their descendants.
|
||||
* This solves the issue of an element (e.g.: link color) being styled in both the parent and a descendant:
|
||||
@@ -133,18 +104,36 @@ function wp_render_elements_support( $block_content, $block ) {
|
||||
*
|
||||
* @since 6.0.0
|
||||
* @since 6.1.0 Implemented the style engine to generate CSS and classnames.
|
||||
* @since 6.6.0 Element block support class and styles are generated via the `render_block_data` filter instead of `pre_render_block`.
|
||||
* @access private
|
||||
*
|
||||
* @param string|null $pre_render The pre-rendered content. Default null.
|
||||
* @param array $block The block being rendered.
|
||||
* @return null
|
||||
* @param array $parsed_block The parsed block.
|
||||
* @return array The same parsed block with elements classname added if appropriate.
|
||||
*/
|
||||
function wp_render_elements_support_styles( $pre_render, $block ) {
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
|
||||
$element_block_styles = isset( $block['attrs']['style']['elements'] ) ? $block['attrs']['style']['elements'] : null;
|
||||
function wp_render_elements_support_styles( $parsed_block ) {
|
||||
/*
|
||||
* The generation of element styles and classname were moved to the
|
||||
* `render_block_data` filter in 6.6.0 to avoid filtered attributes
|
||||
* breaking the application of the elements CSS class.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/59535
|
||||
*
|
||||
* The change in filter means, the argument types for this function
|
||||
* have changed and require deprecating.
|
||||
*/
|
||||
if ( is_string( $parsed_block ) ) {
|
||||
_deprecated_argument(
|
||||
__FUNCTION__,
|
||||
'6.6.0',
|
||||
__( 'Use as a `pre_render_block` filter is deprecated. Use with `render_block_data` instead.' )
|
||||
);
|
||||
}
|
||||
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $parsed_block['blockName'] );
|
||||
$element_block_styles = isset( $parsed_block['attrs']['style']['elements'] ) ? $parsed_block['attrs']['style']['elements'] : null;
|
||||
|
||||
if ( ! $element_block_styles ) {
|
||||
return null;
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
$skip_link_color_serialization = wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' );
|
||||
@@ -155,11 +144,25 @@ function wp_render_elements_support_styles( $pre_render, $block ) {
|
||||
$skip_button_color_serialization;
|
||||
|
||||
if ( $skips_all_element_color_serialization ) {
|
||||
return null;
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
$class_name = wp_get_elements_class_name( $block );
|
||||
$options = array(
|
||||
'button' => array( 'skip' => $skip_button_color_serialization ),
|
||||
'link' => array( 'skip' => $skip_link_color_serialization ),
|
||||
'heading' => array( 'skip' => $skip_heading_color_serialization ),
|
||||
);
|
||||
|
||||
if ( ! wp_should_add_elements_class_name( $parsed_block, $options ) ) {
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
$class_name = wp_get_elements_class_name( $parsed_block );
|
||||
$updated_class_name = isset( $parsed_block['attrs']['className'] ) ? $parsed_block['attrs']['className'] . " $class_name" : $class_name;
|
||||
|
||||
_wp_array_set( $parsed_block, array( 'attrs', 'className' ), $updated_class_name );
|
||||
|
||||
// Generate element styles based on selector and store in style engine for enqueuing.
|
||||
$element_types = array(
|
||||
'button' => array(
|
||||
'selector' => ".$class_name .wp-element-button, .$class_name .wp-block-button__link",
|
||||
@@ -225,8 +228,37 @@ function wp_render_elements_support_styles( $pre_render, $block ) {
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
add_filter( 'render_block', 'wp_render_elements_support', 10, 2 );
|
||||
add_filter( 'pre_render_block', 'wp_render_elements_support_styles', 10, 2 );
|
||||
/**
|
||||
* Ensure the elements block support class name generated, and added to
|
||||
* block attributes, in the `render_block_data` filter gets applied to the
|
||||
* block's markup.
|
||||
*
|
||||
* @see wp_render_elements_support_styles
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @param array $block Block object.
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
function wp_render_elements_class_name( $block_content, $block ) {
|
||||
$class_string = $block['attrs']['className'] ?? '';
|
||||
preg_match( '/\bwp-elements-\S+\b/', $class_string, $matches );
|
||||
|
||||
if ( empty( $matches ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$tags = new WP_HTML_Tag_Processor( $block_content );
|
||||
|
||||
if ( $tags->next_tag() ) {
|
||||
$tags->add_class( $matches[0] );
|
||||
}
|
||||
|
||||
return $tags->get_updated_html();
|
||||
}
|
||||
|
||||
add_filter( 'render_block', 'wp_render_elements_class_name', 10, 2 );
|
||||
add_filter( 'render_block_data', 'wp_render_elements_support_styles', 10, 1 );
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* also be updated.
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @since 6.6.0 Updated specificity for compatibility with 0-1-0 global styles specificity.
|
||||
* @access private
|
||||
*
|
||||
* @return array[] Layout definitions.
|
||||
@@ -51,13 +52,13 @@ function wp_get_layout_definitions() {
|
||||
),
|
||||
'spacingStyles' => array(
|
||||
array(
|
||||
'selector' => ' > :first-child:first-child',
|
||||
'selector' => ' > :first-child',
|
||||
'rules' => array(
|
||||
'margin-block-start' => '0',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'selector' => ' > :last-child:last-child',
|
||||
'selector' => ' > :last-child',
|
||||
'rules' => array(
|
||||
'margin-block-end' => '0',
|
||||
),
|
||||
@@ -116,13 +117,13 @@ function wp_get_layout_definitions() {
|
||||
),
|
||||
'spacingStyles' => array(
|
||||
array(
|
||||
'selector' => ' > :first-child:first-child',
|
||||
'selector' => ' > :first-child',
|
||||
'rules' => array(
|
||||
'margin-block-start' => '0',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'selector' => ' > :last-child:last-child',
|
||||
'selector' => ' > :last-child',
|
||||
'rules' => array(
|
||||
'margin-block-end' => '0',
|
||||
),
|
||||
@@ -150,7 +151,7 @@ function wp_get_layout_definitions() {
|
||||
),
|
||||
),
|
||||
array(
|
||||
'selector' => ' > *',
|
||||
'selector' => ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001.
|
||||
'rules' => array(
|
||||
'margin' => '0',
|
||||
),
|
||||
@@ -172,7 +173,7 @@ function wp_get_layout_definitions() {
|
||||
'displayMode' => 'grid',
|
||||
'baseStyles' => array(
|
||||
array(
|
||||
'selector' => ' > *',
|
||||
'selector' => ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001.
|
||||
'rules' => array(
|
||||
'margin' => '0',
|
||||
),
|
||||
@@ -222,6 +223,8 @@ function wp_register_layout_support( $block_type ) {
|
||||
* @since 5.9.0
|
||||
* @since 6.1.0 Added `$block_spacing` param, use style engine to enqueue styles.
|
||||
* @since 6.3.0 Added grid layout type.
|
||||
* @since 6.6.0 Removed duplicated selector from layout styles.
|
||||
* Enabled negative margins for alignfull children of blocks with custom padding.
|
||||
* @access private
|
||||
*
|
||||
* @param string $selector CSS selector.
|
||||
@@ -261,7 +264,7 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
),
|
||||
),
|
||||
array(
|
||||
'selector' => "$selector$selector > * + *",
|
||||
'selector' => "$selector > * + *",
|
||||
'declarations' => array(
|
||||
'margin-block-start' => $gap_value,
|
||||
'margin-block-end' => '0',
|
||||
@@ -305,32 +308,32 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
'declarations' => array( 'max-width' => 'none' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( isset( $block_spacing ) ) {
|
||||
$block_spacing_values = wp_style_engine_get_styles(
|
||||
array(
|
||||
'spacing' => $block_spacing,
|
||||
)
|
||||
if ( isset( $block_spacing ) ) {
|
||||
$block_spacing_values = wp_style_engine_get_styles(
|
||||
array(
|
||||
'spacing' => $block_spacing,
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Handle negative margins for alignfull children of blocks with custom padding set.
|
||||
* They're added separately because padding might only be set on one side.
|
||||
*/
|
||||
if ( isset( $block_spacing_values['declarations']['padding-right'] ) ) {
|
||||
$padding_right = $block_spacing_values['declarations']['padding-right'];
|
||||
$layout_styles[] = array(
|
||||
'selector' => "$selector > .alignfull",
|
||||
'declarations' => array( 'margin-right' => "calc($padding_right * -1)" ),
|
||||
);
|
||||
}
|
||||
if ( isset( $block_spacing_values['declarations']['padding-left'] ) ) {
|
||||
$padding_left = $block_spacing_values['declarations']['padding-left'];
|
||||
$layout_styles[] = array(
|
||||
'selector' => "$selector > .alignfull",
|
||||
'declarations' => array( 'margin-left' => "calc($padding_left * -1)" ),
|
||||
);
|
||||
|
||||
/*
|
||||
* Handle negative margins for alignfull children of blocks with custom padding set.
|
||||
* They're added separately because padding might only be set on one side.
|
||||
*/
|
||||
if ( isset( $block_spacing_values['declarations']['padding-right'] ) ) {
|
||||
$padding_right = $block_spacing_values['declarations']['padding-right'];
|
||||
$layout_styles[] = array(
|
||||
'selector' => "$selector > .alignfull",
|
||||
'declarations' => array( 'margin-right' => "calc($padding_right * -1)" ),
|
||||
);
|
||||
}
|
||||
if ( isset( $block_spacing_values['declarations']['padding-left'] ) ) {
|
||||
$padding_left = $block_spacing_values['declarations']['padding-left'];
|
||||
$layout_styles[] = array(
|
||||
'selector' => "$selector > .alignfull",
|
||||
'declarations' => array( 'margin-left' => "calc($padding_left * -1)" ),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +373,7 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
),
|
||||
),
|
||||
array(
|
||||
'selector' => "$selector$selector > * + *",
|
||||
'selector' => "$selector > * + *",
|
||||
'declarations' => array(
|
||||
'margin-block-start' => $gap_value,
|
||||
'margin-block-end' => '0',
|
||||
@@ -489,7 +492,10 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
|
||||
$layout_styles[] = array(
|
||||
'selector' => $selector,
|
||||
'declarations' => array( 'grid-template-columns' => 'repeat(auto-fill, minmax(min(' . $minimum_column_width . ', 100%), 1fr))' ),
|
||||
'declarations' => array(
|
||||
'grid-template-columns' => 'repeat(auto-fill, minmax(min(' . $minimum_column_width . ', 100%), 1fr))',
|
||||
'container-type' => 'inline-size',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -546,6 +552,7 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
* @since 5.8.0
|
||||
* @since 6.3.0 Adds compound class to layout wrapper for global spacing styles.
|
||||
* @since 6.3.0 Check for layout support via the `layout` key with fallback to `__experimentalLayout`.
|
||||
* @since 6.6.0 Removed duplicate container class from layout styles.
|
||||
* @access private
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
@@ -555,37 +562,92 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
function wp_render_layout_support_flag( $block_content, $block ) {
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
|
||||
$block_supports_layout = block_has_support( $block_type, 'layout', false ) || block_has_support( $block_type, '__experimentalLayout', false );
|
||||
$layout_from_parent = isset( $block['attrs']['style']['layout']['selfStretch'] ) ? $block['attrs']['style']['layout']['selfStretch'] : null;
|
||||
$child_layout = isset( $block['attrs']['style']['layout'] ) ? $block['attrs']['style']['layout'] : null;
|
||||
|
||||
if ( ! $block_supports_layout && ! $layout_from_parent ) {
|
||||
if ( ! $block_supports_layout && ! $child_layout ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$outer_class_names = array();
|
||||
|
||||
if ( 'fixed' === $layout_from_parent || 'fill' === $layout_from_parent ) {
|
||||
$container_content_class = wp_unique_id( 'wp-container-content-' );
|
||||
// Child layout specific logic.
|
||||
if ( $child_layout ) {
|
||||
$container_content_class = wp_unique_prefixed_id( 'wp-container-content-' );
|
||||
$child_layout_declarations = array();
|
||||
$child_layout_styles = array();
|
||||
|
||||
$child_layout_styles = array();
|
||||
$self_stretch = isset( $child_layout['selfStretch'] ) ? $child_layout['selfStretch'] : null;
|
||||
|
||||
if ( 'fixed' === $self_stretch && isset( $child_layout['flexSize'] ) ) {
|
||||
$child_layout_declarations['flex-basis'] = $child_layout['flexSize'];
|
||||
$child_layout_declarations['box-sizing'] = 'border-box';
|
||||
} elseif ( 'fill' === $self_stretch ) {
|
||||
$child_layout_declarations['flex-grow'] = '1';
|
||||
}
|
||||
|
||||
if ( isset( $child_layout['columnSpan'] ) ) {
|
||||
$column_span = $child_layout['columnSpan'];
|
||||
$child_layout_declarations['grid-column'] = "span $column_span";
|
||||
}
|
||||
if ( isset( $child_layout['rowSpan'] ) ) {
|
||||
$row_span = $child_layout['rowSpan'];
|
||||
$child_layout_declarations['grid-row'] = "span $row_span";
|
||||
}
|
||||
$child_layout_styles[] = array(
|
||||
'selector' => ".$container_content_class",
|
||||
'declarations' => $child_layout_declarations,
|
||||
);
|
||||
|
||||
/*
|
||||
* If columnSpan is set, and the parent grid is responsive, i.e. if it has a minimumColumnWidth set,
|
||||
* the columnSpan should be removed on small grids. If there's a minimumColumnWidth, the grid is responsive.
|
||||
* But if the minimumColumnWidth value wasn't changed, it won't be set. In that case, if columnCount doesn't
|
||||
* exist, we can assume that the grid is responsive.
|
||||
*/
|
||||
if ( isset( $child_layout['columnSpan'] ) && ( isset( $block['parentLayout']['minimumColumnWidth'] ) || ! isset( $block['parentLayout']['columnCount'] ) ) ) {
|
||||
$column_span_number = floatval( $child_layout['columnSpan'] );
|
||||
$parent_column_width = isset( $block['parentLayout']['minimumColumnWidth'] ) ? $block['parentLayout']['minimumColumnWidth'] : '12rem';
|
||||
$parent_column_value = floatval( $parent_column_width );
|
||||
$parent_column_unit = explode( $parent_column_value, $parent_column_width );
|
||||
|
||||
/*
|
||||
* If there is no unit, the width has somehow been mangled so we reset both unit and value
|
||||
* to defaults.
|
||||
* Additionally, the unit should be one of px, rem or em, so that also needs to be checked.
|
||||
*/
|
||||
if ( count( $parent_column_unit ) <= 1 ) {
|
||||
$parent_column_unit = 'rem';
|
||||
$parent_column_value = 12;
|
||||
} else {
|
||||
$parent_column_unit = $parent_column_unit[1];
|
||||
|
||||
if ( ! in_array( $parent_column_unit, array( 'px', 'rem', 'em' ), true ) ) {
|
||||
$parent_column_unit = 'rem';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A default gap value is used for this computation because custom gap values may not be
|
||||
* viable to use in the computation of the container query value.
|
||||
*/
|
||||
$default_gap_value = 'px' === $parent_column_unit ? 24 : 1.5;
|
||||
$container_query_value = $column_span_number * $parent_column_value + ( $column_span_number - 1 ) * $default_gap_value;
|
||||
$container_query_value = $container_query_value . $parent_column_unit;
|
||||
|
||||
if ( 'fixed' === $layout_from_parent && isset( $block['attrs']['style']['layout']['flexSize'] ) ) {
|
||||
$child_layout_styles[] = array(
|
||||
'rules_group' => "@container (max-width: $container_query_value )",
|
||||
'selector' => ".$container_content_class",
|
||||
'declarations' => array(
|
||||
'flex-basis' => $block['attrs']['style']['layout']['flexSize'],
|
||||
'box-sizing' => 'border-box',
|
||||
),
|
||||
);
|
||||
} elseif ( 'fill' === $layout_from_parent ) {
|
||||
$child_layout_styles[] = array(
|
||||
'selector' => ".$container_content_class",
|
||||
'declarations' => array(
|
||||
'flex-grow' => '1',
|
||||
'grid-column' => '1/-1',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
wp_style_engine_get_stylesheet_from_css_rules(
|
||||
/*
|
||||
* Add to the style engine store to enqueue and render layout styles.
|
||||
* Return styles here just to check if any exist.
|
||||
*/
|
||||
$child_css = wp_style_engine_get_stylesheet_from_css_rules(
|
||||
$child_layout_styles,
|
||||
array(
|
||||
'context' => 'block-supports',
|
||||
@@ -593,7 +655,9 @@ function wp_render_layout_support_flag( $block_content, $block ) {
|
||||
)
|
||||
);
|
||||
|
||||
$outer_class_names[] = $container_content_class;
|
||||
if ( $child_css ) {
|
||||
$outer_class_names[] = $container_content_class;
|
||||
}
|
||||
}
|
||||
|
||||
// Prep the processor for modifying the block output.
|
||||
@@ -735,7 +799,7 @@ function wp_render_layout_support_flag( $block_content, $block ) {
|
||||
$has_block_gap_support = isset( $block_gap );
|
||||
|
||||
$style = wp_get_layout_style(
|
||||
".$container_class.$container_class",
|
||||
".$container_class",
|
||||
$used_layout,
|
||||
$has_block_gap_support,
|
||||
$gap_value,
|
||||
@@ -851,6 +915,27 @@ function wp_render_layout_support_flag( $block_content, $block ) {
|
||||
return $processor->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the parent block exists and if it has a layout attribute.
|
||||
* If it does, add the parent layout to the parsed block
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $parsed_block The parsed block.
|
||||
* @param array $source_block The source block.
|
||||
* @param WP_Block $parent_block The parent block.
|
||||
* @return array The parsed block with parent layout attribute if it exists.
|
||||
*/
|
||||
function wp_add_parent_layout_to_parsed_block( $parsed_block, $source_block, $parent_block ) {
|
||||
if ( $parent_block && isset( $parent_block->parsed_block['attrs']['layout'] ) ) {
|
||||
$parsed_block['parentLayout'] = $parent_block->parsed_block['attrs']['layout'];
|
||||
}
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
add_filter( 'render_block_data', 'wp_add_parent_layout_to_parsed_block', 10, 3 );
|
||||
|
||||
// Register the block support.
|
||||
WP_Block_Supports::get_instance()->register(
|
||||
'layout',
|
||||
|
||||
@@ -43,6 +43,7 @@ function wp_register_shadow_support( $block_type ) {
|
||||
* This will be applied to the block markup in the front-end.
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @since 6.6.0 Return early if __experimentalSkipSerialization is true.
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block type.
|
||||
@@ -52,7 +53,10 @@ function wp_register_shadow_support( $block_type ) {
|
||||
function wp_apply_shadow_support( $block_type, $block_attributes ) {
|
||||
$has_shadow_support = block_has_support( $block_type, 'shadow', false );
|
||||
|
||||
if ( ! $has_shadow_support ) {
|
||||
if (
|
||||
! $has_shadow_support ||
|
||||
wp_should_skip_block_supports_serialization( $block_type, 'shadow' )
|
||||
) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ function wp_register_typography_support( $block_type ) {
|
||||
$has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false;
|
||||
$has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false;
|
||||
$has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false;
|
||||
$has_text_align_support = isset( $typography_supports['textAlign'] ) ? $typography_supports['textAlign'] : false;
|
||||
$has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false;
|
||||
$has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false;
|
||||
$has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false;
|
||||
@@ -42,6 +43,7 @@ function wp_register_typography_support( $block_type ) {
|
||||
|| $has_font_weight_support
|
||||
|| $has_letter_spacing_support
|
||||
|| $has_line_height_support
|
||||
|| $has_text_align_support
|
||||
|| $has_text_columns_support
|
||||
|| $has_text_decoration_support
|
||||
|| $has_text_transform_support
|
||||
@@ -106,6 +108,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
$has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false;
|
||||
$has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false;
|
||||
$has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false;
|
||||
$has_text_align_support = isset( $typography_supports['textAlign'] ) ? $typography_supports['textAlign'] : false;
|
||||
$has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false;
|
||||
$has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false;
|
||||
$has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false;
|
||||
@@ -117,6 +120,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
$should_skip_font_style = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontStyle' );
|
||||
$should_skip_font_weight = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontWeight' );
|
||||
$should_skip_line_height = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'lineHeight' );
|
||||
$should_skip_text_align = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textAlign' );
|
||||
$should_skip_text_columns = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textColumns' );
|
||||
$should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' );
|
||||
$should_skip_text_transform = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
|
||||
@@ -176,6 +180,12 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
: null;
|
||||
}
|
||||
|
||||
if ( $has_text_align_support && ! $should_skip_text_align ) {
|
||||
$typography_block_styles['textAlign'] = isset( $block_attributes['style']['typography']['textAlign'] )
|
||||
? $block_attributes['style']['typography']['textAlign']
|
||||
: null;
|
||||
}
|
||||
|
||||
if ( $has_text_columns_support && ! $should_skip_text_columns && isset( $block_attributes['style']['typography']['textColumns'] ) ) {
|
||||
$typography_block_styles['textColumns'] = isset( $block_attributes['style']['typography']['textColumns'] )
|
||||
? $block_attributes['style']['typography']['textColumns']
|
||||
@@ -225,13 +235,22 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
}
|
||||
|
||||
$attributes = array();
|
||||
$classnames = array();
|
||||
$styles = wp_style_engine_get_styles(
|
||||
array( 'typography' => $typography_block_styles ),
|
||||
array( 'convert_vars_to_classnames' => true )
|
||||
);
|
||||
|
||||
if ( ! empty( $styles['classnames'] ) ) {
|
||||
$attributes['class'] = $styles['classnames'];
|
||||
$classnames[] = $styles['classnames'];
|
||||
}
|
||||
|
||||
if ( $has_text_align_support && ! $should_skip_text_align && isset( $block_attributes['style']['typography']['textAlign'] ) ) {
|
||||
$classnames[] = 'has-text-align-' . $block_attributes['style']['typography']['textAlign'];
|
||||
}
|
||||
|
||||
if ( ! empty( $classnames ) ) {
|
||||
$attributes['class'] = implode( ' ', $classnames );
|
||||
}
|
||||
|
||||
if ( ! empty( $styles['css'] ) ) {
|
||||
@@ -498,19 +517,22 @@ function wp_get_computed_fluid_typography_value( $args = array() ) {
|
||||
* @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support.
|
||||
* @since 6.3.0 Using layout.wideSize as max viewport width, and logarithmic scale factor to calculate minimum font scale.
|
||||
* @since 6.4.0 Added configurable min and max viewport width values to the typography.fluid theme.json schema.
|
||||
* @since 6.6.0 Deprecated bool argument $should_use_fluid_typography.
|
||||
*
|
||||
* @param array $preset {
|
||||
* @param array $preset {
|
||||
* Required. fontSizes preset value as seen in theme.json.
|
||||
*
|
||||
* @type string $name Name of the font size preset.
|
||||
* @type string $slug Kebab-case, unique identifier for the font size preset.
|
||||
* @type string|int|float $size CSS font-size value, including units if applicable.
|
||||
* }
|
||||
* @param bool $should_use_fluid_typography An override to switch fluid typography "on". Can be used for unit testing.
|
||||
* Default is false.
|
||||
* @param bool|array $settings Optional Theme JSON settings array that overrides any global theme settings.
|
||||
* Default is false.
|
||||
* @return string|null Font-size value or null if a size is not passed in $preset.
|
||||
*/
|
||||
function wp_get_typography_font_size_value( $preset, $should_use_fluid_typography = false ) {
|
||||
|
||||
|
||||
function wp_get_typography_font_size_value( $preset, $settings = array() ) {
|
||||
if ( ! isset( $preset['size'] ) ) {
|
||||
return null;
|
||||
}
|
||||
@@ -523,25 +545,35 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph
|
||||
return $preset['size'];
|
||||
}
|
||||
|
||||
// Checks if fluid font sizes are activated.
|
||||
$global_settings = wp_get_global_settings();
|
||||
$typography_settings = isset( $global_settings['typography'] ) ? $global_settings['typography'] : array();
|
||||
$layout_settings = isset( $global_settings['layout'] ) ? $global_settings['layout'] : array();
|
||||
|
||||
if (
|
||||
isset( $typography_settings['fluid'] ) &&
|
||||
( true === $typography_settings['fluid'] || is_array( $typography_settings['fluid'] ) )
|
||||
) {
|
||||
$should_use_fluid_typography = true;
|
||||
/*
|
||||
* As a boolean (deprecated since 6.6), $settings acts as an override to switch fluid typography "on" (`true`) or "off" (`false`).
|
||||
*/
|
||||
if ( is_bool( $settings ) ) {
|
||||
_deprecated_argument( __FUNCTION__, '6.6.0', __( '`boolean` type for second argument `$settings` is deprecated. Use `array()` instead.' ) );
|
||||
$settings = array(
|
||||
'typography' => array(
|
||||
'fluid' => $settings,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Fallback to global settings as default.
|
||||
$global_settings = wp_get_global_settings();
|
||||
$settings = wp_parse_args(
|
||||
$settings,
|
||||
$global_settings
|
||||
);
|
||||
|
||||
$typography_settings = isset( $settings['typography'] ) ? $settings['typography'] : array();
|
||||
$should_use_fluid_typography = ! empty( $typography_settings['fluid'] );
|
||||
|
||||
if ( ! $should_use_fluid_typography ) {
|
||||
return $preset['size'];
|
||||
}
|
||||
|
||||
$fluid_settings = isset( $typography_settings['fluid'] ) && is_array( $typography_settings['fluid'] )
|
||||
? $typography_settings['fluid']
|
||||
: array();
|
||||
// $typography_settings['fluid'] can be a bool or an array. Normalize to array.
|
||||
$fluid_settings = is_array( $typography_settings['fluid'] ) ? $typography_settings['fluid'] : array();
|
||||
$layout_settings = isset( $settings['layout'] ) ? $settings['layout'] : array();
|
||||
|
||||
// Defaults.
|
||||
$default_maximum_viewport_width = '1600px';
|
||||
|
||||
@@ -53,7 +53,19 @@ function get_block_theme_folders( $theme_stylesheet = null ) {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return array[] The supported template part area values.
|
||||
* @return array[] {
|
||||
* The allowed template part area values.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* Data for the allowed template part area.
|
||||
*
|
||||
* @type string $area Template part area name.
|
||||
* @type string $label Template part area label.
|
||||
* @type string $description Template part area description.
|
||||
* @type string $icon Template part area icon.
|
||||
* @type string $area_tag Template part area tag.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
function get_allowed_block_template_part_areas() {
|
||||
$default_area_definitions = array(
|
||||
@@ -91,7 +103,19 @@ function get_allowed_block_template_part_areas() {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array[] $default_area_definitions An array of supported area objects.
|
||||
* @param array[] $default_area_definitions {
|
||||
* The allowed template part area values.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* Data for the template part area.
|
||||
*
|
||||
* @type string $area Template part area name.
|
||||
* @type string $label Template part area label.
|
||||
* @type string $description Template part area description.
|
||||
* @type string $icon Template part area icon.
|
||||
* @type string $area_tag Template part area tag.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
return apply_filters( 'default_wp_template_part_areas', $default_area_definitions );
|
||||
}
|
||||
@@ -103,7 +127,16 @@ function get_allowed_block_template_part_areas() {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return array[] The default template types.
|
||||
* @return array[] {
|
||||
* The default template types.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* Data for the template type.
|
||||
*
|
||||
* @type string $title Template type title.
|
||||
* @type string $description Template type description.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
function get_default_block_template_types() {
|
||||
$default_template_types = array(
|
||||
@@ -178,7 +211,16 @@ function get_default_block_template_types() {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array[] $default_template_types An array of template types, formatted as [ slug => [ title, description ] ].
|
||||
* @param array[] $default_template_types {
|
||||
* The default template types.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* Data for the template type.
|
||||
*
|
||||
* @type string $title Template type title.
|
||||
* @type string $description Template type description.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
return apply_filters( 'default_template_types', $default_template_types );
|
||||
}
|
||||
@@ -210,7 +252,7 @@ function _filter_block_template_part_area( $type ) {
|
||||
$type,
|
||||
WP_TEMPLATE_PART_AREA_UNCATEGORIZED
|
||||
);
|
||||
trigger_error( $warning_message, E_USER_NOTICE );
|
||||
wp_trigger_error( __FUNCTION__, $warning_message );
|
||||
return WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
|
||||
}
|
||||
|
||||
@@ -249,16 +291,16 @@ function _get_block_templates_paths( $base_directory ) {
|
||||
* @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
|
||||
* @param string $slug Template slug.
|
||||
* @return array|null {
|
||||
* Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part',
|
||||
* null otherwise.
|
||||
* Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part',
|
||||
* null otherwise.
|
||||
*
|
||||
* @type string $slug Template slug.
|
||||
* @type string $path Template file path.
|
||||
* @type string $theme Theme slug.
|
||||
* @type string $type Template type.
|
||||
* @type string $area Template area. Only for 'wp_template_part'.
|
||||
* @type string $title Optional. Template title.
|
||||
* @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'.
|
||||
* @type string $slug Template slug.
|
||||
* @type string $path Template file path.
|
||||
* @type string $theme Theme slug.
|
||||
* @type string $type Template type.
|
||||
* @type string $area Template area. Only for 'wp_template_part'.
|
||||
* @type string $title Optional. Template title.
|
||||
* @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'.
|
||||
* }
|
||||
*/
|
||||
function _get_block_template_file( $template_type, $slug ) {
|
||||
@@ -320,6 +362,11 @@ function _get_block_templates_files( $template_type, $query = array() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$default_template_types = array();
|
||||
if ( 'wp_template' === $template_type ) {
|
||||
$default_template_types = get_default_block_template_types();
|
||||
}
|
||||
|
||||
// Prepare metadata from $query.
|
||||
$slugs_to_include = isset( $query['slug__in'] ) ? $query['slug__in'] : array();
|
||||
$slugs_to_skip = isset( $query['slug__not_in'] ) ? $query['slug__not_in'] : array();
|
||||
@@ -383,12 +430,19 @@ function _get_block_templates_files( $template_type, $query = array() ) {
|
||||
|
||||
if ( 'wp_template' === $template_type ) {
|
||||
$candidate = _add_block_template_info( $new_template_item );
|
||||
$is_custom = ! isset( $default_template_types[ $candidate['slug'] ] );
|
||||
|
||||
if (
|
||||
! $post_type ||
|
||||
( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
|
||||
) {
|
||||
$template_files[ $template_slug ] = $candidate;
|
||||
}
|
||||
|
||||
// The custom templates with no associated post types are available for all post types.
|
||||
if ( $post_type && ! isset( $candidate['postTypes'] ) && $is_custom ) {
|
||||
$template_files[ $template_slug ] = $candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -556,8 +610,8 @@ function _build_block_template_result_from_file( $template_file, $template_type
|
||||
$after_block_visitor = null;
|
||||
$hooked_blocks = get_hooked_blocks();
|
||||
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template );
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
|
||||
}
|
||||
$blocks = parse_blocks( $template->content );
|
||||
$template->content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
|
||||
@@ -942,8 +996,8 @@ function _build_block_template_result_from_post( $post ) {
|
||||
|
||||
$hooked_blocks = get_hooked_blocks();
|
||||
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template );
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
|
||||
$blocks = parse_blocks( $template->content );
|
||||
$template->content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
|
||||
}
|
||||
@@ -1223,7 +1277,7 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $part The block template part to print. Either 'header' or 'footer'.
|
||||
* @param string $part The block template part to print, for example 'header' or 'footer'.
|
||||
*/
|
||||
function block_template_part( $part ) {
|
||||
$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
|
||||
@@ -1397,13 +1451,16 @@ function wp_generate_block_templates_export_file() {
|
||||
*/
|
||||
function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) {
|
||||
if ( 'index' === $slug ) {
|
||||
return array( 'index' );
|
||||
/** This filter is documented in wp-includes/template.php */
|
||||
return apply_filters( 'index_template_hierarchy', array( 'index' ) );
|
||||
}
|
||||
if ( $is_custom ) {
|
||||
return array( 'page', 'singular', 'index' );
|
||||
/** This filter is documented in wp-includes/template.php */
|
||||
return apply_filters( 'page_template_hierarchy', array( 'page', 'singular', 'index' ) );
|
||||
}
|
||||
if ( 'front-page' === $slug ) {
|
||||
return array( 'front-page', 'home', 'index' );
|
||||
/** This filter is documented in wp-includes/template.php */
|
||||
return apply_filters( 'frontpage_template_hierarchy', array( 'front-page', 'home', 'index' ) );
|
||||
}
|
||||
|
||||
$matches = array();
|
||||
@@ -1469,6 +1526,18 @@ function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '
|
||||
$template_hierarchy[] = 'singular';
|
||||
}
|
||||
$template_hierarchy[] = 'index';
|
||||
|
||||
$template_type = '';
|
||||
if ( ! empty( $template_prefix ) ) {
|
||||
list( $template_type ) = explode( '-', $template_prefix );
|
||||
} else {
|
||||
list( $template_type ) = explode( '-', $slug );
|
||||
}
|
||||
$valid_template_types = array( '404', 'archive', 'attachment', 'author', 'category', 'date', 'embed', 'frontpage', 'home', 'index', 'page', 'paged', 'privacypolicy', 'search', 'single', 'singular', 'tag', 'taxonomy' );
|
||||
if ( in_array( $template_type, $valid_template_types, true ) ) {
|
||||
/** This filter is documented in wp-includes/template.php */
|
||||
return apply_filters( "{$template_type}_template_hierarchy", $template_hierarchy );
|
||||
}
|
||||
return $template_hierarchy;
|
||||
}
|
||||
|
||||
@@ -1542,11 +1611,7 @@ function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated
|
||||
return $template;
|
||||
}
|
||||
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'set_ignored_hooked_blocks_metadata' );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'set_ignored_hooked_blocks_metadata' );
|
||||
|
||||
$blocks = parse_blocks( $changes->post_content );
|
||||
$changes->post_content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
|
||||
$changes->post_content = apply_block_hooks_to_content( $changes->post_content, $template, 'set_ignored_hooked_blocks_metadata' );
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
@@ -210,8 +210,8 @@ function _block_template_render_title_tag() {
|
||||
*
|
||||
* @global string $_wp_current_template_id
|
||||
* @global string $_wp_current_template_content
|
||||
* @global WP_Embed $wp_embed
|
||||
* @global WP_Query $wp_query
|
||||
* @global WP_Embed $wp_embed WordPress Embed object.
|
||||
* @global WP_Query $wp_query WordPress Query object.
|
||||
*
|
||||
* @return string Block template markup.
|
||||
*/
|
||||
|
||||
@@ -858,11 +858,11 @@ function get_hooked_blocks() {
|
||||
* @since 6.5.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
|
||||
* @param string $relative_position The relative position of the hooked blocks.
|
||||
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
|
||||
* @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
|
||||
* @param WP_Block_Template|array $context The block template, template part, or pattern that the anchor block belongs to.
|
||||
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
|
||||
* @param string $relative_position The relative position of the hooked blocks.
|
||||
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
|
||||
* @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
|
||||
* @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function insert_hooked_blocks( &$parsed_anchor_block, $relative_position, $hooked_blocks, $context ) {
|
||||
@@ -949,12 +949,12 @@ function insert_hooked_blocks( &$parsed_anchor_block, $relative_position, $hooke
|
||||
* @since 6.5.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
|
||||
* @param string $relative_position The relative position of the hooked blocks.
|
||||
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
|
||||
* @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
|
||||
* @param WP_Block_Template|array $context The block template, template part, or pattern that the anchor block belongs to.
|
||||
* @return string An empty string.
|
||||
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
|
||||
* @param string $relative_position The relative position of the hooked blocks.
|
||||
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
|
||||
* @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
|
||||
* @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.
|
||||
* @return string Empty string.
|
||||
*/
|
||||
function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_position, $hooked_blocks, $context ) {
|
||||
$anchor_block_type = $parsed_anchor_block['blockName'];
|
||||
@@ -1002,6 +1002,183 @@ function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_po
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the hooked blocks algorithm on the given content.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param string $content Serialized content.
|
||||
* @param WP_Block_Template|WP_Post|array $context A block template, template part, `wp_navigation` post object,
|
||||
* or pattern that the blocks belong to.
|
||||
* @param callable $callback A function that will be called for each block to generate
|
||||
* the markup for a given list of blocks that are hooked to it.
|
||||
* Default: 'insert_hooked_blocks'.
|
||||
* @return string The serialized markup.
|
||||
*/
|
||||
function apply_block_hooks_to_content( $content, $context, $callback = 'insert_hooked_blocks' ) {
|
||||
$hooked_blocks = get_hooked_blocks();
|
||||
if ( empty( $hooked_blocks ) && ! has_filter( 'hooked_block_types' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$blocks = parse_blocks( $content );
|
||||
|
||||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $context, $callback );
|
||||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $context, $callback );
|
||||
|
||||
return traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param string $serialized_block The serialized markup of a block and its inner blocks.
|
||||
* @return string The serialized markup of the inner blocks.
|
||||
*/
|
||||
function remove_serialized_parent_block( $serialized_block ) {
|
||||
$start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
|
||||
$end = strrpos( $serialized_block, '<!--' );
|
||||
return substr( $serialized_block, $start, $end - $start );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the wp_postmeta with the list of ignored hooked blocks where the inner blocks are stored as post content.
|
||||
* Currently only supports `wp_navigation` post types.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param stdClass $post Post object.
|
||||
* @return stdClass The updated post object.
|
||||
*/
|
||||
function update_ignored_hooked_blocks_postmeta( $post ) {
|
||||
/*
|
||||
* In this scenario the user has likely tried to create a navigation via the REST API.
|
||||
* In which case we won't have a post ID to work with and store meta against.
|
||||
*/
|
||||
if ( empty( $post->ID ) ) {
|
||||
return $post;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip meta generation when consumers intentionally update specific Navigation fields
|
||||
* and omit the content update.
|
||||
*/
|
||||
if ( ! isset( $post->post_content ) ) {
|
||||
return $post;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip meta generation when the post content is not a navigation block.
|
||||
*/
|
||||
if ( ! isset( $post->post_type ) || 'wp_navigation' !== $post->post_type ) {
|
||||
return $post;
|
||||
}
|
||||
|
||||
$attributes = array();
|
||||
|
||||
$ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
|
||||
if ( ! empty( $ignored_hooked_blocks ) ) {
|
||||
$ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true );
|
||||
$attributes['metadata'] = array(
|
||||
'ignoredHookedBlocks' => $ignored_hooked_blocks,
|
||||
);
|
||||
}
|
||||
|
||||
$markup = get_comment_delimited_block_content(
|
||||
'core/navigation',
|
||||
$attributes,
|
||||
$post->post_content
|
||||
);
|
||||
|
||||
$serialized_block = apply_block_hooks_to_content( $markup, get_post( $post->ID ), 'set_ignored_hooked_blocks_metadata' );
|
||||
$root_block = parse_blocks( $serialized_block )[0];
|
||||
|
||||
$ignored_hooked_blocks = isset( $root_block['attrs']['metadata']['ignoredHookedBlocks'] )
|
||||
? $root_block['attrs']['metadata']['ignoredHookedBlocks']
|
||||
: array();
|
||||
|
||||
if ( ! empty( $ignored_hooked_blocks ) ) {
|
||||
$existing_ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
|
||||
if ( ! empty( $existing_ignored_hooked_blocks ) ) {
|
||||
$existing_ignored_hooked_blocks = json_decode( $existing_ignored_hooked_blocks, true );
|
||||
$ignored_hooked_blocks = array_unique( array_merge( $ignored_hooked_blocks, $existing_ignored_hooked_blocks ) );
|
||||
}
|
||||
update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
|
||||
}
|
||||
|
||||
$post->post_content = remove_serialized_parent_block( $serialized_block );
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for blocks hooked to the given anchor block in a specific relative position and then
|
||||
* adds a list of hooked block types to an anchor block's ignored hooked block types.
|
||||
*
|
||||
* This function is meant for internal use only.
|
||||
*
|
||||
* @since 6.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
|
||||
* @param string $relative_position The relative position of the hooked blocks.
|
||||
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
|
||||
* @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.
|
||||
* @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.
|
||||
* @return string
|
||||
*/
|
||||
function insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_position, $hooked_blocks, $context ) {
|
||||
$markup = insert_hooked_blocks( $parsed_anchor_block, $relative_position, $hooked_blocks, $context );
|
||||
$markup .= set_ignored_hooked_blocks_metadata( $parsed_anchor_block, $relative_position, $hooked_blocks, $context );
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param WP_REST_Response $response The response object.
|
||||
* @param WP_Post $post Post object.
|
||||
* @return WP_REST_Response The response object.
|
||||
*/
|
||||
function insert_hooked_blocks_into_rest_response( $response, $post ) {
|
||||
if ( ! isset( $response->data['content']['raw'] ) || ! isset( $response->data['content']['rendered'] ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$attributes = array();
|
||||
$ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
|
||||
if ( ! empty( $ignored_hooked_blocks ) ) {
|
||||
$ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true );
|
||||
$attributes['metadata'] = array(
|
||||
'ignoredHookedBlocks' => $ignored_hooked_blocks,
|
||||
);
|
||||
}
|
||||
$content = get_comment_delimited_block_content(
|
||||
'core/navigation',
|
||||
$attributes,
|
||||
$response->data['content']['raw']
|
||||
);
|
||||
|
||||
$content = apply_block_hooks_to_content( $content, $post );
|
||||
|
||||
// Remove mock Navigation block wrapper.
|
||||
$content = remove_serialized_parent_block( $content );
|
||||
|
||||
$response->data['content']['raw'] = $content;
|
||||
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$response->data['content']['rendered'] = apply_filters( 'the_content', $content );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a function that injects the theme attribute into, and hooked blocks before, a given block.
|
||||
*
|
||||
@@ -1201,7 +1378,17 @@ function get_comment_delimited_block_content( $block_name, $block_attributes, $b
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param array $block A representative array of a single parsed block object. See WP_Block_Parser_Block.
|
||||
* @param array $block {
|
||||
* A representative array of a single parsed block object. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @return string String of rendered HTML.
|
||||
*/
|
||||
function serialize_block( $block ) {
|
||||
@@ -1229,7 +1416,21 @@ function serialize_block( $block ) {
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param array[] $blocks An array of representative arrays of parsed block objects. See serialize_block().
|
||||
* @param array[] $blocks {
|
||||
* Array of block structures.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* A representative array of a single parsed block object. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* }
|
||||
* @return string String of rendered HTML.
|
||||
*/
|
||||
function serialize_blocks( $blocks ) {
|
||||
@@ -1320,6 +1521,83 @@ function traverse_and_serialize_block( $block, $pre_callback = null, $post_callb
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces patterns in a block tree with their content.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param array $blocks An array blocks.
|
||||
*
|
||||
* @return array An array of blocks with patterns replaced by their content.
|
||||
*/
|
||||
function resolve_pattern_blocks( $blocks ) {
|
||||
static $inner_content;
|
||||
// Keep track of seen references to avoid infinite loops.
|
||||
static $seen_refs = array();
|
||||
$i = 0;
|
||||
while ( $i < count( $blocks ) ) {
|
||||
if ( 'core/pattern' === $blocks[ $i ]['blockName'] ) {
|
||||
$attrs = $blocks[ $i ]['attrs'];
|
||||
|
||||
if ( empty( $attrs['slug'] ) ) {
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
|
||||
$slug = $attrs['slug'];
|
||||
|
||||
if ( isset( $seen_refs[ $slug ] ) ) {
|
||||
// Skip recursive patterns.
|
||||
array_splice( $blocks, $i, 1 );
|
||||
continue;
|
||||
}
|
||||
|
||||
$registry = WP_Block_Patterns_Registry::get_instance();
|
||||
$pattern = $registry->get_registered( $slug );
|
||||
|
||||
// Skip unknown patterns.
|
||||
if ( ! $pattern ) {
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
|
||||
$blocks_to_insert = parse_blocks( $pattern['content'] );
|
||||
$seen_refs[ $slug ] = true;
|
||||
$prev_inner_content = $inner_content;
|
||||
$inner_content = null;
|
||||
$blocks_to_insert = resolve_pattern_blocks( $blocks_to_insert );
|
||||
$inner_content = $prev_inner_content;
|
||||
unset( $seen_refs[ $slug ] );
|
||||
array_splice( $blocks, $i, 1, $blocks_to_insert );
|
||||
|
||||
// If we have inner content, we need to insert nulls in the
|
||||
// inner content array, otherwise serialize_blocks will skip
|
||||
// blocks.
|
||||
if ( $inner_content ) {
|
||||
$null_indices = array_keys( $inner_content, null, true );
|
||||
$content_index = $null_indices[ $i ];
|
||||
$nulls = array_fill( 0, count( $blocks_to_insert ), null );
|
||||
array_splice( $inner_content, $content_index, 1, $nulls );
|
||||
}
|
||||
|
||||
// Skip inserted blocks.
|
||||
$i += count( $blocks_to_insert );
|
||||
} else {
|
||||
if ( ! empty( $blocks[ $i ]['innerBlocks'] ) ) {
|
||||
$prev_inner_content = $inner_content;
|
||||
$inner_content = $blocks[ $i ]['innerContent'];
|
||||
$blocks[ $i ]['innerBlocks'] = resolve_pattern_blocks(
|
||||
$blocks[ $i ]['innerBlocks']
|
||||
);
|
||||
$blocks[ $i ]['innerContent'] = $inner_content;
|
||||
$inner_content = $prev_inner_content;
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of parsed block trees, applies callbacks before and after serializing them and
|
||||
* returns their concatenated output.
|
||||
@@ -1483,7 +1761,6 @@ function filter_block_kses_value( $value, $allowed_html, $allowed_protocols = ar
|
||||
if ( isset( $block_context['blockName'] ) && 'core/template-part' === $block_context['blockName'] ) {
|
||||
$filtered_value = filter_block_core_template_part_attributes( $filtered_value, $filtered_key, $allowed_html );
|
||||
}
|
||||
|
||||
if ( $filtered_key !== $key ) {
|
||||
unset( $value[ $key ] );
|
||||
}
|
||||
@@ -1502,11 +1779,11 @@ function filter_block_kses_value( $value, $allowed_html, $allowed_protocols = ar
|
||||
*
|
||||
* @since 6.5.5
|
||||
*
|
||||
* @param string $attribute_value The attribute value to filter.
|
||||
* @param string $attribute_name The attribute name.
|
||||
* @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
|
||||
* or a context name such as 'post'. See wp_kses_allowed_html()
|
||||
* for the list of accepted context names.
|
||||
* @param string $attribute_value The attribute value to filter.
|
||||
* @param string $attribute_name The attribute name.
|
||||
* @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
|
||||
* or a context name such as 'post'. See wp_kses_allowed_html()
|
||||
* for the list of accepted context names.
|
||||
* @return string The sanitized attribute value.
|
||||
*/
|
||||
function filter_block_core_template_part_attributes( $attribute_value, $attribute_name, $allowed_html ) {
|
||||
@@ -1666,7 +1943,17 @@ function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) {
|
||||
*
|
||||
* @global WP_Post $post The post to edit.
|
||||
*
|
||||
* @param array $parsed_block A single parsed block object.
|
||||
* @param array $parsed_block {
|
||||
* A representative array of the block being rendered. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @return string String of rendered HTML.
|
||||
*/
|
||||
function render_block( $parsed_block ) {
|
||||
@@ -1680,7 +1967,17 @@ function render_block( $parsed_block ) {
|
||||
* @since 5.9.0 The `$parent_block` parameter was added.
|
||||
*
|
||||
* @param string|null $pre_render The pre-rendered content. Default null.
|
||||
* @param array $parsed_block The block being rendered.
|
||||
* @param array $parsed_block {
|
||||
* A representative array of the block being rendered. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
|
||||
*/
|
||||
$pre_render = apply_filters( 'pre_render_block', null, $parsed_block, $parent_block );
|
||||
@@ -1696,8 +1993,29 @@ function render_block( $parsed_block ) {
|
||||
* @since 5.1.0
|
||||
* @since 5.9.0 The `$parent_block` parameter was added.
|
||||
*
|
||||
* @param array $parsed_block The block being rendered.
|
||||
* @param array $source_block An un-modified copy of $parsed_block, as it appeared in the source content.
|
||||
* @param array $parsed_block {
|
||||
* A representative array of the block being rendered. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @param array $source_block {
|
||||
* An un-modified copy of `$parsed_block`, as it appeared in the source content.
|
||||
* See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
|
||||
*/
|
||||
$parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block );
|
||||
@@ -1723,7 +2041,17 @@ function render_block( $parsed_block ) {
|
||||
* @since 5.9.0 The `$parent_block` parameter was added.
|
||||
*
|
||||
* @param array $context Default context.
|
||||
* @param array $parsed_block Block being rendered, filtered by `render_block_data`.
|
||||
* @param array $parsed_block {
|
||||
* A representative array of the block being rendered. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
|
||||
*/
|
||||
$context = apply_filters( 'render_block_context', $context, $parsed_block, $parent_block );
|
||||
@@ -1739,7 +2067,21 @@ function render_block( $parsed_block ) {
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $content Post content.
|
||||
* @return array[] Array of parsed block objects.
|
||||
* @return array[] {
|
||||
* Array of block structures.
|
||||
*
|
||||
* @type array ...$0 {
|
||||
* A representative array of a single parsed block object. See WP_Block_Parser_Block.
|
||||
*
|
||||
* @type string $blockName Name of block.
|
||||
* @type array $attrs Attributes from block comment delimiters.
|
||||
* @type array[] $innerBlocks List of inner blocks. An array of arrays that
|
||||
* have the same structure as this one.
|
||||
* @type string $innerHTML HTML from inside block comment delimiters.
|
||||
* @type array $innerContent List of string fragments and null markers where
|
||||
* inner blocks were found.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
function parse_blocks( $content ) {
|
||||
/**
|
||||
@@ -1818,14 +2160,16 @@ function block_version( $content ) {
|
||||
* Registers a new block style.
|
||||
*
|
||||
* @since 5.3.0
|
||||
* @since 6.6.0 Added support for registering styles for multiple block types.
|
||||
*
|
||||
* @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/
|
||||
*
|
||||
* @param string $block_name Block type name including namespace.
|
||||
* @param array $style_properties Array containing the properties of the style name, label,
|
||||
* style_handle (name of the stylesheet to be enqueued),
|
||||
* inline_style (string containing the CSS to be added).
|
||||
* See WP_Block_Styles_Registry::register().
|
||||
* @param string|string[] $block_name Block type name including namespace or array of namespaced block type names.
|
||||
* @param array $style_properties Array containing the properties of the style name, label,
|
||||
* style_handle (name of the stylesheet to be enqueued),
|
||||
* inline_style (string containing the CSS to be added),
|
||||
* style_data (theme.json-like array to generate CSS from).
|
||||
* See WP_Block_Styles_Registry::register().
|
||||
* @return bool True if the block style was registered with success and false otherwise.
|
||||
*/
|
||||
function register_block_style( $block_name, $style_properties ) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/archives` block on server.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see WP_Widget_Archives
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
@@ -106,6 +108,8 @@ function render_block_core_archives( $attributes ) {
|
||||
|
||||
/**
|
||||
* Register archives block.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
function register_block_core_archives() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.wp-block-audio{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
.wp-block-audio figcaption{
|
||||
.wp-block-audio :where(figcaption){
|
||||
margin-bottom:1em;
|
||||
margin-top:.5em;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-audio{box-sizing:border-box}.wp-block-audio figcaption{margin-bottom:1em;margin-top:.5em}.wp-block-audio audio{min-width:300px;width:100%}
|
||||
.wp-block-audio{box-sizing:border-box}.wp-block-audio :where(figcaption){margin-bottom:1em;margin-top:.5em}.wp-block-audio audio{min-width:300px;width:100%}
|
||||
@@ -1,7 +1,7 @@
|
||||
.wp-block-audio{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
.wp-block-audio figcaption{
|
||||
.wp-block-audio :where(figcaption){
|
||||
margin-bottom:1em;
|
||||
margin-top:.5em;
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/audio/style.min.css
vendored
2
wp/wp-includes/blocks/audio/style.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-audio{box-sizing:border-box}.wp-block-audio figcaption{margin-bottom:1em;margin-top:.5em}.wp-block-audio audio{min-width:300px;width:100%}
|
||||
.wp-block-audio{box-sizing:border-box}.wp-block-audio :where(figcaption){margin-bottom:1em;margin-top:.5em}.wp-block-audio audio{min-width:300px;width:100%}
|
||||
@@ -1,9 +1,9 @@
|
||||
.wp-block-audio figcaption{
|
||||
.wp-block-audio :where(figcaption){
|
||||
color:#555;
|
||||
font-size:13px;
|
||||
text-align:center;
|
||||
}
|
||||
.is-dark-theme .wp-block-audio figcaption{
|
||||
.is-dark-theme .wp-block-audio :where(figcaption){
|
||||
color:#ffffffa6;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:#ffffffa6}.wp-block-audio{margin:0 0 1em}
|
||||
.wp-block-audio :where(figcaption){color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio :where(figcaption){color:#ffffffa6}.wp-block-audio{margin:0 0 1em}
|
||||
@@ -1,9 +1,9 @@
|
||||
.wp-block-audio figcaption{
|
||||
.wp-block-audio :where(figcaption){
|
||||
color:#555;
|
||||
font-size:13px;
|
||||
text-align:center;
|
||||
}
|
||||
.is-dark-theme .wp-block-audio figcaption{
|
||||
.is-dark-theme .wp-block-audio :where(figcaption){
|
||||
color:#ffffffa6;
|
||||
}
|
||||
|
||||
|
||||
2
wp/wp-includes/blocks/audio/theme.min.css
vendored
2
wp/wp-includes/blocks/audio/theme.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:#ffffffa6}.wp-block-audio{margin:0 0 1em}
|
||||
.wp-block-audio :where(figcaption){color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio :where(figcaption){color:#ffffffa6}.wp-block-audio{margin:0 0 1em}
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/avatar` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -31,7 +33,18 @@ function render_block_core_avatar( $attributes, $content, $block ) {
|
||||
: '';
|
||||
|
||||
if ( ! isset( $block->context['commentId'] ) ) {
|
||||
$author_id = isset( $attributes['userId'] ) ? $attributes['userId'] : get_post_field( 'post_author', $block->context['postId'] );
|
||||
if ( isset( $attributes['userId'] ) ) {
|
||||
$author_id = $attributes['userId'];
|
||||
} elseif ( isset( $block->context['postId'] ) ) {
|
||||
$author_id = get_post_field( 'post_author', $block->context['postId'] );
|
||||
} else {
|
||||
$author_id = get_query_var( 'author' );
|
||||
}
|
||||
|
||||
if ( empty( $author_id ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$author_name = get_the_author_meta( 'display_name', $author_id );
|
||||
// translators: %s is the Author name.
|
||||
$alt = sprintf( __( '%s Avatar' ), $author_name );
|
||||
@@ -88,6 +101,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
|
||||
* Generates class names and styles to apply the border support styles for
|
||||
* the Avatar block.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @return array The border-related classnames and styles for the block.
|
||||
*/
|
||||
@@ -138,6 +153,8 @@ function get_block_core_avatar_border_attributes( $attributes ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/avatar` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_avatar() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
/**
|
||||
* Renders the `core/block` block on server.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @global WP_Embed $wp_embed
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return string Rendered HTML of the referenced block.
|
||||
@@ -74,7 +78,7 @@ function render_block_core_block( $attributes ) {
|
||||
* filter so that it is available when a pattern's inner blocks are
|
||||
* rendering via do_blocks given it only receives the inner content.
|
||||
*/
|
||||
$has_pattern_overrides = isset( $attributes['content'] );
|
||||
$has_pattern_overrides = isset( $attributes['content'] ) && null !== get_block_bindings_source( 'core/pattern-overrides' );
|
||||
if ( $has_pattern_overrides ) {
|
||||
$filter_block_context = static function ( $context ) use ( $attributes ) {
|
||||
$context['pattern/overrides'] = $attributes['content'];
|
||||
@@ -95,6 +99,8 @@ function render_block_core_block( $attributes ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/block` block.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
function register_block_core_block() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -12,9 +12,13 @@
|
||||
"type": "number"
|
||||
},
|
||||
"content": {
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"default": {}
|
||||
}
|
||||
},
|
||||
"providesContext": {
|
||||
"pattern/overrides": "content"
|
||||
},
|
||||
"supports": {
|
||||
"customClassName": false,
|
||||
"html": false,
|
||||
|
||||
@@ -207,9 +207,15 @@
|
||||
'type' => 'number'
|
||||
),
|
||||
'content' => array(
|
||||
'type' => 'object'
|
||||
'type' => 'object',
|
||||
'default' => array(
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
'providesContext' => array(
|
||||
'pattern/overrides' => 'content'
|
||||
),
|
||||
'supports' => array(
|
||||
'customClassName' => false,
|
||||
'html' => false,
|
||||
@@ -302,6 +308,7 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'anchor' => true,
|
||||
'splitting' => true,
|
||||
'align' => false,
|
||||
'alignWide' => false,
|
||||
'color' => array(
|
||||
@@ -1557,6 +1564,7 @@
|
||||
'anchor' => true,
|
||||
'align' => true,
|
||||
'html' => false,
|
||||
'shadow' => true,
|
||||
'spacing' => array(
|
||||
'padding' => true,
|
||||
'margin' => array(
|
||||
@@ -1643,6 +1651,7 @@
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
'__experimentalOnEnter' => true,
|
||||
'align' => array(
|
||||
'wide',
|
||||
'full'
|
||||
@@ -2240,6 +2249,7 @@
|
||||
),
|
||||
'anchor' => true,
|
||||
'className' => true,
|
||||
'splitting' => true,
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'link' => true,
|
||||
@@ -2770,7 +2780,7 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'anchor' => true,
|
||||
'className' => false,
|
||||
'html' => false,
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
'lineHeight' => true,
|
||||
@@ -2801,7 +2811,6 @@
|
||||
)
|
||||
),
|
||||
'__unstablePasteTextInline' => true,
|
||||
'__experimentalSelector' => 'ol,ul',
|
||||
'__experimentalOnMerge' => true,
|
||||
'__experimentalSlashInserter' => true,
|
||||
'interactivity' => array(
|
||||
@@ -2838,7 +2847,8 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'className' => false,
|
||||
'__experimentalSelector' => 'li',
|
||||
'__experimentalSelector' => '.wp-block-list > li',
|
||||
'splitting' => true,
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true,
|
||||
@@ -3013,8 +3023,16 @@
|
||||
),
|
||||
'allowedBlocks' => array(
|
||||
'type' => 'array'
|
||||
),
|
||||
'useFeaturedImage' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false
|
||||
)
|
||||
),
|
||||
'usesContext' => array(
|
||||
'postId',
|
||||
'postType'
|
||||
),
|
||||
'supports' => array(
|
||||
'anchor' => true,
|
||||
'align' => array(
|
||||
@@ -3099,7 +3117,8 @@
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
'customText' => array(
|
||||
'type' => 'string'
|
||||
'type' => 'string',
|
||||
'default' => ''
|
||||
),
|
||||
'noTeaser' => array(
|
||||
'type' => 'boolean',
|
||||
@@ -3279,15 +3298,6 @@
|
||||
'type' => 'flex'
|
||||
)
|
||||
),
|
||||
'__experimentalStyle' => array(
|
||||
'elements' => array(
|
||||
'link' => array(
|
||||
'color' => array(
|
||||
'text' => 'inherit'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'interactivity' => true,
|
||||
'renaming' => false
|
||||
),
|
||||
@@ -3613,9 +3623,6 @@
|
||||
'text'
|
||||
),
|
||||
'textdomain' => 'default',
|
||||
'usesContext' => array(
|
||||
'postId'
|
||||
),
|
||||
'attributes' => array(
|
||||
'align' => array(
|
||||
'type' => 'string'
|
||||
@@ -3642,6 +3649,7 @@
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
'splitting' => true,
|
||||
'anchor' => true,
|
||||
'className' => false,
|
||||
'color' => array(
|
||||
@@ -4185,7 +4193,6 @@
|
||||
'full'
|
||||
),
|
||||
'color' => array(
|
||||
'__experimentalDuotone' => 'img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before',
|
||||
'text' => false,
|
||||
'background' => false
|
||||
),
|
||||
@@ -4193,7 +4200,6 @@
|
||||
'color' => true,
|
||||
'radius' => true,
|
||||
'width' => true,
|
||||
'__experimentalSelector' => 'img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay',
|
||||
'__experimentalSkipSerialization' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'color' => true,
|
||||
@@ -4201,6 +4207,12 @@
|
||||
'width' => true
|
||||
)
|
||||
),
|
||||
'filter' => array(
|
||||
'duotone' => true
|
||||
),
|
||||
'shadow' => array(
|
||||
'__experimentalSkipSerialization' => true
|
||||
),
|
||||
'html' => false,
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
@@ -4210,6 +4222,13 @@
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'selectors' => array(
|
||||
'border' => '.wp-block-post-featured-image img, .wp-block-post-featured-image .block-editor-media-placeholder, .wp-block-post-featured-image .wp-block-post-featured-image__overlay',
|
||||
'shadow' => '.wp-block-post-featured-image img, .wp-block-post-featured-image .components-placeholder',
|
||||
'filter' => array(
|
||||
'duotone' => '.wp-block-post-featured-image img, .wp-block-post-featured-image .wp-block-post-featured-image__placeholder, .wp-block-post-featured-image .components-placeholder__illustration, .wp-block-post-featured-image .components-placeholder::before'
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-post-featured-image-editor',
|
||||
'style' => 'wp-block-post-featured-image'
|
||||
),
|
||||
@@ -5035,7 +5054,7 @@
|
||||
'selector' => 'cite',
|
||||
'__experimentalRole' => 'content'
|
||||
),
|
||||
'align' => array(
|
||||
'textAlign' => array(
|
||||
'type' => 'string'
|
||||
)
|
||||
),
|
||||
@@ -5475,6 +5494,10 @@
|
||||
'attributes' => array(
|
||||
'textAlign' => array(
|
||||
'type' => 'string'
|
||||
),
|
||||
'level' => array(
|
||||
'type' => 'number',
|
||||
'default' => 0
|
||||
)
|
||||
),
|
||||
'example' => array(
|
||||
@@ -5600,7 +5623,7 @@
|
||||
'parent' => array(
|
||||
'core/social-links'
|
||||
),
|
||||
'description' => 'Display an icon linking to a social media profile or site.',
|
||||
'description' => 'Display an icon linking to a social profile or site.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
'url' => array(
|
||||
@@ -5642,7 +5665,7 @@
|
||||
'allowedBlocks' => array(
|
||||
'core/social-link'
|
||||
),
|
||||
'description' => 'Display icons linking to your social media profiles or sites.',
|
||||
'description' => 'Display icons linking to your social profiles or sites.',
|
||||
'keywords' => array(
|
||||
'links'
|
||||
),
|
||||
@@ -5802,7 +5825,7 @@
|
||||
'attributes' => array(
|
||||
'hasFixedLayout' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false
|
||||
'default' => true
|
||||
),
|
||||
'caption' => array(
|
||||
'type' => 'rich-text',
|
||||
@@ -6384,6 +6407,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/widget-group',
|
||||
'title' => 'Widget Group',
|
||||
'category' => 'widgets',
|
||||
'attributes' => array(
|
||||
'title' => array(
|
||||
|
||||
80
wp/wp-includes/blocks/button.php
Normal file
80
wp/wp-includes/blocks/button.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `core/button` block.
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renders the `core/button` block on the server,
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
* @param WP_Block $block The block object.
|
||||
*
|
||||
* @return string The block content.
|
||||
*/
|
||||
function render_block_core_button( $attributes, $content ) {
|
||||
$p = new WP_HTML_Tag_Processor( $content );
|
||||
|
||||
/*
|
||||
* The button block can render an `<a>` or `<button>` and also has a
|
||||
* `<div>` wrapper. Find the a or button tag.
|
||||
*/
|
||||
$tag = null;
|
||||
while ( $p->next_tag() ) {
|
||||
$tag = $p->get_tag();
|
||||
if ( 'A' === $tag || 'BUTTON' === $tag ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If this happens, the likelihood is there's no block content,
|
||||
* or the block has been modified by a plugin.
|
||||
*/
|
||||
if ( null === $tag ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
// If the next token is the closing tag, the button is empty.
|
||||
$is_empty = true;
|
||||
while ( $p->next_token() && $tag !== $p->get_token_name() && $is_empty ) {
|
||||
if ( '#comment' !== $p->get_token_type() ) {
|
||||
/**
|
||||
* Anything else implies this is not empty.
|
||||
* This might include any text content (including a space),
|
||||
* inline images or other HTML.
|
||||
*/
|
||||
$is_empty = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When there's no text, render nothing for the block.
|
||||
* See https://github.com/WordPress/gutenberg/issues/17221 for the
|
||||
* reasoning behind this.
|
||||
*/
|
||||
if ( $is_empty ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the `core/button` block on server.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*/
|
||||
function register_block_core_button() {
|
||||
register_block_type_from_metadata(
|
||||
__DIR__ . '/button',
|
||||
array(
|
||||
'render_callback' => 'render_block_core_button',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_button' );
|
||||
@@ -73,6 +73,7 @@
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"splitting": true,
|
||||
"align": false,
|
||||
"alignWide": false,
|
||||
"color": {
|
||||
|
||||
@@ -27,35 +27,4 @@ div[data-type="core/button"]{
|
||||
|
||||
.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{
|
||||
text-decoration:inherit;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){
|
||||
border-width:initial;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){
|
||||
border-width:initial;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid #0000;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium}
|
||||
.wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid #0000;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}
|
||||
@@ -27,35 +27,4 @@ div[data-type="core/button"]{
|
||||
|
||||
.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{
|
||||
text-decoration:inherit;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){
|
||||
border-width:initial;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){
|
||||
border-width:initial;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
2
wp/wp-includes/blocks/button/editor.min.css
vendored
2
wp/wp-includes/blocks/button/editor.min.css
vendored
@@ -1,2 +1,2 @@
|
||||
.wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{
|
||||
/*!rtl:ignore*/text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid #0000;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium}
|
||||
/*!rtl:ignore*/text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid #0000;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}
|
||||
@@ -64,47 +64,14 @@
|
||||
border-radius:0 !important;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link){
|
||||
border:2px solid;
|
||||
padding:.667em 1.333em;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color)){
|
||||
color:currentColor;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)){
|
||||
background-color:initial;
|
||||
background-image:none;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.has-border-color){
|
||||
border-width:initial;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-top-color]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-right-color]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-left-color]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-style]){
|
||||
border-width:initial;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-top-style]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-right-style]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-left-style]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){background-color:initial;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium}
|
||||
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}:root :where(.wp-block-button .wp-block-button__link.is-style-outline),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link){border:2px solid;padding:.667em 1.333em}:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color)){color:currentColor}:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)){background-color:initial;background-image:none}
|
||||
@@ -64,47 +64,14 @@
|
||||
border-radius:0 !important;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link){
|
||||
border:2px solid;
|
||||
padding:.667em 1.333em;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color)){
|
||||
color:currentColor;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){
|
||||
:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)){
|
||||
background-color:initial;
|
||||
background-image:none;
|
||||
}
|
||||
|
||||
.wp-block-button .wp-block-button__link:where(.has-border-color){
|
||||
border-width:initial;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-top-color]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-right-color]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-left-color]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-style]){
|
||||
border-width:initial;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-top-style]){
|
||||
border-top-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-right-style]){
|
||||
border-right-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){
|
||||
border-bottom-width:medium;
|
||||
}
|
||||
.wp-block-button .wp-block-button__link:where([style*=border-left-style]){
|
||||
border-left-width:medium;
|
||||
}
|
||||
2
wp/wp-includes/blocks/button/style.min.css
vendored
2
wp/wp-includes/blocks/button/style.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){background-color:initial;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium}
|
||||
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}:root :where(.wp-block-button .wp-block-button__link.is-style-outline),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link){border:2px solid;padding:.667em 1.333em}:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color)){color:currentColor}:root :where(.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background)),:root :where(.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)){background-color:initial;background-image:none}
|
||||
@@ -8,6 +8,11 @@
|
||||
/**
|
||||
* Renders the `core/calendar` block on server.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @global int $monthnum.
|
||||
* @global int $year.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return string Returns the block content.
|
||||
@@ -76,6 +81,8 @@ function render_block_core_calendar( $attributes ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/calendar` block on server.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
function register_block_core_calendar() {
|
||||
register_block_type_from_metadata(
|
||||
@@ -94,6 +101,8 @@ add_action( 'init', 'register_block_core_calendar' );
|
||||
* Used to hide the calendar block when there are no published posts.
|
||||
* This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return bool Has any published posts or not.
|
||||
*/
|
||||
function block_core_calendar_has_published_posts() {
|
||||
@@ -117,6 +126,10 @@ function block_core_calendar_has_published_posts() {
|
||||
* Queries the database for any published post and saves
|
||||
* a flag whether any published post exists or not.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @return bool Has any published posts or not.
|
||||
*/
|
||||
function block_core_calendar_update_has_published_posts() {
|
||||
@@ -132,6 +145,8 @@ if ( ! is_multisite() ) {
|
||||
/**
|
||||
* Handler for updating the has published posts flag when a post is deleted.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param int $post_id Deleted post ID.
|
||||
*/
|
||||
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
|
||||
@@ -147,6 +162,8 @@ if ( ! is_multisite() ) {
|
||||
/**
|
||||
* Handler for updating the has published posts flag when a post status changes.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $new_status The status the post is changing to.
|
||||
* @param string $old_status The status the post is changing from.
|
||||
* @param WP_Post $post Post object.
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/categories` block on server.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return string Returns the categories list/dropdown markup.
|
||||
@@ -63,6 +65,8 @@ function render_block_core_categories( $attributes ) {
|
||||
/**
|
||||
* Generates the inline script for a categories dropdown field.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $dropdown_id ID of the dropdown field.
|
||||
*
|
||||
* @return string Returns the dropdown onChange redirection script.
|
||||
@@ -87,6 +91,8 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/categories` block on server.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
function register_block_core_categories() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comment-author-name` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -53,6 +55,8 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-author-name` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_author_name() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comment-content` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -69,6 +71,8 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-content` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_content() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comment-date` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -46,6 +48,8 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-date` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_date() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comment-edit-link` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -48,6 +50,8 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-edit-link` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_edit_link() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comment-reply-link` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -70,6 +72,8 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-reply-link` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_reply_link() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -92,6 +92,8 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
||||
/**
|
||||
* Renders the `core/comment-template` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -136,6 +138,8 @@ function render_block_core_comment_template( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comment-template` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comment_template() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comments-pagination-next` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -48,6 +50,8 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
|
||||
|
||||
/**
|
||||
* Registers the `core/comments-pagination-next` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comments_pagination_next() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comments-pagination-numbers` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -50,6 +52,8 @@ function render_block_core_comments_pagination_numbers( $attributes, $content, $
|
||||
|
||||
/**
|
||||
* Registers the `core/comments-pagination-numbers` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comments_pagination_numbers() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comments-pagination-previous` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -40,6 +42,8 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
|
||||
|
||||
/**
|
||||
* Registers the `core/comments-pagination-previous` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comments_pagination_previous() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comments-pagination` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
*
|
||||
@@ -34,6 +36,8 @@ function render_block_core_comments_pagination( $attributes, $content ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comments-pagination` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comments_pagination() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/comments-title` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
*
|
||||
* @return string Return the post comments title.
|
||||
@@ -84,6 +86,8 @@ function render_block_core_comments_title( $attributes ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comments-title` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_comments_title() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
* the block is in legacy mode. If not, the HTML generated in the editor is
|
||||
* returned instead.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @global WP_Post $post Global post object.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
@@ -83,6 +87,8 @@ function render_block_core_comments( $attributes, $content, $block ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/comments` block on the server.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*/
|
||||
function register_block_core_comments() {
|
||||
register_block_type_from_metadata(
|
||||
@@ -98,6 +104,8 @@ add_action( 'init', 'register_block_core_comments' );
|
||||
/**
|
||||
* Use the button block classes for the form-submit button.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param array $fields The default comment form arguments.
|
||||
*
|
||||
* @return array Returns the modified fields.
|
||||
@@ -116,6 +124,8 @@ add_filter( 'comment_form_defaults', 'comments_block_form_defaults' );
|
||||
* Enqueues styles from the legacy `core/post-comments` block. These styles are
|
||||
* required only by the block's fallback.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param string $block_name Name of the new block type.
|
||||
*/
|
||||
function enqueue_legacy_post_comments_block_styles( $block_name ) {
|
||||
@@ -141,6 +151,8 @@ function enqueue_legacy_post_comments_block_styles( $block_name ) {
|
||||
* The same approach was followed when core/query-loop was renamed to
|
||||
* core/post-template.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/41807
|
||||
* @see https://github.com/WordPress/gutenberg/pull/32514
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* Renders the `core/cover` block on server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block rendered content.
|
||||
*
|
||||
@@ -66,6 +68,8 @@ function render_block_core_cover( $attributes, $content ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/cover` block renderer on server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
function register_block_core_cover() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"anchor": true,
|
||||
"align": true,
|
||||
"html": false,
|
||||
"shadow": true,
|
||||
"spacing": {
|
||||
"padding": true,
|
||||
"margin": [ "top", "bottom" ],
|
||||
|
||||
@@ -17,9 +17,17 @@
|
||||
.wp-block-cover.components-placeholder h2{
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-cover.is-transient{
|
||||
position:relative;
|
||||
}
|
||||
.wp-block-cover.is-transient:before{
|
||||
background-color:#fff;
|
||||
content:"";
|
||||
height:100%;
|
||||
opacity:.3;
|
||||
position:absolute;
|
||||
width:100%;
|
||||
z-index:1;
|
||||
}
|
||||
.wp-block-cover .components-spinner{
|
||||
margin:0;
|
||||
@@ -78,8 +86,4 @@
|
||||
|
||||
.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){
|
||||
margin-top:24px;
|
||||
}
|
||||
|
||||
.wp-block-cover:after{
|
||||
min-height:auto;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{align-items:stretch;display:flex;min-height:240px;padding:0!important}.wp-block-cover.is-placeholder .components-placeholder.is-large{justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder:focus:after{min-height:auto}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{margin:0;position:absolute;right:50%;top:50%;transform:translate(50%,-50%);z-index:1}.wp-block-cover .wp-block-cover__inner-container{margin-left:0;margin-right:0;text-align:right}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}.wp-block-cover .wp-block-cover__image--placeholder-image{bottom:0;left:0;position:absolute;right:0;top:0}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-right:auto}.block-library-cover__resize-container{bottom:0;left:0;min-height:50px;position:absolute!important;right:0;top:0}.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .block-library-cover__resize-container,.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .components-popover__content>div{overflow:visible;pointer-events:none}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){margin-top:24px}.wp-block-cover:after{min-height:auto}
|
||||
.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{align-items:stretch;display:flex;min-height:240px;padding:0!important}.wp-block-cover.is-placeholder .components-placeholder.is-large{justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder:focus:after{min-height:auto}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient{position:relative}.wp-block-cover.is-transient:before{background-color:#fff;content:"";height:100%;opacity:.3;position:absolute;width:100%;z-index:1}.wp-block-cover .components-spinner{margin:0;position:absolute;right:50%;top:50%;transform:translate(50%,-50%);z-index:1}.wp-block-cover .wp-block-cover__inner-container{margin-left:0;margin-right:0;text-align:right}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}.wp-block-cover .wp-block-cover__image--placeholder-image{bottom:0;left:0;position:absolute;right:0;top:0}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-right:auto}.block-library-cover__resize-container{bottom:0;left:0;min-height:50px;position:absolute!important;right:0;top:0}.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .block-library-cover__resize-container,.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .components-popover__content>div{overflow:visible;pointer-events:none}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){margin-top:24px}
|
||||
@@ -17,9 +17,17 @@
|
||||
.wp-block-cover.components-placeholder h2{
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-cover.is-transient{
|
||||
position:relative;
|
||||
}
|
||||
.wp-block-cover.is-transient:before{
|
||||
background-color:#fff;
|
||||
content:"";
|
||||
height:100%;
|
||||
opacity:.3;
|
||||
position:absolute;
|
||||
width:100%;
|
||||
z-index:1;
|
||||
}
|
||||
.wp-block-cover .components-spinner{
|
||||
left:50%;
|
||||
@@ -78,8 +86,4 @@
|
||||
|
||||
.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){
|
||||
margin-top:24px;
|
||||
}
|
||||
|
||||
.wp-block-cover:after{
|
||||
min-height:auto;
|
||||
}
|
||||
2
wp/wp-includes/blocks/cover/editor.min.css
vendored
2
wp/wp-includes/blocks/cover/editor.min.css
vendored
@@ -1 +1 @@
|
||||
.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{align-items:stretch;display:flex;min-height:240px;padding:0!important}.wp-block-cover.is-placeholder .components-placeholder.is-large{justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder:focus:after{min-height:auto}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{left:50%;margin:0;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1}.wp-block-cover .wp-block-cover__inner-container{margin-left:0;margin-right:0;text-align:left}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}.wp-block-cover .wp-block-cover__image--placeholder-image{bottom:0;left:0;position:absolute;right:0;top:0}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-left:auto}.block-library-cover__resize-container{bottom:0;left:0;min-height:50px;position:absolute!important;right:0;top:0}.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .block-library-cover__resize-container,.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .components-popover__content>div{overflow:visible;pointer-events:none}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){margin-top:24px}.wp-block-cover:after{min-height:auto}
|
||||
.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{align-items:stretch;display:flex;min-height:240px;padding:0!important}.wp-block-cover.is-placeholder .components-placeholder.is-large{justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder:focus:after{min-height:auto}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient{position:relative}.wp-block-cover.is-transient:before{background-color:#fff;content:"";height:100%;opacity:.3;position:absolute;width:100%;z-index:1}.wp-block-cover .components-spinner{left:50%;margin:0;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1}.wp-block-cover .wp-block-cover__inner-container{margin-left:0;margin-right:0;text-align:left}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}.wp-block-cover .wp-block-cover__image--placeholder-image{bottom:0;left:0;position:absolute;right:0;top:0}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-left:auto}.block-library-cover__resize-container{bottom:0;left:0;min-height:50px;position:absolute!important;right:0;top:0}.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .block-library-cover__resize-container,.components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover .components-popover__content>div{overflow:visible;pointer-events:none}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.color-block-support-panel__inner-wrapper>:not(.block-editor-tools-panel-color-gradient-settings__item){margin-top:24px}
|
||||
@@ -96,17 +96,6 @@
|
||||
max-width:420px;
|
||||
width:100%;
|
||||
}
|
||||
.wp-block-cover-image:after,.wp-block-cover:after{
|
||||
content:"";
|
||||
display:block;
|
||||
font-size:0;
|
||||
min-height:inherit;
|
||||
}
|
||||
@supports (position:sticky){
|
||||
.wp-block-cover-image:after,.wp-block-cover:after{
|
||||
content:none;
|
||||
}
|
||||
}
|
||||
.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{
|
||||
display:flex;
|
||||
}
|
||||
@@ -115,9 +104,6 @@
|
||||
width:100%;
|
||||
z-index:1;
|
||||
}
|
||||
.wp-block-cover h1:where(:not(.has-text-color)),.wp-block-cover h2:where(:not(.has-text-color)),.wp-block-cover h3:where(:not(.has-text-color)),.wp-block-cover h4:where(:not(.has-text-color)),.wp-block-cover h5:where(:not(.has-text-color)),.wp-block-cover h6:where(:not(.has-text-color)),.wp-block-cover p:where(:not(.has-text-color)),.wp-block-cover-image h1:where(:not(.has-text-color)),.wp-block-cover-image h2:where(:not(.has-text-color)),.wp-block-cover-image h3:where(:not(.has-text-color)),.wp-block-cover-image h4:where(:not(.has-text-color)),.wp-block-cover-image h5:where(:not(.has-text-color)),.wp-block-cover-image h6:where(:not(.has-text-color)),.wp-block-cover-image p:where(:not(.has-text-color)){
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{
|
||||
align-items:flex-start;
|
||||
justify-content:flex-start;
|
||||
@@ -239,4 +225,8 @@
|
||||
|
||||
:where(.wp-block-cover-image.is-light:not(.has-text-color)),:where(.wp-block-cover.is-light:not(.has-text-color)){
|
||||
color:#000;
|
||||
}
|
||||
|
||||
:root :where(.wp-block-cover h1:not(.has-text-color)),:root :where(.wp-block-cover h2:not(.has-text-color)),:root :where(.wp-block-cover h3:not(.has-text-color)),:root :where(.wp-block-cover h4:not(.has-text-color)),:root :where(.wp-block-cover h5:not(.has-text-color)),:root :where(.wp-block-cover h6:not(.has-text-color)),:root :where(.wp-block-cover p:not(.has-text-color)){
|
||||
color:inherit;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -96,17 +96,6 @@
|
||||
max-width:420px;
|
||||
width:100%;
|
||||
}
|
||||
.wp-block-cover-image:after,.wp-block-cover:after{
|
||||
content:"";
|
||||
display:block;
|
||||
font-size:0;
|
||||
min-height:inherit;
|
||||
}
|
||||
@supports (position:sticky){
|
||||
.wp-block-cover-image:after,.wp-block-cover:after{
|
||||
content:none;
|
||||
}
|
||||
}
|
||||
.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{
|
||||
display:flex;
|
||||
}
|
||||
@@ -115,9 +104,6 @@
|
||||
width:100%;
|
||||
z-index:1;
|
||||
}
|
||||
.wp-block-cover h1:where(:not(.has-text-color)),.wp-block-cover h2:where(:not(.has-text-color)),.wp-block-cover h3:where(:not(.has-text-color)),.wp-block-cover h4:where(:not(.has-text-color)),.wp-block-cover h5:where(:not(.has-text-color)),.wp-block-cover h6:where(:not(.has-text-color)),.wp-block-cover p:where(:not(.has-text-color)),.wp-block-cover-image h1:where(:not(.has-text-color)),.wp-block-cover-image h2:where(:not(.has-text-color)),.wp-block-cover-image h3:where(:not(.has-text-color)),.wp-block-cover-image h4:where(:not(.has-text-color)),.wp-block-cover-image h5:where(:not(.has-text-color)),.wp-block-cover-image h6:where(:not(.has-text-color)),.wp-block-cover-image p:where(:not(.has-text-color)){
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{
|
||||
align-items:flex-start;
|
||||
justify-content:flex-start;
|
||||
@@ -239,4 +225,8 @@
|
||||
|
||||
:where(.wp-block-cover-image.is-light:not(.has-text-color)),:where(.wp-block-cover.is-light:not(.has-text-color)){
|
||||
color:#000;
|
||||
}
|
||||
|
||||
:root :where(.wp-block-cover h1:not(.has-text-color)),:root :where(.wp-block-cover h2:not(.has-text-color)),:root :where(.wp-block-cover h3:not(.has-text-color)),:root :where(.wp-block-cover h4:not(.has-text-color)),:root :where(.wp-block-cover h5:not(.has-text-color)),:root :where(.wp-block-cover h6:not(.has-text-color)),:root :where(.wp-block-cover p:not(.has-text-color)){
|
||||
color:inherit;
|
||||
}
|
||||
2
wp/wp-includes/blocks/cover/style.min.css
vendored
2
wp/wp-includes/blocks/cover/style.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -19,6 +19,7 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"__experimentalOnEnter": true,
|
||||
"align": [ "wide", "full" ],
|
||||
"color": {
|
||||
"gradients": true,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
.wp-block-details{
|
||||
box-sizing:border-box;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.wp-block-details summary{
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}
|
||||
.wp-block-details{box-sizing:border-box}.wp-block-details summary{cursor:pointer}
|
||||
@@ -1,6 +1,5 @@
|
||||
.wp-block-details{
|
||||
box-sizing:border-box;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.wp-block-details summary{
|
||||
|
||||
2
wp/wp-includes/blocks/details/style.min.css
vendored
2
wp/wp-includes/blocks/details/style.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}
|
||||
.wp-block-details{box-sizing:border-box}.wp-block-details summary{cursor:pointer}
|
||||
@@ -11,9 +11,6 @@
|
||||
word-break:break-word;
|
||||
}
|
||||
|
||||
.wp-block-embed__learn-more{
|
||||
margin-top:1em;
|
||||
}
|
||||
.wp-block-post-content .wp-block-embed__learn-more a{
|
||||
color:var(--wp-admin-theme-color);
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-embed{clear:both;margin-left:0;margin-right:0}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed__learn-more{margin-top:1em}.wp-block-post-content .wp-block-embed__learn-more a{color:var(--wp-admin-theme-color)}.block-library-embed__interactive-overlay{bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}
|
||||
.wp-block-embed{clear:both;margin-left:0;margin-right:0}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-post-content .wp-block-embed__learn-more a{color:var(--wp-admin-theme-color)}.block-library-embed__interactive-overlay{bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}
|
||||
@@ -11,9 +11,6 @@
|
||||
word-break:break-word;
|
||||
}
|
||||
|
||||
.wp-block-embed__learn-more{
|
||||
margin-top:1em;
|
||||
}
|
||||
.wp-block-post-content .wp-block-embed__learn-more a{
|
||||
color:var(--wp-admin-theme-color);
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/embed/editor.min.css
vendored
2
wp/wp-includes/blocks/embed/editor.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-embed{clear:both;margin-left:0;margin-right:0}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed__learn-more{margin-top:1em}.wp-block-post-content .wp-block-embed__learn-more a{color:var(--wp-admin-theme-color)}.block-library-embed__interactive-overlay{bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}
|
||||
.wp-block-embed{clear:both;margin-left:0;margin-right:0}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-post-content .wp-block-embed__learn-more a{color:var(--wp-admin-theme-color)}.block-library-embed__interactive-overlay{bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}
|
||||
@@ -14,7 +14,7 @@
|
||||
.wp-block-embed{
|
||||
overflow-wrap:break-word;
|
||||
}
|
||||
.wp-block-embed figcaption{
|
||||
.wp-block-embed :where(figcaption){
|
||||
margin-bottom:1em;
|
||||
margin-top:.5em;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-height:240px;min-width:320px}.wp-block-embed{overflow-wrap:break-word}.wp-block-embed figcaption{margin-bottom:1em;margin-top:.5em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}
|
||||
.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-height:240px;min-width:320px}.wp-block-embed{overflow-wrap:break-word}.wp-block-embed :where(figcaption){margin-bottom:1em;margin-top:.5em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}
|
||||
@@ -14,7 +14,7 @@
|
||||
.wp-block-embed{
|
||||
overflow-wrap:break-word;
|
||||
}
|
||||
.wp-block-embed figcaption{
|
||||
.wp-block-embed :where(figcaption){
|
||||
margin-bottom:1em;
|
||||
margin-top:.5em;
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/embed/style.min.css
vendored
2
wp/wp-includes/blocks/embed/style.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-height:240px;min-width:320px}.wp-block-embed{overflow-wrap:break-word}.wp-block-embed figcaption{margin-bottom:1em;margin-top:.5em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}
|
||||
.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-height:240px;min-width:320px}.wp-block-embed{overflow-wrap:break-word}.wp-block-embed :where(figcaption){margin-bottom:1em;margin-top:.5em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}
|
||||
@@ -1,9 +1,9 @@
|
||||
.wp-block-embed figcaption{
|
||||
.wp-block-embed :where(figcaption){
|
||||
color:#555;
|
||||
font-size:13px;
|
||||
text-align:center;
|
||||
}
|
||||
.is-dark-theme .wp-block-embed figcaption{
|
||||
.is-dark-theme .wp-block-embed :where(figcaption){
|
||||
color:#ffffffa6;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:#ffffffa6}.wp-block-embed{margin:0 0 1em}
|
||||
.wp-block-embed :where(figcaption){color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed :where(figcaption){color:#ffffffa6}.wp-block-embed{margin:0 0 1em}
|
||||
@@ -1,9 +1,9 @@
|
||||
.wp-block-embed figcaption{
|
||||
.wp-block-embed :where(figcaption){
|
||||
color:#555;
|
||||
font-size:13px;
|
||||
text-align:center;
|
||||
}
|
||||
.is-dark-theme .wp-block-embed figcaption{
|
||||
.is-dark-theme .wp-block-embed :where(figcaption){
|
||||
color:#ffffffa6;
|
||||
}
|
||||
|
||||
|
||||
2
wp/wp-includes/blocks/embed/theme.min.css
vendored
2
wp/wp-includes/blocks/embed/theme.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:#ffffffa6}.wp-block-embed{margin:0 0 1em}
|
||||
.wp-block-embed :where(figcaption){color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed :where(figcaption){color:#ffffffa6}.wp-block-embed{margin:0 0 1em}
|
||||
@@ -8,6 +8,8 @@
|
||||
/**
|
||||
* When the `core/file` block is rendering, check if we need to enqueue the `wp-block-file-view` script.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
* @param WP_Block $block The parsed block.
|
||||
@@ -15,27 +17,6 @@
|
||||
* @return string Returns the block content.
|
||||
*/
|
||||
function render_block_core_file( $attributes, $content ) {
|
||||
// Update object's aria-label attribute if present in block HTML.
|
||||
// Match an aria-label attribute from an object tag.
|
||||
$pattern = '@<object.+(?<attribute>aria-label="(?<filename>[^"]+)?")@i';
|
||||
$content = preg_replace_callback(
|
||||
$pattern,
|
||||
static function ( $matches ) {
|
||||
$filename = ! empty( $matches['filename'] ) ? $matches['filename'] : '';
|
||||
$has_filename = ! empty( $filename ) && 'PDF embed' !== $filename;
|
||||
$label = $has_filename ?
|
||||
sprintf(
|
||||
/* translators: %s: filename. */
|
||||
__( 'Embed of %s.' ),
|
||||
$filename
|
||||
)
|
||||
: __( 'PDF embed' );
|
||||
|
||||
return str_replace( $matches['attribute'], sprintf( 'aria-label="%s"', $label ), $matches[0] );
|
||||
},
|
||||
$content
|
||||
);
|
||||
|
||||
// If it's interactive, enqueue the script module and add the directives.
|
||||
if ( ! empty( $attributes['displayPreview'] ) ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
@@ -57,6 +38,19 @@ function render_block_core_file( $attributes, $content ) {
|
||||
$processor->next_tag( 'object' );
|
||||
$processor->set_attribute( 'data-wp-bind--hidden', '!state.hasPdfPreview' );
|
||||
$processor->set_attribute( 'hidden', true );
|
||||
|
||||
$filename = $processor->get_attribute( 'aria-label' );
|
||||
$has_filename = ! empty( $filename ) && 'PDF embed' !== $filename;
|
||||
$label = $has_filename ? sprintf(
|
||||
/* translators: %s: filename. */
|
||||
__( 'Embed of %s.' ),
|
||||
$filename
|
||||
) : __( 'PDF embed' );
|
||||
|
||||
// Update object's aria-label attribute if present in block HTML.
|
||||
// Match an aria-label attribute from an object tag.
|
||||
$processor->set_attribute( 'aria-label', $label );
|
||||
|
||||
return $processor->get_updated_html();
|
||||
}
|
||||
|
||||
@@ -65,6 +59,8 @@ function render_block_core_file( $attributes, $content ) {
|
||||
|
||||
/**
|
||||
* Registers the `core/file` block on server.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*/
|
||||
function register_block_core_file() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{
|
||||
height:auto;
|
||||
}
|
||||
.wp-block[data-align=center]>.wp-block-file{
|
||||
text-align:center;
|
||||
}
|
||||
.wp-block-file .components-resizable-box__container{
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em}
|
||||
.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block[data-align=center]>.wp-block-file{text-align:center}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em}
|
||||
@@ -8,6 +8,9 @@
|
||||
.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{
|
||||
height:auto;
|
||||
}
|
||||
.wp-block[data-align=center]>.wp-block-file{
|
||||
text-align:center;
|
||||
}
|
||||
.wp-block-file .components-resizable-box__container{
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/file/editor.min.css
vendored
2
wp/wp-includes/blocks/file/editor.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em}
|
||||
.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block[data-align=center]>.wp-block-file{text-align:center}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em}
|
||||
@@ -13,6 +13,8 @@
|
||||
* we add a custom `data-id` attribute before rendering the gallery
|
||||
* so that the Image Block can pick it up in its render_callback.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $parsed_block The block being rendered.
|
||||
* @return array The migrated block object.
|
||||
*/
|
||||
@@ -35,6 +37,8 @@ add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility'
|
||||
/**
|
||||
* Renders the `core/gallery` block on the server.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $attributes Attributes of the block being rendered.
|
||||
* @param string $content Content of the block being rendered.
|
||||
* @return string The content of the block being rendered.
|
||||
@@ -127,7 +131,7 @@ function block_core_gallery_render( $attributes, $content ) {
|
||||
* the `$parsed_block['innerBlocks']` via the `render_block_data` hook.
|
||||
* However, this hook doesn't apply inner block updates when blocks are
|
||||
* nested.
|
||||
* @todo: In the future, if this hook supports updating innerBlocks in
|
||||
* @todo In the future, if this hook supports updating innerBlocks in
|
||||
* nested blocks, it should be refactored.
|
||||
*
|
||||
* @see: https://github.com/WordPress/gutenberg/pull/58733
|
||||
@@ -164,6 +168,8 @@ function block_core_gallery_render( $attributes, $content ) {
|
||||
}
|
||||
/**
|
||||
* Registers the `core/gallery` block on server.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*/
|
||||
function register_block_core_gallery() {
|
||||
register_block_type_from_metadata(
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
figure.wp-block-gallery{
|
||||
:root :where(figure.wp-block-gallery){
|
||||
display:block;
|
||||
}
|
||||
figure.wp-block-gallery>.blocks-gallery-caption{
|
||||
:root :where(figure.wp-block-gallery)>.blocks-gallery-caption{
|
||||
flex:0 0 100%;
|
||||
}
|
||||
figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{
|
||||
:root :where(figure.wp-block-gallery)>.blocks-gallery-media-placeholder-wrapper{
|
||||
flex-basis:100%;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice.is-error{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice.is-error{
|
||||
display:block;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice__content{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__content{
|
||||
margin:4px 0;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice__dismiss{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__dismiss{
|
||||
left:5px;
|
||||
position:absolute;
|
||||
top:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .components-placeholder__label{
|
||||
display:none;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{
|
||||
margin-bottom:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder{
|
||||
margin:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder .components-placeholder__label{
|
||||
display:flex;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder figcaption{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder figcaption{
|
||||
z-index:2;
|
||||
}
|
||||
figure.wp-block-gallery .components-spinner{
|
||||
:root :where(figure.wp-block-gallery) .components-spinner{
|
||||
margin-right:-9px;
|
||||
margin-top:-9px;
|
||||
position:absolute;
|
||||
|
||||
@@ -1 +1 @@
|
||||
figure.wp-block-gallery{display:block}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{left:5px;position:absolute;top:0}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{margin-right:-9px;margin-top:-9px;position:absolute;right:50%;top:50%}.gallery-settings-buttons .components-button:first-child{margin-left:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{align-items:center;color:#757575;display:flex;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 4px 0 8px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{bottom:0;box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";left:0;outline:2px solid #0000;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{height:100%;margin:0}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{background:#fff;border:1px solid #1e1e1e;border-radius:2px;display:none;margin:8px;position:absolute;top:-2px;transition:box-shadow .2s ease-out;z-index:20}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-delay:0s;transition-duration:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 .7px 1px #0000001a,0 1.2px 1.7px -.2px #0000001a,0 2.3px 3.3px -.5px #0000001a}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{height:inherit;padding:0;width:inherit}}.block-library-gallery-item__inline-menu.is-left{right:-2px}.block-library-gallery-item__inline-menu.is-right{left:-2px}.wp-block-gallery ul.blocks-gallery-grid{margin:0;padding:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;gap:12px;justify-content:flex-end}
|
||||
:root :where(figure.wp-block-gallery){display:block}:root :where(figure.wp-block-gallery)>.blocks-gallery-caption{flex:0 0 100%}:root :where(figure.wp-block-gallery)>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice.is-error{display:block}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__content{margin:4px 0}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__dismiss{left:5px;position:absolute;top:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder{margin:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder .components-placeholder__label{display:flex}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder figcaption{z-index:2}:root :where(figure.wp-block-gallery) .components-spinner{margin-right:-9px;margin-top:-9px;position:absolute;right:50%;top:50%}.gallery-settings-buttons .components-button:first-child{margin-left:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{align-items:center;color:#757575;display:flex;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 4px 0 8px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{bottom:0;box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";left:0;outline:2px solid #0000;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{height:100%;margin:0}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{background:#fff;border:1px solid #1e1e1e;border-radius:2px;display:none;margin:8px;position:absolute;top:-2px;transition:box-shadow .2s ease-out;z-index:20}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-delay:0s;transition-duration:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 .7px 1px #0000001a,0 1.2px 1.7px -.2px #0000001a,0 2.3px 3.3px -.5px #0000001a}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{height:inherit;padding:0;width:inherit}}.block-library-gallery-item__inline-menu.is-left{right:-2px}.block-library-gallery-item__inline-menu.is-right{left:-2px}.wp-block-gallery ul.blocks-gallery-grid{margin:0;padding:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;gap:12px;justify-content:flex-end}
|
||||
@@ -1,39 +1,39 @@
|
||||
figure.wp-block-gallery{
|
||||
:root :where(figure.wp-block-gallery){
|
||||
display:block;
|
||||
}
|
||||
figure.wp-block-gallery>.blocks-gallery-caption{
|
||||
:root :where(figure.wp-block-gallery)>.blocks-gallery-caption{
|
||||
flex:0 0 100%;
|
||||
}
|
||||
figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{
|
||||
:root :where(figure.wp-block-gallery)>.blocks-gallery-media-placeholder-wrapper{
|
||||
flex-basis:100%;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice.is-error{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice.is-error{
|
||||
display:block;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice__content{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__content{
|
||||
margin:4px 0;
|
||||
}
|
||||
figure.wp-block-gallery .wp-block-image .components-notice__dismiss{
|
||||
:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__dismiss{
|
||||
position:absolute;
|
||||
right:5px;
|
||||
top:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .components-placeholder__label{
|
||||
display:none;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{
|
||||
margin-bottom:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder{
|
||||
margin:0;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder .components-placeholder__label{
|
||||
display:flex;
|
||||
}
|
||||
figure.wp-block-gallery .block-editor-media-placeholder figcaption{
|
||||
:root :where(figure.wp-block-gallery) .block-editor-media-placeholder figcaption{
|
||||
z-index:2;
|
||||
}
|
||||
figure.wp-block-gallery .components-spinner{
|
||||
:root :where(figure.wp-block-gallery) .components-spinner{
|
||||
left:50%;
|
||||
margin-left:-9px;
|
||||
margin-top:-9px;
|
||||
|
||||
2
wp/wp-includes/blocks/gallery/editor.min.css
vendored
2
wp/wp-includes/blocks/gallery/editor.min.css
vendored
@@ -1 +1 @@
|
||||
figure.wp-block-gallery{display:block}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{position:absolute;right:5px;top:0}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{left:50%;margin-left:-9px;margin-top:-9px;position:absolute;top:50%}.gallery-settings-buttons .components-button:first-child{margin-right:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{align-items:center;color:#757575;display:flex;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 8px 0 4px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{bottom:0;box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";left:0;outline:2px solid #0000;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{height:100%;margin:0}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{background:#fff;border:1px solid #1e1e1e;border-radius:2px;display:none;margin:8px;position:absolute;top:-2px;transition:box-shadow .2s ease-out;z-index:20}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-delay:0s;transition-duration:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 .7px 1px #0000001a,0 1.2px 1.7px -.2px #0000001a,0 2.3px 3.3px -.5px #0000001a}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{height:inherit;padding:0;width:inherit}}.block-library-gallery-item__inline-menu.is-left{left:-2px}.block-library-gallery-item__inline-menu.is-right{right:-2px}.wp-block-gallery ul.blocks-gallery-grid{margin:0;padding:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;gap:12px;justify-content:flex-end}
|
||||
:root :where(figure.wp-block-gallery){display:block}:root :where(figure.wp-block-gallery)>.blocks-gallery-caption{flex:0 0 100%}:root :where(figure.wp-block-gallery)>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice.is-error{display:block}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__content{margin:4px 0}:root :where(figure.wp-block-gallery) .wp-block-image .components-notice__dismiss{position:absolute;right:5px;top:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder{margin:0}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder .components-placeholder__label{display:flex}:root :where(figure.wp-block-gallery) .block-editor-media-placeholder figcaption{z-index:2}:root :where(figure.wp-block-gallery) .components-spinner{left:50%;margin-left:-9px;margin-top:-9px;position:absolute;top:50%}.gallery-settings-buttons .components-button:first-child{margin-right:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{align-items:center;color:#757575;display:flex;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 8px 0 4px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{bottom:0;box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";left:0;outline:2px solid #0000;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{height:100%;margin:0}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{background:#fff;border:1px solid #1e1e1e;border-radius:2px;display:none;margin:8px;position:absolute;top:-2px;transition:box-shadow .2s ease-out;z-index:20}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-delay:0s;transition-duration:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 .7px 1px #0000001a,0 1.2px 1.7px -.2px #0000001a,0 2.3px 3.3px -.5px #0000001a}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{height:inherit;padding:0;width:inherit}}.block-library-gallery-item__inline-menu.is-left{left:-2px}.block-library-gallery-item__inline-menu.is-right{right:-2px}.wp-block-gallery ul.blocks-gallery-grid{margin:0;padding:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;gap:12px;justify-content:flex-end}
|
||||
@@ -42,49 +42,6 @@
|
||||
right:0;
|
||||
top:0;
|
||||
}
|
||||
.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{
|
||||
.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-button-block-appender,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{
|
||||
pointer-events:all;
|
||||
}
|
||||
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations{
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
flex-wrap:wrap;
|
||||
justify-content:center;
|
||||
list-style:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:100%;
|
||||
}
|
||||
.wp-block-group__placeholder .components-placeholder__instructions{
|
||||
margin-bottom:18px;
|
||||
text-align:center;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations svg{
|
||||
fill:#ccc !important;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations svg:hover{
|
||||
fill:var(--wp-admin-theme-color) !important;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations>li{
|
||||
align-items:center;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
margin:0 12px 12px;
|
||||
width:auto;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button{
|
||||
height:32px;
|
||||
padding:0;
|
||||
width:44px;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button:hover{
|
||||
box-shadow:none;
|
||||
}
|
||||
.wp-block-group__placeholder .components-placeholder{
|
||||
min-height:auto;
|
||||
padding:24px;
|
||||
}
|
||||
.wp-block-group__placeholder .is-medium .wp-block-group-placeholder__variations>li,.wp-block-group__placeholder .is-small .wp-block-group-placeholder__variations>li{
|
||||
margin:12px;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-bottom:18px;margin-top:18px}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child{gap:inherit;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-default-block-appender__content,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{display:inherit;flex:1;flex-direction:inherit;width:100%}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after{border:1px dashed;border-radius:2px;content:"";display:flex;flex:1 0 48px;min-height:46px;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{pointer-events:all}.wp-block-group__placeholder .wp-block-group-placeholder__variations{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;list-style:none;margin:0;padding:0;width:100%}.wp-block-group__placeholder .components-placeholder__instructions{margin-bottom:18px;text-align:center}.wp-block-group__placeholder .wp-block-group-placeholder__variations svg{fill:#ccc!important}.wp-block-group__placeholder .wp-block-group-placeholder__variations svg:hover{fill:var(--wp-admin-theme-color)!important}.wp-block-group__placeholder .wp-block-group-placeholder__variations>li{align-items:center;display:flex;flex-direction:column;margin:0 12px 12px;width:auto}.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button{height:32px;padding:0;width:44px}.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button:hover{box-shadow:none}.wp-block-group__placeholder .components-placeholder{min-height:auto;padding:24px}.wp-block-group__placeholder .is-medium .wp-block-group-placeholder__variations>li,.wp-block-group__placeholder .is-small .wp-block-group-placeholder__variations>li{margin:12px}
|
||||
.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-bottom:18px;margin-top:18px}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child{gap:inherit;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-default-block-appender__content,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{display:inherit;flex:1;flex-direction:inherit;width:100%}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after{border:1px dashed;border-radius:2px;content:"";display:flex;flex:1 0 48px;min-height:46px;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-button-block-appender,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{pointer-events:all}
|
||||
@@ -42,49 +42,6 @@
|
||||
right:0;
|
||||
top:0;
|
||||
}
|
||||
.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{
|
||||
.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-button-block-appender,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{
|
||||
pointer-events:all;
|
||||
}
|
||||
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations{
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
flex-wrap:wrap;
|
||||
justify-content:center;
|
||||
list-style:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:100%;
|
||||
}
|
||||
.wp-block-group__placeholder .components-placeholder__instructions{
|
||||
margin-bottom:18px;
|
||||
text-align:center;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations svg{
|
||||
fill:#ccc !important;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations svg:hover{
|
||||
fill:var(--wp-admin-theme-color) !important;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations>li{
|
||||
align-items:center;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
margin:0 12px 12px;
|
||||
width:auto;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button{
|
||||
height:32px;
|
||||
padding:0;
|
||||
width:44px;
|
||||
}
|
||||
.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button:hover{
|
||||
box-shadow:none;
|
||||
}
|
||||
.wp-block-group__placeholder .components-placeholder{
|
||||
min-height:auto;
|
||||
padding:24px;
|
||||
}
|
||||
.wp-block-group__placeholder .is-medium .wp-block-group-placeholder__variations>li,.wp-block-group__placeholder .is-small .wp-block-group-placeholder__variations>li{
|
||||
margin:12px;
|
||||
}
|
||||
2
wp/wp-includes/blocks/group/editor.min.css
vendored
2
wp/wp-includes/blocks/group/editor.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-bottom:18px;margin-top:18px}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child{gap:inherit;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-default-block-appender__content,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{display:inherit;flex:1;flex-direction:inherit;width:100%}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after{border:1px dashed;border-radius:2px;content:"";display:flex;flex:1 0 48px;min-height:46px;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{pointer-events:all}.wp-block-group__placeholder .wp-block-group-placeholder__variations{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;list-style:none;margin:0;padding:0;width:100%}.wp-block-group__placeholder .components-placeholder__instructions{margin-bottom:18px;text-align:center}.wp-block-group__placeholder .wp-block-group-placeholder__variations svg{fill:#ccc!important}.wp-block-group__placeholder .wp-block-group-placeholder__variations svg:hover{fill:var(--wp-admin-theme-color)!important}.wp-block-group__placeholder .wp-block-group-placeholder__variations>li{align-items:center;display:flex;flex-direction:column;margin:0 12px 12px;width:auto}.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button{height:32px;padding:0;width:44px}.wp-block-group__placeholder .wp-block-group-placeholder__variations li>.wp-block-group-placeholder__variation-button:hover{box-shadow:none}.wp-block-group__placeholder .components-placeholder{min-height:auto;padding:24px}.wp-block-group__placeholder .is-medium .wp-block-group-placeholder__variations>li,.wp-block-group__placeholder .is-small .wp-block-group-placeholder__variations>li{margin:12px}
|
||||
.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-bottom:18px;margin-top:18px}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child{gap:inherit;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-default-block-appender__content,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{display:inherit;flex:1;flex-direction:inherit;width:100%}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after{border:1px dashed;border-radius:2px;content:"";display:flex;flex:1 0 48px;min-height:46px;pointer-events:none}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child:after:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-button-block-appender,.wp-block-group.is-layout-flex.block-editor-block-list__block>.block-list-appender:only-child .block-editor-inserter{pointer-events:all}
|
||||
@@ -1,3 +1,7 @@
|
||||
.wp-block-group{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
|
||||
:where(.wp-block-group.wp-block-group-is-layout-constrained){
|
||||
position:relative;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.wp-block-group{box-sizing:border-box}
|
||||
.wp-block-group{box-sizing:border-box}:where(.wp-block-group.wp-block-group-is-layout-constrained){position:relative}
|
||||
@@ -1,3 +1,7 @@
|
||||
.wp-block-group{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
|
||||
:where(.wp-block-group.wp-block-group-is-layout-constrained){
|
||||
position:relative;
|
||||
}
|
||||
2
wp/wp-includes/blocks/group/style.min.css
vendored
2
wp/wp-includes/blocks/group/style.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block-group{box-sizing:border-box}
|
||||
.wp-block-group{box-sizing:border-box}:where(.wp-block-group.wp-block-group-is-layout-constrained){position:relative}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user