auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+131 -58
View File
@@ -229,14 +229,12 @@ function _get_block_templates_paths( $base_directory ) {
return $template_path_list[ $base_directory ];
}
$path_list = array();
try {
if ( is_dir( $base_directory ) ) {
$nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) );
$nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH );
foreach ( $nested_html_files as $path => $file ) {
$path_list[] = $path;
}
} catch ( Exception $e ) {
// Do nothing.
}
$template_path_list[ $base_directory ] = $path_list;
return $path_list;
@@ -724,6 +722,64 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
return true;
}
/**
* Builds a block template object from a post object.
*
* This is a helper function that creates a block template object from a given post object.
* It is self-sufficient in that it only uses information passed as arguments; it does not
* query the database for additional information.
*
* @since 6.5.3
* @access private
*
* @param WP_Post $post Template post.
* @param array $terms Additional terms to inform the template object.
* @param array $meta Additional meta fields to inform the template object.
* @return WP_Block_Template|WP_Error Template or error object.
*/
function _build_block_template_object_from_post_object( $post, $terms = array(), $meta = array() ) {
if ( empty( $terms['wp_theme'] ) ) {
return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
}
$theme = $terms['wp_theme'];
$default_template_types = get_default_block_template_types();
$template_file = _get_block_template_file( $post->post_type, $post->post_name );
$has_theme_file = get_stylesheet() === $theme && null !== $template_file;
$template = new WP_Block_Template();
$template->wp_id = $post->ID;
$template->id = $theme . '//' . $post->post_name;
$template->theme = $theme;
$template->content = $post->post_content;
$template->slug = $post->post_name;
$template->source = 'custom';
$template->origin = ! empty( $meta['origin'] ) ? $meta['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 = empty( $meta['is_wp_suggestion'] );
$template->author = $post->post_author;
$template->modified = $post->post_modified;
if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
$template->post_types = $template_file['postTypes'];
}
if ( 'wp_template' === $post->post_type && isset( $default_template_types[ $template->slug ] ) ) {
$template->is_custom = false;
}
if ( 'wp_template_part' === $post->post_type && isset( $terms['wp_template_part_area'] ) ) {
$template->area = $terms['wp_template_part_area'];
}
return $template;
}
/**
* Builds a unified template object based a post Object.
*
@@ -736,13 +792,13 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
* @return WP_Block_Template|WP_Error Template or error object.
*/
function _build_block_template_result_from_post( $post ) {
$default_template_types = get_default_block_template_types();
$post_id = wp_is_post_revision( $post );
if ( ! $post_id ) {
$post_id = $post;
}
$parent_post = get_post( $post_id );
$parent_post = get_post( $post_id );
$post->post_name = $parent_post->post_name;
$post->post_type = $parent_post->post_type;
$terms = get_the_terms( $parent_post, 'wp_theme' );
@@ -754,45 +810,28 @@ function _build_block_template_result_from_post( $post ) {
return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
}
$theme = $terms[0]->name;
$template_file = _get_block_template_file( $post->post_type, $post->post_name );
$has_theme_file = get_stylesheet() === $theme && null !== $template_file;
$origin = get_post_meta( $parent_post->ID, 'origin', true );
$is_wp_suggestion = get_post_meta( $parent_post->ID, 'is_wp_suggestion', true );
$template = new WP_Block_Template();
$template->wp_id = $post->ID;
$template->id = $theme . '//' . $parent_post->post_name;
$template->theme = $theme;
$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 = empty( $is_wp_suggestion );
$template->author = $post->post_author;
$template->modified = $post->post_modified;
if ( 'wp_template' === $parent_post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
$template->post_types = $template_file['postTypes'];
}
if ( 'wp_template' === $parent_post->post_type && isset( $default_template_types[ $template->slug ] ) ) {
$template->is_custom = false;
}
$terms = array(
'wp_theme' => $terms[0]->name,
);
if ( 'wp_template_part' === $parent_post->post_type ) {
$type_terms = get_the_terms( $parent_post, 'wp_template_part_area' );
if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) {
$template->area = $type_terms[0]->name;
$terms['wp_template_part_area'] = $type_terms[0]->name;
}
}
$meta = array(
'origin' => get_post_meta( $parent_post->ID, 'origin', true ),
'is_wp_suggestion' => get_post_meta( $parent_post->ID, 'is_wp_suggestion', true ),
);
$template = _build_block_template_object_from_post_object( $post, $terms, $meta );
if ( is_wp_error( $template ) ) {
return $template;
}
// Check for a block template without a description and title or with a title equal to the slug.
if ( 'wp_template' === $parent_post->post_type && empty( $template->description ) && ( empty( $template->title ) || $template->title === $template->slug ) ) {
$matches = array();
@@ -1444,36 +1483,70 @@ function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '
* @since 6.5.0
* @access private
*
* @param stdClass $post An object representing a template or template part
* prepared for inserting or updating the database.
* @param WP_REST_Request $request Request object.
* @return stdClass The updated object representing a template or template part.
* @param stdClass $changes An object representing a template or template part
* prepared for inserting or updating the database.
* @param WP_REST_Request $deprecated Deprecated. Not used.
* @return stdClass|WP_Error The updated object representing a template or template part.
*/
function inject_ignored_hooked_blocks_metadata_attributes( $post, $request ) {
$filter_name = current_filter();
if ( ! str_starts_with( $filter_name, 'rest_pre_insert_' ) ) {
return $post;
function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated = null ) {
if ( null !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '6.5.3' );
}
$post_type = str_replace( 'rest_pre_insert_', '', $filter_name );
$hooked_blocks = get_hooked_blocks();
if ( empty( $hooked_blocks ) && ! has_filter( 'hooked_block_types' ) ) {
return $post;
return $changes;
}
// At this point, the post has already been created.
// We need to build the corresponding `WP_Block_Template` object as context argument for the visitor.
// To that end, we need to suppress hooked blocks from getting inserted into the template.
add_filter( 'hooked_block_types', '__return_empty_array', 99999, 0 );
$template = $request['id'] ? get_block_template( $request['id'], $post_type ) : null;
remove_filter( 'hooked_block_types', '__return_empty_array', 99999 );
$meta = isset( $changes->meta_input ) ? $changes->meta_input : array();
$terms = isset( $changes->tax_input ) ? $changes->tax_input : array();
if ( empty( $changes->ID ) ) {
// There's no post object for this template in the database for this template yet.
$post = $changes;
} else {
// Find the existing post object.
$post = get_post( $changes->ID );
// If the post is a revision, use the parent post's post_name and post_type.
$post_id = wp_is_post_revision( $post );
if ( $post_id ) {
$parent_post = get_post( $post_id );
$post->post_name = $parent_post->post_name;
$post->post_type = $parent_post->post_type;
}
// Apply the changes to the existing post object.
$post = (object) array_merge( (array) $post, (array) $changes );
$type_terms = get_the_terms( $changes->ID, 'wp_theme' );
$terms['wp_theme'] = ! is_wp_error( $type_terms ) && ! empty( $type_terms ) ? $type_terms[0]->name : null;
}
// Required for the WP_Block_Template. Update the post object with the current time.
$post->post_modified = current_time( 'mysql' );
// If the post_author is empty, set it to the current user.
if ( empty( $post->post_author ) ) {
$post->post_author = get_current_user_id();
}
if ( 'wp_template_part' === $post->post_type && ! isset( $terms['wp_template_part_area'] ) ) {
$area_terms = get_the_terms( $changes->ID, 'wp_template_part_area' );
$terms['wp_template_part_area'] = ! is_wp_error( $area_terms ) && ! empty( $area_terms ) ? $area_terms[0]->name : null;
}
$template = _build_block_template_object_from_post_object( new WP_Post( $post ), $terms, $meta );
if ( is_wp_error( $template ) ) {
return $template;
}
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'set_ignored_hooked_blocks_metadata' );
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'set_ignored_hooked_blocks_metadata' );
$blocks = parse_blocks( $post->post_content );
$content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
$blocks = parse_blocks( $changes->post_content );
$changes->post_content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
$post->post_content = $content;
return $post;
return $changes;
}
+2 -2
View File
@@ -49,7 +49,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
$label = '';
if ( '_blank' === $attributes['linkTarget'] ) {
// translators: %s is the Author name.
$label = 'aria-label="' . sprintf( esc_attr__( '(%s author archive, opens in a new tab)' ), $author_name ) . '"';
$label = 'aria-label="' . esc_attr( sprintf( __( '(%s author archive, opens in a new tab)' ), $author_name ) ) . '"';
}
// translators: %1$s: Author archive link. %2$s: Link target. %3$s Aria label. %4$s Avatar image.
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( get_author_posts_url( $author_id ) ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
@@ -76,7 +76,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
$label = '';
if ( '_blank' === $attributes['linkTarget'] ) {
// translators: %s is the Comment Author name.
$label = 'aria-label="' . sprintf( esc_attr__( '(%s website link, opens in a new tab)' ), $comment->comment_author ) . '"';
$label = 'aria-label="' . esc_attr( sprintf( __( '(%s website link, opens in a new tab)' ), $comment->comment_author ) ) . '"';
}
// translators: %1$s: Comment Author website link. %2$s: Link target. %3$s Aria label. %4$s Avatar image.
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( $comment->comment_author_url ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
+3 -2
View File
@@ -151,7 +151,8 @@ const {
},
handleMenuFocusout(event) {
const {
modal
modal,
type
} = (0,interactivity_namespaceObject.getContext)();
// If focus is outside modal, and in the document, close menu
// event.target === The element losing focus
@@ -160,7 +161,7 @@ const {
// `window.document.activeElement` doesn't change.
// The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.
if (event.relatedTarget === null || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
if (event.relatedTarget === null || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement && type === 'submenu') {
actions.closeMenu('click');
actions.closeMenu('focus');
}
+1 -1
View File
@@ -1 +1 @@
import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store}),o=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];document.addEventListener("click",(()=>{}));const{state:l,actions:c}=(0,n.store)("core/navigation",{state:{get roleAttribute(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"dialog":null},get ariaModal(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"true":null},get ariaLabel(){const e=(0,n.getContext)();return"overlay"===e.type&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){const e=(0,n.getContext)();return"overlay"===e.type?e.overlayOpenedBy:e.submenuOpenedBy}},actions:{openMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.openMenu("hover")},closeMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.closeMenu("hover")},openMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();e.previousFocus=t,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();window.document.activeElement!==t&&t.focus();const{menuOpenedBy:o}=l;o.click||o.focus?(c.closeMenu("click"),c.closeMenu("focus")):(e.previousFocus=t,c.openMenu("click"))},handleMenuKeydown(e){const{type:t,firstFocusableElement:o,lastFocusableElement:u}=(0,n.getContext)();if(l.menuOpenedBy.click){if("Escape"===e?.key)return c.closeMenu("click"),void c.closeMenu("focus");"overlay"===t&&"Tab"===e.key&&(e.shiftKey&&window.document.activeElement===o?(e.preventDefault(),u.focus()):e.shiftKey||window.document.activeElement!==u||(e.preventDefault(),o.focus()))}},handleMenuFocusout(e){const{modal:t}=(0,n.getContext)();(null===e.relatedTarget||!t?.contains(e.relatedTarget)&&e.target!==window.document.activeElement)&&(c.closeMenu("click"),c.closeMenu("focus"))},openMenu(e="click"){const{type:t}=(0,n.getContext)();l.menuOpenedBy[e]=!0,"overlay"===t&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){const t=(0,n.getContext)();l.menuOpenedBy[e]=!1,l.isMenuOpen||(t.modal?.contains(window.document.activeElement)&&t.previousFocus?.focus(),t.modal=null,t.previousFocus=null,"overlay"===t.type&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();if(l.isMenuOpen){const n=t.querySelectorAll(o);e.modal=t,e.firstFocusableElement=n[0],e.lastFocusableElement=n[n.length-1]}},focusFirstElement(){const{ref:e}=(0,n.getElement)();if(l.isMenuOpen){const t=e.querySelectorAll(o);t?.[0]?.focus()}}}},{lock:!0});
import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store}),o=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];document.addEventListener("click",(()=>{}));const{state:l,actions:c}=(0,n.store)("core/navigation",{state:{get roleAttribute(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"dialog":null},get ariaModal(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"true":null},get ariaLabel(){const e=(0,n.getContext)();return"overlay"===e.type&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){const e=(0,n.getContext)();return"overlay"===e.type?e.overlayOpenedBy:e.submenuOpenedBy}},actions:{openMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.openMenu("hover")},closeMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.closeMenu("hover")},openMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();e.previousFocus=t,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();window.document.activeElement!==t&&t.focus();const{menuOpenedBy:o}=l;o.click||o.focus?(c.closeMenu("click"),c.closeMenu("focus")):(e.previousFocus=t,c.openMenu("click"))},handleMenuKeydown(e){const{type:t,firstFocusableElement:o,lastFocusableElement:u}=(0,n.getContext)();if(l.menuOpenedBy.click){if("Escape"===e?.key)return c.closeMenu("click"),void c.closeMenu("focus");"overlay"===t&&"Tab"===e.key&&(e.shiftKey&&window.document.activeElement===o?(e.preventDefault(),u.focus()):e.shiftKey||window.document.activeElement!==u||(e.preventDefault(),o.focus()))}},handleMenuFocusout(e){const{modal:t,type:o}=(0,n.getContext)();(null===e.relatedTarget||!t?.contains(e.relatedTarget)&&e.target!==window.document.activeElement&&"submenu"===o)&&(c.closeMenu("click"),c.closeMenu("focus"))},openMenu(e="click"){const{type:t}=(0,n.getContext)();l.menuOpenedBy[e]=!0,"overlay"===t&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){const t=(0,n.getContext)();l.menuOpenedBy[e]=!1,l.isMenuOpen||(t.modal?.contains(window.document.activeElement)&&t.previousFocus?.focus(),t.modal=null,t.previousFocus=null,"overlay"===t.type&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();if(l.isMenuOpen){const n=t.querySelectorAll(o);e.modal=t,e.firstFocusableElement=n[0],e.lastFocusableElement=n[n.length-1]}},focusFirstElement(){const{ref:e}=(0,n.getElement)();if(l.isMenuOpen){const t=e.querySelectorAll(o);t?.[0]?.focus()}}}},{lock:!0});
+1 -1
View File
@@ -175,7 +175,7 @@ class Features {
if ( $tile->parent_item_id != $target_item_id ) {
continue;
}
$status = get_item_features( $tile->tile_item_id, $tile_depth + 1 );
$status = $this->get_item_features( $tile->tile_item_id, $tile_depth + 1 );
if ( $status != NOT_FOUND ) {
return $status;
}
+20 -2
View File
@@ -1227,7 +1227,7 @@ class WP_Theme_JSON {
);
foreach ( $base_styles_nodes as $base_style_node ) {
$stylesheet .= $this->get_layout_styles( $base_style_node );
$stylesheet .= $this->get_layout_styles( $base_style_node, $types );
}
}
@@ -1388,11 +1388,14 @@ class WP_Theme_JSON {
*
* @since 6.1.0
* @since 6.3.0 Reduced specificity for layout margin rules.
* @since 6.5.1 Only output rules referencing content and wide sizes when values exist.
* @since 6.5.3 Add types parameter to check if only base layout styles are needed.
*
* @param array $block_metadata Metadata about the block to get styles for.
* @param array $types Optional. Types of styles to output. If empty, all styles will be output.
* @return string Layout styles for the block.
*/
protected function get_layout_styles( $block_metadata ) {
protected function get_layout_styles( $block_metadata, $types = array() ) {
$block_rules = '';
$block_type = null;
@@ -1542,12 +1545,27 @@ class WP_Theme_JSON {
foreach ( $base_style_rules as $base_style_rule ) {
$declarations = array();
// Skip outputting base styles for flow and constrained layout types if theme doesn't support theme.json. The 'base-layout-styles' type flags this.
if ( in_array( 'base-layout-styles', $types, true ) && ( 'default' === $layout_definition['name'] || 'constrained' === $layout_definition['name'] ) ) {
continue;
}
if (
isset( $base_style_rule['selector'] ) &&
preg_match( $layout_selector_pattern, $base_style_rule['selector'] ) &&
! empty( $base_style_rule['rules'] )
) {
foreach ( $base_style_rule['rules'] as $css_property => $css_value ) {
// Skip rules that reference content size or wide size if they are not defined in the theme.json.
if (
is_string( $css_value ) &&
( str_contains( $css_value, '--global--content-size' ) || str_contains( $css_value, '--global--wide-size' ) ) &&
! isset( $this->theme_json['settings']['layout']['contentSize'] ) &&
! isset( $this->theme_json['settings']['layout']['wideSize'] )
) {
continue;
}
if ( static::is_safe_css_declaration( $css_property, $css_value ) ) {
$declarations[] = array(
'name' => $css_property,
+2 -4
View File
@@ -586,9 +586,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
border-bottom:none;
}
.is-distraction-free .edit-post-header{
-webkit-backdrop-filter:blur(20px) !important;
backdrop-filter:blur(20px) !important;
background-color:#ffffffe6;
background-color:#fff;
border-bottom:1px solid #e0e0e0;
position:absolute;
width:100%;
@@ -596,7 +594,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
.is-distraction-free .edit-post-header>.edit-post-header__settings>.edit-post-header__post-preview-button{
visibility:hidden;
}
.is-distraction-free .edit-post-header>.edit-post-header__settings>.editor-preview-dropdown,.is-distraction-free .edit-post-header>.edit-post-header__settings>.interface-pinned-items,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__document-overview-toggle,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__inserter-toggle{
.is-distraction-free .edit-post-header>.edit-post-header__settings>.editor-preview-dropdown,.is-distraction-free .edit-post-header>.edit-post-header__settings>.interface-pinned-items,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__document-overview-toggle{
display:none;
}
.is-distraction-free .interface-interface-skeleton__header:focus-within{
File diff suppressed because one or more lines are too long
+2 -4
View File
@@ -586,9 +586,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
border-bottom:none;
}
.is-distraction-free .edit-post-header{
-webkit-backdrop-filter:blur(20px) !important;
backdrop-filter:blur(20px) !important;
background-color:#ffffffe6;
background-color:#fff;
border-bottom:1px solid #e0e0e0;
position:absolute;
width:100%;
@@ -596,7 +594,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
.is-distraction-free .edit-post-header>.edit-post-header__settings>.edit-post-header__post-preview-button{
visibility:hidden;
}
.is-distraction-free .edit-post-header>.edit-post-header__settings>.editor-preview-dropdown,.is-distraction-free .edit-post-header>.edit-post-header__settings>.interface-pinned-items,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__document-overview-toggle,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__inserter-toggle{
.is-distraction-free .edit-post-header>.edit-post-header__settings>.editor-preview-dropdown,.is-distraction-free .edit-post-header>.edit-post-header__settings>.interface-pinned-items,.is-distraction-free .edit-post-header>.edit-post-header__toolbar .editor-document-tools__document-overview-toggle{
display:none;
}
.is-distraction-free .interface-interface-skeleton__header:focus-within{
File diff suppressed because one or more lines are too long
+2
View File
@@ -4053,6 +4053,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
border-bottom:none;
}
.font-library-modal .components-modal__content{
margin-bottom:70px;
padding-top:0;
}
.font-library-modal .font-library-modal__subtitle{
@@ -4071,6 +4072,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
background-color:#fff;
border-top:1px solid #ddd;
bottom:32px;
height:70px;
margin:0 -32px -32px;
padding:16px 32px;
position:absolute;
File diff suppressed because one or more lines are too long
+2
View File
@@ -4053,6 +4053,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
border-bottom:none;
}
.font-library-modal .components-modal__content{
margin-bottom:70px;
padding-top:0;
}
.font-library-modal .font-library-modal__subtitle{
@@ -4071,6 +4072,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
background-color:#fff;
border-top:1px solid #ddd;
bottom:32px;
height:70px;
margin:0 -32px -32px;
padding:16px 32px;
position:absolute;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -753,7 +753,7 @@ add_action( 'before_delete_post', '_wp_before_delete_font_face', 10, 2 );
add_action( 'init', '_wp_register_default_font_collections' );
// Add ignoredHookedBlocks metadata attribute to the template and template part post types.
add_filter( 'rest_pre_insert_wp_template', 'inject_ignored_hooked_blocks_metadata_attributes', 10, 2 );
add_filter( 'rest_pre_insert_wp_template_part', 'inject_ignored_hooked_blocks_metadata_attributes', 10, 2 );
add_filter( 'rest_pre_insert_wp_template', 'inject_ignored_hooked_blocks_metadata_attributes' );
add_filter( 'rest_pre_insert_wp_template_part', 'inject_ignored_hooked_blocks_metadata_attributes' );
unset( $filter, $action );
+1 -7
View File
@@ -211,7 +211,6 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $args
*
* @see WP_Scripts::localize()
* @link https://core.trac.wordpress.org/ticket/11520
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
*
* @since 2.2.0
*
@@ -224,12 +223,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $args
* @return bool True if the script was successfully localized, false otherwise.
*/
function wp_localize_script( $handle, $object_name, $l10n ) {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return false;
}
$wp_scripts = wp_scripts();
return $wp_scripts->localize( $handle, $object_name, $l10n );
}
+81 -48
View File
@@ -32883,7 +32883,8 @@ function layout_addAttribute(settings) {
}
function BlockWithLayoutStyles({
block: BlockListBlock,
props
props,
layoutClasses
}) {
const {
name,
@@ -32900,7 +32901,6 @@ function BlockWithLayoutStyles({
...layout,
type: 'constrained'
} : layout || defaultBlockLayout || {};
const layoutClasses = useLayoutClasses(attributes, name);
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
@@ -32942,7 +32942,12 @@ function BlockWithLayoutStyles({
* @return {Function} Wrapped component.
*/
const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
const {
name,
attributes
} = props;
const blockSupportsLayout = hasLayoutBlockSupport(props.name);
const layoutClasses = useLayoutClasses(attributes, name);
const shouldRenderLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
// The callback returns early to avoid block editor subscription.
if (!blockSupportsLayout) {
@@ -32952,12 +32957,14 @@ const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrde
}, [blockSupportsLayout]);
if (!shouldRenderLayoutStyles) {
return (0,external_React_.createElement)(BlockListBlock, {
...props
...props,
__unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined
});
}
return (0,external_React_.createElement)(BlockWithLayoutStyles, {
block: BlockListBlock,
props: props
props: props,
layoutClasses: layoutClasses
});
}, 'withLayoutStyles');
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute);
@@ -41962,12 +41969,14 @@ function Pagination({
variant: "tertiary",
onClick: () => changePage(1),
disabled: currentPage === 1,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('First page')
"aria-label": (0,external_wp_i18n_namespaceObject.__)('First page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\xAB")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(currentPage - 1),
disabled: currentPage === 1,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page')
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\u2039"))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
variant: "muted"
}, (0,external_wp_i18n_namespaceObject.sprintf)(
@@ -41980,13 +41989,15 @@ function Pagination({
variant: "tertiary",
onClick: () => changePage(currentPage + 1),
disabled: currentPage === numPages,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page')
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\u203A")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(numPages),
disabled: currentPage === numPages,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page'),
size: "default"
size: "default",
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\xBB")))));
}
@@ -42439,11 +42450,13 @@ function PatternsListHeader({
function PatternList({
searchValue,
selectedCategory,
patternCategories
patternCategories,
rootClientId
}) {
const container = (0,external_wp_element_namespaceObject.useRef)();
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
rootClientId,
shouldFocusBlock: true
});
const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId);
@@ -42589,7 +42602,8 @@ function PatternsExplorer({
searchValue: searchValue,
selectedCategory: selectedCategory,
patternCategories: patternCategories,
patternSourceFilter: patternSourceFilter
patternSourceFilter: patternSourceFilter,
rootClientId: rootClientId
}));
}
function PatternsExplorerModal({
@@ -54045,9 +54059,14 @@ function useListViewDropZone({
const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
dropZoneElement,
onDrop(event) {
throttled.cancel();
if (target) {
onBlockDrop(event);
}
// Use `undefined` value to indicate that the drag has concluded.
// This allows styling rules that are active only when a user is
// dragging to be removed.
setTarget(undefined);
},
onDragLeave() {
throttled.cancel();
@@ -60705,7 +60724,8 @@ const ImageURLInputUI = ({
rel,
showLightboxSetting,
lightboxEnabled,
onSetLightbox
onSetLightbox,
resetLightbox
}) => {
const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
// Use internal state instead of a ref to make sure that the component
@@ -60866,8 +60886,52 @@ const ImageURLInputUI = ({
onChange: onSetLinkClass
}));
const linkEditorValue = urlInput !== null ? urlInput : url;
const showLinkEditor = (!linkEditorValue && !lightboxEnabled) === true;
const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting;
const showLinkEditor = !linkEditorValue && hideLightboxPanel;
const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
const PopoverChildren = () => {
if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) {
return (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__expand-on-click"
}, (0,external_React_.createElement)(build_module_icon, {
icon: library_fullscreen
}), (0,external_React_.createElement)("div", {
className: "text"
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Expand on click')), (0,external_React_.createElement)("p", {
className: "description"
}, (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Disable expand on click'),
onClick: () => {
onSetLightbox(false);
},
size: "compact"
}));
} else if (!url || isEditingLink) {
return (0,external_React_.createElement)(url_popover.LinkEditor, {
className: "block-editor-format-toolbar__link-container-content",
value: linkEditorValue,
onChangeInputValue: setUrlInput,
onSubmit: onSubmitLinkChange(),
autocompleteRef: autocompleteRef
});
} else if (url && !isEditingLink) {
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(url_popover.LinkViewer, {
className: "block-editor-format-toolbar__link-container-content",
url: url,
onEditLinkClick: startEditLink,
urlLabel: urlLabel
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Remove link'),
onClick: () => {
onLinkRemove();
resetLightbox();
},
size: "compact"
}));
}
};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_link,
className: "components-toolbar__control",
@@ -60875,13 +60939,13 @@ const ImageURLInputUI = ({
"aria-expanded": isOpen,
onClick: openLinkUI,
ref: setPopoverAnchor,
isActive: !!url || lightboxEnabled
isActive: !!url || lightboxEnabled && showLightboxSetting
}), isOpen && (0,external_React_.createElement)(url_popover, {
ref: wrapperRef,
anchor: popoverAnchor,
onFocusOutside: onFocusOutside(),
onClose: closeLinkUI,
renderSettings: !lightboxEnabled ? () => advancedOptions : null,
renderSettings: hideLightboxPanel ? () => advancedOptions : null,
additionalControls: showLinkEditor && (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, getLinkDestinations().map(link => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
key: link.linkDestination,
icon: link.icon,
@@ -60908,38 +60972,7 @@ const ImageURLInputUI = ({
}
}, (0,external_wp_i18n_namespaceObject.__)('Expand on click'))),
offset: 13
}, (!url || isEditingLink) && !lightboxEnabled && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(url_popover.LinkEditor, {
className: "block-editor-format-toolbar__link-container-content",
value: linkEditorValue,
onChangeInputValue: setUrlInput,
onSubmit: onSubmitLinkChange(),
autocompleteRef: autocompleteRef
})), url && !isEditingLink && !lightboxEnabled && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(url_popover.LinkViewer, {
className: "block-editor-format-toolbar__link-container-content",
url: url,
onEditLinkClick: startEditLink,
urlLabel: urlLabel
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Remove link'),
onClick: onLinkRemove,
size: "compact"
})), !url && !isEditingLink && lightboxEnabled && (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__expand-on-click"
}, (0,external_React_.createElement)(build_module_icon, {
icon: library_fullscreen
}), (0,external_React_.createElement)("div", {
className: "text"
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Expand on click')), (0,external_React_.createElement)("p", {
className: "description"
}, (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Disable expand on click'),
onClick: () => {
onSetLightbox(false);
},
size: "compact"
}))));
}, PopoverChildren()));
};
@@ -62395,12 +62428,12 @@ const DeprecatedExperimentalRecursionProvider = props => {
...props
});
};
const DeprecatedExperimentalUseHasRecursion = props => {
const DeprecatedExperimentalUseHasRecursion = (...args) => {
external_wp_deprecated_default()('wp.blockEditor.__experimentalUseHasRecursion', {
since: '6.5',
alternative: 'wp.blockEditor.useHasRecursion'
});
return useHasRecursion(...props);
return useHasRecursion(...args);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
File diff suppressed because one or more lines are too long
+59 -12
View File
@@ -25964,6 +25964,23 @@ function image_Image({
});
}
}
function resetLightbox() {
// When deleting a link from an image while lightbox settings
// are enabled by default, we should disable the lightbox,
// otherwise the resulting UX looks like a mistake.
// See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123.
if (lightboxSetting?.enabled && lightboxSetting?.allowEditing) {
setAttributes({
lightbox: {
enabled: false
}
});
} else {
setAttributes({
lightbox: undefined
});
}
}
function onSetTitle(value) {
// This is the HTML title attribute, separate from the media object
// title.
@@ -26031,7 +26048,10 @@ function image_Image({
availableUnits: ['px']
});
const [lightboxSetting] = (0,external_wp_blockEditor_namespaceObject.useSettings)('lightbox');
const showLightboxSetting = !!lightbox || lightboxSetting?.allowEditing === true;
const showLightboxSetting =
// If a block-level override is set, we should give users the option to
// remove that override, even if the lightbox UI is disabled in the settings.
!!lightbox && lightbox?.enabled !== lightboxSetting?.enabled || lightboxSetting?.allowEditing;
const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
const dimensionsControl = (0,external_React_namespaceObject.createElement)(DimensionsTool, {
value: {
@@ -26138,7 +26158,8 @@ function image_Image({
rel: rel,
showLightboxSetting: showLightboxSetting,
lightboxEnabled: lightboxChecked,
onSetLightbox: onSetLightbox
onSetLightbox: onSetLightbox,
resetLightbox: resetLightbox
}), allowCrop && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => setIsEditingImage(true),
icon: library_crop,
@@ -45021,7 +45042,15 @@ const useUnsupportedBlocks = clientId => {
const blocks = {};
getClientIdsOfDescendants(clientId).forEach(descendantClientId => {
const blockName = getBlockName(descendantClientId);
if (!blockName.startsWith('core/')) {
/*
* Client side navigation can be true in two states:
* - supports.interactivity = true;
* - supports.interactivity.clientNavigation = true;
*/
const blockSupportsInteractivity = Object.is((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity'), true);
const blockSupportsInteractivityClientNavigation = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity.clientNavigation');
const blockInteractivity = blockSupportsInteractivity || blockSupportsInteractivityClientNavigation;
if (!blockInteractivity) {
blocks.hasBlocksFromPlugins = true;
} else if (blockName === 'core/post-content') {
blocks.hasPostContentBlock = true;
@@ -45897,7 +45926,7 @@ function EnhancedPaginationModal({
};
let notice = (0,external_wp_i18n_namespaceObject.__)('If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.');
if (hasBlocksFromPlugins) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when blocks from plugins are present inside the Query block.') + ' ' + notice;
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when non-interactive or non-clientNavigation compatible blocks from plugins are present inside the Query block.') + ' ' + notice;
} else if (hasPostContentBlock) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.') + ' ' + notice;
}
@@ -48945,6 +48974,30 @@ function setBlockEditMode(setEditMode, blocks, mode) {
block.name === block_name ? 'disabled' : mode);
});
}
function RecursionWarning() {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
// Wrap the main Edit function for the pattern block with a recursion wrapper
// that allows short-circuiting rendering as early as possible, before any
// of the other effects in the block edit have run.
function ReusableBlockEditRecursionWrapper(props) {
const {
ref
} = props.attributes;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(ref);
if (hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)(RecursionWarning, null);
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: ref
}, (0,external_React_namespaceObject.createElement)(ReusableBlockEdit, {
...props
}));
}
function ReusableBlockEdit({
name,
attributes: {
@@ -48956,7 +49009,6 @@ function ReusableBlockEdit({
setAttributes
}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(ref);
const {
record,
editedRecord,
@@ -49094,18 +49146,13 @@ function ReusableBlockEdit({
}
};
let children = null;
if (hasAlreadyRendered) {
children = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.'));
}
if (isMissing) {
children = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block has been deleted or is unavailable.'));
}
if (!hasResolved) {
children = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: ref
}, userCanEdit && onNavigateToEntityRecord && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, userCanEdit && onNavigateToEntityRecord && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: handleEditOriginal
}, (0,external_wp_i18n_namespaceObject.__)('Edit original')))), canOverrideBlocks && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: resetContent,
@@ -49286,7 +49333,7 @@ const {
const block_settings = {
deprecated: block_deprecated,
edit: ReusableBlockEdit,
edit: ReusableBlockEditRecursionWrapper,
icon: library_symbol,
__experimentalLabel: ({
ref
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -56545,7 +56545,7 @@ const DayButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_butt
justify-self: end;
`, " ", props => props.disabled && `
pointer-events: none;
`, " &&&{border-radius:100%;height:", space(8), ";width:", space(8), ";", props => props.isSelected && `
`, " &&&{border-radius:100%;height:", space(7), ";width:", space(7), ";", props => props.isSelected && `
background: ${COLORS.theme.accent};
color: ${COLORS.white};
`, " ", props => !props.isSelected && props.isToday && `
File diff suppressed because one or more lines are too long
+24 -6
View File
@@ -3490,26 +3490,44 @@ function areMetaBoxesInitialized(state) {
* @return {Object?} Post Template.
*/
const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
const {
id: postId,
type: postType,
slug
} = select(external_wp_editor_namespaceObject.store).getCurrentPost();
const {
getSite,
getEditedEntityRecord,
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
const siteSettings = getSite();
// First check if the current page is set as the posts page.
const isPostsPage = +postId === siteSettings?.page_for_posts;
if (isPostsPage) {
const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({
slug: 'home'
});
return getEditedEntityRecord('postType', 'wp_template', defaultTemplateId);
}
const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template');
if (currentTemplate) {
const templateWithSameSlug = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
const templateWithSameSlug = getEntityRecords('postType', 'wp_template', {
per_page: -1
})?.find(template => template.slug === currentTemplate);
if (!templateWithSameSlug) {
return templateWithSameSlug;
}
return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
return getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
}
const post = select(external_wp_editor_namespaceObject.store).getCurrentPost();
let slugToCheck;
// In `draft` status we might not have a slug available, so we use the `single`
// post type templates slug(ex page, single-post, single-product etc..).
// Pages do not need the `single` prefix in the slug to be prioritized
// through template hierarchy.
if (post.slug) {
slugToCheck = post.type === 'page' ? `${post.type}-${post.slug}` : `single-${post.type}-${post.slug}`;
if (slug) {
slugToCheck = postType === 'page' ? `${postType}-${slug}` : `single-${postType}-${slug}`;
} else {
slugToCheck = post.type === 'page' ? 'page' : `single-${post.type}`;
slugToCheck = postType === 'page' ? 'page' : `single-${postType}`;
}
const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({
slug: slugToCheck
File diff suppressed because one or more lines are too long
+111 -71
View File
@@ -9658,6 +9658,45 @@ function useSupportedStyles(name, element) {
return supportedPanels;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js
/**
* Sets the value at path of object.
* If a portion of path doesnt exist, its created.
* Arrays are created for missing index properties while objects are created
* for all other missing properties.
*
* This function intentionally mutates the input object.
*
* Inspired by _.set().
*
* @see https://lodash.com/docs/4.17.15#set
*
* @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.
*
* @param {Object} object Object to modify
* @param {Array} path Path of the property to set.
* @param {*} value Value to set.
*/
function setNestedValue(object, path, value) {
if (!object || typeof object !== 'object') {
return object;
}
path.reduce((acc, key, idx) => {
if (acc[key] === undefined) {
if (Number.isInteger(path[idx + 1])) {
acc[key] = [];
} else {
acc[key] = {};
}
}
if (idx === path.length - 1) {
acc[key] = value;
}
return acc[key];
}, object);
return object;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js
/**
@@ -9679,6 +9718,7 @@ function useSupportedStyles(name, element) {
*/
const {
cleanEmptyObject,
GlobalStylesContext
@@ -9877,44 +9917,6 @@ function useChangesToPush(name, attributes, userConfig) {
return changes;
}, [supports, attributes, blockUserConfig]);
}
/**
* Sets the value at path of object.
* If a portion of path doesnt exist, its created.
* Arrays are created for missing index properties while objects are created
* for all other missing properties.
*
* This function intentionally mutates the input object.
*
* Inspired by _.set().
*
* @see https://lodash.com/docs/4.17.15#set
*
* @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.
*
* @param {Object} object Object to modify
* @param {Array} path Path of the property to set.
* @param {*} value Value to set.
*/
function setNestedValue(object, path, value) {
if (!object || typeof object !== 'object') {
return object;
}
path.reduce((acc, key, idx) => {
if (acc[key] === undefined) {
if (Number.isInteger(path[idx + 1])) {
acc[key] = [];
} else {
acc[key] = {};
}
}
if (idx === path.length - 1) {
acc[key] = value;
}
return acc[key];
}, object);
return object;
}
function cloneDeep(object) {
return !object ? {} : JSON.parse(JSON.stringify(object));
}
@@ -17917,6 +17919,7 @@ function useResolveEditedEntityAndContext({
const {
hasLoadedAllDependencies,
homepageId,
postsPageId,
url,
frontPageTemplateId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
@@ -17930,16 +17933,20 @@ function useResolveEditedEntityAndContext({
const templates = getEntityRecords('postType', constants_TEMPLATE_POST_TYPE, {
per_page: -1
});
let _frontPateTemplateId;
const _homepageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_on_front) && !!+siteData.page_on_front // We also need to check if it's not zero(`0`).
? siteData.page_on_front.toString() : null;
const _postsPageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_for_posts) ? siteData.page_for_posts.toString() : null;
let _frontPageTemplateId;
if (templates) {
const frontPageTemplate = templates.find(t => t.slug === 'front-page');
_frontPateTemplateId = frontPageTemplate ? frontPageTemplate.id : false;
_frontPageTemplateId = frontPageTemplate ? frontPageTemplate.id : false;
}
return {
hasLoadedAllDependencies: !!base && !!siteData,
homepageId: siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_on_front) ? siteData.page_on_front.toString() : null,
homepageId: _homepageId,
postsPageId: _postsPageId,
url: base?.home,
frontPageTemplateId: _frontPateTemplateId
frontPageTemplateId: _frontPageTemplateId
};
}, []);
@@ -17977,6 +17984,10 @@ function useResolveEditedEntityAndContext({
if (!editedEntity) {
return undefined;
}
// Check if the current page is the posts page.
if (postTypeToResolve === 'page' && postsPageId === postIdToResolve) {
return __experimentalGetTemplateForLink(editedEntity.link)?.id;
}
// First see if the post/page has an assigned template and fetch it.
const currentTemplateSlug = editedEntity.template;
if (currentTemplateSlug) {
@@ -18028,7 +18039,7 @@ function useResolveEditedEntityAndContext({
const template = __experimentalGetTemplateForLink(url);
return template?.id;
}
}, [homepageId, hasLoadedAllDependencies, url, postId, postType, path, frontPageTemplateId]);
}, [homepageId, postsPageId, hasLoadedAllDependencies, url, postId, postType, path, frontPageTemplateId]);
const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (postTypesWithoutParentTemplate.includes(postType)) {
return {};
@@ -26985,12 +26996,13 @@ const {
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const FontLibraryContext = (0,external_wp_element_namespaceObject.createContext)({});
function FontLibraryProvider({
children
}) {
const {
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
saveEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
globalStylesId
@@ -27031,9 +27043,25 @@ function FontLibraryProvider({
// theme.json file font families
const [baseFontFamilies] = context_useGlobalSetting('typography.fontFamilies', undefined, 'base');
// Save font families to the global styles post in the database.
const saveFontFamilies = () => {
saveSpecifiedEntityEdits('root', 'globalStyles', globalStylesId, ['settings.typography.fontFamilies']);
/*
* Save the font families to the database.
* This function is called when the user activates or deactivates a font family.
* It only updates the global styles post content in the database for new font families.
* This avoids saving other styles/settings changed by the user using other parts of the editor.
*
* It uses the font families from the param to avoid using the font families from an outdated state.
*
* @param {Array} fonts - The font families that will be saved to the database.
*/
const saveFontFamilies = async fonts => {
// Gets the global styles database post content.
const updatedGlobalStyles = globalStyles.record;
// Updates the database version of global styles with the edited font families in the client.
setNestedValue(updatedGlobalStyles, ['settings', 'typography', 'fontFamilies'], fonts);
// Saves a new version of the global styles in the database.
await saveEntityRecord('root', 'globalStyles', updatedGlobalStyles);
};
// Library Fonts
@@ -27176,10 +27204,9 @@ function FontLibraryProvider({
installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []);
if (fontFamiliesToActivate.length > 0) {
// Activate the font family (add the font family to the global styles).
activateCustomFontFamilies(fontFamiliesToActivate);
const activeFonts = activateCustomFontFamilies(fontFamiliesToActivate);
// Save the global styles to the database.
await saveSpecifiedEntityEdits('root', 'globalStyles', globalStylesId, ['settings.typography.fontFamilies']);
await saveFontFamilies(activeFonts);
refreshLibrary();
}
if (installationErrors.length > 0) {
@@ -27200,9 +27227,9 @@ function FontLibraryProvider({
// Deactivate the font family if delete request is successful
// (Removes the font family from the global styles).
if (uninstalledFontFamily.deleted) {
deactivateFontFamily(fontFamilyToUninstall);
const activeFonts = deactivateFontFamily(fontFamilyToUninstall);
// Save the global styles to the database.
await saveSpecifiedEntityEdits('root', 'globalStyles', globalStylesId, ['settings.typography.fontFamilies']);
await saveFontFamilies(activeFonts);
}
// Refresh the library (the library font families from database).
@@ -27220,19 +27247,35 @@ function FontLibraryProvider({
// We want to save as active all the theme fonts at the beginning
const initialCustomFonts = (_fontFamilies$font$so = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so !== void 0 ? _fontFamilies$font$so : [];
const newCustomFonts = initialCustomFonts.filter(f => f.slug !== font.slug);
setFontFamilies({
const activeFonts = {
...fontFamilies,
[font.source]: newCustomFonts
});
};
setFontFamilies(activeFonts);
if (font.fontFace) {
font.fontFace.forEach(face => {
unloadFontFaceInBrowser(face, 'all');
});
}
return activeFonts;
};
const activateCustomFontFamilies = fontsToAdd => {
// Removes the id from the families and faces to avoid saving that to global styles post content.
const fontsToActivate = fontsToAdd.map(({
const fontsToActivate = cleanFontsForSave(fontsToAdd);
const activeFonts = {
...fontFamilies,
// Merge the existing custom fonts with the new fonts.
custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate)
};
// Activate the fonts by set the new custom fonts array.
setFontFamilies(activeFonts);
loadFontsInBrowser(fontsToActivate);
return activeFonts;
};
// Removes the id from the families and faces to avoid saving that to global styles post content.
const cleanFontsForSave = fonts => {
return fonts.map(({
id: _familyDbId,
fontFace,
...font
@@ -27245,16 +27288,10 @@ function FontLibraryProvider({
}) => face)
} : {})
}));
// Activate the fonts by set the new custom fonts array.
setFontFamilies({
...fontFamilies,
// Merge the existing custom fonts with the new fonts.
custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate)
});
};
const loadFontsInBrowser = fonts => {
// Add custom fonts to the browser.
fontsToActivate.forEach(font => {
fonts.forEach(font => {
if (font.fontFace) {
font.fontFace.forEach(face => {
// Load font faces just in the iframe because they already are in the document.
@@ -27324,6 +27361,7 @@ function FontLibraryProvider({
value: {
libraryFontSelected,
handleSetLibraryFontSelected,
fontFamilies,
themeFonts,
baseThemeFonts,
customFonts,
@@ -27622,7 +27660,8 @@ function InstalledFonts() {
getFontFacesActivated,
fontFamiliesHasChanges,
notice,
setNotice
setNotice,
fontFamilies
} = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext);
const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id;
@@ -27700,9 +27739,7 @@ function InstalledFonts() {
onClick: () => {
handleSetLibraryFontSelected(font);
}
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
margin: 16
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
})))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
path: "/fontFamily"
}, (0,external_React_.createElement)(ConfirmDeleteDialog, {
font: libraryFontSelected,
@@ -27752,7 +27789,9 @@ function InstalledFonts() {
onClick: handleUninstallClick
}, (0,external_wp_i18n_namespaceObject.__)('Delete')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: saveFontFamilies,
onClick: () => {
saveFontFamilies(fontFamilies);
},
disabled: !fontFamiliesHasChanges,
__experimentalIsFocusable: true
}, (0,external_wp_i18n_namespaceObject.__)('Update'))));
@@ -28188,6 +28227,7 @@ function FontCollection({
isSmall: true,
onClick: () => {
setSelectedFont(null);
setNotice(null);
},
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
@@ -32375,7 +32415,7 @@ const {
} = unlock(external_wp_components_namespaceObject.privateApis);
const DEFAULT_TAB = {
id: 'installed-fonts',
title: (0,external_wp_i18n_namespaceObject.__)('Library')
title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library')
};
const UPLOAD_TAB = {
id: 'upload-fonts',
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -15925,7 +15925,7 @@ function DocumentTools({
variant: "unstyled"
}, (0,external_React_.createElement)("div", {
className: "editor-document-tools__left"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
}, !isDistractionFree && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
ref: inserterButton,
as: external_wp_components_namespaceObject.Button,
className: "editor-document-tools__inserter-toggle",
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+16
View File
@@ -728,6 +728,10 @@ function load_textdomain( $domain, $mofile, $locale = null ) {
$l10n_unloaded = (array) $l10n_unloaded;
if ( ! is_string( $domain ) ) {
return false;
}
/**
* Filters whether to short-circuit loading .mo file.
*
@@ -989,6 +993,10 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
if ( ! is_string( $domain ) ) {
return false;
}
/**
* Filters a plugin's locale.
*
@@ -1037,6 +1045,10 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
if ( ! is_string( $domain ) ) {
return false;
}
/** This filter is documented in wp-includes/l10n.php */
$locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
@@ -1076,6 +1088,10 @@ function load_theme_textdomain( $domain, $path = false ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
if ( ! is_string( $domain ) ) {
return false;
}
/**
* Filters a theme's locale.
*
@@ -165,7 +165,8 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
array_shift( $hierarchy );
} while ( ! empty( $hierarchy ) && empty( $fallback_template->content ) );
$response = $this->prepare_item_for_response( $fallback_template, $request );
// To maintain original behavior, return an empty object rather than a 404 error when no template is found.
$response = $fallback_template ? $this->prepare_item_for_response( $fallback_template, $request ) : new stdClass();
return rest_ensure_response( $response );
}
@@ -532,7 +533,7 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
* @since 5.8.0
*
* @param WP_REST_Request $request Request object.
* @return stdClass Changes to pass to wp_update_post.
* @return stdClass|WP_Error Changes to pass to wp_update_post.
*/
protected function prepare_item_for_database( $request ) {
$template = $request['id'] ? get_block_template( $request['id'], $this->post_type ) : null;
+1 -1
View File
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5';
$wp_version = '6.5.3';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.