Block Editor: Include the fixes targetted for WordPress 5.8 RC3.
This includes the following fixes: - Safari: see if compositing layer size is more reasonable when position fixed divs are not inserted into content. - Site Logo Block: update Site Logo block UI and option syncing. - Fix moving inner blocks in the Widgets Customizer. - Allow themes to provide empty values for color.duotone and spacing.units - Update getTermsInfo() to workaround parsing issue for translatable strings. - Specify what settings can be part of settings.layout. - Update conditions to hide duotone panel. - Prevent entering invalid values in the Query Loop block config. - Prevent color panel from showing as empty. - Avoid calling gutenberg_ functions within code shipped through WordPress Core. Props desrosj. See #53397. Built from https://develop.svn.wordpress.org/trunk@51421 git-svn-id: http://core.svn.wordpress.org/trunk@51032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -86,63 +86,3 @@ function register_block_core_post_template() {
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_post_template' );
|
||||
|
||||
/**
|
||||
* Renders the legacy `core/query-loop` block on the server.
|
||||
* It triggers a developer warning and then calls the renamed
|
||||
* block's `render_callback` function output.
|
||||
*
|
||||
* This can be removed when WordPress 5.9 is released.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
*
|
||||
* @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
|
||||
*/
|
||||
function render_legacy_query_loop_block( $attributes, $content, $block ) {
|
||||
trigger_error(
|
||||
/* translators: %1$s: Block type */
|
||||
sprintf( __( 'Block %1$s has been renamed to Post Template. %1$s will be supported until WordPress version 5.9.' ), $block->name ),
|
||||
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
|
||||
);
|
||||
return render_block_core_post_template( $attributes, $content, $block );
|
||||
}
|
||||
|
||||
/**
|
||||
* Complements the renaming of `Query Loop` to `Post Template`.
|
||||
* This ensures backwards compatibility for any users running the Gutenberg
|
||||
* plugin who have used Query Loop prior to its renaming.
|
||||
*
|
||||
* This can be removed when WordPress 5.9 is released.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/32514
|
||||
*/
|
||||
function gutenberg_register_legacy_query_loop_block() {
|
||||
$registry = WP_Block_Type_Registry::get_instance();
|
||||
if ( $registry->is_registered( 'core/query-loop' ) ) {
|
||||
unregister_block_type( 'core/query-loop' );
|
||||
}
|
||||
register_block_type(
|
||||
'core/query-loop',
|
||||
array(
|
||||
'category' => 'design',
|
||||
'uses_context' => array(
|
||||
'queryId',
|
||||
'query',
|
||||
'queryContext',
|
||||
'displayLayout',
|
||||
'templateSlug',
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
'html' => false,
|
||||
'align' => true,
|
||||
),
|
||||
'style' => 'wp-block-post-template',
|
||||
'render_callback' => 'render_legacy_query_loop_block',
|
||||
'skip_inner_blocks' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'gutenberg_register_legacy_query_loop_block' );
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
function render_block_core_site_logo( $attributes ) {
|
||||
$adjust_width_height_filter = function ( $image ) use ( $attributes ) {
|
||||
if ( empty( $attributes['width'] ) ) {
|
||||
if ( empty( $attributes['width'] ) || empty( $image ) ) {
|
||||
return $image;
|
||||
}
|
||||
$height = (float) $attributes['width'] / ( (float) $image[1] / (float) $image[2] );
|
||||
@@ -111,54 +111,52 @@ add_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
|
||||
/**
|
||||
* Updates the site_logo option when the custom_logo theme-mod gets updated.
|
||||
*
|
||||
* This function is hooked on "update_option_theme_mods_$theme" and not
|
||||
* "pre_set_theme_mod_custom_logo" because by hooking in `update_option`
|
||||
* the function accounts for remove_theme_mod() as well.
|
||||
*
|
||||
* @param mixed $old_value The old option value.
|
||||
* @param mixed $value The new option value.
|
||||
* @param mixed $value Attachment ID of the custom logo or an empty value.
|
||||
* @return mixed
|
||||
*/
|
||||
function _sync_custom_logo_to_site_logo( $old_value, $value ) {
|
||||
// Delete the option when the custom logo does not exist or was removed.
|
||||
// This step ensures the option stays in sync.
|
||||
if ( empty( $value['custom_logo'] ) ) {
|
||||
function _sync_custom_logo_to_site_logo( $value ) {
|
||||
if ( empty( $value ) ) {
|
||||
delete_option( 'site_logo' );
|
||||
} else {
|
||||
remove_action( 'update_option_site_logo', '_sync_site_logo_to_custom_logo' );
|
||||
update_option( 'site_logo', $value['custom_logo'] );
|
||||
add_action( 'update_option_site_logo', '_sync_site_logo_to_custom_logo', 10, 2 );
|
||||
update_option( 'site_logo', $value );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
|
||||
|
||||
/**
|
||||
* Deletes the site_logo when the custom_logo theme mod is removed.
|
||||
*
|
||||
* @param array $old_value Previous theme mod settings.
|
||||
* @param array $value Updated theme mod settings.
|
||||
*/
|
||||
function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) {
|
||||
// If the custom_logo is being unset, it's being removed from theme mods.
|
||||
if ( isset( $old_value['custom_logo'] ) && ! isset( $value['custom_logo'] ) ) {
|
||||
delete_option( 'site_logo' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks `_sync_custom_logo_to_site_logo` in `update_option_theme_mods_$theme`.
|
||||
* Deletes the site logo when all theme mods are being removed.
|
||||
*/
|
||||
function _delete_site_logo_on_remove_theme_mods() {
|
||||
if ( false !== get_theme_support( 'custom-logo' ) ) {
|
||||
delete_option( 'site_logo' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks `_delete_site_logo_on_remove_custom_logo` in `update_option_theme_mods_$theme`.
|
||||
* Hooks `_delete_site_logo_on_remove_theme_mods` in `delete_option_theme_mods_$theme`.
|
||||
*
|
||||
* Runs on `setup_theme` to account for dynamically-switched themes in the Customizer.
|
||||
*/
|
||||
function _sync_custom_logo_to_site_logo_on_setup_theme() {
|
||||
function _delete_site_logo_on_remove_custom_logo_on_setup_theme() {
|
||||
$theme = get_option( 'stylesheet' );
|
||||
add_action( "update_option_theme_mods_$theme", '_sync_custom_logo_to_site_logo', 10, 2 );
|
||||
add_action( "update_option_theme_mods_$theme", '_delete_site_logo_on_remove_custom_logo', 10, 2 );
|
||||
add_action( "delete_option_theme_mods_$theme", '_delete_site_logo_on_remove_theme_mods' );
|
||||
}
|
||||
add_action( 'setup_theme', '_sync_custom_logo_to_site_logo_on_setup_theme', 11 );
|
||||
|
||||
/**
|
||||
* Updates the custom_logo theme-mod when the site_logo option gets updated.
|
||||
*
|
||||
* @param mixed $old_value The old option value.
|
||||
* @param mixed $value The new option value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _sync_site_logo_to_custom_logo( $old_value, $value ) {
|
||||
// Delete the option when the custom logo does not exist or was removed.
|
||||
// This step ensures the option stays in sync.
|
||||
if ( empty( $value ) ) {
|
||||
remove_theme_mod( 'custom_logo' );
|
||||
} else {
|
||||
remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
|
||||
set_theme_mod( 'custom_logo', $value );
|
||||
add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'update_option_site_logo', '_sync_site_logo_to_custom_logo', 10, 2 );
|
||||
add_action( 'setup_theme', '_delete_site_logo_on_remove_custom_logo_on_setup_theme', 11 );
|
||||
|
||||
@@ -100,14 +100,17 @@
|
||||
max-width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder {
|
||||
justify-content: flex-start;
|
||||
min-height: auto;
|
||||
height: 120px;
|
||||
padding: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label {
|
||||
margin-top: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon {
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label > svg {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
@@ -126,23 +129,4 @@
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper .site-logo_placeholder {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
border-radius: 2px;
|
||||
background-color: #fff;
|
||||
box-shadow: inset 0 0 0 1px #1e1e1e;
|
||||
padding: 12px;
|
||||
}
|
||||
.editor-styles-wrapper .site-logo_placeholder svg {
|
||||
margin-left: 12px;
|
||||
}
|
||||
.editor-styles-wrapper .site-logo_placeholder p {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
line-height: initial;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{min-height:auto;height:120px;padding:8px}.wp-block-site-logo .components-placeholder .components-placeholder__label{white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon{margin-left:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.editor-styles-wrapper .site-logo_placeholder{display:flex;flex-direction:row;align-items:flex-start;border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;padding:12px}.editor-styles-wrapper .site-logo_placeholder svg{margin-left:12px}.editor-styles-wrapper .site-logo_placeholder p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;margin:0;line-height:normal}
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{justify-content:flex-start;min-height:auto;height:120px;padding:12px}.wp-block-site-logo .components-placeholder .components-placeholder__label{margin-top:12px;white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,.wp-block-site-logo .components-placeholder .components-placeholder__label>svg{margin-left:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}
|
||||
@@ -100,14 +100,17 @@
|
||||
max-width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder {
|
||||
justify-content: flex-start;
|
||||
min-height: auto;
|
||||
height: 120px;
|
||||
padding: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label {
|
||||
margin-top: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon {
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label > svg {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
@@ -126,23 +129,4 @@
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.editor-styles-wrapper .site-logo_placeholder {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
border-radius: 2px;
|
||||
background-color: #fff;
|
||||
box-shadow: inset 0 0 0 1px #1e1e1e;
|
||||
padding: 12px;
|
||||
}
|
||||
.editor-styles-wrapper .site-logo_placeholder svg {
|
||||
margin-right: 12px;
|
||||
}
|
||||
.editor-styles-wrapper .site-logo_placeholder p {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
line-height: initial;
|
||||
}
|
||||
2
wp-includes/blocks/site-logo/editor.min.css
vendored
2
wp-includes/blocks/site-logo/editor.min.css
vendored
@@ -1 +1 @@
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{min-height:auto;height:120px;padding:8px}.wp-block-site-logo .components-placeholder .components-placeholder__label{white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon{margin-right:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.editor-styles-wrapper .site-logo_placeholder{display:flex;flex-direction:row;align-items:flex-start;border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;padding:12px}.editor-styles-wrapper .site-logo_placeholder svg{margin-right:12px}.editor-styles-wrapper .site-logo_placeholder p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;margin:0;line-height:normal}
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{justify-content:flex-start;min-height:auto;height:120px;padding:12px}.wp-block-site-logo .components-placeholder .components-placeholder__label{margin-top:12px;white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,.wp-block-site-logo .components-placeholder .components-placeholder__label>svg{margin-right:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}
|
||||
Reference in New Issue
Block a user