Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All backports for WordPress Beta1 #58964

Merged
merged 16 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
f8897cc
Restore default border and focus style on image url input field. (#58…
afercia Feb 9, 2024
8a16821
Spacer block: Fix `null` label in tooltip when horizontal layout (#58…
t-hamano Feb 12, 2024
781dc3b
Fix Spacer orientation when inside a block with default flex layout. …
tellthemachines Feb 12, 2024
1adfe8d
Revert "Rich text: pad multiple spaces through en/em replacement (#56…
ellatrix Feb 12, 2024
924b0f1
Site editor: fix start patterns store selector (#58813)
ellatrix Feb 12, 2024
5f03c58
Fix incorrect useAnchor positioning when switching from virtual to ri…
jeryj Feb 12, 2024
d1155e0
Close link preview if collapsed selection when creating link (#58896)
jeryj Feb 12, 2024
f7e9fdf
Pagination Numbers: Add `data-wp-key` to pagination numbers if enhanc…
DAreRodz Feb 12, 2024
50cd70c
Editor: Remove the 'all' rendering mode (#58935)
youknowriad Feb 12, 2024
72a22e5
Block Bindings: lock editing of blocks by default (#58787)
SantosGuillamot Feb 12, 2024
5ccaa81
Font Library: Show error message when no fonts found to install (#58914)
t-hamano Feb 12, 2024
a56d511
Clean up link control CSS. (#58934)
afercia Feb 12, 2024
87c120a
Use `data_wp_context` helper in core blocks and remove `data-wp-inter…
SantosGuillamot Feb 12, 2024
46eb65d
Upgrade Floating UI packages, fix nested iframe positioning bug (#58932)
jsnajdr Feb 12, 2024
8c44497
Fix layout for non viewable post types (#58962)
youknowriad Feb 13, 2024
b1e1b10
DataViews: Remove second `reset filter` button in filter dialog (#58960)
ntsekouras Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ Returns an action used to set the rendering mode of the post editor. We support

_Parameters_

- _mode_ `string`: Mode (one of 'post-only', 'template-locked' or 'all').
- _mode_ `string`: Mode (one of 'post-only' or 'template-locked').

### setTemplateValidity

Expand Down
114 changes: 46 additions & 68 deletions package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,6 @@ $block-editor-link-control-number-of-actions: 1;
}
}

.block-editor-link-control__drawer {
display: flex; // allow for ordering.
order: 30;
flex-direction: column;
flex-basis: 100%; // occupy full width.
}

// Inner div required to avoid padding/margin
// causing janky animation.
.block-editor-link-control__drawer-inner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { useRef } from '@wordpress/element';
import { useRefEffect } from '@wordpress/compose';
import { insert, isCollapsed, toHTMLString } from '@wordpress/rich-text';
import { insert, toHTMLString } from '@wordpress/rich-text';
import { getBlockTransforms, findTransform } from '@wordpress/blocks';
import { useDispatch } from '@wordpress/data';

Expand Down Expand Up @@ -47,34 +47,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 ( ! 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 insert( value, '\u2002', start - 2, start );
}
// Replace an en space followed by a space with an em space.
else if ( lastTwoCharacters === '\u2002 ' ) {
return insert( value, '\u2003', start - 2, start );
}

return value;
}

export function useInputRules( props ) {
const {
__unstableMarkLastChangeAsPersistent,
Expand Down Expand Up @@ -155,7 +127,7 @@ export function useInputRules( props ) {

return accumlator;
},
preventEventDiscovery( replacePrecedingSpaces( value ) )
preventEventDiscovery( value )
);

if ( transformed !== value ) {
Expand Down
4 changes: 0 additions & 4 deletions packages/block-editor/src/components/url-input/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ $input-size: 300px;
margin-left: 0;
margin-right: 0;

&:not(:focus) {
border-color: transparent;
}

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: $mobile-text-min-font-size;
@include break-small {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const createEditFunctionWithBindingsAttribute = () =>
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
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ function blockBindingsSources( state = {}, action ) {
[ action.sourceName ]: {
label: action.sourceLabel,
useSource: action.useSource,
lockAttributesEditing: action.lockAttributesEditing,
lockAttributesEditing: action.lockAttributesEditing ?? true,
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function ButtonEdit( props ) {
lockUrlControls:
!! metadata?.bindings?.url &&
getBlockBindingsSource( metadata?.bindings?.url?.source )
?.lockAttributesEditing === true,
?.lockAttributesEditing,
};
},
[ isSelected ]
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/file/index.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
2 changes: 1 addition & 1 deletion packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export function ImageEdit( {
lockUrlControls:
!! metadata?.bindings?.url &&
getBlockBindingsSource( metadata?.bindings?.url?.source )
?.lockAttributesEditing === true,
?.lockAttributesEditing,
};
},
[ isSingleSelected ]
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,19 @@ export default function Image( {
lockUrlControls:
!! urlBinding &&
getBlockBindingsSource( urlBinding?.source )
?.lockAttributesEditing === true,
?.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,
?.lockAttributesEditing,
lockTitleControls:
!! titleBinding &&
getBlockBindingsSource( titleBinding?.source )
?.lockAttributesEditing === true,
?.lockAttributesEditing,
};
},
[ clientId, isSingleSelected, metadata?.bindings ]
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/image/index.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 packages/block-library/src/navigation/index.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
Loading
Loading