Editor: Update Packages with the latest bug fixes for 6.5 beta1.

It includes all the backports from this Gutenberg PR https://github.com/WordPress/gutenberg/pull/58964

Props youknowriad, get_dave.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57619


git-svn-id: http://core.svn.wordpress.org/trunk@57120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2024-02-13 13:12:17 +00:00
parent 046fe2802c
commit 8cd718b010
41 changed files with 478 additions and 342 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@ function render_block_core_file( $attributes, $content ) {
$processor = new WP_HTML_Tag_Processor( $content ); $processor = new WP_HTML_Tag_Processor( $content );
$processor->next_tag(); $processor->next_tag();
$processor->set_attribute( 'data-wp-interactive', '{"namespace":"core/file"}' ); $processor->set_attribute( 'data-wp-interactive', 'core/file' );
$processor->next_tag( 'object' ); $processor->next_tag( 'object' );
$processor->set_attribute( 'data-wp-bind--hidden', '!state.hasPdfPreview' ); $processor->set_attribute( 'data-wp-bind--hidden', '!state.hasPdfPreview' );
$processor->set_attribute( 'hidden', true ); $processor->set_attribute( 'hidden', true );

View File

@ -159,7 +159,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$figure_class_names = $p->get_attribute( 'class' ); $figure_class_names = $p->get_attribute( 'class' );
$figure_styles = $p->get_attribute( 'style' ); $figure_styles = $p->get_attribute( 'style' );
$p->add_class( 'wp-lightbox-container' ); $p->add_class( 'wp-lightbox-container' );
$p->set_attribute( 'data-wp-interactive', '{"namespace":"core/image"}' ); $p->set_attribute( 'data-wp-interactive', 'core/image' );
$p->set_attribute( $p->set_attribute(
'data-wp-context', 'data-wp-context',
wp_json_encode( wp_json_encode(
@ -240,7 +240,7 @@ function block_core_image_print_lightbox_overlay() {
echo <<<HTML echo <<<HTML
<div <div
class="wp-lightbox-overlay zoom" class="wp-lightbox-overlay zoom"
data-wp-interactive='{"namespace":"core/image"}' data-wp-interactive="core/image"
data-wp-context='{}' data-wp-context='{}'
data-wp-bind--role="state.roleAttribute" data-wp-bind--role="state.roleAttribute"
data-wp-bind--aria-label="state.currentImage.ariaLabel" data-wp-bind--aria-label="state.currentImage.ariaLabel"

View File

@ -557,19 +557,17 @@ class WP_Navigation_Block_Renderer {
return ''; return '';
} }
// When adding to this array be mindful of security concerns. // When adding to this array be mindful of security concerns.
$nav_element_context = wp_json_encode( $nav_element_context = data_wp_context(
array( array(
'overlayOpenedBy' => array(), 'overlayOpenedBy' => array(),
'type' => 'overlay', 'type' => 'overlay',
'roleAttribute' => '', 'roleAttribute' => '',
'ariaLabel' => __( 'Menu' ), 'ariaLabel' => __( 'Menu' ),
), )
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
); );
$nav_element_directives = ' $nav_element_directives = '
data-wp-interactive=\'{"namespace":"core/navigation"}\' data-wp-interactive="core/navigation"'
data-wp-context=\'' . $nav_element_context . '\' . $nav_element_context;
';
/* /*
* When the navigation's 'overlayMenu' attribute is set to 'always', JavaScript * When the navigation's 'overlayMenu' attribute is set to 'always', JavaScript
@ -780,7 +778,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
) )
) ) { ) ) {
// Add directives to the parent `<li>`. // Add directives to the parent `<li>`.
$tags->set_attribute( 'data-wp-interactive', '{ "namespace": "core/navigation" }' ); $tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": {}, "type": "submenu" }' ); $tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": {}, "type": "submenu" }' );
$tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' ); $tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' ); $tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );

View File

@ -91,14 +91,17 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo
} }
if ( $enhanced_pagination ) { if ( $enhanced_pagination ) {
$p = new WP_HTML_Tag_Processor( $content ); $p = new WP_HTML_Tag_Processor( $content );
$tag_index = 0;
while ( $p->next_tag( while ( $p->next_tag(
array( array( 'class_name' => 'page-numbers' )
'tag_name' => 'a',
'class_name' => 'page-numbers',
)
) ) { ) ) {
$p->set_attribute( 'data-wp-on--click', 'core/query::actions.navigate' ); if ( null === $p->get_attribute( 'data-wp-key' ) ) {
$p->set_attribute( 'data-wp-key', 'index-' . $tag_index++ );
}
if ( 'A' === $p->get_tag() ) {
$p->set_attribute( 'data-wp-on--click', 'core/query::actions.navigate' );
}
} }
$content = $p->get_updated_html(); $content = $p->get_updated_html();
} }

View File

@ -49,7 +49,7 @@ function render_block_core_query( $attributes, $content, $block ) {
$p = new WP_HTML_Tag_Processor( $content ); $p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag() ) { if ( $p->next_tag() ) {
// Add the necessary directives. // Add the necessary directives.
$p->set_attribute( 'data-wp-interactive', '{"namespace":"core/query"}' ); $p->set_attribute( 'data-wp-interactive', 'core/query' );
$p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] ); $p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] );
$p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' ); $p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' );
$p->set_attribute( 'data-wp-context', '{}' ); $p->set_attribute( 'data-wp-context', '{}' );

View File

@ -47,7 +47,7 @@ function render_block_core_search( $attributes ) {
$border_color_classes = get_border_color_classes_for_block_core_search( $attributes ); $border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
// This variable is a constant and its value is always false at this moment. // This variable is a constant and its value is always false at this moment.
// It is defined this way because some values depend on it, in case it changes in the future. // It is defined this way because some values depend on it, in case it changes in the future.
$open_by_default = 'false'; $open_by_default = false;
$label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] ); $label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] );
$label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) ); $label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
@ -179,12 +179,20 @@ function render_block_core_search( $attributes ) {
if ( $is_expandable_searchfield ) { if ( $is_expandable_searchfield ) {
$aria_label_expanded = __( 'Submit Search' ); $aria_label_expanded = __( 'Submit Search' );
$aria_label_collapsed = __( 'Expand search field' ); $aria_label_collapsed = __( 'Expand search field' );
$form_context = data_wp_context(
array(
'isSearchInputVisible' => $open_by_default,
'inputId' => $input_id,
'ariaLabelExpanded' => $aria_label_expanded,
'ariaLabelCollapsed' => $aria_label_collapsed,
)
);
$form_directives = ' $form_directives = '
data-wp-interactive=\'{ "namespace": "core/search" }\' data-wp-interactive=\'"core/search"\''
data-wp-context=\'{ "isSearchInputVisible": ' . $open_by_default . ', "inputId": "' . $input_id . '", "ariaLabelExpanded": "' . $aria_label_expanded . '", "ariaLabelCollapsed": "' . $aria_label_collapsed . '" }\' . $form_context .
data-wp-class--wp-block-search__searchfield-hidden="!context.isSearchInputVisible" 'data-wp-class--wp-block-search__searchfield-hidden="!context.isSearchInputVisible"
data-wp-on--keydown="actions.handleSearchKeydown" data-wp-on--keydown="actions.handleSearchKeydown"
data-wp-on--focusout="actions.handleSearchFocusout" data-wp-on--focusout="actions.handleSearchFocusout"
'; ';
} }

View File

@ -27,5 +27,6 @@
content:none; content:none;
} }
.block-library-spacer__resize-container.resize-horizontal{ .block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0; margin-bottom:0;
} }

View File

@ -1 +1 @@
.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;height:100%;min-height:8px;min-width:8px;position:absolute;width:100%;z-index:1}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container,.wp-block-spacer.is-selected.custom-sizes-disabled{background:#0000001a}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container,.is-dark-theme .wp-block-spacer.is-selected.custom-sizes-disabled{background:#ffffff26}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0} .block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;height:100%;min-height:8px;min-width:8px;position:absolute;width:100%;z-index:1}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container,.wp-block-spacer.is-selected.custom-sizes-disabled{background:#0000001a}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container,.is-dark-theme .wp-block-spacer.is-selected.custom-sizes-disabled{background:#ffffff26}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{height:100%!important;margin-bottom:0}

View File

@ -27,5 +27,6 @@
content:none; content:none;
} }
.block-library-spacer__resize-container.resize-horizontal{ .block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0; margin-bottom:0;
} }

View File

@ -1 +1 @@
.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;height:100%;min-height:8px;min-width:8px;position:absolute;width:100%;z-index:1}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container,.wp-block-spacer.is-selected.custom-sizes-disabled{background:#0000001a}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container,.is-dark-theme .wp-block-spacer.is-selected.custom-sizes-disabled{background:#ffffff26}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0} .block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;height:100%;min-height:8px;min-width:8px;position:absolute;width:100%;z-index:1}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container,.wp-block-spacer.is-selected.custom-sizes-disabled{background:#0000001a}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container,.is-dark-theme .wp-block-spacer.is-selected.custom-sizes-disabled{background:#ffffff26}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{height:100%!important;margin-bottom:0}

View File

@ -1919,13 +1919,6 @@ iframe[name=editor-canvas].has-editor-padding{
top:0; top:0;
} }
.block-editor-link-control__drawer{
display:flex;
flex-basis:100%;
flex-direction:column;
order:30;
}
.block-editor-link-control__drawer-inner{ .block-editor-link-control__drawer-inner{
display:flex; display:flex;
flex-basis:100%; flex-basis:100%;
@ -2714,17 +2707,10 @@ iframe[name=editor-canvas].has-editor-padding{
padding:8px 12px 8px 8px; padding:8px 12px 8px 8px;
width:100%; width:100%;
} }
@media (min-width:600px){
.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{
width:300px;
}
}
.block-editor-block-list__block .block-editor-url-input input[type=text]:not(:focus),.block-editor-url-input input[type=text]:not(:focus),.components-popover .block-editor-url-input input[type=text]:not(:focus){
border-color:#0000;
}
@media (min-width:600px){ @media (min-width:600px){
.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{ .block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{
font-size:13px; font-size:13px;
width:300px;
} }
} }
.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{ .block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{

File diff suppressed because one or more lines are too long

View File

@ -1919,13 +1919,6 @@ iframe[name=editor-canvas].has-editor-padding{
top:0; top:0;
} }
.block-editor-link-control__drawer{
display:flex;
flex-basis:100%;
flex-direction:column;
order:30;
}
.block-editor-link-control__drawer-inner{ .block-editor-link-control__drawer-inner{
display:flex; display:flex;
flex-basis:100%; flex-basis:100%;
@ -2714,17 +2707,10 @@ iframe[name=editor-canvas].has-editor-padding{
padding:8px 8px 8px 12px; padding:8px 8px 8px 12px;
width:100%; width:100%;
} }
@media (min-width:600px){
.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{
width:300px;
}
}
.block-editor-block-list__block .block-editor-url-input input[type=text]:not(:focus),.block-editor-url-input input[type=text]:not(:focus),.components-popover .block-editor-url-input input[type=text]:not(:focus){
border-color:#0000;
}
@media (min-width:600px){ @media (min-width:600px){
.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{ .block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{
font-size:13px; font-size:13px;
width:300px;
} }
} }
.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{ .block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{

File diff suppressed because one or more lines are too long

View File

@ -2383,6 +2383,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
content:none; content:none;
} }
.block-library-spacer__resize-container.resize-horizontal{ .block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0; margin-bottom:0;
} }

File diff suppressed because one or more lines are too long

View File

@ -2381,6 +2381,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
content:none; content:none;
} }
.block-library-spacer__resize-container.resize-horizontal{ .block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0; margin-bottom:0;
} }

File diff suppressed because one or more lines are too long

View File

@ -918,11 +918,6 @@ body.is-fullscreen-mode .interface-interface-skeleton{
color:#757575; color:#757575;
} }
.dataviews-filter-summary__reset{
border-top:1px solid #e0e0e0;
padding:4px;
}
.dataviews-filter-summary__chip-container{ .dataviews-filter-summary__chip-container{
position:relative; position:relative;
white-space:pre-wrap; white-space:pre-wrap;

File diff suppressed because one or more lines are too long

View File

@ -918,11 +918,6 @@ body.is-fullscreen-mode .interface-interface-skeleton{
color:#757575; color:#757575;
} }
.dataviews-filter-summary__reset{
border-top:1px solid #e0e0e0;
padding:4px;
}
.dataviews-filter-summary__chip-container{ .dataviews-filter-summary__chip-container{
position:relative; position:relative;
white-space:pre-wrap; white-space:pre-wrap;

File diff suppressed because one or more lines are too long

View File

@ -10957,12 +10957,13 @@ function lastFocus(state = false, action) {
} }
function blockBindingsSources(state = {}, action) { function blockBindingsSources(state = {}, action) {
if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') { if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') {
var _action$lockAttribute;
return { return {
...state, ...state,
[action.sourceName]: { [action.sourceName]: {
label: action.sourceLabel, label: action.sourceLabel,
useSource: action.useSource, useSource: action.useSource,
lockAttributesEditing: action.lockAttributesEditing lockAttributesEditing: (_action$lockAttribute = action.lockAttributesEditing) !== null && _action$lockAttribute !== void 0 ? _action$lockAttribute : true
} }
}; };
} }
@ -34175,7 +34176,7 @@ const createEditFunctionWithBindingsAttribute = () => (0,external_wp_compose_nam
if (updatedAttributes?.metadata?.bindings) { if (updatedAttributes?.metadata?.bindings) {
Object.entries(updatedAttributes.metadata.bindings).forEach(([attributeName, settings]) => { Object.entries(updatedAttributes.metadata.bindings).forEach(([attributeName, settings]) => {
const source = getBlockBindingsSource(settings.source); const source = getBlockBindingsSource(settings.source);
if (source) { if (source && source.useSource) {
// Second argument (`updateMetaValue`) will be used to update the value in the future. // Second argument (`updateMetaValue`) will be used to update the value in the future.
const { const {
placeholder, placeholder,
@ -58718,35 +58719,6 @@ function findSelection(blocks) {
} }
return []; return [];
} }
/**
* An input rule that replaces two spaces with an en space, and an en space
* followed by a space with an em space.
*
* @param {Object} value Value to replace spaces in.
*
* @return {Object} Value with spaces replaced.
*/
function replacePrecedingSpaces(value) {
if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
return value;
}
const {
text,
start
} = value;
const lastTwoCharacters = text.slice(start - 2, start);
// Replace two spaces with an em space.
if (lastTwoCharacters === ' ') {
return (0,external_wp_richText_namespaceObject.insert)(value, '\u2002', start - 2, start);
}
// Replace an en space followed by a space with an em space.
else if (lastTwoCharacters === '\u2002 ') {
return (0,external_wp_richText_namespaceObject.insert)(value, '\u2003', start - 2, start);
}
return value;
}
function useInputRules(props) { function useInputRules(props) {
const { const {
__unstableMarkLastChangeAsPersistent, __unstableMarkLastChangeAsPersistent,
@ -58826,7 +58798,7 @@ function useInputRules(props) {
accumlator = __unstableInputRule(accumlator); accumlator = __unstableInputRule(accumlator);
} }
return accumlator; return accumlator;
}, preventEventDiscovery(replacePrecedingSpaces(value))); }, preventEventDiscovery(value));
if (transformed !== value) { if (transformed !== value) {
__unstableMarkLastChangeAsPersistent(); __unstableMarkLastChangeAsPersistent();
onChange({ onChange({

File diff suppressed because one or more lines are too long

View File

@ -5081,7 +5081,7 @@ function ButtonEdit(props) {
getBlockBindingsSource getBlockBindingsSource
} = unlock(select(external_wp_blockEditor_namespaceObject.store)); } = unlock(select(external_wp_blockEditor_namespaceObject.store));
return { return {
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing === true lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
}; };
}, [isSelected]); }, [isSelected]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
@ -25988,13 +25988,13 @@ function image_Image({
} = metadata?.bindings || {}; } = metadata?.bindings || {};
const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0; const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0;
return { return {
lockUrlControls: !!urlBinding && getBlockBindingsSource(urlBinding?.source)?.lockAttributesEditing === true, lockUrlControls: !!urlBinding && getBlockBindingsSource(urlBinding?.source)?.lockAttributesEditing,
lockHrefControls: lockHrefControls:
// Disable editing the link of the URL if the image is inside a pattern instance. // Disable editing the link of the URL if the image is inside a pattern instance.
// This is a temporary solution until we support overriding the link on the frontend. // This is a temporary solution until we support overriding the link on the frontend.
hasParentPattern, hasParentPattern,
lockAltControls: !!altBinding && getBlockBindingsSource(altBinding?.source)?.lockAttributesEditing === true, lockAltControls: !!altBinding && getBlockBindingsSource(altBinding?.source)?.lockAttributesEditing,
lockTitleControls: !!titleBinding && getBlockBindingsSource(titleBinding?.source)?.lockAttributesEditing === true lockTitleControls: !!titleBinding && getBlockBindingsSource(titleBinding?.source)?.lockAttributesEditing
}; };
}, [clientId, isSingleSelected, metadata?.bindings]); }, [clientId, isSingleSelected, metadata?.bindings]);
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, { const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
@ -26548,7 +26548,7 @@ function ImageEdit({
getBlockBindingsSource getBlockBindingsSource
} = unlock(select(external_wp_blockEditor_namespaceObject.store)); } = unlock(select(external_wp_blockEditor_namespaceObject.store));
return { return {
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing === true lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
}; };
}, [isSingleSelected]); }, [isSingleSelected]);
const placeholder = content => { const placeholder = content => {
@ -53885,10 +53885,13 @@ const SpacerEdit = ({
} = context; } = context;
const { const {
orientation: parentOrientation, orientation: parentOrientation,
type type,
default: {
type: defaultType
} = {}
} = parentLayout || {}; } = parentLayout || {};
// Check if the spacer is inside a flex container. // Check if the spacer is inside a flex container.
const isFlexLayout = type === 'flex'; const isFlexLayout = type === 'flex' || !type && defaultType === 'flex';
// If the spacer is inside a flex container, it should either inherit the orientation // If the spacer is inside a flex container, it should either inherit the orientation
// of the parent or use the flex default orientation. // of the parent or use the flex default orientation.
const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation; const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation;

File diff suppressed because one or more lines are too long

View File

@ -8252,7 +8252,7 @@ const autoPlacement = function (options) {
* clipping boundary. Alternative to `autoPlacement`. * clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip * @see https://floating-ui.com/docs/flip
*/ */
const floating_ui_core_flip = function (options) { const flip = function (options) {
if (options === void 0) { if (options === void 0) {
options = {}; options = {};
} }
@ -8638,7 +8638,7 @@ const offset = function (options) {
* keep it in view when it will overflow the clipping boundary. * keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift * @see https://floating-ui.com/docs/shift
*/ */
const floating_ui_core_shift = function (options) { const shift = function (options) {
if (options === void 0) { if (options === void 0) {
options = {}; options = {};
} }
@ -8859,7 +8859,138 @@ const size = function (options) {
;// CONCATENATED MODULE: ./node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.mjs ;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
/**
* Custom positioning reference element.
* @see https://floating-ui.com/docs/virtual-elements
*/
const dist_floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left']));
const floating_ui_utils_alignments = (/* unused pure expression or super */ null && (['start', 'end']));
const dist_floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (dist_floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + floating_ui_utils_alignments[0], side + "-" + floating_ui_utils_alignments[1]), [])));
const dist_floating_ui_utils_min = Math.min;
const dist_floating_ui_utils_max = Math.max;
const floating_ui_utils_round = Math.round;
const floating_ui_utils_floor = Math.floor;
const floating_ui_utils_createCoords = v => ({
x: v,
y: v
});
const floating_ui_utils_oppositeSideMap = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
const floating_ui_utils_oppositeAlignmentMap = {
start: 'end',
end: 'start'
};
function floating_ui_utils_clamp(start, value, end) {
return dist_floating_ui_utils_max(start, dist_floating_ui_utils_min(value, end));
}
function dist_floating_ui_utils_evaluate(value, param) {
return typeof value === 'function' ? value(param) : value;
}
function dist_floating_ui_utils_getSide(placement) {
return placement.split('-')[0];
}
function dist_floating_ui_utils_getAlignment(placement) {
return placement.split('-')[1];
}
function floating_ui_utils_getOppositeAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}
function floating_ui_utils_getAxisLength(axis) {
return axis === 'y' ? 'height' : 'width';
}
function dist_floating_ui_utils_getSideAxis(placement) {
return ['top', 'bottom'].includes(dist_floating_ui_utils_getSide(placement)) ? 'y' : 'x';
}
function floating_ui_utils_getAlignmentAxis(placement) {
return floating_ui_utils_getOppositeAxis(dist_floating_ui_utils_getSideAxis(placement));
}
function dist_floating_ui_utils_getAlignmentSides(placement, rects, rtl) {
if (rtl === void 0) {
rtl = false;
}
const alignment = dist_floating_ui_utils_getAlignment(placement);
const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement);
const length = floating_ui_utils_getAxisLength(alignmentAxis);
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
if (rects.reference[length] > rects.floating[length]) {
mainAlignmentSide = floating_ui_utils_getOppositePlacement(mainAlignmentSide);
}
return [mainAlignmentSide, floating_ui_utils_getOppositePlacement(mainAlignmentSide)];
}
function floating_ui_utils_getExpandedPlacements(placement) {
const oppositePlacement = floating_ui_utils_getOppositePlacement(placement);
return [dist_floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, dist_floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)];
}
function dist_floating_ui_utils_getOppositeAlignmentPlacement(placement) {
return placement.replace(/start|end/g, alignment => floating_ui_utils_oppositeAlignmentMap[alignment]);
}
function floating_ui_utils_getSideList(side, isStart, rtl) {
const lr = ['left', 'right'];
const rl = ['right', 'left'];
const tb = ['top', 'bottom'];
const bt = ['bottom', 'top'];
switch (side) {
case 'top':
case 'bottom':
if (rtl) return isStart ? rl : lr;
return isStart ? lr : rl;
case 'left':
case 'right':
return isStart ? tb : bt;
default:
return [];
}
}
function floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
const alignment = dist_floating_ui_utils_getAlignment(placement);
let list = floating_ui_utils_getSideList(dist_floating_ui_utils_getSide(placement), direction === 'start', rtl);
if (alignment) {
list = list.map(side => side + "-" + alignment);
if (flipAlignment) {
list = list.concat(list.map(dist_floating_ui_utils_getOppositeAlignmentPlacement));
}
}
return list;
}
function floating_ui_utils_getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, side => floating_ui_utils_oppositeSideMap[side]);
}
function floating_ui_utils_expandPaddingObject(padding) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...padding
};
}
function dist_floating_ui_utils_getPaddingObject(padding) {
return typeof padding !== 'number' ? floating_ui_utils_expandPaddingObject(padding) : {
top: padding,
right: padding,
bottom: padding,
left: padding
};
}
function dist_floating_ui_utils_rectToClientRect(rect) {
return {
...rect,
top: rect.y,
left: rect.x,
right: rect.x + rect.width,
bottom: rect.y + rect.height
};
}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
function getNodeName(node) { function getNodeName(node) {
if (isNode(node)) { if (isNode(node)) {
return (node.nodeName || '').toLowerCase(); return (node.nodeName || '').toLowerCase();
@ -8871,7 +9002,7 @@ function getNodeName(node) {
} }
function floating_ui_utils_dom_getWindow(node) { function floating_ui_utils_dom_getWindow(node) {
var _node$ownerDocument; var _node$ownerDocument;
return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
} }
function getDocumentElement(node) { function getDocumentElement(node) {
var _ref; var _ref;
@ -9005,7 +9136,7 @@ function getCssDimensions(element) {
const hasOffset = isHTMLElement(element); const hasOffset = isHTMLElement(element);
const offsetWidth = hasOffset ? element.offsetWidth : width; const offsetWidth = hasOffset ? element.offsetWidth : width;
const offsetHeight = hasOffset ? element.offsetHeight : height; const offsetHeight = hasOffset ? element.offsetHeight : height;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; const shouldFallback = floating_ui_utils_round(width) !== offsetWidth || floating_ui_utils_round(height) !== offsetHeight;
if (shouldFallback) { if (shouldFallback) {
width = offsetWidth; width = offsetWidth;
height = offsetHeight; height = offsetHeight;
@ -9024,7 +9155,7 @@ function unwrapElement(element) {
function getScale(element) { function getScale(element) {
const domElement = unwrapElement(element); const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) { if (!isHTMLElement(domElement)) {
return createCoords(1); return floating_ui_utils_createCoords(1);
} }
const rect = domElement.getBoundingClientRect(); const rect = domElement.getBoundingClientRect();
const { const {
@ -9032,8 +9163,8 @@ function getScale(element) {
height, height,
$ $
} = getCssDimensions(domElement); } = getCssDimensions(domElement);
let x = ($ ? round(rect.width) : rect.width) / width; let x = ($ ? floating_ui_utils_round(rect.width) : rect.width) / width;
let y = ($ ? round(rect.height) : rect.height) / height; let y = ($ ? floating_ui_utils_round(rect.height) : rect.height) / height;
// 0, NaN, or Infinity should always fallback to 1. // 0, NaN, or Infinity should always fallback to 1.
@ -9049,7 +9180,7 @@ function getScale(element) {
}; };
} }
const noOffsets = /*#__PURE__*/createCoords(0); const noOffsets = /*#__PURE__*/floating_ui_utils_createCoords(0);
function getVisualOffsets(element) { function getVisualOffsets(element) {
const win = floating_ui_utils_dom_getWindow(element); const win = floating_ui_utils_dom_getWindow(element);
if (!isWebKit() || !win.visualViewport) { if (!isWebKit() || !win.visualViewport) {
@ -9079,7 +9210,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
} }
const clientRect = element.getBoundingClientRect(); const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element); const domElement = unwrapElement(element);
let scale = createCoords(1); let scale = floating_ui_utils_createCoords(1);
if (includeScale) { if (includeScale) {
if (offsetParent) { if (offsetParent) {
if (isElement(offsetParent)) { if (isElement(offsetParent)) {
@ -9089,7 +9220,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
scale = getScale(element); scale = getScale(element);
} }
} }
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floating_ui_utils_createCoords(0);
let x = (clientRect.left + visualOffsets.x) / scale.x; let x = (clientRect.left + visualOffsets.x) / scale.x;
let y = (clientRect.top + visualOffsets.y) / scale.y; let y = (clientRect.top + visualOffsets.y) / scale.y;
let width = clientRect.width / scale.x; let width = clientRect.width / scale.x;
@ -9097,8 +9228,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
if (domElement) { if (domElement) {
const win = floating_ui_utils_dom_getWindow(domElement); const win = floating_ui_utils_dom_getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? floating_ui_utils_dom_getWindow(offsetParent) : offsetParent; const offsetWin = offsetParent && isElement(offsetParent) ? floating_ui_utils_dom_getWindow(offsetParent) : offsetParent;
let currentIFrame = win.frameElement; let currentWin = win;
while (currentIFrame && offsetParent && offsetWin !== win) { let currentIFrame = currentWin.frameElement;
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
const iframeScale = getScale(currentIFrame); const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect(); const iframeRect = currentIFrame.getBoundingClientRect();
const css = floating_ui_utils_dom_getComputedStyle(currentIFrame); const css = floating_ui_utils_dom_getComputedStyle(currentIFrame);
@ -9110,7 +9242,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
height *= iframeScale.y; height *= iframeScale.y;
x += left; x += left;
y += top; y += top;
currentIFrame = floating_ui_utils_dom_getWindow(currentIFrame).frameElement; currentWin = floating_ui_utils_dom_getWindow(currentIFrame);
currentIFrame = currentWin.frameElement;
} }
} }
return floating_ui_utils_rectToClientRect({ return floating_ui_utils_rectToClientRect({
@ -9121,24 +9254,38 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
}); });
} }
const topLayerSelectors = [':popover-open', ':modal'];
function isTopLayer(floating) {
return topLayerSelectors.some(selector => {
try {
return floating.matches(selector);
} catch (e) {
return false;
}
});
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
let { let {
elements,
rect, rect,
offsetParent, offsetParent,
strategy strategy
} = _ref; } = _ref;
const isOffsetParentAnElement = isHTMLElement(offsetParent); const isFixed = strategy === 'fixed';
const documentElement = getDocumentElement(offsetParent); const documentElement = getDocumentElement(offsetParent);
if (offsetParent === documentElement) { const topLayer = elements ? isTopLayer(elements.floating) : false;
if (offsetParent === documentElement || topLayer && isFixed) {
return rect; return rect;
} }
let scroll = { let scroll = {
scrollLeft: 0, scrollLeft: 0,
scrollTop: 0 scrollTop: 0
}; };
let scale = createCoords(1); let scale = floating_ui_utils_createCoords(1);
const offsets = createCoords(0); const offsets = floating_ui_utils_createCoords(0);
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') { const isOffsetParentAnElement = isHTMLElement(offsetParent);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent); scroll = getNodeScroll(offsetParent);
} }
@ -9173,12 +9320,12 @@ function getDocumentRect(element) {
const html = getDocumentElement(element); const html = getDocumentElement(element);
const scroll = getNodeScroll(element); const scroll = getNodeScroll(element);
const body = element.ownerDocument.body; const body = element.ownerDocument.body;
const width = floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); const width = dist_floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
const height = floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); const height = dist_floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
let x = -scroll.scrollLeft + getWindowScrollBarX(element); let x = -scroll.scrollLeft + getWindowScrollBarX(element);
const y = -scroll.scrollTop; const y = -scroll.scrollTop;
if (floating_ui_utils_dom_getComputedStyle(body).direction === 'rtl') { if (floating_ui_utils_dom_getComputedStyle(body).direction === 'rtl') {
x += floating_ui_utils_max(html.clientWidth, body.clientWidth) - width; x += dist_floating_ui_utils_max(html.clientWidth, body.clientWidth) - width;
} }
return { return {
width, width,
@ -9218,7 +9365,7 @@ function getInnerBoundingClientRect(element, strategy) {
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
const top = clientRect.top + element.clientTop; const top = clientRect.top + element.clientTop;
const left = clientRect.left + element.clientLeft; const left = clientRect.left + element.clientLeft;
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); const scale = isHTMLElement(element) ? getScale(element) : floating_ui_utils_createCoords(1);
const width = element.clientWidth * scale.x; const width = element.clientWidth * scale.x;
const height = element.clientHeight * scale.y; const height = element.clientHeight * scale.y;
const x = left * scale.x; const x = left * scale.x;
@ -9304,10 +9451,10 @@ function getClippingRect(_ref) {
const firstClippingAncestor = clippingAncestors[0]; const firstClippingAncestor = clippingAncestors[0];
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
accRect.top = floating_ui_utils_max(rect.top, accRect.top); accRect.top = dist_floating_ui_utils_max(rect.top, accRect.top);
accRect.right = floating_ui_utils_min(rect.right, accRect.right); accRect.right = dist_floating_ui_utils_min(rect.right, accRect.right);
accRect.bottom = floating_ui_utils_min(rect.bottom, accRect.bottom); accRect.bottom = dist_floating_ui_utils_min(rect.bottom, accRect.bottom);
accRect.left = floating_ui_utils_max(rect.left, accRect.left); accRect.left = dist_floating_ui_utils_max(rect.left, accRect.left);
return accRect; return accRect;
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
return { return {
@ -9319,7 +9466,14 @@ function getClippingRect(_ref) {
} }
function getDimensions(element) { function getDimensions(element) {
return getCssDimensions(element); const {
width,
height
} = getCssDimensions(element);
return {
width,
height
};
} }
function getRectRelativeToOffsetParent(element, offsetParent, strategy) { function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
@ -9331,7 +9485,7 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
scrollLeft: 0, scrollLeft: 0,
scrollTop: 0 scrollTop: 0
}; };
const offsets = createCoords(0); const offsets = floating_ui_utils_createCoords(0);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent); scroll = getNodeScroll(offsetParent);
@ -9344,9 +9498,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
offsets.x = getWindowScrollBarX(documentElement); offsets.x = getWindowScrollBarX(documentElement);
} }
} }
const x = rect.left + scroll.scrollLeft - offsets.x;
const y = rect.top + scroll.scrollTop - offsets.y;
return { return {
x: rect.left + scroll.scrollLeft - offsets.x, x,
y: rect.top + scroll.scrollTop - offsets.y, y,
width: rect.width, width: rect.width,
height: rect.height height: rect.height
}; };
@ -9366,7 +9522,7 @@ function getTrueOffsetParent(element, polyfill) {
// such as table ancestors and cross browser bugs. // such as table ancestors and cross browser bugs.
function getOffsetParent(element, polyfill) { function getOffsetParent(element, polyfill) {
const window = floating_ui_utils_dom_getWindow(element); const window = floating_ui_utils_dom_getWindow(element);
if (!isHTMLElement(element)) { if (!isHTMLElement(element) || isTopLayer(element)) {
return window; return window;
} }
let offsetParent = getTrueOffsetParent(element, polyfill); let offsetParent = getTrueOffsetParent(element, polyfill);
@ -9379,20 +9535,15 @@ function getOffsetParent(element, polyfill) {
return offsetParent || getContainingBlock(element) || window; return offsetParent || getContainingBlock(element) || window;
} }
const getElementRects = async function (_ref) { const getElementRects = async function (data) {
let {
reference,
floating,
strategy
} = _ref;
const getOffsetParentFn = this.getOffsetParent || getOffsetParent; const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
const getDimensionsFn = this.getDimensions; const getDimensionsFn = this.getDimensions;
return { return {
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy), reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
floating: { floating: {
x: 0, x: 0,
y: 0, y: 0,
...(await getDimensionsFn(floating)) ...(await getDimensionsFn(data.floating))
} }
}; };
}; };
@ -9420,8 +9571,9 @@ function observeMove(element, onMove) {
let timeoutId; let timeoutId;
const root = getDocumentElement(element); const root = getDocumentElement(element);
function cleanup() { function cleanup() {
var _io;
clearTimeout(timeoutId); clearTimeout(timeoutId);
io && io.disconnect(); (_io = io) == null || _io.disconnect();
io = null; io = null;
} }
function refresh(skip, threshold) { function refresh(skip, threshold) {
@ -9444,14 +9596,14 @@ function observeMove(element, onMove) {
if (!width || !height) { if (!width || !height) {
return; return;
} }
const insetTop = floor(top); const insetTop = floating_ui_utils_floor(top);
const insetRight = floor(root.clientWidth - (left + width)); const insetRight = floating_ui_utils_floor(root.clientWidth - (left + width));
const insetBottom = floor(root.clientHeight - (top + height)); const insetBottom = floating_ui_utils_floor(root.clientHeight - (top + height));
const insetLeft = floor(left); const insetLeft = floating_ui_utils_floor(left);
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
const options = { const options = {
rootMargin, rootMargin,
threshold: floating_ui_utils_max(0, floating_ui_utils_min(1, threshold)) || 1 threshold: dist_floating_ui_utils_max(0, dist_floating_ui_utils_min(1, threshold)) || 1
}; };
let isFirstUpdate = true; let isFirstUpdate = true;
function handleObserve(entries) { function handleObserve(entries) {
@ -9527,7 +9679,8 @@ function autoUpdate(reference, floating, update, options) {
resizeObserver.unobserve(floating); resizeObserver.unobserve(floating);
cancelAnimationFrame(reobserveFrame); cancelAnimationFrame(reobserveFrame);
reobserveFrame = requestAnimationFrame(() => { reobserveFrame = requestAnimationFrame(() => {
resizeObserver && resizeObserver.observe(floating); var _resizeObserver;
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
}); });
} }
update(); update();
@ -9552,12 +9705,13 @@ function autoUpdate(reference, floating, update, options) {
} }
update(); update();
return () => { return () => {
var _resizeObserver2;
ancestors.forEach(ancestor => { ancestors.forEach(ancestor => {
ancestorScroll && ancestor.removeEventListener('scroll', update); ancestorScroll && ancestor.removeEventListener('scroll', update);
ancestorResize && ancestor.removeEventListener('resize', update); ancestorResize && ancestor.removeEventListener('resize', update);
}); });
cleanupIo && cleanupIo(); cleanupIo == null || cleanupIo();
resizeObserver && resizeObserver.disconnect(); (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
resizeObserver = null; resizeObserver = null;
if (animationFrame) { if (animationFrame) {
cancelAnimationFrame(frameId); cancelAnimationFrame(frameId);
@ -9565,10 +9719,66 @@ function autoUpdate(reference, floating, update, options) {
}; };
} }
/**
* Optimizes the visibility of the floating element by choosing the placement
* that has the most space available automatically, without needing to specify a
* preferred placement. Alternative to `flip`.
* @see https://floating-ui.com/docs/autoPlacement
*/
const floating_ui_dom_autoPlacement = (/* unused pure expression or super */ null && (autoPlacement$1));
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
const floating_ui_dom_shift = shift;
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/
const floating_ui_dom_flip = flip;
/**
* Provides data that allows you to change the size of the floating element
* for instance, prevent it from overflowing the clipping boundary or match the
* width of the reference element.
* @see https://floating-ui.com/docs/size
*/
const floating_ui_dom_size = size;
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/
const floating_ui_dom_hide = (/* unused pure expression or super */ null && (hide$1));
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
const floating_ui_dom_arrow = arrow;
/**
* Provides improved positioning for inline reference elements that can span
* over multiple lines, such as hyperlinks or range selections.
* @see https://floating-ui.com/docs/inline
*/
const floating_ui_dom_inline = (/* unused pure expression or super */ null && (inline$1));
/**
* Built-in `limiter` that will stop `shift()` at a certain point.
*/
const floating_ui_dom_limitShift = limitShift;
/** /**
* Computes the `x` and `y` coordinates that will place the floating element * Computes the `x` and `y` coordinates that will place the floating element
* next to a reference element when it is given a certain CSS positioning * next to a given reference element.
* strategy.
*/ */
const floating_ui_dom_computePosition = (reference, floating, options) => { const floating_ui_dom_computePosition = (reference, floating, options) => {
// This caches the expensive `getClippingElementAncestors` function so that // This caches the expensive `getClippingElementAncestors` function so that
@ -9668,7 +9878,7 @@ function getFlipMiddleware(props) {
!fallbackPlacements || fallbackPlacements.every(isValidPlacement), !fallbackPlacements || fallbackPlacements.every(isValidPlacement),
false && 0 false && 0
); );
return floating_ui_core_flip({ return floating_ui_dom_flip({
padding: props.overflowPadding, padding: props.overflowPadding,
fallbackPlacements fallbackPlacements
}); });
@ -9676,15 +9886,15 @@ function getFlipMiddleware(props) {
function getShiftMiddleware(props) { function getShiftMiddleware(props) {
if (!props.slide && !props.overlap) if (!props.slide && !props.overlap)
return; return;
return floating_ui_core_shift({ return floating_ui_dom_shift({
mainAxis: props.slide, mainAxis: props.slide,
crossAxis: props.overlap, crossAxis: props.overlap,
padding: props.overflowPadding, padding: props.overflowPadding,
limiter: limitShift() limiter: floating_ui_dom_limitShift()
}); });
} }
function getSizeMiddleware(props) { function getSizeMiddleware(props) {
return size({ return floating_ui_dom_size({
padding: props.overflowPadding, padding: props.overflowPadding,
apply({ elements, availableWidth, availableHeight, rects }) { apply({ elements, availableWidth, availableHeight, rects }) {
const wrapper = elements.floating; const wrapper = elements.floating;
@ -9716,7 +9926,7 @@ function getSizeMiddleware(props) {
function getArrowMiddleware(arrowElement, props) { function getArrowMiddleware(arrowElement, props) {
if (!arrowElement) if (!arrowElement)
return; return;
return arrow({ return floating_ui_dom_arrow({
element: arrowElement, element: arrowElement,
padding: props.arrowPadding padding: props.arrowPadding
}); });
@ -32692,14 +32902,15 @@ const floating_ui_react_dom_arrow = options => {
} = typeof options === 'function' ? options(state) : options; } = typeof options === 'function' ? options(state) : options;
if (element && isRef(element)) { if (element && isRef(element)) {
if (element.current != null) { if (element.current != null) {
return arrow({ return floating_ui_dom_arrow({
element: element.current, element: element.current,
padding padding
}).fn(state); }).fn(state);
} }
return {}; return {};
} else if (element) { }
return arrow({ if (element) {
return floating_ui_dom_arrow({
element, element,
padding padding
}).fn(state); }).fn(state);
@ -32723,11 +32934,13 @@ function deepEqual(a, b) {
if (typeof a === 'function' && a.toString() === b.toString()) { if (typeof a === 'function' && a.toString() === b.toString()) {
return true; return true;
} }
let length, i, keys; let length;
if (a && b && typeof a == 'object') { let i;
let keys;
if (a && b && typeof a === 'object') {
if (Array.isArray(a)) { if (Array.isArray(a)) {
length = a.length; length = a.length;
if (length != b.length) return false; if (length !== b.length) return false;
for (i = length; i-- !== 0;) { for (i = length; i-- !== 0;) {
if (!deepEqual(a[i], b[i])) { if (!deepEqual(a[i], b[i])) {
return false; return false;
@ -32756,6 +32969,8 @@ function deepEqual(a, b) {
} }
return true; return true;
} }
// biome-ignore lint/suspicious/noSelfCompare: in source
return a !== a && b !== b; return a !== a && b !== b;
} }
@ -32782,7 +32997,7 @@ function useLatestRef(value) {
/** /**
* Provides data to position a floating element. * Provides data to position a floating element.
* @see https://floating-ui.com/docs/react * @see https://floating-ui.com/docs/useFloating
*/ */
function useFloating(options) { function useFloating(options) {
if (options === void 0) { if (options === void 0) {
@ -32816,22 +33031,23 @@ function useFloating(options) {
const [_reference, _setReference] = external_React_.useState(null); const [_reference, _setReference] = external_React_.useState(null);
const [_floating, _setFloating] = external_React_.useState(null); const [_floating, _setFloating] = external_React_.useState(null);
const setReference = external_React_.useCallback(node => { const setReference = external_React_.useCallback(node => {
if (node != referenceRef.current) { if (node !== referenceRef.current) {
referenceRef.current = node; referenceRef.current = node;
_setReference(node); _setReference(node);
} }
}, [_setReference]); }, []);
const setFloating = external_React_.useCallback(node => { const setFloating = external_React_.useCallback(node => {
if (node !== floatingRef.current) { if (node !== floatingRef.current) {
floatingRef.current = node; floatingRef.current = node;
_setFloating(node); _setFloating(node);
} }
}, [_setFloating]); }, []);
const referenceEl = externalReference || _reference; const referenceEl = externalReference || _reference;
const floatingEl = externalFloating || _floating; const floatingEl = externalFloating || _floating;
const referenceRef = external_React_.useRef(null); const referenceRef = external_React_.useRef(null);
const floatingRef = external_React_.useRef(null); const floatingRef = external_React_.useRef(null);
const dataRef = external_React_.useRef(data); const dataRef = external_React_.useRef(data);
const hasWhileElementsMounted = whileElementsMounted != null;
const whileElementsMountedRef = useLatestRef(whileElementsMounted); const whileElementsMountedRef = useLatestRef(whileElementsMounted);
const platformRef = useLatestRef(platform); const platformRef = useLatestRef(platform);
const update = external_React_.useCallback(() => { const update = external_React_.useCallback(() => {
@ -32875,17 +33091,18 @@ function useFloating(options) {
isMountedRef.current = false; isMountedRef.current = false;
}; };
}, []); }, []);
// biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included.
index(() => { index(() => {
if (referenceEl) referenceRef.current = referenceEl; if (referenceEl) referenceRef.current = referenceEl;
if (floatingEl) floatingRef.current = floatingEl; if (floatingEl) floatingRef.current = floatingEl;
if (referenceEl && floatingEl) { if (referenceEl && floatingEl) {
if (whileElementsMountedRef.current) { if (whileElementsMountedRef.current) {
return whileElementsMountedRef.current(referenceEl, floatingEl, update); return whileElementsMountedRef.current(referenceEl, floatingEl, update);
} else {
update();
} }
update();
} }
}, [referenceEl, floatingEl, update, whileElementsMountedRef]); }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
const refs = external_React_.useMemo(() => ({ const refs = external_React_.useMemo(() => ({
reference: referenceRef, reference: referenceRef,
floating: floatingRef, floating: floatingRef,
@ -34747,7 +34964,7 @@ function overlayMiddlewares() {
}) { }) {
return rects.reference; return rects.reference;
} }
}, size({ }, floating_ui_dom_size({
apply({ apply({
rects, rects,
elements elements
@ -34916,7 +35133,7 @@ const UnconnectedPopover = (props, forwardedRef) => {
const isExpanded = expandOnMobile && isMobileViewport; const isExpanded = expandOnMobile && isMobileViewport;
const hasArrow = !isExpanded && !noArrow; const hasArrow = !isExpanded && !noArrow;
const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp; const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), offset(offsetProp), computedFlipProp && floating_ui_core_flip(), computedResizeProp && size({ const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), offset(offsetProp), computedFlipProp && floating_ui_dom_flip(), computedResizeProp && floating_ui_dom_size({
apply(sizeProps) { apply(sizeProps) {
var _refs$floating$curren; var _refs$floating$curren;
const { const {
@ -34932,9 +35149,9 @@ const UnconnectedPopover = (props, forwardedRef) => {
overflow: 'auto' overflow: 'auto'
}); });
} }
}), shift && floating_ui_core_shift({ }), shift && floating_ui_dom_shift({
crossAxis: true, crossAxis: true,
limiter: limitShift(), limiter: floating_ui_dom_limitShift(),
padding: 1 // Necessary to avoid flickering at the edge of the viewport. padding: 1 // Necessary to avoid flickering at the edge of the viewport.
}), floating_ui_react_dom_arrow({ }), floating_ui_react_dom_arrow({
element: arrowRef element: arrowRef

File diff suppressed because one or more lines are too long

View File

@ -3470,7 +3470,7 @@ const isEditingTemplate = (0,external_wp_data_namespaceObject.createRegistrySele
since: '6.5', since: '6.5',
alternative: `select( 'core/editor' ).getRenderingMode` alternative: `select( 'core/editor' ).getRenderingMode`
}); });
return select(external_wp_editor_namespaceObject.store).getRenderingMode() !== 'post-only'; return select(external_wp_editor_namespaceObject.store).getCurrentPostType() !== 'post-only';
}); });
/** /**
@ -7299,18 +7299,17 @@ function Editor({
const { const {
updatePreferredStyleVariations updatePreferredStyleVariations
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const defaultRenderingMode = currentPost.postType === 'wp_template' ? 'all' : 'post-only';
const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...settings, ...settings,
onNavigateToEntityRecord, onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord, onNavigateToPreviousEntityRecord,
defaultRenderingMode, defaultRenderingMode: 'post-only',
__experimentalPreferredStyleVariations: { __experimentalPreferredStyleVariations: {
value: preferredStyleVariations, value: preferredStyleVariations,
onChange: updatePreferredStyleVariations onChange: updatePreferredStyleVariations
}, },
hasInlineToolbar hasInlineToolbar
}), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, defaultRenderingMode]); }), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
if (!post) { if (!post) {
return null; return null;
} }
@ -7654,7 +7653,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
* so that common filters in the block library are not overwritten. * so that common filters in the block library are not overwritten.
*/ */
(0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
if ((0,external_wp_data_namespaceObject.select)(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only' && blockType.name === 'core/template-part') { if (blockType.name === 'core/template-part') {
return false; return false;
} }
return canInsert; return canInsert;
@ -7669,7 +7668,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
(0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
getBlockParentsByBlockName getBlockParentsByBlockName
}) => { }) => {
if ((0,external_wp_data_namespaceObject.select)(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only' && blockType.name === 'core/post-content') { if (blockType.name === 'core/post-content') {
return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
} }
return canInsert; return canInsert;

File diff suppressed because one or more lines are too long

View File

@ -26681,15 +26681,6 @@ function FontLibraryProvider({
const refreshLibrary = () => { const refreshLibrary = () => {
setRefreshKey(Date.now()); setRefreshKey(Date.now());
}; };
// Reset notice on dismiss.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (notice) {
notice.onRemove = () => {
setNotice(null);
};
}
}, [notice, setNotice]);
const { const {
records: libraryPosts = [], records: libraryPosts = [],
isResolving: isResolvingLibrary, isResolving: isResolvingLibrary,
@ -27000,6 +26991,12 @@ function FontLibraryProvider({
/**
* Internal dependencies
*/
function TabPanelLayout({ function TabPanelLayout({
title, title,
description, description,
@ -27008,6 +27005,9 @@ function TabPanelLayout({
children, children,
footer footer
}) { }) {
const {
setNotice
} = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext);
return (0,external_React_.createElement)("div", { return (0,external_React_.createElement)("div", {
className: "font-library-modal__tabpanel-layout" className: "font-library-modal__tabpanel-layout"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
@ -27033,7 +27033,7 @@ function TabPanelLayout({
margin: 1 margin: 1
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, { }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
status: notice.type, status: notice.type,
onRemove: notice.onRemove onRemove: () => setNotice(null)
}, notice.message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { }, notice.message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
margin: 1 margin: 1
}))), (0,external_React_.createElement)("div", { }))), (0,external_React_.createElement)("div", {
@ -31853,6 +31853,12 @@ function UploadFonts() {
}); });
if (allowedFiles.length > 0) { if (allowedFiles.length > 0) {
loadFiles(allowedFiles); loadFiles(allowedFiles);
} else {
setNotice({
type: 'error',
message: (0,external_wp_i18n_namespaceObject.__)('No fonts found to install.')
});
setIsUploading(false);
} }
}; };
@ -35214,17 +35220,15 @@ function useStartPatterns(fallbackContent) {
getEditedPostId getEditedPostId
} = select(store_store); } = select(store_store);
const { const {
getEntityRecord getEntityRecord,
getBlockPatterns
} = select(external_wp_coreData_namespaceObject.store); } = select(external_wp_coreData_namespaceObject.store);
const postId = getEditedPostId(); const postId = getEditedPostId();
const postType = getEditedPostType(); const postType = getEditedPostType();
const record = getEntityRecord('postType', postType, postId); const record = getEntityRecord('postType', postType, postId);
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
return { return {
slug: record.slug, slug: record.slug,
patterns: getSettings().__experimentalBlockPatterns patterns: getBlockPatterns()
}; };
}, []); }, []);
const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet); const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet);
@ -35781,7 +35785,7 @@ function useSpecificEditorSettings() {
}; };
}, []); }, []);
const archiveLabels = useArchiveLabel(templateSlug); const archiveLabels = useArchiveLabel(templateSlug);
const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all'; const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'post-only';
const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
return { return {
@ -41675,38 +41679,6 @@ function OperatorSelector({
hideLabelFromVision: true hideLabelFromVision: true
})); }));
} }
function ResetFilter({
filter,
view,
onChangeView,
addFilterRef
}) {
const isDisabled = filter.isPrimary && view.filters.find(_filter => _filter.field === filter.field)?.value === undefined;
return (0,external_React_.createElement)("div", {
className: "dataviews-filter-summary__reset"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
disabled: isDisabled,
__experimentalIsFocusable: true,
size: "compact",
variant: "tertiary",
style: {
justifyContent: 'center',
width: '100%'
},
onClick: () => {
onChangeView({
...view,
page: 1,
filters: view.filters.filter(_filter => _filter.field !== filter.field)
});
// If the filter is not primary and can be removed, it will be added
// back to the available filters from `Add filter` component.
if (!filter.isPrimary) {
addFilterRef.current?.focus();
}
}
}, filter.isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove')));
}
function FilterSummary({ function FilterSummary({
addFilterRef, addFilterRef,
openedFilter, openedFilter,
@ -41796,9 +41768,6 @@ function FilterSummary({
...commonProps ...commonProps
}), (0,external_React_.createElement)(SearchWidget, { }), (0,external_React_.createElement)(SearchWidget, {
...commonProps ...commonProps
}), (0,external_React_.createElement)(ResetFilter, {
...commonProps,
addFilterRef: addFilterRef
})); }));
} }
}); });
@ -41872,7 +41841,7 @@ function AddFilter({
*/ */
function reset_filters_ResetFilter({ function ResetFilter({
filters, filters,
view, view,
onChangeView onChangeView
@ -41976,7 +41945,7 @@ const Filters = (0,external_wp_element_namespaceObject.memo)(function Filters({
}); });
}), addFilter]; }), addFilter];
if (filterComponents.length > 1) { if (filterComponents.length > 1) {
filterComponents.push((0,external_React_.createElement)(reset_filters_ResetFilter, { filterComponents.push((0,external_React_.createElement)(ResetFilter, {
key: "reset-filters", key: "reset-filters",
filters: filters, filters: filters,
view: view, view: view,

File diff suppressed because one or more lines are too long

View File

@ -1704,10 +1704,22 @@ const {
unlock unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor'); } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor');
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: external ["wp","i18n"] ;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js
/**
* WordPress dependencies
*/
/* harmony default export */ const pattern_overrides = ({
name: 'core/pattern-overrides',
label: (0,external_wp_i18n_namespaceObject._x)('Pattern Overrides', 'block bindings source'),
useSource: null,
lockAttributesEditing: false
});
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
/** /**
* WordPress dependencies * WordPress dependencies
@ -2004,7 +2016,7 @@ function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
} }
return state; return state;
} }
function renderingMode(state = 'all', action) { function renderingMode(state = 'post-only', action) {
switch (action.type) { switch (action.type) {
case 'SET_RENDERING_MODE': case 'SET_RENDERING_MODE':
return action.mode; return action.mode;
@ -4792,7 +4804,7 @@ function updateEditorSettings(settings) {
* - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template. * - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template.
* - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable. * - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable.
* *
* @param {string} mode Mode (one of 'post-only', 'template-locked' or 'all'). * @param {string} mode Mode (one of 'post-only' or 'template-locked').
*/ */
const setRenderingMode = mode => ({ const setRenderingMode = mode => ({
dispatch, dispatch,
@ -5268,7 +5280,7 @@ unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
/* harmony default export */ const post_meta = ({ /* harmony default export */ const post_meta = ({
name: 'core/post-meta', name: 'core/post-meta',
label: (0,external_wp_i18n_namespaceObject.__)('Post Meta'), label: (0,external_wp_i18n_namespaceObject._x)('Post Meta', 'block bindings source'),
useSource(props, sourceAttributes) { useSource(props, sourceAttributes) {
const { const {
getCurrentPostType getCurrentPostType
@ -5297,8 +5309,7 @@ unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
placeholder: metaKey, placeholder: metaKey,
useValue: [metaValue, updateMetaValue] useValue: [metaValue, updateMetaValue]
}; };
}, }
lockAttributesEditing: true
}); });
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/index.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/index.js
@ -5312,9 +5323,11 @@ unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
*/ */
const { const {
registerBlockBindingsSource registerBlockBindingsSource
} = unlock((0,external_wp_data_namespaceObject.dispatch)(external_wp_blockEditor_namespaceObject.store)); } = unlock((0,external_wp_data_namespaceObject.dispatch)(external_wp_blockEditor_namespaceObject.store));
registerBlockBindingsSource(pattern_overrides);
registerBlockBindingsSource(post_meta); registerBlockBindingsSource(post_meta);
;// CONCATENATED MODULE: external ["wp","compose"] ;// CONCATENATED MODULE: external ["wp","compose"]
@ -15522,6 +15535,12 @@ const {
} = unlock(external_wp_blockEditor_namespaceObject.privateApis); } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const editor_canvas_noop = () => {}; const editor_canvas_noop = () => {};
/**
* These post types have a special editor where they don't allow you to fill the title
* and they don't apply the layout styles.
*/
const DESIGN_POST_TYPES = ['wp_block', 'wp_template', 'wp_navigation', 'wp_template_part'];
/** /**
* Given an array of nested blocks, find the first Post Content * Given an array of nested blocks, find the first Post Content
* block inside it, recursing through any nesting levels, * block inside it, recursing through any nesting levels,
@ -15569,7 +15588,8 @@ function EditorCanvas({
wrapperBlockName, wrapperBlockName,
wrapperUniqueId, wrapperUniqueId,
deviceType, deviceType,
showEditorPadding showEditorPadding,
isDesignPostType
} = (0,external_wp_data_namespaceObject.useSelect)(select => { } = (0,external_wp_data_namespaceObject.useSelect)(select => {
const { const {
getCurrentPostId, getCurrentPostId,
@ -15589,7 +15609,7 @@ function EditorCanvas({
let _wrapperBlockName; let _wrapperBlockName;
if (postTypeSlug === 'wp_block') { if (postTypeSlug === 'wp_block') {
_wrapperBlockName = 'core/block'; _wrapperBlockName = 'core/block';
} else if (!_renderingMode === 'post-only') { } else if (_renderingMode === 'post-only') {
_wrapperBlockName = 'core/post-content'; _wrapperBlockName = 'core/post-content';
} }
const editorSettings = getEditorSettings(); const editorSettings = getEditorSettings();
@ -15601,6 +15621,7 @@ function EditorCanvas({
return { return {
renderingMode: _renderingMode, renderingMode: _renderingMode,
postContentAttributes: editorSettings.postContentAttributes, postContentAttributes: editorSettings.postContentAttributes,
isDesignPostType: DESIGN_POST_TYPES.includes(postTypeSlug),
// Post template fetch returns a 404 on classic themes, which // Post template fetch returns a 404 on classic themes, which
// messes with e2e tests, so check it's a block theme first. // messes with e2e tests, so check it's a block theme first.
editedPostTemplate: postType?.viewable && supportsTemplateMode && canEditTemplate ? template : undefined, editedPostTemplate: postType?.viewable && supportsTemplateMode && canEditTemplate ? template : undefined,
@ -15631,7 +15652,7 @@ function EditorCanvas({
// fallbackLayout is used if there is no Post Content, // fallbackLayout is used if there is no Post Content,
// and for Post Title. // and for Post Title.
const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (renderingMode !== 'post-only') { if (renderingMode !== 'post-only' || isDesignPostType) {
return { return {
type: 'default' type: 'default'
}; };
@ -15648,7 +15669,7 @@ function EditorCanvas({
return { return {
type: 'default' type: 'default'
}; };
}, [renderingMode, themeSupportsLayout, globalLayoutSettings]); }, [renderingMode, themeSupportsLayout, globalLayoutSettings, isDesignPostType]);
const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) {
return postContentAttributes; return postContentAttributes;
@ -15736,7 +15757,7 @@ function EditorCanvas({
...deviceStyles ...deviceStyles
} }
} }
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(LayoutStyle, { }, themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(LayoutStyle, {
selector: ".editor-editor-canvas__post-title-wrapper", selector: ".editor-editor-canvas__post-title-wrapper",
layout: fallbackLayout layout: fallbackLayout
}), (0,external_React_.createElement)(LayoutStyle, { }), (0,external_React_.createElement)(LayoutStyle, {
@ -15747,7 +15768,7 @@ function EditorCanvas({
}), postContentLayoutStyles && (0,external_React_.createElement)(LayoutStyle, { }), postContentLayoutStyles && (0,external_React_.createElement)(LayoutStyle, {
layout: postContentLayout, layout: postContentLayout,
css: postContentLayoutStyles css: postContentLayoutStyles
})), renderingMode === 'post-only' && (0,external_React_.createElement)("div", { })), renderingMode === 'post-only' && !isDesignPostType && (0,external_React_.createElement)("div", {
className: classnames_default()('editor-editor-canvas__post-title-wrapper', className: classnames_default()('editor-editor-canvas__post-title-wrapper',
// The following class is only here for backward comapatibility // The following class is only here for backward comapatibility
// some themes might be using it to style the post title. // some themes might be using it to style the post title.
@ -15767,7 +15788,7 @@ function EditorCanvas({
blockName: wrapperBlockName, blockName: wrapperBlockName,
uniqueId: wrapperUniqueId uniqueId: wrapperUniqueId
}, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
className: classnames_default()(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules. className: classnames_default()(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
), ),
layout: blockListLayout, layout: blockListLayout,
dropZoneElement: dropZoneElement:

File diff suppressed because one or more lines are too long

View File

@ -670,17 +670,23 @@ function InlineLinkUI({
// Get the text content minus any HTML tags. // Get the text content minus any HTML tags.
const richTextText = richLinkTextValue.text; const richTextText = richLinkTextValue.text;
const {
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const { const {
createPageEntity, createPageEntity,
userCanCreatePages userCanCreatePages,
selectionStart
} = (0,external_wp_data_namespaceObject.useSelect)(select => { } = (0,external_wp_data_namespaceObject.useSelect)(select => {
const { const {
getSettings getSettings,
getSelectionStart
} = select(external_wp_blockEditor_namespaceObject.store); } = select(external_wp_blockEditor_namespaceObject.store);
const _settings = getSettings(); const _settings = getSettings();
return { return {
createPageEntity: _settings.__experimentalCreatePageEntity, createPageEntity: _settings.__experimentalCreatePageEntity,
userCanCreatePages: _settings.__experimentalUserCanCreatePages userCanCreatePages: _settings.__experimentalUserCanCreatePages,
selectionStart: getSelectionStart()
}; };
}, []); }, []);
const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
@ -721,7 +727,20 @@ function InlineLinkUI({
if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) { if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) {
// Scenario: we don't have any actively selected text or formats. // Scenario: we don't have any actively selected text or formats.
const inserted = (0,external_wp_richText_namespaceObject.insert)(value, newText); const inserted = (0,external_wp_richText_namespaceObject.insert)(value, newText);
newValue = (0,external_wp_richText_namespaceObject.applyFormat)(inserted, linkFormat, value.start, value.end + newText.length); newValue = (0,external_wp_richText_namespaceObject.applyFormat)(inserted, linkFormat, value.start, value.start + newText.length);
onChange(newValue);
// Close the Link UI.
stopAddingLink();
// Move the selection to the end of the inserted link outside of the format boundary
// so the user can continue typing after the link.
selectionChange({
clientId: selectionStart.clientId,
identifier: selectionStart.attributeKey,
start: value.start + newText.length + 1
});
return;
} else if (newText === richTextText) { } else if (newText === richTextText) {
newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat); newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat);
} else { } else {
@ -781,27 +800,11 @@ function InlineLinkUI({
} }
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
editableContentElement: contentRef.current, editableContentElement: contentRef.current,
settings: build_module_link_link settings: {
...build_module_link_link,
isActive
}
}); });
// As you change the link by interacting with the Link UI
// the return value of document.getSelection jumps to the field you're editing,
// not the highlighted text. Given that useAnchor uses document.getSelection,
// it will return null, since it can't find the <mark> element within the Link UI.
// This caches the last truthy value of the selection anchor reference.
// This ensures the Popover is positioned correctly on initial submission of the link.
const cachedRect = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)(popoverAnchor.getBoundingClientRect());
// If the link is not active (i.e. it is a new link) then we need to
// override the getBoundingClientRect method on the anchor element
// to return the cached value of the selection represented by the text
// that the user selected to be linked.
// If the link is active (i.e. it is an existing link) then we allow
// the default behaviour of the popover anchor to be used. This will get
// the anchor based on the `<a>` element in the rich text.
if (!isActive) {
popoverAnchor.getBoundingClientRect = () => cachedRect;
}
async function handleCreate(pageTitle) { async function handleCreate(pageTitle) {
const page = await createPageEntity({ const page = await createPageEntity({
title: pageTitle, title: pageTitle,
@ -910,17 +913,6 @@ function link_Edit({
if (!editableContentElement) { if (!editableContentElement) {
return; return;
} }
// Close the Link popover if there is no active selection
// after the link was added - this can happen if the user
// adds a link without any text selected.
// We assume that if there is no active selection after
// link insertion there are no active formats.
if (!value.activeFormats) {
editableContentElement.focus();
setAddingLink(false);
return;
}
function handleClick(event) { function handleClick(event) {
// There is a situation whereby there is an existing link in the rich text // There is a situation whereby there is an existing link in the rich text
// and the user clicks on the leftmost edge of that link and fails to activate // and the user clicks on the leftmost edge of that link and fails to activate
@ -937,7 +929,7 @@ function link_Edit({
return () => { return () => {
editableContentElement.removeEventListener('click', handleClick); editableContentElement.removeEventListener('click', handleClick);
}; };
}, [contentRef, isActive, addingLink, value]); }, [contentRef, isActive]);
function addLink(target) { function addLink(target) {
const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value)); const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value));
if (!isActive && text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) { if (!isActive && text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) {
@ -1368,22 +1360,16 @@ function InlineColorUI({
value, value,
onChange, onChange,
onClose, onClose,
contentRef contentRef,
isActive
}) { }) {
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
editableContentElement: contentRef.current, editableContentElement: contentRef.current,
settings: text_color_textColor settings: {
...text_color_textColor,
isActive
}
}); });
/*
As you change the text color by typing a HEX value into a field,
the return value of document.getSelection jumps to the field you're editing,
not the highlighted text. Given that useAnchor uses document.getSelection,
it will return null, since it can't find the <mark> element within the HEX input.
This caches the last truthy value of the selection anchor reference.
*/
const cachedRect = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)(popoverAnchor.getBoundingClientRect());
popoverAnchor.getBoundingClientRect = () => cachedRect;
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
onClose: onClose, onClose: onClose,
className: "format-library__inline-color-popover", className: "format-library__inline-color-popover",
@ -1482,7 +1468,8 @@ function TextColorEdit({
activeAttributes: activeAttributes, activeAttributes: activeAttributes,
value: value, value: value,
onChange: onChange, onChange: onChange,
contentRef: contentRef contentRef: contentRef,
isActive: isActive
})); }));
} }
const text_color_textColor = { const text_color_textColor = {

File diff suppressed because one or more lines are too long

View File

@ -3041,12 +3041,15 @@ function useAnchorRef({
}, [activeFormat, value.start, value.end, tagName, className]); }, [activeFormat, value.start, value.end, tagName, className]);
} }
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-anchor.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-anchor.js
/** /**
* WordPress dependencies * WordPress dependencies
*/ */
/** @typedef {import('../register-format-type').WPFormat} WPFormat */ /** @typedef {import('../register-format-type').WPFormat} WPFormat */
/** @typedef {import('../types').RichTextValue} RichTextValue */ /** @typedef {import('../types').RichTextValue} RichTextValue */
@ -3167,39 +3170,29 @@ function useAnchor({
}) { }) {
const { const {
tagName, tagName,
className className,
isActive
} = settings; } = settings;
const [anchor, setAnchor] = (0,external_wp_element_namespaceObject.useState)(() => getAnchor(editableContentElement, tagName, className)); const [anchor, setAnchor] = (0,external_wp_element_namespaceObject.useState)(() => getAnchor(editableContentElement, tagName, className));
const wasActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => { (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!editableContentElement) return; if (!editableContentElement) return;
const { const {
ownerDocument ownerDocument
} = editableContentElement; } = editableContentElement;
function callback() { if (editableContentElement === ownerDocument.activeElement ||
// When a link is created, we need to attach the popover to the newly created anchor.
!wasActive && isActive ||
// Sometimes we're _removing_ an active anchor, such as the inline color popover.
// When we add the color, it switches from a virtual anchor to a `<mark>` element.
// When we _remove_ the color, it switches from a `<mark>` element to a virtual anchor.
wasActive && !isActive) {
setAnchor(getAnchor(editableContentElement, tagName, className)); setAnchor(getAnchor(editableContentElement, tagName, className));
} }
function attach() { }, [editableContentElement, tagName, className, isActive, wasActive]);
ownerDocument.addEventListener('selectionchange', callback);
}
function detach() {
ownerDocument.removeEventListener('selectionchange', callback);
}
if (editableContentElement === ownerDocument.activeElement) {
attach();
}
editableContentElement.addEventListener('focusin', attach);
editableContentElement.addEventListener('focusout', detach);
return () => {
detach();
editableContentElement.removeEventListener('focusin', attach);
editableContentElement.removeEventListener('focusout', detach);
};
}, [editableContentElement, tagName, className]);
return anchor; return anchor;
} }
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-default-style.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-default-style.js
/** /**
* WordPress dependencies * WordPress dependencies

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57618'; $wp_version = '6.5-alpha-57619';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.