mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Update @wordpress packages
Update packages to include these bug fixes from Gutenberg: - Update Pattern block category and add documentation - Fix non existent menu handling in nav block - Make Reusable blocks available in the Site Editor - Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type() - theme.json: add appearanceTools flag to opt-in into appearance UI controls - Update the block theme folders to templates and parts - Remove reference to gutenberg_, swap with wp_ - Use table layout in templates list screen - Update featured image placeholder graphic. - [Inserter]: Adjust order of theme blocks and reorder inserter items - Implement suitable fallback for Nav block on front end of site when no menu selected - Toggle Group Control: add tooltip - Use first non-empty Nav post as primary fallback for Nav block - Change .nvmrc and documentation for Node.js version (LTS to 14.18.1) - Update: Migrate global styles user database data on the rest endpoint - Update global styles public API - Update: Rename user preset origin to custom - Try always generating navigation post title - Show all templates and template parts on the site editor list screens - Highlight "Site" in the navigation panel - Fix template part slug generation when creating through the block placeholder - [Block Library - Post Title]: Fix render error when setting Page to homepage - Add 'Clear customizations' button to template list page - Gallery v1: Allow clicks within replace media placeholder state - Site Editor: Set the <title> on the list page to be same as the CPT name - Gallery: Fix stuck image size options loader - Cover: Fix undo trap - Add success and error snackbars to the templates list page - Fix: theme colors cannot override defaults - Fix: Color palette is not being stored - Add elements support to the typography panel in global styles - Make links plural in global styles - Add: Gradient palette editor - Update some small style regressions in the template list - Add: Transparency support on global styles colors - Fix: apply by slug on all origins - Render empty Nav block if no fallback block can be utilised - Allow filtering of Nav block fallback - Fix Nav block fallback DB query to match on full block grammar start tag - Remove unstable max pages attribute from Nav block - DateTimePicker: set PM hours correctly - Update delete template button - Site Editor: Template list add rename action - Fix Nav block editing wrong entity on creation of new Menu - [REST] Restore the missing double slash in the ID received by /templates - Add icons to navigation sidebar items - Update function names for the public global styles API functions - Templates Controller: Add missing 'is_custom' prop - Rename gutenberg_ to wp_ for some functions that land in WordPress 5.9 - [Block Library - Template Part]:Remove support for conversion to Reusable block - Global Styles: Call "palettes" and not "color palettes" on panel label - Add button text when no colors found - Update: Global Styes: Count all color palette origins on the palette counter - Rename navigationMenuId to ref - Offset the parent iframe when computing Popover position - Fix: Failing PHPUnit test - Show theme, plugin or author in Added By column with appropriate icon or avatar - Add origin and author to template rest api See #54487. Props talldanwp, mamaduka, oandregal. Built from https://develop.svn.wordpress.org/trunk@52275 git-svn-id: http://core.svn.wordpress.org/trunk@51867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8294b090fb
commit
e4b553a201
@ -23,8 +23,6 @@ if ( ! wp_is_block_template_theme() ) {
|
||||
wp_die( __( 'The theme you are currently using is not compatible with Full Site Editing.' ) );
|
||||
}
|
||||
|
||||
// Used in the HTML title tag.
|
||||
$title = __( 'Editor (beta)' );
|
||||
$parent_file = 'themes.php';
|
||||
|
||||
// Flag that we're loading the block editor.
|
||||
@ -59,6 +57,9 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
|
||||
wp_die( __( 'Invalid post type.' ) );
|
||||
}
|
||||
|
||||
// Used in the HTML title tag.
|
||||
$title = $post_type->labels->name;
|
||||
|
||||
$preload_paths = array(
|
||||
'/',
|
||||
'/wp/v2/types/' . $post_type->name . '?context=edit',
|
||||
@ -81,6 +82,9 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
// Used in the HTML title tag.
|
||||
$title = __( 'Editor (beta)' );
|
||||
|
||||
$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
|
||||
$active_theme = wp_get_theme()->get_stylesheet();
|
||||
$preload_paths = array(
|
||||
|
File diff suppressed because one or more lines are too long
@ -338,8 +338,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
|
||||
// These settings may need to be updated based on data coming from theme.json sources.
|
||||
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
|
||||
$colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette'];
|
||||
$editor_settings['colors'] = isset( $colors_by_origin['user'] ) ?
|
||||
$colors_by_origin['user'] : (
|
||||
$editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ?
|
||||
$colors_by_origin['custom'] : (
|
||||
isset( $colors_by_origin['theme'] ) ?
|
||||
$colors_by_origin['theme'] :
|
||||
$colors_by_origin['default']
|
||||
@ -347,8 +347,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
|
||||
}
|
||||
if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
|
||||
$gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients'];
|
||||
$editor_settings['gradients'] = isset( $gradients_by_origin['user'] ) ?
|
||||
$gradients_by_origin['user'] : (
|
||||
$editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ?
|
||||
$gradients_by_origin['custom'] : (
|
||||
isset( $gradients_by_origin['theme'] ) ?
|
||||
$gradients_by_origin['theme'] :
|
||||
$gradients_by_origin['default']
|
||||
@ -356,8 +356,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
|
||||
}
|
||||
if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
|
||||
$font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
|
||||
$editor_settings['fontSizes'] = isset( $font_sizes_by_origin['user'] ) ?
|
||||
$font_sizes_by_origin['user'] : (
|
||||
$editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ?
|
||||
$font_sizes_by_origin['custom'] : (
|
||||
isset( $font_sizes_by_origin['theme'] ) ?
|
||||
$font_sizes_by_origin['theme'] :
|
||||
$font_sizes_by_origin['default']
|
||||
|
@ -525,6 +525,8 @@ function _build_block_template_result_from_post( $post ) {
|
||||
$has_theme_file = wp_get_theme()->get_stylesheet() === $theme &&
|
||||
null !== _get_block_template_file( $post->post_type, $post->post_name );
|
||||
|
||||
$origin = get_post_meta( $post->ID, 'origin', true );
|
||||
|
||||
$template = new WP_Block_Template();
|
||||
$template->wp_id = $post->ID;
|
||||
$template->id = $theme . '//' . $post->post_name;
|
||||
@ -532,12 +534,14 @@ function _build_block_template_result_from_post( $post ) {
|
||||
$template->content = $post->post_content;
|
||||
$template->slug = $post->post_name;
|
||||
$template->source = 'custom';
|
||||
$template->origin = ! empty( $origin ) ? $origin : null;
|
||||
$template->type = $post->post_type;
|
||||
$template->description = $post->post_excerpt;
|
||||
$template->title = $post->post_title;
|
||||
$template->status = $post->post_status;
|
||||
$template->has_theme_file = $has_theme_file;
|
||||
$template->is_custom = true;
|
||||
$template->author = $post->post_author;
|
||||
|
||||
if ( 'wp_template' === $post->post_type && isset( $default_template_types[ $template->slug ] ) ) {
|
||||
$template->is_custom = false;
|
||||
|
@ -85,7 +85,7 @@ function block_core_calendar_has_published_posts() {
|
||||
}
|
||||
|
||||
// On single sites we try our own cached option first.
|
||||
$has_published_posts = get_option( 'gutenberg_calendar_block_has_published_posts', null );
|
||||
$has_published_posts = get_option( 'wp_calendar_block_has_published_posts', null );
|
||||
if ( null !== $has_published_posts ) {
|
||||
return (bool) $has_published_posts;
|
||||
}
|
||||
@ -103,7 +103,7 @@ function block_core_calendar_has_published_posts() {
|
||||
function block_core_calendar_update_has_published_posts() {
|
||||
global $wpdb;
|
||||
$has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
|
||||
update_option( 'gutenberg_calendar_block_has_published_posts', $has_published_posts );
|
||||
update_option( 'wp_calendar_block_has_published_posts', $has_published_posts );
|
||||
return $has_published_posts;
|
||||
}
|
||||
|
||||
|
@ -173,6 +173,7 @@ figure.wp-block-gallery .components-spinner {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
.blocks-gallery-item figure.is-transient img {
|
||||
opacity: 0.3;
|
||||
|
@ -1 +1 @@
|
||||
figure.wp-block-gallery{display:block;margin:0}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}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;top:0;left:5px}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:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;pointer-events:none}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{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.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{display:flex;align-items:center;color:#757575;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{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right: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{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@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{padding:0;width:inherit;height: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{padding:0;margin:0}.wp-block-update-gallery-modal{max-width:400px}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons .components-button{margin-right:12px}
|
||||
figure.wp-block-gallery{display:block;margin:0}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}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;top:0;left:5px}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:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;pointer-events:none}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{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.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{display:flex;align-items:center;color:#757575;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{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;pointer-events:none}.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{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@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{padding:0;width:inherit;height: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{padding:0;margin:0}.wp-block-update-gallery-modal{max-width:400px}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons .components-button{margin-right:12px}
|
@ -173,6 +173,7 @@ figure.wp-block-gallery .components-spinner {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
.blocks-gallery-item figure.is-transient img {
|
||||
opacity: 0.3;
|
||||
|
2
wp-includes/blocks/gallery/editor.min.css
vendored
2
wp-includes/blocks/gallery/editor.min.css
vendored
@ -1 +1 @@
|
||||
figure.wp-block-gallery{display:block;margin:0}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}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;top:0;right:5px}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:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none}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{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.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{display:flex;align-items:center;color:#757575;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{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left: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{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@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{padding:0;width:inherit;height: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{padding:0;margin:0}.wp-block-update-gallery-modal{max-width:400px}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons .components-button{margin-left:12px}
|
||||
figure.wp-block-gallery{display:block;margin:0}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}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;top:0;right:5px}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:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none}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{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.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{display:flex;align-items:center;color:#757575;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{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none}.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{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@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{padding:0;width:inherit;height: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{padding:0;margin:0}.wp-block-update-gallery-modal{max-width:400px}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end}.wp-block-update-gallery-modal .wp-block-update-gallery-modal-buttons .components-button{margin-left:12px}
|
@ -9,7 +9,8 @@
|
||||
* Build an array with CSS classes and inline styles defining the colors
|
||||
* which will be applied to the navigation markup in the front-end.
|
||||
*
|
||||
* @param array $attributes Navigation block attributes.
|
||||
* @param array $attributes Navigation block attributes.
|
||||
*
|
||||
* @return array Colors CSS classes and inline styles.
|
||||
*/
|
||||
function block_core_navigation_build_css_colors( $attributes ) {
|
||||
@ -99,7 +100,8 @@ function block_core_navigation_build_css_colors( $attributes ) {
|
||||
* Build an array with CSS classes and inline styles defining the font sizes
|
||||
* which will be applied to the navigation markup in the front-end.
|
||||
*
|
||||
* @param array $attributes Navigation block attributes.
|
||||
* @param array $attributes Navigation block attributes.
|
||||
*
|
||||
* @return array Font size CSS classes and inline styles.
|
||||
*/
|
||||
function block_core_navigation_build_css_font_sizes( $attributes ) {
|
||||
@ -132,6 +134,100 @@ function block_core_navigation_render_submenu_icon() {
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the first non-empty `wp_navigation` Post.
|
||||
*
|
||||
* @return WP_Post|null the first non-empty Navigation or null.
|
||||
*/
|
||||
function block_core_navigation_get_first_non_empty_navigation() {
|
||||
// Order and orderby args set to mirror those in `wp_get_nav_menus`
|
||||
// see:
|
||||
// - https://github.com/WordPress/wordpress-develop/blob/ba943e113d3b31b121f77a2d30aebe14b047c69d/src/wp-includes/nav-menu.php#L613-L619.
|
||||
// - https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters.
|
||||
$navigation_posts = get_posts(
|
||||
array(
|
||||
'post_type' => 'wp_navigation',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'name',
|
||||
'posts_per_page' => 1, // only the first post.
|
||||
's' => '<!-- wp:', // look for block indicators to ensure we only include non-empty Navigations.
|
||||
)
|
||||
);
|
||||
return count( $navigation_posts ) ? $navigation_posts[0] : null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out empty "null" blocks from the block list.
|
||||
* 'parse_blocks' includes a null block with '\n\n' as the content when
|
||||
* it encounters whitespace. This is not a bug but rather how the parser
|
||||
* is designed.
|
||||
*
|
||||
* @param array $parsed_blocks the parsed blocks to be normalized.
|
||||
* @return array the normalized parsed blocks.
|
||||
*/
|
||||
function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) {
|
||||
$filtered = array_filter(
|
||||
$parsed_blocks,
|
||||
function( $block ) {
|
||||
return isset( $block['blockName'] );
|
||||
}
|
||||
);
|
||||
|
||||
// Reset keys.
|
||||
return array_values( $filtered );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the appropriate fallback to be used on the front of the
|
||||
* site when there is no menu assigned to the Nav block.
|
||||
*
|
||||
* This aims to mirror how the fallback mechanic for wp_nav_menu works.
|
||||
* See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information.
|
||||
*
|
||||
* @return array the array of blocks to be used as a fallback.
|
||||
*/
|
||||
function block_core_navigation_get_fallback_blocks() {
|
||||
$page_list_fallback = array(
|
||||
array(
|
||||
'blockName' => 'core/page-list',
|
||||
'attrs' => array(
|
||||
'__unstableMaxPages' => 4,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$registry = WP_Block_Type_Registry::get_instance();
|
||||
|
||||
// If `core/page-list` is not registered then return empty blocks.
|
||||
$fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array();
|
||||
|
||||
// Default to a list of Pages.
|
||||
|
||||
$navigation_post = block_core_navigation_get_first_non_empty_navigation();
|
||||
|
||||
// Prefer using the first non-empty Navigation as fallback if available.
|
||||
if ( $navigation_post ) {
|
||||
$maybe_fallback = block_core_navigation_filter_out_empty_blocks( parse_blocks( $navigation_post->post_content ) );
|
||||
|
||||
// Normalizing blocks may result in an empty array of blocks if they were all `null` blocks.
|
||||
// In this case default to the (Page List) fallback.
|
||||
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the fallback experience for the Navigation block.
|
||||
*
|
||||
* Returning a falsey value will opt out of the fallback and cause the block not to render.
|
||||
* To customise the blocks provided return an array of blocks - these should be valid
|
||||
* children of the `core/navigation` block.
|
||||
*
|
||||
* @param array[] default fallback blocks provided by the default block mechanic.
|
||||
*/
|
||||
return apply_filters( 'block_core_navigation_render_fallback', $fallback_blocks );
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the `core/navigation` block on server.
|
||||
*
|
||||
@ -142,6 +238,11 @@ function block_core_navigation_render_submenu_icon() {
|
||||
* @return string Returns the post content with the legacy widget added.
|
||||
*/
|
||||
function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
|
||||
// Flag used to indicate whether the rendered output is considered to be
|
||||
// a fallback (i.e. the block has no menu associated with it).
|
||||
$is_fallback = false;
|
||||
|
||||
/**
|
||||
* Deprecated:
|
||||
* The rgbTextColor and rgbBackgroundColor attributes
|
||||
@ -187,13 +288,17 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
$area = $block->context['navigationArea'];
|
||||
$mapping = get_option( 'wp_navigation_areas', array() );
|
||||
if ( ! empty( $mapping[ $area ] ) ) {
|
||||
$attributes['navigationMenuId'] = $mapping[ $area ];
|
||||
$attributes['ref'] = $mapping[ $area ];
|
||||
}
|
||||
}
|
||||
|
||||
// Load inner blocks from the navigation post.
|
||||
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
||||
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
|
||||
$navigation_post = get_post( $attributes['navigationMenuId'] );
|
||||
$attributes['ref'] = $attributes['navigationMenuId'];
|
||||
}
|
||||
// Load inner blocks from the navigation post.
|
||||
if ( array_key_exists( 'ref', $attributes ) ) {
|
||||
$navigation_post = get_post( $attributes['ref'] );
|
||||
if ( ! isset( $navigation_post ) ) {
|
||||
return '';
|
||||
}
|
||||
@ -202,20 +307,26 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
|
||||
// 'parse_blocks' includes a null block with '\n\n' as the content when
|
||||
// it encounters whitespace. This code strips it.
|
||||
$compacted_blocks = array_filter(
|
||||
$parsed_blocks,
|
||||
function( $block ) {
|
||||
return isset( $block['blockName'] );
|
||||
}
|
||||
);
|
||||
$compacted_blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );
|
||||
|
||||
// TODO - this uses the full navigation block attributes for the
|
||||
// context which could be refined.
|
||||
$inner_blocks = new WP_Block_List( $compacted_blocks, $attributes );
|
||||
}
|
||||
|
||||
// If there are no inner blocks then fallback to rendering an appropriate fallback.
|
||||
if ( empty( $inner_blocks ) ) {
|
||||
return '';
|
||||
$is_fallback = true; // indicate we are rendering the fallback.
|
||||
|
||||
$fallback_blocks = block_core_navigation_get_fallback_blocks();
|
||||
|
||||
// Fallback my have been filtered so do basic test for validity.
|
||||
if ( empty( $fallback_blocks ) || ! is_array( $fallback_blocks ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$inner_blocks = new WP_Block_List( $fallback_blocks, $attributes );
|
||||
|
||||
}
|
||||
|
||||
// Restore legacy classnames for submenu positioning.
|
||||
@ -234,7 +345,8 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
$colors['css_classes'],
|
||||
$font_sizes['css_classes'],
|
||||
$is_responsive_menu ? array( 'is-responsive' ) : array(),
|
||||
$layout_class ? array( $layout_class ) : array()
|
||||
$layout_class ? array( $layout_class ) : array(),
|
||||
$is_fallback ? array( 'is-fallback' ) : array()
|
||||
);
|
||||
|
||||
$inner_blocks_html = '';
|
||||
@ -323,8 +435,8 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
/**
|
||||
* Register the navigation block.
|
||||
*
|
||||
* @uses render_block_core_navigation()
|
||||
* @throws WP_Error An WP_Error exception parsing the block definition.
|
||||
* @uses render_block_core_navigation()
|
||||
*/
|
||||
function register_block_core_navigation() {
|
||||
register_block_type_from_metadata(
|
||||
@ -341,6 +453,7 @@ add_action( 'init', 'register_block_core_navigation' );
|
||||
* Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly.
|
||||
*
|
||||
* @param array $parsed_block The block being rendered.
|
||||
*
|
||||
* @return array The block being rendered without typographic presets.
|
||||
*/
|
||||
function block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) {
|
||||
@ -364,6 +477,7 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"navigationMenuId": {
|
||||
"ref": {
|
||||
"type": "number"
|
||||
},
|
||||
"textColor": {
|
||||
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '554dac353fae87a844b8e51706ae55ba');
|
||||
<?php return array('dependencies' => array(), 'version' => '37dc06be3966f1583d5594ebf12956ed');
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '4942262e50480536aae4cd504a13f19c');
|
||||
<?php return array('dependencies' => array(), 'version' => 'f3cbbfbf9b9c434c39d6f77037d5267c');
|
2
wp-includes/blocks/navigation/view.min.js
vendored
2
wp-includes/blocks/navigation/view.min.js
vendored
File diff suppressed because one or more lines are too long
@ -293,6 +293,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
||||
|
||||
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
||||
|
||||
// Limit the number of items to be visually displayed.
|
||||
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
|
||||
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
|
||||
}
|
||||
|
||||
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
||||
|
||||
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/pattern",
|
||||
"title": "Pattern",
|
||||
"category": "design",
|
||||
"category": "theme",
|
||||
"description": "Show a block pattern.",
|
||||
"supports": {
|
||||
"html": false,
|
||||
|
@ -114,7 +114,7 @@
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -159,7 +159,7 @@
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
|
||||
min-height: 48px;
|
||||
|
@ -1 +1 @@
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__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-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.block-library-post-featured-image-dimension-controls{margin-bottom:8px}.block-library-post-featured-image-dimension-controls.scale-control-is-visible{margin-bottom:16px}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__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-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.block-library-post-featured-image-dimension-controls{margin-bottom:8px}.block-library-post-featured-image-dimension-controls.scale-control-is-visible{margin-bottom:16px}
|
@ -114,7 +114,7 @@
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -159,7 +159,7 @@
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
|
||||
min-height: 48px;
|
||||
|
@ -1 +1 @@
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__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-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.block-library-post-featured-image-dimension-controls{margin-bottom:8px}.block-library-post-featured-image-dimension-controls.scale-control-is-visible{margin-bottom:16px}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__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-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.block-library-post-featured-image-dimension-controls{margin-bottom:8px}.block-library-post-featured-image-dimension-controls.scale-control-is-visible{margin-bottom:16px}
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/post-terms",
|
||||
"title": "Post Terms",
|
||||
"category": "design",
|
||||
"category": "theme",
|
||||
"description": "Post terms.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/query-title",
|
||||
"title": "Query Title",
|
||||
"category": "design",
|
||||
"category": "theme",
|
||||
"description": "Display the query title.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/site-logo",
|
||||
"title": "Site Logo",
|
||||
"category": "layout",
|
||||
"category": "theme",
|
||||
"description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
|
@ -154,7 +154,7 @@
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -194,7 +194,7 @@
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
|
@ -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{height:auto;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;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.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.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
||||
.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{height:auto;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;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.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.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
@ -154,7 +154,7 @@
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -194,7 +194,7 @@
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
|
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{height:auto;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;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.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.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
||||
.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{height:auto;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;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.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.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/site-tagline",
|
||||
"title": "Site Tagline",
|
||||
"category": "design",
|
||||
"category": "theme",
|
||||
"description": "Describe in a few words what the website is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.",
|
||||
"keywords": [ "description" ],
|
||||
"textdomain": "default",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"apiVersion": 2,
|
||||
"name": "core/site-title",
|
||||
"title": "Site Title",
|
||||
"category": "design",
|
||||
"category": "theme",
|
||||
"description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
|
@ -53,7 +53,8 @@ function render_block_core_template_part( $attributes ) {
|
||||
} else {
|
||||
// Else, if the template part was provided by the active theme,
|
||||
// render the corresponding file content.
|
||||
$template_part_file_path = get_theme_file_path( '/block-template-parts/' . $attributes['slug'] . '.html' );
|
||||
$theme_folders = get_block_theme_folders();
|
||||
$template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
||||
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
|
||||
$content = file_get_contents( $template_part_file_path );
|
||||
$content = is_string( $content ) && '' !== $content
|
||||
|
@ -29,7 +29,8 @@
|
||||
"spacing": {
|
||||
"padding": true
|
||||
},
|
||||
"__experimentalLayout": true
|
||||
"__experimentalLayout": true,
|
||||
"reusable": false
|
||||
},
|
||||
"editorStyle": "wp-block-template-part-editor"
|
||||
}
|
||||
|
@ -77,6 +77,16 @@ class WP_Block_Template {
|
||||
*/
|
||||
public $source = 'theme';
|
||||
|
||||
/**
|
||||
* Origin of the content when the content has been customized.
|
||||
* When customized, origin takes on the value of source and source becomes
|
||||
* 'custom'.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @var string
|
||||
*/
|
||||
public $origin;
|
||||
|
||||
/**
|
||||
* Post Id.
|
||||
*
|
||||
@ -109,4 +119,14 @@ class WP_Block_Template {
|
||||
* @var bool
|
||||
*/
|
||||
public $is_custom = true;
|
||||
|
||||
/**
|
||||
* Author.
|
||||
*
|
||||
* A value of 0 means no author.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @var int
|
||||
*/
|
||||
public $author;
|
||||
}
|
||||
|
@ -222,35 +222,52 @@ class WP_Theme_JSON_Resolver {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param bool $should_create_cpt Optional. Whether a new custom post type should be created if none are found.
|
||||
* False by default.
|
||||
* @param array $post_status_filter Filter Optional. custom post type by post status.
|
||||
* ['publish'] by default, so it only fetches published posts.
|
||||
*
|
||||
* @param WP_Theme $theme The theme object. If empty, it
|
||||
* defaults to the current theme.
|
||||
* @param bool $should_create_cpt Optional. Whether a new custom post
|
||||
* type should be created if none are
|
||||
* found. False by default.
|
||||
* @param array $post_status_filter Filter Optional. custom post type by
|
||||
* post status. ['publish'] by default,
|
||||
* so it only fetches published posts.
|
||||
* @return array Custom Post Type for the user's origin config.
|
||||
*/
|
||||
private static function get_user_data_from_custom_post_type( $should_create_cpt = false, $post_status_filter = array( 'publish' ) ) {
|
||||
public static function get_user_data_from_custom_post_type( $theme, $should_create_cpt = false, $post_status_filter = array( 'publish' ) ) {
|
||||
if ( ! $theme instanceof WP_Theme ) {
|
||||
$theme = wp_get_theme();
|
||||
}
|
||||
$user_cpt = array();
|
||||
$post_type_filter = 'wp_global_styles';
|
||||
$query = new WP_Query(
|
||||
array(
|
||||
'posts_per_page' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'desc',
|
||||
'post_type' => $post_type_filter,
|
||||
'post_status' => $post_status_filter,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wp_theme',
|
||||
'field' => 'name',
|
||||
'terms' => wp_get_theme()->get_stylesheet(),
|
||||
),
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'desc',
|
||||
'post_type' => $post_type_filter,
|
||||
'post_status' => $post_status_filter,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wp_theme',
|
||||
'field' => 'name',
|
||||
'terms' => $theme->get_stylesheet(),
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
if ( is_array( $query->posts ) && ( 1 === $query->post_count ) ) {
|
||||
$user_cpt = $query->posts[0]->to_array();
|
||||
$cache_key = sprintf( 'wp_global_styles_%s', md5( serialize( $args ) ) );
|
||||
$post_id = wp_cache_get( $cache_key );
|
||||
|
||||
if ( (int) $post_id > 0 ) {
|
||||
return get_post( $post_id, ARRAY_A );
|
||||
}
|
||||
|
||||
// Special case: '-1' is a results not found.
|
||||
if ( -1 === $post_id && ! $should_create_cpt ) {
|
||||
return $user_cpt;
|
||||
}
|
||||
|
||||
$recent_posts = wp_get_recent_posts( $args );
|
||||
if ( is_array( $recent_posts ) && ( count( $recent_posts ) === 1 ) ) {
|
||||
$user_cpt = $recent_posts[0];
|
||||
} elseif ( $should_create_cpt ) {
|
||||
$cpt_post_id = wp_insert_post(
|
||||
array(
|
||||
@ -265,13 +282,10 @@ class WP_Theme_JSON_Resolver {
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_wp_error( $cpt_post_id ) ) {
|
||||
$user_cpt = array();
|
||||
} else {
|
||||
$user_cpt = get_post( $cpt_post_id, ARRAY_A );
|
||||
}
|
||||
$user_cpt = get_post( $cpt_post_id, ARRAY_A );
|
||||
}
|
||||
$cache_expiration = $user_cpt ? DAY_IN_SECONDS : HOUR_IN_SECONDS;
|
||||
wp_cache_set( $cache_key, $user_cpt ? $user_cpt['ID'] : -1, '', $cache_expiration );
|
||||
|
||||
return $user_cpt;
|
||||
}
|
||||
@ -289,7 +303,7 @@ class WP_Theme_JSON_Resolver {
|
||||
}
|
||||
|
||||
$config = array();
|
||||
$user_cpt = self::get_user_data_from_custom_post_type();
|
||||
$user_cpt = self::get_user_data_from_custom_post_type( wp_get_theme() );
|
||||
|
||||
if ( array_key_exists( 'post_content', $user_cpt ) ) {
|
||||
$decoded_data = json_decode( $user_cpt['post_content'], true );
|
||||
@ -297,7 +311,7 @@ class WP_Theme_JSON_Resolver {
|
||||
$json_decoding_error = json_last_error();
|
||||
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
|
||||
trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() );
|
||||
return new WP_Theme_JSON( $config, 'user' );
|
||||
return new WP_Theme_JSON( $config, 'custom' );
|
||||
}
|
||||
|
||||
// Very important to verify if the flag isGlobalStylesUserThemeJSON is true.
|
||||
@ -311,15 +325,15 @@ class WP_Theme_JSON_Resolver {
|
||||
$config = $decoded_data;
|
||||
}
|
||||
}
|
||||
self::$user = new WP_Theme_JSON( $config, 'user' );
|
||||
self::$user = new WP_Theme_JSON( $config, 'custom' );
|
||||
|
||||
return self::$user;
|
||||
}
|
||||
|
||||
/**
|
||||
* There are three sources of data (origins) for a site:
|
||||
* default, theme, and user. The user's has higher priority
|
||||
* than the theme's, and the theme's higher than core's.
|
||||
* default, theme, and custom. The custom's has higher priority
|
||||
* than the theme's, and the theme's higher than default's.
|
||||
*
|
||||
* Unlike the getters {@link get_core_data},
|
||||
* {@link get_theme_data}, and {@link get_user_data},
|
||||
@ -336,11 +350,11 @@ class WP_Theme_JSON_Resolver {
|
||||
* @since 5.9.0 Add user data and change the arguments.
|
||||
*
|
||||
* @param string $origin Optional. To what level should we merge data.
|
||||
* Valid values are 'theme' or 'user'.
|
||||
* Default is 'user'.
|
||||
* Valid values are 'theme' or 'custom'.
|
||||
* Default is 'custom'.
|
||||
* @return WP_Theme_JSON
|
||||
*/
|
||||
public static function get_merged_data( $origin = 'user' ) {
|
||||
public static function get_merged_data( $origin = 'custom' ) {
|
||||
if ( is_array( $origin ) ) {
|
||||
_deprecated_argument( __FUNCTION__, '5.9' );
|
||||
}
|
||||
@ -349,7 +363,7 @@ class WP_Theme_JSON_Resolver {
|
||||
$result->merge( self::get_core_data() );
|
||||
$result->merge( self::get_theme_data() );
|
||||
|
||||
if ( 'user' === $origin ) {
|
||||
if ( 'custom' === $origin ) {
|
||||
$result->merge( self::get_user_data() );
|
||||
}
|
||||
|
||||
@ -369,7 +383,7 @@ class WP_Theme_JSON_Resolver {
|
||||
return self::$user_custom_post_type_id;
|
||||
}
|
||||
|
||||
$user_cpt = self::get_user_data_from_custom_post_type( true );
|
||||
$user_cpt = self::get_user_data_from_custom_post_type( wp_get_theme(), true );
|
||||
|
||||
if ( array_key_exists( 'ID', $user_cpt ) ) {
|
||||
self::$user_custom_post_type_id = $user_cpt['ID'];
|
||||
|
@ -53,7 +53,7 @@ class WP_Theme_JSON {
|
||||
const VALID_ORIGINS = array(
|
||||
'default',
|
||||
'theme',
|
||||
'user',
|
||||
'custom',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -75,15 +75,28 @@ class WP_Theme_JSON {
|
||||
* This contains the necessary metadata to process them:
|
||||
*
|
||||
* - path => where to find the preset within the settings section
|
||||
* - override => whether a theme preset with the same slug as a default preset
|
||||
* can override it
|
||||
* - value_key => the key that represents the value
|
||||
* - value_func => the callback to render the value (either value_key or value_func should be present)
|
||||
* - value_func => optionally, instead of value_key, a function to generate
|
||||
* the value that takes a preset as an argument
|
||||
* (either value_key or value_func should be present)
|
||||
* - css_vars => template string to use in generating the CSS Custom Property.
|
||||
* Example output: "--wp--preset--duotone--blue: <value>" will generate as many CSS Custom Properties as presets defined
|
||||
* substituting the $slug for the slug's value for each preset value.
|
||||
* - classes => array containing a structure with the classes to generate for the presets.
|
||||
* Each key is a template string to resolve similarly to the css_vars and each value is the CSS property to use for that class.
|
||||
* Example output: ".has-blue-color { color: <value> }"
|
||||
* - properties => a list of CSS properties to be used by kses to check the preset value is safe.
|
||||
* - classes => array containing a structure with the classes to
|
||||
* generate for the presets, where for each array item
|
||||
* the key is the class name and the value the property name.
|
||||
* The "$slug" substring will be replaced by the slug of each preset.
|
||||
* For example:
|
||||
* 'classes' => array(
|
||||
* '.has-$slug-color' => 'color',
|
||||
* '.has-$slug-background-color' => 'background-color',
|
||||
* '.has-$slug-border-color' => 'border-color',
|
||||
* )
|
||||
* - properties => array of CSS properties to be used by kses to
|
||||
* validate the content of each preset
|
||||
* by means of the remove_insecure_properties method.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @since 5.9.0 Added new presets and simplified the metadata structure.
|
||||
@ -92,6 +105,7 @@ class WP_Theme_JSON {
|
||||
const PRESETS_METADATA = array(
|
||||
array(
|
||||
'path' => array( 'color', 'palette' ),
|
||||
'override' => false,
|
||||
'value_key' => 'color',
|
||||
'css_vars' => '--wp--preset--color--$slug',
|
||||
'classes' => array(
|
||||
@ -103,6 +117,7 @@ class WP_Theme_JSON {
|
||||
),
|
||||
array(
|
||||
'path' => array( 'color', 'gradients' ),
|
||||
'override' => false,
|
||||
'value_key' => 'gradient',
|
||||
'css_vars' => '--wp--preset--gradient--$slug',
|
||||
'classes' => array( '.has-$slug-gradient-background' => 'background' ),
|
||||
@ -110,6 +125,7 @@ class WP_Theme_JSON {
|
||||
),
|
||||
array(
|
||||
'path' => array( 'color', 'duotone' ),
|
||||
'override' => true,
|
||||
'value_func' => 'wp_render_duotone_filter_preset',
|
||||
'css_vars' => '--wp--preset--duotone--$slug',
|
||||
'classes' => array(),
|
||||
@ -117,6 +133,7 @@ class WP_Theme_JSON {
|
||||
),
|
||||
array(
|
||||
'path' => array( 'typography', 'fontSizes' ),
|
||||
'override' => true,
|
||||
'value_key' => 'size',
|
||||
'css_vars' => '--wp--preset--font-size--$slug',
|
||||
'classes' => array( '.has-$slug-font-size' => 'font-size' ),
|
||||
@ -124,6 +141,7 @@ class WP_Theme_JSON {
|
||||
),
|
||||
array(
|
||||
'path' => array( 'typography', 'fontFamilies' ),
|
||||
'override' => true,
|
||||
'value_key' => 'fontFamily',
|
||||
'css_vars' => '--wp--preset--font-family--$slug',
|
||||
'classes' => array( '.has-$slug-font-family' => 'font-family' ),
|
||||
@ -213,13 +231,14 @@ class WP_Theme_JSON {
|
||||
* @var array
|
||||
*/
|
||||
const VALID_SETTINGS = array(
|
||||
'border' => array(
|
||||
'appearanceTools' => null,
|
||||
'border' => array(
|
||||
'color' => null,
|
||||
'radius' => null,
|
||||
'style' => null,
|
||||
'width' => null,
|
||||
),
|
||||
'color' => array(
|
||||
'color' => array(
|
||||
'background' => null,
|
||||
'custom' => null,
|
||||
'customDuotone' => null,
|
||||
@ -232,18 +251,18 @@ class WP_Theme_JSON {
|
||||
'palette' => null,
|
||||
'text' => null,
|
||||
),
|
||||
'custom' => null,
|
||||
'layout' => array(
|
||||
'custom' => null,
|
||||
'layout' => array(
|
||||
'contentSize' => null,
|
||||
'wideSize' => null,
|
||||
),
|
||||
'spacing' => array(
|
||||
'spacing' => array(
|
||||
'blockGap' => null,
|
||||
'margin' => null,
|
||||
'padding' => null,
|
||||
'units' => null,
|
||||
),
|
||||
'typography' => array(
|
||||
'typography' => array(
|
||||
'customFontSize' => null,
|
||||
'dropCap' => null,
|
||||
'fontFamilies' => null,
|
||||
@ -297,6 +316,8 @@ class WP_Theme_JSON {
|
||||
);
|
||||
|
||||
/**
|
||||
* The valid elements that can be found under styles.
|
||||
*
|
||||
* @since 5.8.0
|
||||
* @var string[]
|
||||
*/
|
||||
@ -326,7 +347,7 @@ class WP_Theme_JSON {
|
||||
*
|
||||
* @param array $theme_json A structure that follows the theme.json schema.
|
||||
* @param string $origin Optional. What source of data this object represents.
|
||||
* One of 'default', 'theme', or 'user'. Default 'theme'.
|
||||
* One of 'default', 'theme', or 'custom'. Default 'theme'.
|
||||
*/
|
||||
public function __construct( $theme_json = array(), $origin = 'theme' ) {
|
||||
if ( ! in_array( $origin, self::VALID_ORIGINS, true ) ) {
|
||||
@ -336,7 +357,8 @@ class WP_Theme_JSON {
|
||||
$this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json );
|
||||
$valid_block_names = array_keys( self::get_blocks_metadata() );
|
||||
$valid_element_names = array_keys( self::ELEMENTS );
|
||||
$this->theme_json = self::sanitize( $this->theme_json, $valid_block_names, $valid_element_names );
|
||||
$theme_json = self::sanitize( $this->theme_json, $valid_block_names, $valid_element_names );
|
||||
$this->theme_json = self::maybe_opt_in_into_settings( $theme_json );
|
||||
|
||||
// Internally, presets are keyed by origin.
|
||||
$nodes = self::get_setting_nodes( $this->theme_json );
|
||||
@ -345,7 +367,8 @@ class WP_Theme_JSON {
|
||||
$path = array_merge( $node['path'], $preset_metadata['path'] );
|
||||
$preset = _wp_array_get( $this->theme_json, $path, null );
|
||||
if ( null !== $preset ) {
|
||||
if ( 'user' !== $origin || isset( $preset[0] ) ) {
|
||||
// If the preset is not already keyed by origin.
|
||||
if ( isset( $preset[0] ) || empty( $preset ) ) {
|
||||
_wp_array_set( $this->theme_json, $path, array( $origin => $preset ) );
|
||||
}
|
||||
}
|
||||
@ -353,6 +376,61 @@ class WP_Theme_JSON {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables some opt-in settings if theme declared support.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $theme_json A theme.json structure to modify.
|
||||
* @return array The modified theme.json structure.
|
||||
*/
|
||||
private static function maybe_opt_in_into_settings( $theme_json ) {
|
||||
$new_theme_json = $theme_json;
|
||||
|
||||
if ( isset( $new_theme_json['settings']['appearanceTools'] ) ) {
|
||||
self::do_opt_in_into_settings( $new_theme_json['settings'] );
|
||||
}
|
||||
|
||||
if ( isset( $new_theme_json['settings']['blocks'] ) && is_array( $new_theme_json['settings']['blocks'] ) ) {
|
||||
foreach ( $new_theme_json['settings']['blocks'] as &$block ) {
|
||||
if ( isset( $block['appearanceTools'] ) ) {
|
||||
self::do_opt_in_into_settings( $block );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $new_theme_json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables some settings.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $context The context to which the settings belong.
|
||||
*/
|
||||
private static function do_opt_in_into_settings( &$context ) {
|
||||
$to_opt_in = array(
|
||||
array( 'border', 'color' ),
|
||||
array( 'border', 'radius' ),
|
||||
array( 'border', 'style' ),
|
||||
array( 'border', 'width' ),
|
||||
array( 'color', 'link' ),
|
||||
array( 'spacing', 'blockGap' ),
|
||||
array( 'spacing', 'margin' ),
|
||||
array( 'spacing', 'padding' ),
|
||||
array( 'typography', 'lineHeight' ),
|
||||
);
|
||||
|
||||
foreach ( $to_opt_in as $path ) {
|
||||
if ( null === _wp_array_get( $context, $path, null ) ) {
|
||||
_wp_array_set( $context, $path, true );
|
||||
}
|
||||
}
|
||||
|
||||
unset( $context['appearanceTools'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes the input according to the schemas.
|
||||
*
|
||||
@ -414,6 +492,7 @@ class WP_Theme_JSON {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the metadata for each block.
|
||||
*
|
||||
@ -1378,31 +1457,137 @@ class WP_Theme_JSON {
|
||||
$this->theme_json = array_replace_recursive( $this->theme_json, $incoming_data );
|
||||
|
||||
/*
|
||||
* The array_replace_recursive algorithm merges at the leaf level.
|
||||
* For leaf values that are arrays it will use the numeric indexes for replacement.
|
||||
* In those cases, we want to replace the existing with the incoming value, if it exists.
|
||||
* The array_replace_recursive algorithm merges at the leaf level,
|
||||
* but we don't want leaf arrays to be merged, so we overwrite it.
|
||||
*
|
||||
* For leaf values that are sequential arrays it will use the numeric indexes for replacement.
|
||||
* We rather replace the existing with the incoming value, if it exists.
|
||||
* This is the case of spacing.units.
|
||||
*
|
||||
* For leaf values that are associative arrays it will merge them as expected.
|
||||
* This is also not the behavior we want for the current associative arrays (presets).
|
||||
* We rather replace the existing with the incoming value, if it exists.
|
||||
* This happens, for example, when we merge data from theme.json upon existing
|
||||
* theme supports or when we merge anything coming from the same source twice.
|
||||
* This is the case of color.palette, color.gradients, color.duotone,
|
||||
* typography.fontSizes, or typography.fontFamilies.
|
||||
*
|
||||
* Additionally, for some preset types, we also want to make sure the
|
||||
* values they introduce don't conflict with default values. We do so
|
||||
* by checking the incoming slugs for theme presets and compare them
|
||||
* with the equivalent dfefault presets: if a slug is present as a default
|
||||
* we remove it from the theme presets.
|
||||
*/
|
||||
$to_replace = array();
|
||||
$to_replace[] = array( 'spacing', 'units' );
|
||||
foreach ( self::VALID_ORIGINS as $origin ) {
|
||||
$to_replace[] = array( 'color', 'duotone', $origin );
|
||||
$to_replace[] = array( 'color', 'palette', $origin );
|
||||
$to_replace[] = array( 'color', 'gradients', $origin );
|
||||
$to_replace[] = array( 'typography', 'fontSizes', $origin );
|
||||
$to_replace[] = array( 'typography', 'fontFamilies', $origin );
|
||||
}
|
||||
$nodes = self::get_setting_nodes( $incoming_data );
|
||||
$slugs_global = self::get_slugs_not_to_override( $this->theme_json );
|
||||
foreach ( $nodes as $node ) {
|
||||
$slugs_node = self::get_slugs_not_to_override( $this->theme_json, $node['path'] );
|
||||
$slugs = array_merge_recursive( $slugs_global, $slugs_node );
|
||||
|
||||
$nodes = self::get_setting_nodes( $this->theme_json );
|
||||
foreach ( $nodes as $metadata ) {
|
||||
foreach ( $to_replace as $property_path ) {
|
||||
$path = array_merge( $metadata['path'], $property_path );
|
||||
$node = _wp_array_get( $incoming_data, $path, null );
|
||||
if ( isset( $node ) ) {
|
||||
_wp_array_set( $this->theme_json, $path, $node );
|
||||
// Replace the spacing.units.
|
||||
$path = array_merge( $node['path'], array( 'spacing', 'units' ) );
|
||||
$content = _wp_array_get( $incoming_data, $path, null );
|
||||
if ( isset( $content ) ) {
|
||||
_wp_array_set( $this->theme_json, $path, $content );
|
||||
}
|
||||
|
||||
// Replace the presets.
|
||||
foreach ( self::PRESETS_METADATA as $preset ) {
|
||||
foreach ( self::VALID_ORIGINS as $origin ) {
|
||||
$path = array_merge( $node['path'], $preset['path'], array( $origin ) );
|
||||
$content = _wp_array_get( $incoming_data, $path, null );
|
||||
if ( ! isset( $content ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
( 'theme' !== $origin ) ||
|
||||
( 'theme' === $origin && $preset['override'] )
|
||||
) {
|
||||
_wp_array_set( $this->theme_json, $path, $content );
|
||||
}
|
||||
|
||||
if ( 'theme' === $origin && ! $preset['override'] ) {
|
||||
$content = self::filter_slugs( $content, $preset['path'], $slugs );
|
||||
_wp_array_set( $this->theme_json, $path, $content );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the slugs for all the presets that cannot be overriden
|
||||
* in the given path. It returns an associative array
|
||||
* whose keys are the preset paths and the leafs is the list of slugs.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* array(
|
||||
* 'color' => array(
|
||||
* 'palette' => array( 'slug-1', 'slug-2' ),
|
||||
* 'gradients' => array( 'slug-3', 'slug-4' ),
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $data A theme.json like structure to inspect.
|
||||
* @param array $node_path The path to inspect. It's 'settings' by default.
|
||||
*
|
||||
* @return array An associative array containing the slugs for the given path.
|
||||
*/
|
||||
private static function get_slugs_not_to_override( $data, $node_path = array( 'settings' ) ) {
|
||||
$slugs = array();
|
||||
foreach ( self::PRESETS_METADATA as $metadata ) {
|
||||
if ( $metadata['override'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$slugs_for_preset = array();
|
||||
$path = array_merge( $node_path, $metadata['path'], array( 'default' ) );
|
||||
$preset = _wp_array_get( $data, $path, null );
|
||||
if ( ! isset( $preset ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$slugs_for_preset = array_map(
|
||||
function( $value ) {
|
||||
return isset( $value['slug'] ) ? $value['slug'] : null;
|
||||
},
|
||||
$preset
|
||||
);
|
||||
_wp_array_set( $slugs, $metadata['path'], $slugs_for_preset );
|
||||
}
|
||||
|
||||
return $slugs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the preset values whose slug is equal to any of given slugs.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $node The node with the presets to validate.
|
||||
* @param array $path The path to the preset type to inspect.
|
||||
* @param array $slugs The slugs that should not be overriden.
|
||||
*
|
||||
* @return array The new node
|
||||
*/
|
||||
private static function filter_slugs( $node, $path, $slugs ) {
|
||||
$slugs_for_preset = _wp_array_get( $slugs, $path, array() );
|
||||
if ( empty( $slugs_for_preset ) ) {
|
||||
return $node;
|
||||
}
|
||||
|
||||
$new_node = array();
|
||||
foreach ( $node as $value ) {
|
||||
if ( isset( $value['slug'] ) && ! in_array( $value['slug'], $slugs_for_preset, true ) ) {
|
||||
$new_node[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $new_node;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -820,6 +820,7 @@ figure.wp-block-gallery .components-spinner {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
.blocks-gallery-item figure.is-transient img {
|
||||
opacity: 0.3;
|
||||
@ -1975,7 +1976,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -2015,7 +2016,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
@ -2502,7 +2503,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -2547,7 +2548,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
|
||||
min-height: 48px;
|
||||
|
File diff suppressed because one or more lines are too long
@ -825,6 +825,7 @@ figure.wp-block-gallery .components-spinner {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
.blocks-gallery-item figure.is-transient img {
|
||||
opacity: 0.3;
|
||||
@ -1980,7 +1981,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -2020,7 +2021,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
@ -2510,7 +2511,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
@ -2555,7 +2556,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
|
||||
min-height: 48px;
|
||||
|
File diff suppressed because one or more lines are too long
13
wp-includes/css/dist/components/style-rtl.css
vendored
13
wp-includes/css/dist/components/style-rtl.css
vendored
@ -754,11 +754,22 @@ svg.components-checkbox-control__checked {
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.components-color-edit__color-popover.components-popover .components-popover__content.components-popover__content.components-popover__content {
|
||||
.components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content {
|
||||
margin-left: 156px;
|
||||
margin-top: -49px;
|
||||
}
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar {
|
||||
margin-top: 0;
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker__ui-line {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker {
|
||||
width: 280px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.component-color-indicator {
|
||||
width: 25px;
|
||||
height: 16px;
|
||||
|
File diff suppressed because one or more lines are too long
13
wp-includes/css/dist/components/style.css
vendored
13
wp-includes/css/dist/components/style.css
vendored
@ -754,11 +754,22 @@ svg.components-checkbox-control__checked {
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.components-color-edit__color-popover.components-popover .components-popover__content.components-popover__content.components-popover__content {
|
||||
.components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content {
|
||||
margin-right: 156px;
|
||||
margin-top: -49px;
|
||||
}
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar {
|
||||
margin-top: 0;
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker__ui-line {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.components-palette-edit__popover .components-custom-gradient-picker {
|
||||
width: 280px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.component-color-indicator {
|
||||
width: 25px;
|
||||
height: 16px;
|
||||
|
File diff suppressed because one or more lines are too long
153
wp-includes/css/dist/edit-site/style-rtl.css
vendored
153
wp-includes/css/dist/edit-site/style-rtl.css
vendored
@ -535,6 +535,30 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.edit-site-typography-panel__preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100px;
|
||||
margin-bottom: 16px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-typography {
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-typography__indicator {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
font-size: 14px;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-colors {
|
||||
margin: 16px;
|
||||
}
|
||||
@ -561,6 +585,15 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
width: unset;
|
||||
}
|
||||
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control {
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.edit-site-header {
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
@ -1099,12 +1132,14 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
|
||||
.edit-site-list-table {
|
||||
width: 100%;
|
||||
border: 1px solid #e0e0e0;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 2px;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
border-spacing: 0;
|
||||
max-width: 960px;
|
||||
}
|
||||
.edit-site-list-table li {
|
||||
.edit-site-list-table tr {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
@ -1112,36 +1147,119 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
border-top: 1px solid #f0f0f0;
|
||||
margin: 0;
|
||||
}
|
||||
.edit-site-list-table tr:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list-table li {
|
||||
.edit-site-list-table tr {
|
||||
padding: 24px 32px;
|
||||
}
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(1) {
|
||||
width: calc(60% - 36px);
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) {
|
||||
width: calc(60% - 18px);
|
||||
padding-left: 24px;
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(1) a {
|
||||
display: block;
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) a {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(2) {
|
||||
width: calc(40% - 36px);
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(2) {
|
||||
width: calc(40% - 18px);
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(3) {
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(3) {
|
||||
min-width: 36px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.edit-site-list-table li.edit-site-list-table-head {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
.edit-site-list-table tr.edit-site-list-table-head {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
text-align: right;
|
||||
color: #000;
|
||||
color: #1e1e1e;
|
||||
border-top: none;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.edit-site-list-table li.edit-site-list-table-head + li {
|
||||
border-top: 0;
|
||||
.edit-site-list-table tr.edit-site-list-table-head th {
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list.is-navigation-open .components-snackbar-list {
|
||||
margin-right: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list__rename-modal .components-base-control {
|
||||
width: 320px;
|
||||
}
|
||||
}
|
||||
.edit-site-list__rename-modal .components-modal__header {
|
||||
border-bottom: none;
|
||||
}
|
||||
.edit-site-list__rename-modal .components-modal__content::before {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.edit-site-list__rename-modal-actions {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.edit-site-template__actions button:not(:last-child) {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.edit-site-list-added-by__icon {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: #2f2f2f;
|
||||
border-radius: 100%;
|
||||
}
|
||||
.edit-site-list-added-by__icon svg {
|
||||
fill: #fff;
|
||||
}
|
||||
.edit-site-list-added-by__icon.is-customized::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background: var(--wp-admin-theme-color);
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
outline: 2px solid #fff;
|
||||
border-radius: 100%;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
}
|
||||
|
||||
.edit-site-list-added-by__avatar {
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 100%;
|
||||
background: #2f2f2f;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
.edit-site-list-added-by__avatar img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s linear;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.edit-site-list-added-by__avatar img {
|
||||
transition-duration: 0s;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.edit-site-list-added-by__avatar.is-loaded img {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.edit-site-new-template-dropdown .components-dropdown-menu__toggle {
|
||||
@ -1212,7 +1330,8 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-color-palette-panel {
|
||||
.edit-site-global-styles-color-palette-panel,
|
||||
.edit-site-global-styles-gradient-palette-panel {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
153
wp-includes/css/dist/edit-site/style.css
vendored
153
wp-includes/css/dist/edit-site/style.css
vendored
@ -535,6 +535,30 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.edit-site-typography-panel__preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100px;
|
||||
margin-bottom: 16px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-typography {
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-typography__indicator {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
font-size: 14px;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-screen-colors {
|
||||
margin: 16px;
|
||||
}
|
||||
@ -561,6 +585,15 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
||||
margin-right: 16px;
|
||||
margin-left: 16px;
|
||||
width: unset;
|
||||
}
|
||||
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control {
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.edit-site-header {
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
@ -1099,12 +1132,14 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
|
||||
.edit-site-list-table {
|
||||
width: 100%;
|
||||
border: 1px solid #e0e0e0;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 2px;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
border-spacing: 0;
|
||||
max-width: 960px;
|
||||
}
|
||||
.edit-site-list-table li {
|
||||
.edit-site-list-table tr {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
@ -1112,36 +1147,119 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
border-top: 1px solid #f0f0f0;
|
||||
margin: 0;
|
||||
}
|
||||
.edit-site-list-table tr:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list-table li {
|
||||
.edit-site-list-table tr {
|
||||
padding: 24px 32px;
|
||||
}
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(1) {
|
||||
width: calc(60% - 36px);
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) {
|
||||
width: calc(60% - 18px);
|
||||
padding-right: 24px;
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(1) a {
|
||||
display: block;
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) a {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(2) {
|
||||
width: calc(40% - 36px);
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(2) {
|
||||
width: calc(40% - 18px);
|
||||
}
|
||||
.edit-site-list-table li .edit-site-list-table-column:nth-child(3) {
|
||||
.edit-site-list-table tr .edit-site-list-table-column:nth-child(3) {
|
||||
min-width: 36px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.edit-site-list-table li.edit-site-list-table-head {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
.edit-site-list-table tr.edit-site-list-table-head {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
color: #000;
|
||||
color: #1e1e1e;
|
||||
border-top: none;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.edit-site-list-table li.edit-site-list-table-head + li {
|
||||
border-top: 0;
|
||||
.edit-site-list-table tr.edit-site-list-table-head th {
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list.is-navigation-open .components-snackbar-list {
|
||||
margin-left: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 782px) {
|
||||
.edit-site-list__rename-modal .components-base-control {
|
||||
width: 320px;
|
||||
}
|
||||
}
|
||||
.edit-site-list__rename-modal .components-modal__header {
|
||||
border-bottom: none;
|
||||
}
|
||||
.edit-site-list__rename-modal .components-modal__content::before {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.edit-site-list__rename-modal-actions {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.edit-site-template__actions button:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.edit-site-list-added-by__icon {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: #2f2f2f;
|
||||
border-radius: 100%;
|
||||
}
|
||||
.edit-site-list-added-by__icon svg {
|
||||
fill: #fff;
|
||||
}
|
||||
.edit-site-list-added-by__icon.is-customized::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background: var(--wp-admin-theme-color);
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
outline: 2px solid #fff;
|
||||
border-radius: 100%;
|
||||
top: -1px;
|
||||
right: -1px;
|
||||
}
|
||||
|
||||
.edit-site-list-added-by__avatar {
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 100%;
|
||||
background: #2f2f2f;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
.edit-site-list-added-by__avatar img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s linear;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.edit-site-list-added-by__avatar img {
|
||||
transition-duration: 0s;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.edit-site-list-added-by__avatar.is-loaded img {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.edit-site-new-template-dropdown .components-dropdown-menu__toggle {
|
||||
@ -1212,7 +1330,8 @@ body.is-fullscreen-mode .edit-site-list-header {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.edit-site-global-styles-color-palette-panel {
|
||||
.edit-site-global-styles-color-palette-panel,
|
||||
.edit-site-global-styles-gradient-palette-panel {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
|
2
wp-includes/css/dist/edit-site/style.min.css
vendored
2
wp-includes/css/dist/edit-site/style.min.css
vendored
File diff suppressed because one or more lines are too long
@ -10,25 +10,28 @@
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $path Path to the specific setting to retrieve. Optional.
|
||||
* If empty, will return all settings.
|
||||
* @param string $block_name Which block to retrieve the settings from. Optional
|
||||
* If empty, it'll return the settings for the global context.
|
||||
* @param string $origin Which origin to take data from. Optional.
|
||||
* It can be 'all' (core, theme, and user) or 'base' (core and theme).
|
||||
* If empty or unknown, 'all' is used.
|
||||
* @param array $path Path to the specific setting to retrieve. Optional.
|
||||
* If empty, will return all settings.
|
||||
* @param array $context {
|
||||
* Metadata to know where to retrieve the $path from. Optional.
|
||||
*
|
||||
* @type string $block_name Which block to retrieve the settings from.
|
||||
* If empty, it'll return the settings for the global context.
|
||||
* @type string $origin Which origin to take data from.
|
||||
* Valid values are 'all' (core, theme, and user) or 'base' (core and theme).
|
||||
* If empty or unknown, 'all' is used.
|
||||
* }
|
||||
*
|
||||
* @return array The settings to retrieve.
|
||||
*/
|
||||
function wp_get_global_settings( $path = array(), $block_name = '', $origin = 'all' ) {
|
||||
if ( '' !== $block_name ) {
|
||||
$path = array_merge( array( 'blocks', $block_name ), $path );
|
||||
function wp_get_global_settings( $path = array(), $context = array() ) {
|
||||
if ( ! empty( $context['block_name'] ) ) {
|
||||
$path = array_merge( array( 'blocks', $context['block_name'] ), $path );
|
||||
}
|
||||
|
||||
if ( 'base' === $origin ) {
|
||||
$origin = 'custom';
|
||||
if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
|
||||
$origin = 'theme';
|
||||
} else {
|
||||
$origin = 'user';
|
||||
}
|
||||
|
||||
$settings = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_settings();
|
||||
@ -41,25 +44,28 @@ function wp_get_global_settings( $path = array(), $block_name = '', $origin = 'a
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $path Path to the specific style to retrieve. Optional.
|
||||
* If empty, will return all styles.
|
||||
* @param string $block_name Which block to retrieve the styles from. Optional.
|
||||
* If empty, it'll return the styles for the global context.
|
||||
* @param string $origin Which origin to take data from. Optional.
|
||||
* It can be 'all' (core, theme, and user) or 'base' (core and theme).
|
||||
* If empty or unknown, 'all' is used.
|
||||
* @param array $path Path to the specific style to retrieve. Optional.
|
||||
* If empty, will return all styles.
|
||||
* @param array $context {
|
||||
* Metadata to know where to retrieve the $path from. Optional.
|
||||
*
|
||||
* @type string $block_name Which block to retrieve the styles from.
|
||||
* If empty, it'll return the styles for the global context.
|
||||
* @type string $origin Which origin to take data from.
|
||||
* Valid values are 'all' (core, theme, and user) or 'base' (core and theme).
|
||||
* If empty or unknown, 'all' is used.
|
||||
* }
|
||||
*
|
||||
* @return array The styles to retrieve.
|
||||
*/
|
||||
function wp_get_global_styles( $path = array(), $block_name = '', $origin = 'all' ) {
|
||||
if ( '' !== $block_name ) {
|
||||
$path = array_merge( array( 'blocks', $block_name ), $path );
|
||||
function wp_get_global_styles( $path = array(), $context = array() ) {
|
||||
if ( ! empty( $context['block_name'] ) ) {
|
||||
$path = array_merge( array( 'blocks', $context['block_name'] ), $path );
|
||||
}
|
||||
|
||||
if ( 'base' === $origin ) {
|
||||
$origin = 'custom';
|
||||
if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
|
||||
$origin = 'theme';
|
||||
} else {
|
||||
$origin = 'user';
|
||||
}
|
||||
|
||||
$styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles'];
|
||||
@ -105,7 +111,7 @@ function wp_get_global_stylesheet( $types = array() ) {
|
||||
$types = array( 'variables', 'styles', 'presets' );
|
||||
}
|
||||
|
||||
$origins = array( 'default', 'theme', 'user' );
|
||||
$origins = array( 'default', 'theme', 'custom' );
|
||||
if ( ! $supports_theme_json && ! $supports_link_color ) {
|
||||
// In this case we only enqueue the core presets (CSS Custom Properties + the classes).
|
||||
$origins = array( 'default' );
|
||||
|
185
wp-includes/js/dist/block-editor.js
vendored
185
wp-includes/js/dist/block-editor.js
vendored
@ -14886,7 +14886,6 @@ var use_setting = __webpack_require__("v5LD");
|
||||
|
||||
|
||||
|
||||
const DEFAULT_COLORS = [];
|
||||
/**
|
||||
* Higher order component factory for injecting the `colorsArray` argument as
|
||||
* the colors prop in the `withCustomColors` HOC.
|
||||
@ -14908,9 +14907,12 @@ const withCustomColorPalette = colorsArray => Object(external_wp_compose_["creat
|
||||
|
||||
|
||||
const withEditorColorPalette = () => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => {
|
||||
const colors = Object(use_setting["a" /* default */])('color.palette') || DEFAULT_COLORS;
|
||||
const {
|
||||
palette: colorPerOrigin
|
||||
} = Object(use_setting["a" /* default */])('color') || {};
|
||||
const allColors = Object(external_wp_element_["useMemo"])(() => [...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.custom) || []), ...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.theme) || []), ...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.default) || [])], [colorPerOrigin]);
|
||||
return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, {
|
||||
colors: colors
|
||||
colors: allColors
|
||||
}));
|
||||
}, 'withEditorColorPalette');
|
||||
/**
|
||||
@ -20692,38 +20694,33 @@ const getInserterItems = Object(rememo["a" /* default */])(function (state) {
|
||||
};
|
||||
|
||||
const blockTypeInserterItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
|
||||
const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; // Exclude any block type item that is to be replaced by a default
|
||||
// variation.
|
||||
|
||||
const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(_ref4 => {
|
||||
let {
|
||||
variations = []
|
||||
} = _ref4;
|
||||
return !variations.some(_ref5 => {
|
||||
let {
|
||||
isDefault
|
||||
} = _ref5;
|
||||
return isDefault;
|
||||
});
|
||||
});
|
||||
const blockVariations = []; // Show all available blocks with variations
|
||||
|
||||
for (const item of blockTypeInserterItems) {
|
||||
const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
|
||||
const items = blockTypeInserterItems.reduce((accumulator, item) => {
|
||||
const {
|
||||
variations = []
|
||||
} = item;
|
||||
} = item; // Exclude any block type item that is to be replaced by a default variation
|
||||
|
||||
if (!variations.some(_ref4 => {
|
||||
let {
|
||||
isDefault
|
||||
} = _ref4;
|
||||
return isDefault;
|
||||
})) {
|
||||
accumulator.push(item);
|
||||
}
|
||||
|
||||
if (variations.length) {
|
||||
const variationMapper = getItemFromVariation(state, item);
|
||||
blockVariations.push(...variations.map(variationMapper));
|
||||
accumulator.push(...variations.map(variationMapper));
|
||||
}
|
||||
} // Ensure core blocks are prioritized in the returned results,
|
||||
|
||||
return accumulator;
|
||||
}, []); // Ensure core blocks are prioritized in the returned results,
|
||||
// because third party blocks can be registered earlier than
|
||||
// the core blocks (usually by using the `init` action),
|
||||
// thus affecting the display order.
|
||||
// We don't sort reusable blocks as they are handled differently.
|
||||
|
||||
|
||||
const groupByType = (blocks, block) => {
|
||||
const {
|
||||
core,
|
||||
@ -20734,15 +20731,14 @@ const getInserterItems = Object(rememo["a" /* default */])(function (state) {
|
||||
return blocks;
|
||||
};
|
||||
|
||||
const items = visibleBlockTypeInserterItems.reduce(groupByType, {
|
||||
const {
|
||||
core: coreItems,
|
||||
noncore: nonCoreItems
|
||||
} = items.reduce(groupByType, {
|
||||
core: [],
|
||||
noncore: []
|
||||
});
|
||||
const variations = blockVariations.reduce(groupByType, {
|
||||
core: [],
|
||||
noncore: []
|
||||
});
|
||||
const sortedBlockTypes = [...items.core, ...variations.core, ...items.noncore, ...variations.noncore];
|
||||
const sortedBlockTypes = [...coreItems, ...nonCoreItems];
|
||||
return [...sortedBlockTypes, ...reusableBlockInserterItems];
|
||||
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]);
|
||||
/**
|
||||
@ -20777,10 +20773,10 @@ const getBlockTransformItems = Object(rememo["a" /* default */])(function (state
|
||||
buildScope: 'transform'
|
||||
});
|
||||
const blockTypeTransformItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
|
||||
const itemsByName = Object(external_lodash_["mapKeys"])(blockTypeTransformItems, _ref6 => {
|
||||
const itemsByName = Object(external_lodash_["mapKeys"])(blockTypeTransformItems, _ref5 => {
|
||||
let {
|
||||
name
|
||||
} = _ref6;
|
||||
} = _ref5;
|
||||
return name;
|
||||
});
|
||||
const possibleTransforms = Object(external_wp_blocks_["getPossibleBlockTransformations"])(blocks).reduce((accumulator, block) => {
|
||||
@ -20890,10 +20886,10 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
||||
|
||||
const __experimentalGetParsedPattern = Object(rememo["a" /* default */])((state, patternName) => {
|
||||
const patterns = state.settings.__experimentalBlockPatterns;
|
||||
const pattern = patterns.find(_ref7 => {
|
||||
const pattern = patterns.find(_ref6 => {
|
||||
let {
|
||||
name
|
||||
} = _ref7;
|
||||
} = _ref6;
|
||||
return name === patternName;
|
||||
});
|
||||
|
||||
@ -20910,21 +20906,21 @@ const getAllAllowedPatterns = Object(rememo["a" /* default */])(state => {
|
||||
const {
|
||||
allowedBlockTypes
|
||||
} = getSettings(state);
|
||||
const parsedPatterns = patterns.filter(_ref8 => {
|
||||
const parsedPatterns = patterns.filter(_ref7 => {
|
||||
let {
|
||||
inserter = true
|
||||
} = _ref8;
|
||||
} = _ref7;
|
||||
return !!inserter;
|
||||
}).map(_ref9 => {
|
||||
}).map(_ref8 => {
|
||||
let {
|
||||
name
|
||||
} = _ref9;
|
||||
} = _ref8;
|
||||
return __experimentalGetParsedPattern(state, name);
|
||||
});
|
||||
const allowedPatterns = parsedPatterns.filter(_ref10 => {
|
||||
const allowedPatterns = parsedPatterns.filter(_ref9 => {
|
||||
let {
|
||||
blocks
|
||||
} = _ref10;
|
||||
} = _ref9;
|
||||
return checkAllowListRecursive(blocks, allowedBlockTypes);
|
||||
});
|
||||
return allowedPatterns;
|
||||
@ -20941,14 +20937,14 @@ const getAllAllowedPatterns = Object(rememo["a" /* default */])(state => {
|
||||
const __experimentalGetAllowedPatterns = Object(rememo["a" /* default */])(function (state) {
|
||||
let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
const availableParsedPatterns = getAllAllowedPatterns(state);
|
||||
const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, _ref11 => {
|
||||
const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, _ref10 => {
|
||||
let {
|
||||
blocks
|
||||
} = _ref11;
|
||||
return blocks.every(_ref12 => {
|
||||
} = _ref10;
|
||||
return blocks.every(_ref11 => {
|
||||
let {
|
||||
name
|
||||
} = _ref12;
|
||||
} = _ref11;
|
||||
return canInsertBlockType(state, name, rootClientId);
|
||||
});
|
||||
});
|
||||
@ -21010,21 +21006,21 @@ const __experimentalGetPatternTransformItems = Object(rememo["a" /* default */])
|
||||
* to check for this case too.
|
||||
*/
|
||||
|
||||
if (blocks.some(_ref13 => {
|
||||
if (blocks.some(_ref12 => {
|
||||
let {
|
||||
clientId,
|
||||
innerBlocks
|
||||
} = _ref13;
|
||||
} = _ref12;
|
||||
return innerBlocks.length || areInnerBlocksControlled(state, clientId);
|
||||
})) {
|
||||
return EMPTY_ARRAY;
|
||||
} // Create a Set of the selected block names that is used in patterns filtering.
|
||||
|
||||
|
||||
const selectedBlockNames = Array.from(new Set(blocks.map(_ref14 => {
|
||||
const selectedBlockNames = Array.from(new Set(blocks.map(_ref13 => {
|
||||
let {
|
||||
name
|
||||
} = _ref14;
|
||||
} = _ref13;
|
||||
return name;
|
||||
})));
|
||||
/**
|
||||
@ -23075,7 +23071,6 @@ const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createEle
|
||||
|
||||
|
||||
|
||||
const EMPTY_ARRAY = [];
|
||||
function __experimentalGetGradientClass(gradientSlug) {
|
||||
if (!gradientSlug) {
|
||||
return undefined;
|
||||
@ -23121,7 +23116,10 @@ function __experimentalUseGradient() {
|
||||
const {
|
||||
clientId
|
||||
} = Object(_block_edit__WEBPACK_IMPORTED_MODULE_3__[/* useBlockEditContext */ "c"])();
|
||||
const gradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('color.gradients') || EMPTY_ARRAY;
|
||||
const {
|
||||
gradients: gradientsPerOrigin
|
||||
} = Object(_use_setting__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('color') || {};
|
||||
const allGradients = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
|
||||
const {
|
||||
gradient,
|
||||
customGradient
|
||||
@ -23139,7 +23137,7 @@ function __experimentalUseGradient() {
|
||||
updateBlockAttributes
|
||||
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useDispatch"])(_store__WEBPACK_IMPORTED_MODULE_5__[/* store */ "a"]);
|
||||
const setGradient = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(newGradientValue => {
|
||||
const slug = getGradientSlugByValue(gradients, newGradientValue);
|
||||
const slug = getGradientSlugByValue(allGradients, newGradientValue);
|
||||
|
||||
if (slug) {
|
||||
updateBlockAttributes(clientId, {
|
||||
@ -23153,14 +23151,14 @@ function __experimentalUseGradient() {
|
||||
[gradientAttribute]: undefined,
|
||||
[customGradientAttribute]: newGradientValue
|
||||
});
|
||||
}, [gradients, clientId, updateBlockAttributes]);
|
||||
}, [allGradients, clientId, updateBlockAttributes]);
|
||||
|
||||
const gradientClass = __experimentalGetGradientClass(gradient);
|
||||
|
||||
let gradientValue;
|
||||
|
||||
if (gradient) {
|
||||
gradientValue = getGradientValueBySlug(gradients, gradient);
|
||||
gradientValue = getGradientValueBySlug(allGradients, gradient);
|
||||
} else {
|
||||
gradientValue = customGradient;
|
||||
}
|
||||
@ -32029,7 +32027,8 @@ function ColorGradientControlInner(_ref) {
|
||||
colorValue,
|
||||
gradientValue,
|
||||
clearable,
|
||||
showTitle = true
|
||||
showTitle = true,
|
||||
enableAlpha
|
||||
} = _ref;
|
||||
const canChooseAColor = onColorChange && (!Object(lodash__WEBPACK_IMPORTED_MODULE_3__["isEmpty"])(colors) || !disableCustomColors);
|
||||
const canChooseAGradient = onGradientChange && (!Object(lodash__WEBPACK_IMPORTED_MODULE_3__["isEmpty"])(gradients) || !disableCustomGradients);
|
||||
@ -32066,7 +32065,8 @@ function ColorGradientControlInner(_ref) {
|
||||
colors,
|
||||
disableCustomColors,
|
||||
__experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
|
||||
clearable: clearable
|
||||
clearable: clearable,
|
||||
enableAlpha: enableAlpha
|
||||
}), (currentTab === 'gradient' || !canChooseAColor) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["GradientPicker"], {
|
||||
value: gradientValue,
|
||||
onChange: canChooseAColor ? newGradient => {
|
||||
@ -42022,7 +42022,6 @@ function ColorPanel(_ref) {
|
||||
|
||||
|
||||
const COLOR_SUPPORT_KEY = 'color';
|
||||
const color_EMPTY_ARRAY = [];
|
||||
|
||||
const hasColorSupport = blockType => {
|
||||
const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY);
|
||||
@ -42192,19 +42191,25 @@ function immutableSet(object, path, value) {
|
||||
|
||||
|
||||
function ColorEdit(props) {
|
||||
var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
|
||||
var _solidsPerOrigin$them, _gradientsPerOrigin$t, _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
|
||||
|
||||
const {
|
||||
name: blockName,
|
||||
attributes
|
||||
} = props;
|
||||
const solids = Object(use_setting["a" /* default */])('color.palette') || color_EMPTY_ARRAY;
|
||||
const gradients = Object(use_setting["a" /* default */])('color.gradients') || color_EMPTY_ARRAY;
|
||||
const areCustomSolidsEnabled = Object(use_setting["a" /* default */])('color.custom');
|
||||
const areCustomGradientsEnabled = Object(use_setting["a" /* default */])('color.customGradient');
|
||||
const isLinkEnabled = Object(use_setting["a" /* default */])('color.link');
|
||||
const isTextEnabled = Object(use_setting["a" /* default */])('color.text');
|
||||
const isBackgroundEnabled = Object(use_setting["a" /* default */])('color.background'); // Shouldn't be needed but right now the ColorGradientsPanel
|
||||
const {
|
||||
palette: solidsPerOrigin,
|
||||
gradients: gradientsPerOrigin,
|
||||
customGradient: areCustomGradientsEnabled,
|
||||
custom: areCustomSolidsEnabled,
|
||||
text: isTextEnabled,
|
||||
background: isBackgroundEnabled,
|
||||
link: isLinkEnabled
|
||||
} = Object(use_setting["a" /* default */])('color') || {};
|
||||
const solidsEnabled = areCustomSolidsEnabled || !(solidsPerOrigin !== null && solidsPerOrigin !== void 0 && solidsPerOrigin.theme) || (solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : (_solidsPerOrigin$them = solidsPerOrigin.theme) === null || _solidsPerOrigin$them === void 0 ? void 0 : _solidsPerOrigin$them.length) > 0;
|
||||
const gradientsEnabled = areCustomGradientsEnabled || !(gradientsPerOrigin !== null && gradientsPerOrigin !== void 0 && gradientsPerOrigin.theme) || (gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : (_gradientsPerOrigin$t = gradientsPerOrigin.theme) === null || _gradientsPerOrigin$t === void 0 ? void 0 : _gradientsPerOrigin$t.length) > 0;
|
||||
const allSolids = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
|
||||
const allGradients = Object(external_wp_element_["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]); // Shouldn't be needed but right now the ColorGradientsPanel
|
||||
// can trigger both onChangeColor and onChangeBackground
|
||||
// synchronously causing our two callbacks to override changes
|
||||
// from each other.
|
||||
@ -42218,10 +42223,10 @@ function ColorEdit(props) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
||||
const hasTextColor = hasTextColorSupport(blockName) && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
||||
const hasBackgroundColor = hasBackgroundColorSupport(blockName) && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
||||
const hasGradientColor = hasGradientSupport(blockName) && (gradients.length > 0 || areCustomGradientsEnabled);
|
||||
const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && solidsEnabled;
|
||||
const hasTextColor = hasTextColorSupport(blockName) && isTextEnabled && solidsEnabled;
|
||||
const hasBackgroundColor = hasBackgroundColorSupport(blockName) && isBackgroundEnabled && solidsEnabled;
|
||||
const hasGradientColor = hasGradientSupport(blockName) && gradientsEnabled;
|
||||
|
||||
if (!hasLinkColor && !hasTextColor && !hasBackgroundColor && !hasGradientColor) {
|
||||
return null;
|
||||
@ -42236,7 +42241,7 @@ function ColorEdit(props) {
|
||||
let gradientValue;
|
||||
|
||||
if (hasGradientColor && gradient) {
|
||||
gradientValue = Object(use_gradient["e" /* getGradientValueBySlug */])(gradients, gradient);
|
||||
gradientValue = Object(use_gradient["e" /* getGradientValueBySlug */])(allGradients, gradient);
|
||||
} else if (hasGradientColor) {
|
||||
var _style$color5;
|
||||
|
||||
@ -42246,7 +42251,7 @@ function ColorEdit(props) {
|
||||
const onChangeColor = name => value => {
|
||||
var _localAttributes$curr, _localAttributes$curr2;
|
||||
|
||||
const colorObject = Object(utils["c" /* getColorObjectByColorValue */])(solids, value);
|
||||
const colorObject = Object(utils["c" /* getColorObjectByColorValue */])(allSolids, value);
|
||||
const attributeName = name + 'Color';
|
||||
const newStyle = { ...localAttributes.current.style,
|
||||
color: { ...((_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color),
|
||||
@ -42265,7 +42270,7 @@ function ColorEdit(props) {
|
||||
};
|
||||
|
||||
const onChangeGradient = value => {
|
||||
const slug = Object(use_gradient["d" /* getGradientSlugByValue */])(gradients, value);
|
||||
const slug = Object(use_gradient["d" /* getGradientSlugByValue */])(allGradients, value);
|
||||
let newAttributes;
|
||||
|
||||
if (slug) {
|
||||
@ -42301,7 +42306,7 @@ function ColorEdit(props) {
|
||||
};
|
||||
|
||||
const onChangeLinkColor = value => {
|
||||
const colorObject = Object(utils["c" /* getColorObjectByColorValue */])(solids, value);
|
||||
const colorObject = Object(utils["c" /* getColorObjectByColorValue */])(allSolids, value);
|
||||
const newLinkColorValue = colorObject !== null && colorObject !== void 0 && colorObject.slug ? `var:preset|color|${colorObject.slug}` : value;
|
||||
const newStyle = Object(hooks_utils["a" /* cleanEmptyObject */])(immutableSet(style, ['elements', 'link', 'color', 'text'], newLinkColorValue));
|
||||
props.setAttributes({
|
||||
@ -42316,17 +42321,17 @@ function ColorEdit(props) {
|
||||
settings: [...(hasTextColor ? [{
|
||||
label: Object(external_wp_i18n_["__"])('Text color'),
|
||||
onColorChange: onChangeColor('text'),
|
||||
colorValue: Object(utils["b" /* getColorObjectByAttributeValues */])(solids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color
|
||||
colorValue: Object(utils["b" /* getColorObjectByAttributeValues */])(allSolids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color
|
||||
}] : []), ...(hasBackgroundColor || hasGradientColor ? [{
|
||||
label: Object(external_wp_i18n_["__"])('Background color'),
|
||||
onColorChange: hasBackgroundColor ? onChangeColor('background') : undefined,
|
||||
colorValue: Object(utils["b" /* getColorObjectByAttributeValues */])(solids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color,
|
||||
colorValue: Object(utils["b" /* getColorObjectByAttributeValues */])(allSolids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color,
|
||||
gradientValue,
|
||||
onGradientChange: hasGradientColor ? onChangeGradient : undefined
|
||||
}] : []), ...(hasLinkColor ? [{
|
||||
label: Object(external_wp_i18n_["__"])('Link Color'),
|
||||
onColorChange: onChangeLinkColor,
|
||||
colorValue: getLinkColorFromAttributeValue(solids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text),
|
||||
colorValue: getLinkColorFromAttributeValue(allSolids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text),
|
||||
clearable: !!(style !== null && style !== void 0 && (_style$elements3 = style.elements) !== null && _style$elements3 !== void 0 && (_style$elements3$link = _style$elements3.link) !== null && _style$elements3$link !== void 0 && (_style$elements3$link2 = _style$elements3$link.color) !== null && _style$elements3$link2 !== void 0 && _style$elements3$link2.text)
|
||||
}] : [])]
|
||||
});
|
||||
@ -42351,7 +42356,10 @@ const withColorPaletteStyles = Object(external_wp_compose_["createHigherOrderCom
|
||||
backgroundColor,
|
||||
textColor
|
||||
} = attributes;
|
||||
const colors = Object(use_setting["a" /* default */])('color.palette') || color_EMPTY_ARRAY;
|
||||
const {
|
||||
palette: solidsPerOrigin
|
||||
} = Object(use_setting["a" /* default */])('color') || {};
|
||||
const colors = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
|
||||
|
||||
if (!hasColorSupport(name) || color_shouldSkipSerialization(name)) {
|
||||
return Object(external_wp_element_["createElement"])(BlockListBlock, props);
|
||||
@ -43556,7 +43564,6 @@ function TypographyPanel(props) {
|
||||
panelId: clientId
|
||||
}, Object(external_wp_element_["createElement"])(LetterSpacingEdit, props)));
|
||||
}
|
||||
|
||||
const hasTypographySupport = blockName => {
|
||||
return TYPOGRAPHY_SUPPORT_KEYS.some(key => Object(external_wp_blocks_["hasBlockSupport"])(blockName, key));
|
||||
};
|
||||
@ -44996,6 +45003,11 @@ function useBorderProps(attributes) {
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
@ -45010,7 +45022,6 @@ function useBorderProps(attributes) {
|
||||
// block support is being skipped for a block but the color related CSS classes
|
||||
// & styles still need to be generated so they can be applied to inner elements.
|
||||
|
||||
const use_color_props_EMPTY_ARRAY = [];
|
||||
/**
|
||||
* Provides the CSS class names and inline styles for a block's color support
|
||||
* attributes.
|
||||
@ -45072,8 +45083,12 @@ function useColorProps(attributes) {
|
||||
textColor,
|
||||
gradient
|
||||
} = attributes;
|
||||
const colors = Object(use_setting["a" /* default */])('color.palette') || use_color_props_EMPTY_ARRAY;
|
||||
const gradients = Object(use_setting["a" /* default */])('color.gradients') || use_color_props_EMPTY_ARRAY;
|
||||
const {
|
||||
palette: solidsPerOrigin,
|
||||
gradients: gradientsPerOrigin
|
||||
} = Object(use_setting["a" /* default */])('color') || {};
|
||||
const colors = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
|
||||
const gradients = Object(external_wp_element_["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
|
||||
const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color
|
||||
// stylesheets in the editor.
|
||||
|
||||
@ -45401,7 +45416,7 @@ function useSetting(path) {
|
||||
if (_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["__EXPERIMENTAL_PATHS_WITH_MERGE"][normalizedPath]) {
|
||||
var _ref, _experimentalFeatures;
|
||||
|
||||
return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.default;
|
||||
return (_ref = (_experimentalFeatures = experimentalFeaturesResult.custom) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.default;
|
||||
}
|
||||
|
||||
return experimentalFeaturesResult;
|
||||
@ -49487,6 +49502,7 @@ const PanelColorGradientSettingsInner = _ref3 => {
|
||||
title,
|
||||
showTitle = true,
|
||||
__experimentalHasMultipleOrigins,
|
||||
enableAlpha,
|
||||
...props
|
||||
} = _ref3;
|
||||
|
||||
@ -49511,7 +49527,8 @@ const PanelColorGradientSettingsInner = _ref3 => {
|
||||
gradients,
|
||||
disableCustomColors,
|
||||
disableCustomGradients,
|
||||
__experimentalHasMultipleOrigins
|
||||
__experimentalHasMultipleOrigins,
|
||||
enableAlpha
|
||||
}, setting))), children);
|
||||
};
|
||||
|
||||
@ -49531,7 +49548,7 @@ const PanelColorGradientSettingsSingleSelect = props => {
|
||||
|
||||
const PanelColorGradientSettingsMultipleSelect = props => {
|
||||
const colorGradientSettings = useCommonSingleMultipleSelects();
|
||||
const customColors = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.palette.user');
|
||||
const customColors = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.palette.custom');
|
||||
const themeColors = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.palette.theme');
|
||||
const defaultColors = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.palette.default');
|
||||
const shouldDisplayDefaultColors = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.defaultPalette');
|
||||
@ -49561,7 +49578,7 @@ const PanelColorGradientSettingsMultipleSelect = props => {
|
||||
|
||||
return result;
|
||||
}, [defaultColors, themeColors, customColors]);
|
||||
const customGradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.gradients.user');
|
||||
const customGradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.gradients.custom');
|
||||
const themeGradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.gradients.theme');
|
||||
const defaultGradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.gradients.default');
|
||||
const shouldDisplayDefaultGradients = Object(_use_setting__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('color.defaultGradients');
|
||||
|
4
wp-includes/js/dist/block-editor.min.js
vendored
4
wp-includes/js/dist/block-editor.min.js
vendored
File diff suppressed because one or more lines are too long
699
wp-includes/js/dist/block-library.js
vendored
699
wp-includes/js/dist/block-library.js
vendored
File diff suppressed because it is too large
Load Diff
2
wp-includes/js/dist/block-library.min.js
vendored
2
wp-includes/js/dist/block-library.min.js
vendored
File diff suppressed because one or more lines are too long
3231
wp-includes/js/dist/components.js
vendored
3231
wp-includes/js/dist/components.js
vendored
File diff suppressed because it is too large
Load Diff
10
wp-includes/js/dist/components.min.js
vendored
10
wp-includes/js/dist/components.min.js
vendored
File diff suppressed because one or more lines are too long
9
wp-includes/js/dist/core-data.js
vendored
9
wp-includes/js/dist/core-data.js
vendored
@ -2021,6 +2021,15 @@ const defaultEntities = [{
|
||||
context: 'edit'
|
||||
},
|
||||
key: 'stylesheet'
|
||||
}, {
|
||||
label: Object(external_wp_i18n_["__"])('Plugins'),
|
||||
name: 'plugin',
|
||||
kind: 'root',
|
||||
baseURL: '/wp/v2/plugins',
|
||||
baseURLParams: {
|
||||
context: 'edit'
|
||||
},
|
||||
key: 'plugin'
|
||||
}];
|
||||
const kinds = [{
|
||||
name: 'postType',
|
||||
|
2
wp-includes/js/dist/core-data.min.js
vendored
2
wp-includes/js/dist/core-data.min.js
vendored
File diff suppressed because one or more lines are too long
1177
wp-includes/js/dist/edit-site.js
vendored
1177
wp-includes/js/dist/edit-site.js
vendored
File diff suppressed because it is too large
Load Diff
4
wp-includes/js/dist/edit-site.min.js
vendored
4
wp-includes/js/dist/edit-site.min.js
vendored
File diff suppressed because one or more lines are too long
46
wp-includes/js/dist/plugins.js
vendored
46
wp-includes/js/dist/plugins.js
vendored
@ -87,6 +87,31 @@ this["wp"] = this["wp"] || {}; this["wp"]["plugins"] =
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "0Ene":
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
|
||||
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const plugins = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
||||
d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
|
||||
}));
|
||||
/* harmony default export */ __webpack_exports__["a"] = (plugins);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "4eJC":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
@ -349,23 +374,8 @@ const withPluginContext = mapContextToProps => Object(external_wp_compose_["crea
|
||||
return props => Object(external_wp_element_["createElement"])(Consumer, null, context => Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, mapContextToProps(context, props))));
|
||||
}, 'withPluginContext');
|
||||
|
||||
// EXTERNAL MODULE: external ["wp","primitives"]
|
||||
var external_wp_primitives_ = __webpack_require__("Tqx9");
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const plugins = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
|
||||
d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
|
||||
}));
|
||||
/* harmony default export */ var library_plugins = (plugins);
|
||||
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
|
||||
var plugins = __webpack_require__("0Ene");
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/api/index.js
|
||||
/* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
|
||||
@ -527,7 +537,7 @@ function registerPlugin(name, settings) {
|
||||
|
||||
api_plugins[name] = {
|
||||
name,
|
||||
icon: library_plugins,
|
||||
icon: plugins["a" /* default */],
|
||||
...settings
|
||||
};
|
||||
Object(external_wp_hooks_["doAction"])('plugins.pluginRegistered', settings, name);
|
||||
|
2
wp-includes/js/dist/plugins.min.js
vendored
2
wp-includes/js/dist/plugins.min.js
vendored
File diff suppressed because one or more lines are too long
@ -384,6 +384,7 @@ function create_initial_post_types() {
|
||||
'excerpt',
|
||||
'editor',
|
||||
'revisions',
|
||||
'author',
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -442,6 +443,7 @@ function create_initial_post_types() {
|
||||
'excerpt',
|
||||
'editor',
|
||||
'revisions',
|
||||
'author',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
@ -232,12 +232,16 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
|
||||
* @return WP_REST_Response $data
|
||||
*/
|
||||
public function prepare_item_for_response( $post, $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
$config = json_decode( $post->post_content, true );
|
||||
$is_global_styles_user_theme_json = isset( $config['isGlobalStylesUserThemeJSON'] ) && true === $config['isGlobalStylesUserThemeJSON'];
|
||||
$fields = $this->get_fields_for_response( $request );
|
||||
$raw_config = json_decode( $post->post_content, true );
|
||||
$is_global_styles_user_theme_json = isset( $raw_config['isGlobalStylesUserThemeJSON'] ) && true === $raw_config['isGlobalStylesUserThemeJSON'];
|
||||
$config = array();
|
||||
if ( $is_global_styles_user_theme_json ) {
|
||||
$config = ( new WP_Theme_JSON( $raw_config, 'custom' ) )->get_raw_data();
|
||||
}
|
||||
|
||||
// Base fields for every post.
|
||||
$data = array();
|
||||
$data = array();
|
||||
$fields = $this->get_fields_for_response( $request );
|
||||
|
||||
if ( rest_is_field_included( 'id', $fields ) ) {
|
||||
$data['id'] = $post->ID;
|
||||
|
@ -72,8 +72,9 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'The id of a template' ),
|
||||
'type' => 'string',
|
||||
'description' => __( 'The id of a template' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => array( $this, '_sanitize_template_id' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
@ -131,6 +132,39 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requesting this endpoint for a template like 'twentytwentytwo//home'
|
||||
* requires using a path like /wp/v2/templates/twentytwentytwo//home. There
|
||||
* are special cases when WordPress routing corrects the name to contain
|
||||
* only a single slash like 'twentytwentytwo/home'.
|
||||
*
|
||||
* This method doubles the last slash if it's not already doubled. It relies
|
||||
* on the template ID format {theme_name}//{template_slug} and the fact that
|
||||
* slugs cannot contain slashes.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @see https://core.trac.wordpress.org/ticket/54507
|
||||
*
|
||||
* @param string $id Template ID.
|
||||
* @return string Sanitized template ID.
|
||||
*/
|
||||
public function _sanitize_template_id( $id ) {
|
||||
$last_slash_pos = strrpos( $id, '/' );
|
||||
if ( false === $last_slash_pos ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
$is_double_slashed = substr( $id, $last_slash_pos - 1, 1 ) === '/';
|
||||
if ( $is_double_slashed ) {
|
||||
return $id;
|
||||
}
|
||||
return (
|
||||
substr( $id, 0, $last_slash_pos )
|
||||
. '/'
|
||||
. substr( $id, $last_slash_pos )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given request has access to read templates.
|
||||
*
|
||||
@ -244,6 +278,10 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
|
||||
$changes = $this->prepare_item_for_database( $request );
|
||||
|
||||
if ( is_wp_error( $changes ) ) {
|
||||
return $changes;
|
||||
}
|
||||
|
||||
if ( 'custom' === $template->source ) {
|
||||
$result = wp_update_post( wp_slash( (array) $changes ), true );
|
||||
} else {
|
||||
@ -298,6 +336,11 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
$prepared_post = $this->prepare_item_for_database( $request );
|
||||
|
||||
if ( is_wp_error( $prepared_post ) ) {
|
||||
return $prepared_post;
|
||||
}
|
||||
|
||||
$prepared_post->post_name = $request['slug'];
|
||||
$post_id = wp_insert_post( wp_slash( (array) $prepared_post ), true );
|
||||
if ( is_wp_error( $post_id ) ) {
|
||||
@ -430,6 +473,9 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
$changes->tax_input = array(
|
||||
'wp_theme' => $template->theme,
|
||||
);
|
||||
$changes->meta_input = array(
|
||||
'origin' => $template->source,
|
||||
);
|
||||
} else {
|
||||
$changes->post_name = $template->slug;
|
||||
$changes->ID = $template->wp_id;
|
||||
@ -469,6 +515,24 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $request['author'] ) ) {
|
||||
$post_author = (int) $request['author'];
|
||||
|
||||
if ( get_current_user_id() !== $post_author ) {
|
||||
$user_obj = get_userdata( $post_author );
|
||||
|
||||
if ( ! $user_obj ) {
|
||||
return new WP_Error(
|
||||
'rest_invalid_author',
|
||||
__( 'Invalid author ID.' ),
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$changes->post_author = $post_author;
|
||||
}
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
@ -518,6 +582,10 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
$data['source'] = $template->source;
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'origin', $fields ) ) {
|
||||
$data['origin'] = $template->origin;
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'type', $fields ) ) {
|
||||
$data['type'] = $template->type;
|
||||
}
|
||||
@ -555,6 +623,14 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
$data['has_theme_file'] = (bool) $template->has_theme_file;
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'is_custom', $fields ) && 'wp_template' === $template->type ) {
|
||||
$data['is_custom'] = $template->is_custom;
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'author', $fields ) ) {
|
||||
$data['author'] = (int) $template->author;
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'area', $fields ) && 'wp_template_part' === $template->type ) {
|
||||
$data['area'] = $template->area;
|
||||
}
|
||||
@ -703,6 +779,12 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'origin' => array(
|
||||
'description' => __( 'Source of a customized template' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'content' => array(
|
||||
'description' => __( 'Content of template.' ),
|
||||
'type' => array( 'object', 'string' ),
|
||||
@ -766,9 +848,23 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'author' => array(
|
||||
'description' => __( 'The ID for the author of the template.' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if ( 'wp_template' === $this->post_type ) {
|
||||
$schema['properties']['is_custom'] = array(
|
||||
'description' => __( 'Whether a template is a custom template.' ),
|
||||
'type' => 'bool',
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'wp_template_part' === $this->post_type ) {
|
||||
$schema['properties']['area'] = array(
|
||||
'description' => __( 'Where the template part is intended for use (header, footer, etc.)' ),
|
||||
|
@ -320,22 +320,8 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||
// This creates a record for the current theme if not existent.
|
||||
$id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
|
||||
} else {
|
||||
$wp_query_args = array(
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'wp_global_styles',
|
||||
'posts_per_page' => 1,
|
||||
'no_found_rows' => true,
|
||||
'fields' => 'ids',
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wp_theme',
|
||||
'field' => 'name',
|
||||
'terms' => $theme->get_stylesheet(),
|
||||
),
|
||||
),
|
||||
);
|
||||
$global_styles_query = new WP_Query( $wp_query_args );
|
||||
$id = ! empty( $global_styles_query->posts ) ? array_shift( $global_styles_query->posts ) : null;
|
||||
$user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type( $theme );
|
||||
$id = isset( $user_cpt['ID'] ) ? $user_cpt['ID'] : null;
|
||||
}
|
||||
|
||||
if ( $id ) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"version": 2,
|
||||
"settings": {
|
||||
"appearanceTools": false,
|
||||
"border": {
|
||||
"color": false,
|
||||
"radius": false,
|
||||
@ -8,12 +9,12 @@
|
||||
"width": false
|
||||
},
|
||||
"color": {
|
||||
"background": true,
|
||||
"custom": true,
|
||||
"customDuotone": true,
|
||||
"customGradient": true,
|
||||
"link": false,
|
||||
"background": true,
|
||||
"text": true,
|
||||
"defaultGradients": true,
|
||||
"defaultPalette": true,
|
||||
"duotone": [
|
||||
{
|
||||
"name": "Dark grayscale" ,
|
||||
@ -118,6 +119,7 @@
|
||||
"slug": "midnight"
|
||||
}
|
||||
],
|
||||
"link": false,
|
||||
"palette": [
|
||||
{
|
||||
"name": "Black",
|
||||
@ -179,7 +181,8 @@
|
||||
"slug": "vivid-purple",
|
||||
"color": "#9b51e0"
|
||||
}
|
||||
]
|
||||
],
|
||||
"text": true
|
||||
},
|
||||
"spacing": {
|
||||
"blockGap": null,
|
||||
@ -190,12 +193,6 @@
|
||||
"typography": {
|
||||
"customFontSize": true,
|
||||
"dropCap": true,
|
||||
"fontStyle": true,
|
||||
"fontWeight": true,
|
||||
"letterSpacing": true,
|
||||
"lineHeight": false,
|
||||
"textDecoration": true,
|
||||
"textTransform": true,
|
||||
"fontSizes": [
|
||||
{
|
||||
"name": "Small",
|
||||
@ -222,7 +219,13 @@
|
||||
"slug": "huge",
|
||||
"size": "42px"
|
||||
}
|
||||
]
|
||||
],
|
||||
"fontStyle": true,
|
||||
"fontWeight": true,
|
||||
"letterSpacing": true,
|
||||
"lineHeight": false,
|
||||
"textDecoration": true,
|
||||
"textTransform": true
|
||||
},
|
||||
"blocks": {
|
||||
"core/button": {
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-52274';
|
||||
$wp_version = '5.9-alpha-52275';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user