mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Editor: Update WordPress packages to use with WordPress 5.8
In the response to the discussion during the Dev Chat, I'm doing a first pass to keep WordPress packages up to date in the WordPress 5.8 release cycle. See https://github.com/WordPress/wordpress-develop/pull/1176 for more details. Props youknowriad, aristath, andraganescu. See #52991. git-svn-id: https://develop.svn.wordpress.org/trunk@50761 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a45c871541
commit
4072823456
2479
package-lock.json
generated
2479
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
108
package.json
108
package.json
@ -25,11 +25,11 @@
|
||||
"last 2 Opera versions"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@wordpress/custom-templated-path-webpack-plugin": "2.0.2",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.1.1",
|
||||
"@wordpress/e2e-test-utils": "5.1.1",
|
||||
"@wordpress/library-export-default-webpack-plugin": "2.0.2",
|
||||
"@wordpress/scripts": "14.1.0",
|
||||
"@wordpress/custom-templated-path-webpack-plugin": "2.0.3",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.1.2",
|
||||
"@wordpress/e2e-test-utils": "5.1.2",
|
||||
"@wordpress/library-export-default-webpack-plugin": "2.0.3",
|
||||
"@wordpress/scripts": "14.1.1",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"chalk": "4.1.0",
|
||||
"check-node-version": "4.1.0",
|
||||
@ -78,55 +78,55 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "7.10.1",
|
||||
"@wordpress/a11y": "2.14.3",
|
||||
"@wordpress/annotations": "1.24.8",
|
||||
"@wordpress/api-fetch": "3.21.5",
|
||||
"@wordpress/autop": "2.11.1",
|
||||
"@wordpress/blob": "2.12.1",
|
||||
"@wordpress/block-directory": "1.18.13",
|
||||
"@wordpress/block-editor": "5.2.11",
|
||||
"@wordpress/block-library": "2.28.10",
|
||||
"@wordpress/block-serialization-default-parser": "3.9.1",
|
||||
"@wordpress/blocks": "7.0.6",
|
||||
"@wordpress/components": "12.0.8",
|
||||
"@wordpress/compose": "3.24.5",
|
||||
"@wordpress/core-data": "2.25.9",
|
||||
"@wordpress/data": "4.26.8",
|
||||
"@wordpress/data-controls": "1.20.8",
|
||||
"@wordpress/date": "3.13.1",
|
||||
"@wordpress/deprecated": "2.11.1",
|
||||
"@wordpress/dom": "2.16.2",
|
||||
"@wordpress/dom-ready": "2.12.1",
|
||||
"@wordpress/edit-post": "3.26.13",
|
||||
"@wordpress/editor": "9.25.12",
|
||||
"@wordpress/element": "2.19.1",
|
||||
"@wordpress/escape-html": "1.11.1",
|
||||
"@wordpress/format-library": "1.26.11",
|
||||
"@wordpress/hooks": "2.11.1",
|
||||
"@wordpress/html-entities": "2.10.1",
|
||||
"@wordpress/i18n": "3.18.0",
|
||||
"@wordpress/icons": "2.9.1",
|
||||
"@wordpress/interface": "1.0.6",
|
||||
"@wordpress/is-shallow-equal": "3.0.1",
|
||||
"@wordpress/keyboard-shortcuts": "1.13.8",
|
||||
"@wordpress/keycodes": "2.18.3",
|
||||
"@wordpress/list-reusable-blocks": "1.25.8",
|
||||
"@wordpress/media-utils": "1.19.5",
|
||||
"@wordpress/notices": "2.12.8",
|
||||
"@wordpress/nux": "3.24.8",
|
||||
"@wordpress/plugins": "2.24.7",
|
||||
"@wordpress/primitives": "1.11.1",
|
||||
"@wordpress/priority-queue": "1.10.1",
|
||||
"@wordpress/redux-routine": "3.13.1",
|
||||
"@wordpress/reusable-blocks": "1.1.11",
|
||||
"@wordpress/rich-text": "3.24.8",
|
||||
"@wordpress/server-side-render": "1.20.8",
|
||||
"@wordpress/shortcode": "2.12.1",
|
||||
"@wordpress/token-list": "1.14.1",
|
||||
"@wordpress/url": "2.21.2",
|
||||
"@wordpress/viewport": "2.25.8",
|
||||
"@wordpress/warning": "1.3.1",
|
||||
"@wordpress/wordcount": "2.14.1",
|
||||
"@wordpress/a11y": "2.15.2",
|
||||
"@wordpress/annotations": "1.25.2",
|
||||
"@wordpress/api-fetch": "3.23.1",
|
||||
"@wordpress/autop": "2.12.2",
|
||||
"@wordpress/blob": "2.13.2",
|
||||
"@wordpress/block-directory": "1.19.2",
|
||||
"@wordpress/block-editor": "5.3.2",
|
||||
"@wordpress/block-library": "2.29.2",
|
||||
"@wordpress/block-serialization-default-parser": "3.10.2",
|
||||
"@wordpress/blocks": "8.0.2",
|
||||
"@wordpress/components": "13.0.2",
|
||||
"@wordpress/compose": "3.25.2",
|
||||
"@wordpress/core-data": "2.26.2",
|
||||
"@wordpress/data": "4.27.2",
|
||||
"@wordpress/data-controls": "1.21.2",
|
||||
"@wordpress/date": "3.15.1",
|
||||
"@wordpress/deprecated": "2.12.2",
|
||||
"@wordpress/dom": "2.17.2",
|
||||
"@wordpress/dom-ready": "2.13.2",
|
||||
"@wordpress/edit-post": "3.27.2",
|
||||
"@wordpress/editor": "9.26.2",
|
||||
"@wordpress/element": "2.20.2",
|
||||
"@wordpress/escape-html": "1.12.2",
|
||||
"@wordpress/format-library": "1.27.2",
|
||||
"@wordpress/hooks": "2.12.2",
|
||||
"@wordpress/html-entities": "2.11.2",
|
||||
"@wordpress/i18n": "3.19.2",
|
||||
"@wordpress/icons": "2.10.2",
|
||||
"@wordpress/interface": "2.0.1",
|
||||
"@wordpress/is-shallow-equal": "3.1.2",
|
||||
"@wordpress/keyboard-shortcuts": "1.14.2",
|
||||
"@wordpress/keycodes": "2.19.2",
|
||||
"@wordpress/list-reusable-blocks": "1.26.2",
|
||||
"@wordpress/media-utils": "1.20.2",
|
||||
"@wordpress/notices": "2.13.2",
|
||||
"@wordpress/nux": "3.25.2",
|
||||
"@wordpress/plugins": "2.25.2",
|
||||
"@wordpress/primitives": "1.12.2",
|
||||
"@wordpress/priority-queue": "1.11.2",
|
||||
"@wordpress/redux-routine": "3.14.2",
|
||||
"@wordpress/reusable-blocks": "1.2.2",
|
||||
"@wordpress/rich-text": "3.25.2",
|
||||
"@wordpress/server-side-render": "1.21.2",
|
||||
"@wordpress/shortcode": "2.13.2",
|
||||
"@wordpress/token-list": "1.15.2",
|
||||
"@wordpress/url": "2.22.2",
|
||||
"@wordpress/viewport": "2.26.2",
|
||||
"@wordpress/warning": "1.4.2",
|
||||
"@wordpress/wordcount": "2.15.2",
|
||||
"backbone": "1.4.0",
|
||||
"clipboard": "2.0.8",
|
||||
"core-js-url-browser": "3.6.4",
|
||||
|
||||
@ -184,18 +184,9 @@ if ( ! $max_upload_size ) {
|
||||
// Editor Styles.
|
||||
$styles = array(
|
||||
array(
|
||||
'css' => file_get_contents(
|
||||
is_rtl()
|
||||
? ABSPATH . WPINC . '/css/dist/editor/editor-styles-rtl.css'
|
||||
: ABSPATH . WPINC . '/css/dist/editor/editor-styles.css'
|
||||
),
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
),
|
||||
);
|
||||
|
||||
$styles[] = array(
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
);
|
||||
|
||||
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
|
||||
foreach ( $editor_styles as $style ) {
|
||||
if ( preg_match( '~^(https?:)?//~', $style ) ) {
|
||||
@ -217,17 +208,6 @@ if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Default editor styles.
|
||||
$default_editor_styles = array(
|
||||
array(
|
||||
'css' => file_get_contents(
|
||||
is_rtl()
|
||||
? ABSPATH . WPINC . '/css/dist/editor/editor-styles-rtl.css'
|
||||
: ABSPATH . WPINC . '/css/dist/editor/editor-styles.css'
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Image sizes.
|
||||
|
||||
/** This filter is documented in wp-admin/includes/media.php */
|
||||
@ -324,7 +304,6 @@ $editor_settings = array(
|
||||
'maxUploadFileSize' => $max_upload_size,
|
||||
'allowedMimeTypes' => get_allowed_mime_types(),
|
||||
'styles' => $styles,
|
||||
'defaultEditorStyles' => $default_editor_styles,
|
||||
'imageSizes' => $available_image_sizes,
|
||||
'imageDefaultSize' => $image_default_size,
|
||||
'imageDimensions' => $image_dimensions,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -3,20 +3,19 @@
|
||||
* Align block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the align block attribute for block types that support it.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
*/
|
||||
function wp_register_alignment_support( $block_type ) {
|
||||
$has_align_support = false;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_align_support = _wp_array_get( $block_type->supports, array( 'align' ), false );
|
||||
}
|
||||
$has_align_support = block_has_support( $block_type, array( 'align' ), false );
|
||||
if ( $has_align_support ) {
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
@ -35,6 +34,7 @@ function wp_register_alignment_support( $block_type ) {
|
||||
* Add CSS classes for block alignment to the incoming attributes array.
|
||||
* This will be applied to the block markup in the front-end.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
@ -44,10 +44,7 @@ function wp_register_alignment_support( $block_type ) {
|
||||
*/
|
||||
function wp_apply_alignment_support( $block_type, $block_attributes ) {
|
||||
$attributes = array();
|
||||
$has_align_support = false;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_align_support = _wp_array_get( $block_type->supports, array( 'align' ), false );
|
||||
}
|
||||
$has_align_support = block_has_support( $block_type, array( 'align' ), false );
|
||||
if ( $has_align_support ) {
|
||||
$has_block_alignment = array_key_exists( 'align', $block_attributes );
|
||||
|
||||
|
||||
89
src/wp-includes/block-supports/border.php
Normal file
89
src/wp-includes/block-supports/border.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Border block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the style attribute used by the border feature if needed for block types that
|
||||
* support borders.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
*/
|
||||
function wp_register_border_support( $block_type ) {
|
||||
// Determine border related features supported.
|
||||
// Border width, style etc can be added in the future.
|
||||
$has_border_radius_support = block_has_support( $block_type, array( '__experimentalBorder', 'radius' ), false );
|
||||
|
||||
// Setup attributes and styles within that if needed.
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
}
|
||||
|
||||
if ( $has_border_radius_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
$block_type->attributes['style'] = array(
|
||||
'type' => 'object',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds CSS classes and inline styles for border styles to the incoming
|
||||
* attributes array. This will be applied to the block markup in the front-end.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_type $block_type Block type.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return array Border CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_border_support( $block_type, $block_attributes ) {
|
||||
$border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false );
|
||||
|
||||
if (
|
||||
is_array( $border_support ) &&
|
||||
array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
|
||||
$border_support['__experimentalSkipSerialization']
|
||||
) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Arrays used to ease addition of further border related features in future.
|
||||
$styles = array();
|
||||
|
||||
// Border Radius.
|
||||
$has_border_radius_support = block_has_support( $block_type, array( '__experimentalBorder', 'radius' ), false );
|
||||
if ( $has_border_radius_support ) {
|
||||
if ( isset( $block_attributes['style']['border']['radius'] ) ) {
|
||||
$border_radius = intval( $block_attributes['style']['border']['radius'] );
|
||||
$styles[] = sprintf( 'border-radius: %dpx;', $border_radius );
|
||||
}
|
||||
}
|
||||
|
||||
// Border width, style etc can be added here.
|
||||
|
||||
// Collect classes and styles.
|
||||
$attributes = array();
|
||||
|
||||
if ( ! empty( $styles ) ) {
|
||||
$attributes['style'] = implode( ' ', $styles );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
// Register the block support.
|
||||
WP_Block_Supports::get_instance()->register(
|
||||
'border',
|
||||
array(
|
||||
'register_attribute' => 'wp_register_border_support',
|
||||
'apply' => 'wp_apply_border_support',
|
||||
)
|
||||
);
|
||||
@ -3,11 +3,13 @@
|
||||
* Colors block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the style and colors block attributes for block types that support it.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
@ -20,12 +22,17 @@ function wp_register_colors_support( $block_type ) {
|
||||
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
|
||||
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
|
||||
$has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
|
||||
$has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
|
||||
$has_color_support = $has_text_colors_support ||
|
||||
$has_background_colors_support ||
|
||||
$has_gradients_support ||
|
||||
$has_link_colors_support;
|
||||
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
}
|
||||
|
||||
if ( $has_text_colors_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
if ( $has_color_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
$block_type->attributes['style'] = array(
|
||||
'type' => 'object',
|
||||
);
|
||||
@ -55,15 +62,25 @@ function wp_register_colors_support( $block_type ) {
|
||||
* Add CSS classes and inline styles for colors to the incoming attributes array.
|
||||
* This will be applied to the block markup in the front-end.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block type.
|
||||
* @param array $block_attributes Block attributes.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return array Colors CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_colors_support( $block_type, $block_attributes ) {
|
||||
$color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
|
||||
$color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
|
||||
|
||||
if (
|
||||
is_array( $color_support ) &&
|
||||
array_key_exists( '__experimentalSkipSerialization', $color_support ) &&
|
||||
$color_support['__experimentalSkipSerialization']
|
||||
) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
|
||||
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
|
||||
$has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
|
||||
|
||||
@ -3,20 +3,20 @@
|
||||
* Custom classname block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the custom classname block attribute for block types that support it.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
*/
|
||||
function wp_register_custom_classname_support( $block_type ) {
|
||||
$has_custom_classname_support = true;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_custom_classname_support = _wp_array_get( $block_type->supports, array( 'customClassName' ), true );
|
||||
}
|
||||
$has_custom_classname_support = block_has_support( $block_type, array( 'customClassName' ), true );
|
||||
|
||||
if ( $has_custom_classname_support ) {
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
@ -33,6 +33,7 @@ function wp_register_custom_classname_support( $block_type ) {
|
||||
/**
|
||||
* Add the custom classnames to the output.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
@ -41,11 +42,8 @@ function wp_register_custom_classname_support( $block_type ) {
|
||||
* @return array Block CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
|
||||
$has_custom_classname_support = true;
|
||||
$has_custom_classname_support = block_has_support( $block_type, array( 'customClassName' ), true );
|
||||
$attributes = array();
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_custom_classname_support = _wp_array_get( $block_type->supports, array( 'customClassName' ), true );
|
||||
}
|
||||
if ( $has_custom_classname_support ) {
|
||||
$has_custom_classnames = array_key_exists( 'className', $block_attributes );
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Generated classname block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,16 +46,12 @@ function wp_get_block_default_classname( $block_name ) {
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return array Block CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_generated_classname_support( $block_type, $block_attributes ) {
|
||||
$has_generated_classname_support = true;
|
||||
function wp_apply_generated_classname_support( $block_type ) {
|
||||
$attributes = array();
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_generated_classname_support = _wp_array_get( $block_type->supports, array( 'className' ), true );
|
||||
}
|
||||
$has_generated_classname_support = block_has_support( $block_type, array( 'className' ), true );
|
||||
if ( $has_generated_classname_support ) {
|
||||
$block_classname = wp_get_block_default_classname( $block_type->name );
|
||||
|
||||
|
||||
42
src/wp-includes/block-supports/layout.php
Normal file
42
src/wp-includes/block-supports/layout.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Layout block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* For themes without theme.json file, make sure
|
||||
* to restore the inner div for the group block
|
||||
* to avoid breaking styles relying on that div.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @param array $block Block object.
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
function wp_restore_group_inner_container( $block_content, $block ) {
|
||||
$group_with_inner_container_regex = '/(^\s*<div\b[^>]*wp-block-group(\s|")[^>]*>)(\s*<div\b[^>]*wp-block-group__inner-container(\s|")[^>]*>)((.|\S|\s)*)/';
|
||||
|
||||
if (
|
||||
'core/group' !== $block['blockName'] ||
|
||||
1 === preg_match( $group_with_inner_container_regex, $block_content )
|
||||
) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$replace_regex = '/(^\s*<div\b[^>]*wp-block-group[^>]*>)(.*)(<\/div>\s*$)/ms';
|
||||
$updated_content = preg_replace_callback(
|
||||
$replace_regex,
|
||||
function( $matches ) {
|
||||
return $matches[1] . '<div class="wp-block-group__inner-container">' . $matches[2] . '</div>' . $matches[3];
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
return $updated_content;
|
||||
}
|
||||
|
||||
add_filter( 'render_block', 'wp_restore_group_inner_container', 10, 2 );
|
||||
66
src/wp-includes/block-supports/padding.php
Normal file
66
src/wp-includes/block-supports/padding.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Padding block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the style block attribute for block types that support it.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
*/
|
||||
function wp_register_padding_support( $block_type ) {
|
||||
$has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
|
||||
|
||||
// Setup attributes and styles within that if needed.
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
}
|
||||
|
||||
if ( $has_padding_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
$block_type->attributes['style'] = array(
|
||||
'type' => 'object',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS classes for block padding to the incoming attributes array.
|
||||
* This will be applied to the block markup in the front-end.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return array Block padding CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_padding_support( $block_type, $block_attributes ) {
|
||||
$has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
|
||||
$styles = array();
|
||||
if ( $has_padding_support ) {
|
||||
$padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null );
|
||||
if ( null !== $padding_value ) {
|
||||
foreach ( $padding_value as $key => $value ) {
|
||||
$styles[] = sprintf( 'padding-%s: %s;', $key, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
|
||||
}
|
||||
|
||||
// Register the block support.
|
||||
WP_Block_Supports::get_instance()->register(
|
||||
'padding',
|
||||
array(
|
||||
'register_attribute' => 'wp_register_padding_support',
|
||||
'apply' => 'wp_apply_padding_support',
|
||||
)
|
||||
);
|
||||
@ -3,31 +3,41 @@
|
||||
* Typography block support flag.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.6.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the style and typography block attributes for block types that support it.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block Type.
|
||||
*/
|
||||
function wp_register_typography_support( $block_type ) {
|
||||
$has_font_size_support = false;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_font_size_support = _wp_array_get( $block_type->supports, array( '__experimentalFontSize' ), false );
|
||||
if ( ! property_exists( $block_type, 'supports' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$has_line_height_support = false;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_line_height_support = _wp_array_get( $block_type->supports, array( '__experimentalLineHeight' ), false );
|
||||
}
|
||||
$has_font_size_support = _wp_array_get( $block_type->supports, array( 'fontSize' ), false );
|
||||
$has_font_style_support = _wp_array_get( $block_type->supports, array( '__experimentalFontStyle' ), false );
|
||||
$has_font_weight_support = _wp_array_get( $block_type->supports, array( '__experimentalFontWeight' ), false );
|
||||
$has_line_height_support = _wp_array_get( $block_type->supports, array( 'lineHeight' ), false );
|
||||
$has_text_decoration_support = _wp_array_get( $block_type->supports, array( '__experimentalTextDecoration' ), false );
|
||||
$has_text_transform_support = _wp_array_get( $block_type->supports, array( '__experimentalTextTransform' ), false );
|
||||
|
||||
$has_typography_support = $has_font_size_support
|
||||
|| $has_font_weight_support
|
||||
|| $has_font_style_support
|
||||
|| $has_line_height_support
|
||||
|| $has_text_transform_support
|
||||
|| $has_text_decoration_support;
|
||||
|
||||
if ( ! $block_type->attributes ) {
|
||||
$block_type->attributes = array();
|
||||
}
|
||||
|
||||
if ( ( $has_font_size_support || $has_line_height_support ) && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
if ( $has_typography_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
|
||||
$block_type->attributes['style'] = array(
|
||||
'type' => 'object',
|
||||
);
|
||||
@ -41,28 +51,33 @@ function wp_register_typography_support( $block_type ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS classes and inline styles for font sizes to the incoming attributes array.
|
||||
* This will be applied to the block markup in the front-end.
|
||||
* Add CSS classes and inline styles for typography features such as font sizes
|
||||
* to the incoming attributes array. This will be applied to the block markup in
|
||||
* the front-end.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @access private
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block type.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return array Font size CSS classes and inline styles.
|
||||
* @return array Typography CSS classes and inline styles.
|
||||
*/
|
||||
function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
$has_font_size_support = false;
|
||||
$classes = array();
|
||||
$styles = array();
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_font_size_support = _wp_array_get( $block_type->supports, array( 'fontSize' ), false );
|
||||
if ( ! property_exists( $block_type, 'supports' ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$has_line_height_support = false;
|
||||
if ( property_exists( $block_type, 'supports' ) ) {
|
||||
$has_line_height_support = _wp_array_get( $block_type->supports, array( 'lineHeight' ), false );
|
||||
}
|
||||
$classes = array();
|
||||
$styles = array();
|
||||
|
||||
$has_font_family_support = _wp_array_get( $block_type->supports, array( '__experimentalFontFamily' ), false );
|
||||
$has_font_style_support = _wp_array_get( $block_type->supports, array( '__experimentalFontStyle' ), false );
|
||||
$has_font_weight_support = _wp_array_get( $block_type->supports, array( '__experimentalFontWeight' ), false );
|
||||
$has_font_size_support = _wp_array_get( $block_type->supports, array( 'fontSize' ), false );
|
||||
$has_line_height_support = _wp_array_get( $block_type->supports, array( 'lineHeight' ), false );
|
||||
$has_text_decoration_support = _wp_array_get( $block_type->supports, array( '__experimentalTextDecoration' ), false );
|
||||
$has_text_transform_support = _wp_array_get( $block_type->supports, array( '__experimentalTextTransform' ), false );
|
||||
|
||||
// Font Size.
|
||||
if ( $has_font_size_support ) {
|
||||
@ -73,7 +88,42 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
if ( $has_named_font_size ) {
|
||||
$classes[] = sprintf( 'has-%s-font-size', $block_attributes['fontSize'] );
|
||||
} elseif ( $has_custom_font_size ) {
|
||||
$styles[] = sprintf( 'font-size: %spx;', $block_attributes['style']['typography']['fontSize'] );
|
||||
$styles[] = sprintf( 'font-size: %s;', $block_attributes['style']['typography']['fontSize'] );
|
||||
}
|
||||
}
|
||||
|
||||
// Font Family.
|
||||
if ( $has_font_family_support ) {
|
||||
$has_font_family = isset( $block_attributes['style']['typography']['fontFamily'] );
|
||||
// Apply required class and style.
|
||||
if ( $has_font_family ) {
|
||||
$font_family = $block_attributes['style']['typography']['fontFamily'];
|
||||
if ( strpos( $font_family, 'var:preset|font-family' ) !== false ) {
|
||||
// Get the name from the string and add proper styles.
|
||||
$index_to_splice = strrpos( $font_family, '|' ) + 1;
|
||||
$font_family_name = substr( $font_family, $index_to_splice );
|
||||
$styles[] = sprintf( 'font-family: var(--wp--preset--font-family--%s);', $font_family_name );
|
||||
} else {
|
||||
$styles[] = sprintf( 'font-family: %s;', $block_attributes['style']['color']['fontFamily'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Font style.
|
||||
if ( $has_font_style_support ) {
|
||||
// Apply font style.
|
||||
$font_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontStyle', 'font-style' );
|
||||
if ( $font_style ) {
|
||||
$styles[] = $font_style;
|
||||
}
|
||||
}
|
||||
|
||||
// Font weight.
|
||||
if ( $has_font_weight_support ) {
|
||||
// Apply font weight.
|
||||
$font_weight = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontWeight', 'font-weight' );
|
||||
if ( $font_weight ) {
|
||||
$styles[] = $font_weight;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +136,22 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Text Decoration.
|
||||
if ( $has_text_decoration_support ) {
|
||||
$text_decoration_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textDecoration', 'text-decoration' );
|
||||
if ( $text_decoration_style ) {
|
||||
$styles[] = $text_decoration_style;
|
||||
}
|
||||
}
|
||||
|
||||
// Text Transform.
|
||||
if ( $has_text_transform_support ) {
|
||||
$text_transform_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textTransform', 'text-transform' );
|
||||
if ( $text_transform_style ) {
|
||||
$styles[] = $text_transform_style;
|
||||
}
|
||||
}
|
||||
|
||||
$attributes = array();
|
||||
if ( ! empty( $classes ) ) {
|
||||
$attributes['class'] = implode( ' ', $classes );
|
||||
@ -97,6 +163,41 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an inline style for a typography feature e.g. text decoration,
|
||||
* text transform, and font style.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $attributes Block's attributes.
|
||||
* @param string $feature Key for the feature within the typography styles.
|
||||
* @param string $css_property Slug for the CSS property the inline style sets.
|
||||
*
|
||||
* @return string CSS inline style.
|
||||
*/
|
||||
function wp_typography_get_css_variable_inline_style( $attributes, $feature, $css_property ) {
|
||||
// Retrieve current attribute value or skip if not found.
|
||||
$style_value = _wp_array_get( $attributes, array( 'style', 'typography', $feature ), false );
|
||||
if ( ! $style_value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't have a preset CSS variable, we'll assume it's a regular CSS value.
|
||||
if ( strpos( $style_value, "var:preset|{$css_property}|" ) === false ) {
|
||||
return sprintf( '%s:%s;', $css_property, $style_value );
|
||||
}
|
||||
|
||||
// We have a preset CSS variable as the style.
|
||||
// Get the style value from the string and return CSS style.
|
||||
$index_to_splice = strrpos( $style_value, '|' ) + 1;
|
||||
$slug = substr( $style_value, $index_to_splice );
|
||||
|
||||
// Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`.
|
||||
return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug );
|
||||
}
|
||||
|
||||
// Register the block support.
|
||||
WP_Block_Supports::get_instance()->register(
|
||||
'typography',
|
||||
array(
|
||||
|
||||
@ -908,3 +908,23 @@ function register_block_style( $block_name, $style_properties ) {
|
||||
function unregister_block_style( $block_name, $block_style_name ) {
|
||||
return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the current block type supports the feature requested.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param WP_Block_Type $block_type Block type to check for support.
|
||||
* @param string $feature Name of the feature to check support for.
|
||||
* @param mixed $default Fallback value for feature support, defaults to false.
|
||||
*
|
||||
* @return boolean Whether or not the feature is supported.
|
||||
*/
|
||||
function block_has_support( $block_type, $feature, $default = false ) {
|
||||
$block_support = $default;
|
||||
if ( $block_type && property_exists( $block_type, 'supports' ) ) {
|
||||
$block_support = _wp_array_get( $block_type->supports, $feature, $default );
|
||||
}
|
||||
|
||||
return true === $block_support || is_array( $block_support );
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ function render_block_core_block( $attributes ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
// translators: %s is the user-provided title of the reusable block.
|
||||
__( 'Could not render Reusable Block <strong>%s</strong>: blocks cannot be rendered inside themselves.' ),
|
||||
__( 'Could not render Reusable Block <strong>%s</strong>. Block cannot be rendered inside itself.' ),
|
||||
$reusable_block->post_title
|
||||
),
|
||||
E_USER_WARNING
|
||||
|
||||
@ -61,8 +61,12 @@
|
||||
"anchor": true,
|
||||
"align": true,
|
||||
"alignWide": false,
|
||||
"color": {
|
||||
"__experimentalSkipSerialization": true,
|
||||
"gradients": true
|
||||
},
|
||||
"reusable": false,
|
||||
"__experimentalSelector": ".wp-block-button > a"
|
||||
"__experimentalSelector": ".wp-block-button__link"
|
||||
},
|
||||
"editorStyle": "wp-block-button-editor",
|
||||
"style": "wp-block-button"
|
||||
|
||||
@ -12,10 +12,7 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": [
|
||||
"wide",
|
||||
"full"
|
||||
],
|
||||
"align": [ "wide", "full" ],
|
||||
"anchor": true,
|
||||
"html": false,
|
||||
"color": {
|
||||
@ -26,8 +23,12 @@
|
||||
"padding": true
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"radius": true
|
||||
}
|
||||
"color": true,
|
||||
"radius": true,
|
||||
"style": true,
|
||||
"width": true
|
||||
},
|
||||
"__experimentalLayout": true
|
||||
},
|
||||
"editorStyle": "wp-block-group-editor",
|
||||
"style": "wp-block-group"
|
||||
|
||||
@ -52,7 +52,6 @@ function register_core_block_types_from_metadata() {
|
||||
'separator',
|
||||
'social-links',
|
||||
'spacer',
|
||||
'subhead',
|
||||
'table',
|
||||
'text-columns',
|
||||
'verse',
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
global $block_core_latest_posts_excerpt_length;
|
||||
$block_core_latest_posts_excerpt_length = 0;
|
||||
|
||||
/**
|
||||
|
||||
@ -13,6 +13,9 @@
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"color": {
|
||||
"gradients": true
|
||||
},
|
||||
"fontSize": true
|
||||
},
|
||||
"style": "wp-block-preformatted"
|
||||
|
||||
@ -36,7 +36,7 @@ function render_block_core_search( $attributes ) {
|
||||
$label_markup = '';
|
||||
$input_markup = '';
|
||||
$button_markup = '';
|
||||
$width_styles = '';
|
||||
$inline_styles = styles_for_block_core_search( $attributes );
|
||||
|
||||
if ( $show_label ) {
|
||||
if ( ! empty( $attributes['label'] ) ) {
|
||||
@ -56,10 +56,11 @@ function render_block_core_search( $attributes ) {
|
||||
|
||||
if ( $show_input ) {
|
||||
$input_markup = sprintf(
|
||||
'<input type="search" id="%s" class="wp-block-search__input" name="s" value="%s" placeholder="%s" required />',
|
||||
'<input type="search" id="%s" class="wp-block-search__input" name="s" value="%s" placeholder="%s" %s required />',
|
||||
$input_id,
|
||||
esc_attr( get_search_query() ),
|
||||
esc_attr( $attributes['placeholder'] )
|
||||
esc_attr( $attributes['placeholder'] ),
|
||||
$inline_styles['shared']
|
||||
);
|
||||
}
|
||||
|
||||
@ -80,20 +81,16 @@ function render_block_core_search( $attributes ) {
|
||||
}
|
||||
|
||||
$button_markup = sprintf(
|
||||
'<button type="submit"class="wp-block-search__button ' . $button_classes . '">%s</button>',
|
||||
'<button type="submit" class="wp-block-search__button %s"%s>%s</button>',
|
||||
$button_classes,
|
||||
$inline_styles['shared'],
|
||||
$button_internal_markup
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] ) ) {
|
||||
if ( ! empty( $attributes['buttonPosition'] ) && 'button-only' !== $attributes['buttonPosition'] ) {
|
||||
$width_styles = ' style="width: ' . $attributes['width'] . $attributes['widthUnit'] . ';"';
|
||||
}
|
||||
}
|
||||
|
||||
$field_markup = sprintf(
|
||||
'<div class="wp-block-search__inside-wrapper"%s>%s</div>',
|
||||
$width_styles,
|
||||
$inline_styles['wrapper'],
|
||||
$input_markup . $button_markup
|
||||
);
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
||||
@ -159,3 +156,58 @@ function classnames_for_block_core_search( $attributes ) {
|
||||
|
||||
return implode( ' ', $classnames );
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of inline styles for the search block.
|
||||
*
|
||||
* The result will contain one entry for shared styles such as those for the
|
||||
* inner input or button and a second for the inner wrapper should the block
|
||||
* be positioning the button "inside".
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return array Style HTML attribute.
|
||||
*/
|
||||
function styles_for_block_core_search( $attributes ) {
|
||||
$shared_styles = array();
|
||||
$wrapper_styles = array();
|
||||
|
||||
// Add width styles.
|
||||
$has_width = ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] );
|
||||
$button_only = ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition'];
|
||||
|
||||
if ( $has_width && ! $button_only ) {
|
||||
$wrapper_styles[] = sprintf(
|
||||
'width: %d%s;',
|
||||
esc_attr( $attributes['width'] ),
|
||||
esc_attr( $attributes['widthUnit'] )
|
||||
);
|
||||
}
|
||||
|
||||
// Add border radius styles.
|
||||
$has_border_radius = ! empty( $attributes['style']['border']['radius'] );
|
||||
|
||||
if ( $has_border_radius ) {
|
||||
// Shared style for button and input radius values.
|
||||
$border_radius = $attributes['style']['border']['radius'];
|
||||
$shared_styles[] = sprintf( 'border-radius: %spx;', esc_attr( $border_radius ) );
|
||||
|
||||
// Apply wrapper border radius if button placed inside.
|
||||
$button_inside = ! empty( $attributes['buttonPosition'] ) &&
|
||||
'button-inside' === $attributes['buttonPosition'];
|
||||
|
||||
if ( $button_inside ) {
|
||||
// We adjust the border radius value for the outer wrapper element
|
||||
// to make it visually consistent with the radius applied to inner
|
||||
// elements.
|
||||
$default_padding = 4;
|
||||
$adjusted_radius = $border_radius + $default_padding;
|
||||
$wrapper_styles[] = sprintf( 'border-radius: %dpx;', esc_attr( $adjusted_radius ) );
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'shared' => ! empty( $shared_styles ) ? sprintf( ' style="%s"', implode( ' ', $shared_styles ) ) : '',
|
||||
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', implode( ' ', $wrapper_styles ) ) : '',
|
||||
);
|
||||
}
|
||||
|
||||
@ -34,6 +34,10 @@
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "left", "center", "right" ],
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"__experimentalSkipSerialization": true
|
||||
},
|
||||
"html": false
|
||||
},
|
||||
"editorStyle": "wp-block-search-editor",
|
||||
|
||||
@ -17,9 +17,14 @@
|
||||
function render_block_core_social_link( $attributes, $content, $block ) {
|
||||
$open_in_new_tab = isset( $block->context['openInNewTab'] ) ? $block->context['openInNewTab'] : false;
|
||||
|
||||
$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
|
||||
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
|
||||
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
|
||||
$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
|
||||
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
|
||||
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : sprintf(
|
||||
/* translators: %1$s: Social-network name. %2$s: URL. */
|
||||
__( '%1$s: %2$s', 'gutenberg' ),
|
||||
block_core_social_link_get_name( $service ),
|
||||
$url
|
||||
);
|
||||
$class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;
|
||||
|
||||
// Don't render a link if there is no URL set.
|
||||
|
||||
@ -6,8 +6,14 @@
|
||||
"height": {
|
||||
"type": "number",
|
||||
"default": 100
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"orientation"
|
||||
],
|
||||
"supports": {
|
||||
"anchor": true
|
||||
},
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
{
|
||||
"apiVersion": 2,
|
||||
"name": "core/subhead",
|
||||
"category": "text",
|
||||
"attributes": {
|
||||
"align": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "p"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"inserter": false,
|
||||
"multiple": false
|
||||
},
|
||||
"editorStyle": "wp-block-subhead-editor",
|
||||
"style": "wp-block-subhead"
|
||||
}
|
||||
@ -17,7 +17,10 @@
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"__experimentalFontFamily": true,
|
||||
"fontSize": true
|
||||
"fontSize": true,
|
||||
"spacing": {
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-verse",
|
||||
"editorStyle": "wp-block-verse-editor"
|
||||
|
||||
@ -2248,6 +2248,8 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
|
||||
'margin-left',
|
||||
'margin-top',
|
||||
|
||||
'object-position',
|
||||
|
||||
'padding',
|
||||
'padding-right',
|
||||
'padding-bottom',
|
||||
|
||||
@ -259,27 +259,27 @@ function create_initial_post_types() {
|
||||
'wp_block',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => _x( 'Reusable Blocks', 'post type general name' ),
|
||||
'singular_name' => _x( 'Reusable Block', 'post type singular name' ),
|
||||
'menu_name' => _x( 'Reusable Blocks', 'admin menu' ),
|
||||
'name_admin_bar' => _x( 'Reusable Block', 'add new on admin bar' ),
|
||||
'add_new' => _x( 'Add New', 'Reusable Block' ),
|
||||
'add_new_item' => __( 'Add New Reusable Block' ),
|
||||
'new_item' => __( 'New Reusable Block' ),
|
||||
'edit_item' => __( 'Edit Reusable Block' ),
|
||||
'view_item' => __( 'View Reusable Block' ),
|
||||
'all_items' => __( 'All Reusable Blocks' ),
|
||||
'search_items' => __( 'Search Reusable Blocks' ),
|
||||
'name' => _x( 'Reusable blocks', 'post type general name' ),
|
||||
'singular_name' => _x( 'Reusable block', 'post type singular name' ),
|
||||
'menu_name' => _x( 'Reusable blocks', 'admin menu' ),
|
||||
'name_admin_bar' => _x( 'Reusable block', 'add new on admin bar' ),
|
||||
'add_new' => _x( 'Add New', 'Reusable block' ),
|
||||
'add_new_item' => __( 'Add new Reusable block' ),
|
||||
'new_item' => __( 'New Reusable block' ),
|
||||
'edit_item' => __( 'Edit Reusable block' ),
|
||||
'view_item' => __( 'View Reusable block' ),
|
||||
'all_items' => __( 'All Reusable blocks' ),
|
||||
'search_items' => __( 'Search Reusable blocks' ),
|
||||
'not_found' => __( 'No reusable blocks found.' ),
|
||||
'not_found_in_trash' => __( 'No reusable blocks found in Trash.' ),
|
||||
'filter_items_list' => __( 'Filter reusable blocks list' ),
|
||||
'items_list_navigation' => __( 'Reusable Blocks list navigation' ),
|
||||
'items_list' => __( 'Reusable Blocks list' ),
|
||||
'item_published' => __( 'Reusable Block published.' ),
|
||||
'item_published_privately' => __( 'Reusable Block published privately.' ),
|
||||
'item_reverted_to_draft' => __( 'Reusable Block reverted to draft.' ),
|
||||
'item_scheduled' => __( 'Reusable Block scheduled.' ),
|
||||
'item_updated' => __( 'Reusable Block updated.' ),
|
||||
'items_list_navigation' => __( 'Reusable blocks list navigation' ),
|
||||
'items_list' => __( 'Reusable blocks list' ),
|
||||
'item_published' => __( 'Reusable block published.' ),
|
||||
'item_published_privately' => __( 'Reusable block published privately.' ),
|
||||
'item_reverted_to_draft' => __( 'Reusable block reverted to draft.' ),
|
||||
'item_scheduled' => __( 'Reusable block scheduled.' ),
|
||||
'item_updated' => __( 'Reusable block updated.' ),
|
||||
),
|
||||
'public' => false,
|
||||
'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
|
||||
|
||||
@ -1504,16 +1504,42 @@ function wp_default_styles( $styles ) {
|
||||
|
||||
$styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
|
||||
|
||||
$styles->add(
|
||||
'wp-reset-editor-styles',
|
||||
"/wp-includes/css/dist/block-library/reset$suffix.css",
|
||||
array( 'common', 'forms' ) // Make sure the reset is loaded after the default WP Admin styles.
|
||||
);
|
||||
|
||||
$styles->add(
|
||||
'wp-editor-classic-layout-styles',
|
||||
"/wp-includes/css/dist/edit-post/classic$suffix.css",
|
||||
array()
|
||||
);
|
||||
|
||||
$wp_edit_blocks_dependencies = array(
|
||||
'wp-components',
|
||||
'wp-editor',
|
||||
// This need to be added before the block library styles,
|
||||
// The block library styles override the "reset" styles.
|
||||
'wp-reset-editor-styles',
|
||||
'wp-block-library',
|
||||
'wp-reusable-blocks',
|
||||
|
||||
// This dependency shouldn't be added for themes with theme.json support
|
||||
// It's here for backward compatibility only.
|
||||
// A check should be added here when theme.json is backported to Core.
|
||||
'wp-editor-classic-layout-styles',
|
||||
);
|
||||
global $editor_styles;
|
||||
if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) {
|
||||
// Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken.
|
||||
$wp_edit_blocks_dependencies[] = 'wp-block-library-theme';
|
||||
}
|
||||
|
||||
$styles->add(
|
||||
'wp-edit-blocks',
|
||||
"/wp-includes/css/dist/block-library/editor$suffix.css",
|
||||
array(
|
||||
'wp-components',
|
||||
'wp-editor',
|
||||
'wp-block-library',
|
||||
// Always include visual styles so the editor never appears broken.
|
||||
'wp-block-library-theme',
|
||||
)
|
||||
$wp_edit_blocks_dependencies
|
||||
);
|
||||
|
||||
$package_styles = array(
|
||||
@ -1533,9 +1559,11 @@ function wp_default_styles( $styles ) {
|
||||
'wp-components',
|
||||
'wp-block-editor',
|
||||
'wp-nux',
|
||||
'wp-reusable-blocks',
|
||||
),
|
||||
'format-library' => array(),
|
||||
'list-reusable-blocks' => array( 'wp-components' ),
|
||||
'reusable-blocks' => array( 'wp-components' ),
|
||||
'nux' => array( 'wp-components' ),
|
||||
);
|
||||
|
||||
@ -1580,6 +1608,8 @@ function wp_default_styles( $styles ) {
|
||||
'wp-pointer',
|
||||
'wp-jquery-ui-dialog',
|
||||
// Package styles.
|
||||
'wp-reset-editor-styles',
|
||||
'wp-editor-classic-layout-styles',
|
||||
'wp-block-library-theme',
|
||||
'wp-edit-blocks',
|
||||
'wp-block-editor',
|
||||
@ -1590,6 +1620,7 @@ function wp_default_styles( $styles ) {
|
||||
'wp-editor',
|
||||
'wp-format-library',
|
||||
'wp-list-reusable-blocks',
|
||||
'wp-reusable-blocks',
|
||||
'wp-nux',
|
||||
// Deprecated CSS.
|
||||
'deprecated-media',
|
||||
|
||||
@ -297,9 +297,12 @@ require ABSPATH . WPINC . '/blocks/index.php';
|
||||
require ABSPATH . WPINC . '/block-patterns.php';
|
||||
require ABSPATH . WPINC . '/class-wp-block-supports.php';
|
||||
require ABSPATH . WPINC . '/block-supports/align.php';
|
||||
require ABSPATH . WPINC . '/block-supports/border.php';
|
||||
require ABSPATH . WPINC . '/block-supports/colors.php';
|
||||
require ABSPATH . WPINC . '/block-supports/custom-classname.php';
|
||||
require ABSPATH . WPINC . '/block-supports/generated-classname.php';
|
||||
require ABSPATH . WPINC . '/block-supports/layout.php';
|
||||
require ABSPATH . WPINC . '/block-supports/padding.php';
|
||||
require ABSPATH . WPINC . '/block-supports/typography.php';
|
||||
|
||||
$GLOBALS['wp_embed'] = new WP_Embed();
|
||||
|
||||
@ -7339,7 +7339,7 @@ mockedApiResponse.TypesCollection = {
|
||||
"wp_block": {
|
||||
"description": "",
|
||||
"hierarchical": false,
|
||||
"name": "Reusable Blocks",
|
||||
"name": "Reusable blocks",
|
||||
"slug": "wp_block",
|
||||
"taxonomies": [],
|
||||
"rest_base": "blocks",
|
||||
|
||||
@ -144,7 +144,6 @@ module.exports = function( env = { environment: 'production', watch: false, buil
|
||||
'separator',
|
||||
'social-links',
|
||||
'spacer',
|
||||
'subhead',
|
||||
'table',
|
||||
'text-columns',
|
||||
'verse',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user