Skip to content

Commit

Permalink
Editor: Update Packages with the latest bug fixes for 6.5 beta1.
Browse files Browse the repository at this point in the history
It includes all the backports from this Gutenberg PR WordPress/gutenberg#58964

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


git-svn-id: https://core.svn.wordpress.org/trunk@57120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
youknowriad committed Feb 13, 2024
1 parent 3f70c7a commit c8e2620
Show file tree
Hide file tree
Showing 41 changed files with 478 additions and 342 deletions.
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-includes/blocks/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static function ( $matches ) {

$processor = new WP_HTML_Tag_Processor( $content );
$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->set_attribute( 'data-wp-bind--hidden', '!state.hasPdfPreview' );
$processor->set_attribute( 'hidden', true );
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/blocks/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$figure_class_names = $p->get_attribute( 'class' );
$figure_styles = $p->get_attribute( 'style' );
$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(
'data-wp-context',
wp_json_encode(
Expand Down Expand Up @@ -240,7 +240,7 @@ function block_core_image_print_lightbox_overlay() {
echo <<<HTML
<div
class="wp-lightbox-overlay zoom"
data-wp-interactive='{"namespace":"core/image"}'
data-wp-interactive="core/image"
data-wp-context='{}'
data-wp-bind--role="state.roleAttribute"
data-wp-bind--aria-label="state.currentImage.ariaLabel"
Expand Down
12 changes: 5 additions & 7 deletions wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,19 +557,17 @@ private static function get_nav_element_directives( $is_interactive, $attributes
return '';
}
// When adding to this array be mindful of security concerns.
$nav_element_context = wp_json_encode(
$nav_element_context = data_wp_context(
array(
'overlayOpenedBy' => array(),
'type' => 'overlay',
'roleAttribute' => '',
'ariaLabel' => __( 'Menu' ),
),
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
)
);
$nav_element_directives = '
data-wp-interactive=\'{"namespace":"core/navigation"}\'
data-wp-context=\'' . $nav_element_context . '\'
';
data-wp-interactive="core/navigation"'
. $nav_element_context;

/*
* When the navigation's 'overlayMenu' attribute is set to 'always', JavaScript
Expand Down Expand Up @@ -780,7 +778,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
)
) ) {
// 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-watch', 'callbacks.initMenu' );
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
Expand Down
15 changes: 9 additions & 6 deletions wp-includes/blocks/query-pagination-numbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo
}

if ( $enhanced_pagination ) {
$p = new WP_HTML_Tag_Processor( $content );
$p = new WP_HTML_Tag_Processor( $content );
$tag_index = 0;
while ( $p->next_tag(
array(
'tag_name' => 'a',
'class_name' => 'page-numbers',
)
array( '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();
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function render_block_core_query( $attributes, $content, $block ) {
$p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag() ) {
// 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-init', 'callbacks.setQueryRef' );
$p->set_attribute( 'data-wp-context', '{}' );
Expand Down
20 changes: 14 additions & 6 deletions wp-includes/blocks/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function render_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.
// 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 = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
Expand Down Expand Up @@ -179,12 +179,20 @@ function render_block_core_search( $attributes ) {
if ( $is_expandable_searchfield ) {
$aria_label_expanded = __( 'Submit Search' );
$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 = '
data-wp-interactive=\'{ "namespace": "core/search" }\'
data-wp-context=\'{ "isSearchInputVisible": ' . $open_by_default . ', "inputId": "' . $input_id . '", "ariaLabelExpanded": "' . $aria_label_expanded . '", "ariaLabelCollapsed": "' . $aria_label_collapsed . '" }\'
data-wp-class--wp-block-search__searchfield-hidden="!context.isSearchInputVisible"
data-wp-on--keydown="actions.handleSearchKeydown"
data-wp-on--focusout="actions.handleSearchFocusout"
data-wp-interactive=\'"core/search"\''
. $form_context .
'data-wp-class--wp-block-search__searchfield-hidden="!context.isSearchInputVisible"
data-wp-on--keydown="actions.handleSearchKeydown"
data-wp-on--focusout="actions.handleSearchFocusout"
';
}

Expand Down
1 change: 1 addition & 0 deletions wp-includes/blocks/spacer/editor-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
content:none;
}
.block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0;
}
2 changes: 1 addition & 1 deletion wp-includes/blocks/spacer/editor-rtl.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions wp-includes/blocks/spacer/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
content:none;
}
.block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0;
}
2 changes: 1 addition & 1 deletion wp-includes/blocks/spacer/editor.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions wp-includes/css/dist/block-editor/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1919,13 +1919,6 @@ iframe[name=editor-canvas].has-editor-padding{
top:0;
}

.block-editor-link-control__drawer{
display:flex;
flex-basis:100%;
flex-direction:column;
order:30;
}

.block-editor-link-control__drawer-inner{
display:flex;
flex-basis:100%;
Expand Down Expand Up @@ -2714,17 +2707,10 @@ iframe[name=editor-canvas].has-editor-padding{
padding:8px 12px 8px 8px;
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){
.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;
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{
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-editor/style-rtl.min.css

Large diffs are not rendered by default.

16 changes: 1 addition & 15 deletions wp-includes/css/dist/block-editor/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1919,13 +1919,6 @@ iframe[name=editor-canvas].has-editor-padding{
top:0;
}

.block-editor-link-control__drawer{
display:flex;
flex-basis:100%;
flex-direction:column;
order:30;
}

.block-editor-link-control__drawer-inner{
display:flex;
flex-basis:100%;
Expand Down Expand Up @@ -2714,17 +2707,10 @@ iframe[name=editor-canvas].has-editor-padding{
padding:8px 8px 8px 12px;
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){
.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;
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{
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-editor/style.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wp-includes/css/dist/block-library/editor-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
content:none;
}
.block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-library/editor-rtl.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wp-includes/css/dist/block-library/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
content:none;
}
.block-library-spacer__resize-container.resize-horizontal{
height:100% !important;
margin-bottom:0;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-library/editor.min.css

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions wp-includes/css/dist/edit-site/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,6 @@ body.is-fullscreen-mode .interface-interface-skeleton{
color:#757575;
}

.dataviews-filter-summary__reset{
border-top:1px solid #e0e0e0;
padding:4px;
}

.dataviews-filter-summary__chip-container{
position:relative;
white-space:pre-wrap;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/edit-site/style-rtl.min.css

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions wp-includes/css/dist/edit-site/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,6 @@ body.is-fullscreen-mode .interface-interface-skeleton{
color:#757575;
}

.dataviews-filter-summary__reset{
border-top:1px solid #e0e0e0;
padding:4px;
}

.dataviews-filter-summary__chip-container{
position:relative;
white-space:pre-wrap;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/edit-site/style.min.css

Large diffs are not rendered by default.

36 changes: 4 additions & 32 deletions wp-includes/js/dist/block-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10957,12 +10957,13 @@ function lastFocus(state = false, action) {
}
function blockBindingsSources(state = {}, action) {
if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') {
var _action$lockAttribute;
return {
...state,
[action.sourceName]: {
label: action.sourceLabel,
useSource: action.useSource,
lockAttributesEditing: action.lockAttributesEditing
lockAttributesEditing: (_action$lockAttribute = action.lockAttributesEditing) !== null && _action$lockAttribute !== void 0 ? _action$lockAttribute : true
}
};
}
Expand Down Expand Up @@ -34175,7 +34176,7 @@ const createEditFunctionWithBindingsAttribute = () => (0,external_wp_compose_nam
if (updatedAttributes?.metadata?.bindings) {
Object.entries(updatedAttributes.metadata.bindings).forEach(([attributeName, settings]) => {
const source = getBlockBindingsSource(settings.source);
if (source) {
if (source && source.useSource) {
// Second argument (`updateMetaValue`) will be used to update the value in the future.
const {
placeholder,
Expand Down Expand Up @@ -58718,35 +58719,6 @@ function findSelection(blocks) {
}
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) {
const {
__unstableMarkLastChangeAsPersistent,
Expand Down Expand Up @@ -58826,7 +58798,7 @@ function useInputRules(props) {
accumlator = __unstableInputRule(accumlator);
}
return accumlator;
}, preventEventDiscovery(replacePrecedingSpaces(value)));
}, preventEventDiscovery(value));
if (transformed !== value) {
__unstableMarkLastChangeAsPersistent();
onChange({
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/js/dist/block-editor.min.js

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions wp-includes/js/dist/block-library.js
Original file line number Diff line number Diff line change
Expand Up @@ -5081,7 +5081,7 @@ function ButtonEdit(props) {
getBlockBindingsSource
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
return {
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing === true
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
};
}, [isSelected]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
Expand Down Expand Up @@ -25988,13 +25988,13 @@ function image_Image({
} = metadata?.bindings || {};
const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0;
return {
lockUrlControls: !!urlBinding && getBlockBindingsSource(urlBinding?.source)?.lockAttributesEditing === true,
lockUrlControls: !!urlBinding && getBlockBindingsSource(urlBinding?.source)?.lockAttributesEditing,
lockHrefControls:
// 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.
hasParentPattern,
lockAltControls: !!altBinding && getBlockBindingsSource(altBinding?.source)?.lockAttributesEditing === true,
lockTitleControls: !!titleBinding && getBlockBindingsSource(titleBinding?.source)?.lockAttributesEditing === true
lockAltControls: !!altBinding && getBlockBindingsSource(altBinding?.source)?.lockAttributesEditing,
lockTitleControls: !!titleBinding && getBlockBindingsSource(titleBinding?.source)?.lockAttributesEditing
};
}, [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, {
Expand Down Expand Up @@ -26548,7 +26548,7 @@ function ImageEdit({
getBlockBindingsSource
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
return {
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing === true
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
};
}, [isSingleSelected]);
const placeholder = content => {
Expand Down Expand Up @@ -53885,10 +53885,13 @@ const SpacerEdit = ({
} = context;
const {
orientation: parentOrientation,
type
type,
default: {
type: defaultType
} = {}
} = parentLayout || {};
// 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
// of the parent or use the flex default orientation.
const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation;
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/js/dist/block-library.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit c8e2620

Please sign in to comment.