Editor: Backport bug fixes from Gutenberg into Core for WP 6.0.2 RC

This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.

- @wordpress/block-directory@3.4.14
 - @wordpress/block-editor@8.5.10
 - @wordpress/block-library@7.3.14
 - @wordpress/customize-widgets@3.3.14
 - @wordpress/edit-post@6.3.14
 - @wordpress/edit-site@4.3.14
 - @wordpress/edit-widgets@4.3.14
 - @wordpress/editor@12.5.10
 - @wordpress/format-library@3.4.10
 - @wordpress/reusable-blocks@3.4.10
 - @wordpress/widgets@2.4.10

Props SergeyBiryukov.
Fixes #56414.


Built from https://develop.svn.wordpress.org/trunk@53929


git-svn-id: http://core.svn.wordpress.org/trunk@53488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2022-08-23 15:42:33 +00:00
parent 08f5675e1c
commit 972e7f2a95
12 changed files with 117 additions and 74 deletions

File diff suppressed because one or more lines are too long

View File

@ -44,24 +44,16 @@ function render_block_core_post_template( $attributes, $content, $block ) {
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
$query_args = build_query_vars_from_query_block( $block, $page );
// Override the custom query with the global query if needed.
// Use global query if needed.
$use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
if ( $use_global_query ) {
global $wp_query;
if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) {
// Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination.
unset( $query_args['offset'] );
$query_args = wp_parse_args( $wp_query->query_vars, $query_args );
if ( empty( $query_args['post_type'] ) && is_singular() ) {
$query_args['post_type'] = get_post_type( get_the_ID() );
}
}
$query = clone $wp_query;
} else {
$query_args = build_query_vars_from_query_block( $block, $page );
$query = new WP_Query( $query_args );
}
$query = new WP_Query( $query_args );
if ( ! $query->have_posts() ) {
return '';
}
@ -107,6 +99,11 @@ function render_block_core_post_template( $attributes, $content, $block ) {
$content .= '<li class="' . esc_attr( $post_classes ) . '">' . $block_content . '</li>';
}
/*
* Use this function to restore the context of the template tags
* from a secondary query loop back to the main query loop.
* Since we use two custom loops, it's safest to always restore.
*/
wp_reset_postdata();
return sprintf(

View File

@ -19,24 +19,26 @@ function render_block_core_query_no_results( $attributes, $content, $block ) {
return '';
}
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
$query_args = build_query_vars_from_query_block( $block, $page );
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
// Override the custom query with the global query if needed.
$use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
if ( $use_global_query ) {
global $wp_query;
if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) {
$query_args = wp_parse_args( $wp_query->query_vars, $query_args );
}
$query = $wp_query;
} else {
$query_args = build_query_vars_from_query_block( $block, $page );
$query = new WP_Query( $query_args );
}
$query = new WP_Query( $query_args );
if ( $query->have_posts() ) {
return '';
}
wp_reset_postdata();
if ( ! $use_global_query ) {
wp_reset_postdata();
}
return sprintf(
'<div %1$s>%2$s</div>',

View File

@ -1375,6 +1375,12 @@
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
}
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
word-break: break-all;
white-space: normal;
text-align: start;
text-align-last: center;
}
.block-editor-block-styles__block-preview-container,
.block-editor-block-styles__block-preview-container * {

File diff suppressed because one or more lines are too long

View File

@ -1375,6 +1375,12 @@
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
}
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
word-break: break-all;
white-space: normal;
text-align: start;
text-align-last: center;
}
.block-editor-block-styles__block-preview-container,
.block-editor-block-styles__block-preview-container * {

File diff suppressed because one or more lines are too long

View File

@ -13469,9 +13469,9 @@ let findTimeout = time => ~(~timeouts.findIndex(t => t.time > time) || ~timeouts
raf.cancel = fn => {
onStartQueue.delete(fn);
onFrameQueue.delete(fn);
onFinishQueue.delete(fn);
updateQueue.delete(fn);
writeQueue.delete(fn);
onFinishQueue.delete(fn);
};
raf.sync = fn => {
@ -13570,15 +13570,16 @@ function update() {
pendingCount -= count;
}
if (!pendingCount) {
stop();
return;
}
onStartQueue.flush();
updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
onFrameQueue.flush();
writeQueue.flush();
onFinishQueue.flush();
if (!pendingCount) {
stop();
}
}
function makeQueue() {
@ -13650,7 +13651,6 @@ var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_)
function noop() {}
const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
value,
@ -14344,11 +14344,11 @@ function isAnimatedString(value) {
return react_spring_shared_esm_is.str(value) && (value[0] == '#' || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {}));
}
const react_spring_shared_esm_useLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? external_React_.useLayoutEffect : external_React_.useEffect;
const react_spring_shared_esm_useIsomorphicLayoutEffect = isSSR() ? external_React_.useEffect : external_React_.useLayoutEffect;
const useIsMounted = () => {
const isMounted = (0,external_React_.useRef)(false);
react_spring_shared_esm_useLayoutEffect(() => {
react_spring_shared_esm_useIsomorphicLayoutEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
@ -14424,6 +14424,27 @@ function react_spring_shared_esm_usePrev(value) {
return prevRef.current;
}
const useReducedMotion = () => {
const [reducedMotion, setReducedMotion] = useState(null);
react_spring_shared_esm_useIsomorphicLayoutEffect(() => {
const mql = window.matchMedia('(prefers-reduced-motion)');
const handleMediaChange = e => {
setReducedMotion(e.matches);
react_spring_shared_esm_assign({
skipAnimation: e.matches
});
};
handleMediaChange(mql);
mql.addEventListener('change', handleMediaChange);
return () => {
mql.removeEventListener('change', handleMediaChange);
};
}, []);
return reducedMotion;
};
;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/react-spring-animated.esm.js
@ -14701,7 +14722,7 @@ const withAnimated = (Component, host) => {
const observer = new PropsObserver(callback, deps);
const observerRef = (0,external_React_.useRef)();
react_spring_shared_esm_useLayoutEffect(() => {
react_spring_shared_esm_useIsomorphicLayoutEffect(() => {
observerRef.current = observer;
react_spring_shared_esm_each(deps, dep => addFluidObserver(dep, observer));
return () => {
@ -14949,7 +14970,7 @@ function replaceRef(ctrl, ref) {
}
function useChain(refs, timeSteps, timeFrame = 1000) {
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (timeSteps) {
let prevDelay = 0;
each(refs, (ref, i) => {
@ -16795,7 +16816,7 @@ function useSprings(length, props, deps) {
const context = (0,external_React_.useContext)(SpringContext);
const prevContext = react_spring_shared_esm_usePrev(context);
const hasContext = context !== prevContext && hasProps(context);
react_spring_shared_esm_useLayoutEffect(() => {
react_spring_shared_esm_useIsomorphicLayoutEffect(() => {
layoutId.current++;
state.ctrls = ctrls.current;
const {
@ -16860,7 +16881,7 @@ function useTrail(length, propsArg, deps) {
return props;
}, deps || [{}]);
const ref = (_passedRef = passedRef) != null ? _passedRef : result[1];
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
each(ref.current, (ctrl, i) => {
const parent = ref.current[i + (reverse ? 1 : -1)];
@ -16934,19 +16955,13 @@ function useTransition(data, props, deps) {
const transitions = [];
const usedTransitions = useRef(null);
const prevTransitions = reset ? null : usedTransitions.current;
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
usedTransitions.current = transitions;
});
useOnce(() => {
each(usedTransitions.current, t => {
var _t$ctrl$ref;
(_t$ctrl$ref = t.ctrl.ref) == null ? void 0 : _t$ctrl$ref.add(t.ctrl);
const change = changes.get(t);
if (change) {
t.ctrl.start(change.payload);
}
each(transitions, t => {
ref == null ? void 0 : ref.add(t.ctrl);
t.ctrl.ref = ref;
});
return () => {
each(usedTransitions.current, t => {
@ -16961,7 +16976,7 @@ function useTransition(data, props, deps) {
});
const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions);
const expired = reset && usedTransitions.current || [];
useLayoutEffect(() => each(expired, ({
useIsomorphicLayoutEffect(() => each(expired, ({
ctrl,
item,
key
@ -17135,7 +17150,7 @@ function useTransition(data, props, deps) {
const context = useContext(SpringContext);
const prevContext = usePrev(context);
const hasContext = context !== prevContext && hasProps(context);
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (hasContext) {
each(transitions, t => {
t.ctrl.start({
@ -17150,7 +17165,7 @@ function useTransition(data, props, deps) {
transitions.splice(ind, 1);
}
});
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
each(exitingTransitions.current.size ? exitingTransitions.current : changes, ({
phase,
payload
@ -17170,7 +17185,7 @@ function useTransition(data, props, deps) {
if (payload) {
replaceRef(ctrl, payload.ref);
if (ctrl.ref && !forceChange.current) {
if ((ctrl.ref || ref) && !forceChange.current) {
ctrl.update(payload);
} else {
ctrl.start(payload);
@ -40225,12 +40240,9 @@ function BlockStyles(_ref3) {
onClick: () => onSelectStylePreview(style),
role: "button",
tabIndex: "0"
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
as: "span",
limit: 12,
ellipsizeMode: "tail",
className: "block-editor-block-styles__item-text",
truncate: true
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1,
className: "block-editor-block-styles__item-text"
}, buttonText));
})), hoveredStyle && !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)(BlockStylesPreviewPanelFill, {
scope: scope,

File diff suppressed because one or more lines are too long

View File

@ -35329,6 +35329,38 @@ function TaxonomyControls(_ref) {
/* harmony default export */ var taxonomy_controls = (TaxonomyControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/sticky-control.js
/**
* WordPress dependencies
*/
const stickyOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Include'),
value: ''
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Exclude'),
value: 'exclude'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Only'),
value: 'only'
}];
function StickyControl(_ref) {
let {
value,
onChange
} = _ref;
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Sticky posts'),
options: stickyOptions,
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('Blog posts can be "stickied", a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.')
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/index.js
@ -35352,16 +35384,7 @@ function TaxonomyControls(_ref) {
const stickyOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Include'),
value: ''
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Exclude'),
value: 'exclude'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Only'),
value: 'only'
}];
function QueryInspectorControls(_ref) {
let {
attributes: {
@ -35456,14 +35479,11 @@ function QueryInspectorControls(_ref) {
order,
orderBy,
onChange: setQuery
}), showSticky && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Sticky posts'),
options: stickyOptions,
}), !inherit && showSticky && (0,external_wp_element_namespaceObject.createElement)(StickyControl, {
value: sticky,
onChange: value => setQuery({
sticky: value
}),
help: (0,external_wp_i18n_namespaceObject.__)('Blog posts can be "stickied", a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.')
})
})), !inherit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Filters')
}, (0,external_wp_element_namespaceObject.createElement)(taxonomy_controls, {

File diff suppressed because one or more lines are too long

View File

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