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 gziolo, SergeyBiryukov.
Merges [53929] to the 6.0 branch.
Fixes #56414.
Built from https://develop.svn.wordpress.org/branches/6.0@53930


git-svn-id: http://core.svn.wordpress.org/branches/6.0@53489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-08-23 15:54:28 +00:00
parent bd2cb12160
commit 76684dfc4d
16 changed files with 6144 additions and 5888 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

@ -13468,9 +13468,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 => {
@ -13569,15 +13569,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() {
@ -13649,7 +13650,6 @@ var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_)
function noop() {}
const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
value,
@ -14343,11 +14343,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;
@ -14423,6 +14423,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
@ -14700,7 +14721,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 () => {
@ -14948,7 +14969,7 @@ function replaceRef(ctrl, ref) {
}
function useChain(refs, timeSteps, timeFrame = 1000) {
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (timeSteps) {
let prevDelay = 0;
each(refs, (ref, i) => {
@ -16794,7 +16815,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 {
@ -16859,7 +16880,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)];
@ -16933,19 +16954,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 => {
@ -16960,7 +16975,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
@ -17134,7 +17149,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({
@ -17149,7 +17164,7 @@ function useTransition(data, props, deps) {
transitions.splice(ind, 1);
}
});
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
each(exitingTransitions.current.size ? exitingTransitions.current : changes, ({
phase,
payload
@ -17169,7 +17184,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);
@ -40224,12 +40239,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

@ -35328,6 +35328,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
@ -35351,16 +35383,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: {
@ -35455,14 +35478,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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ moment.tz.load(__webpack_require__(1128));
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//! moment-timezone-utils.js
//! version : 0.5.34
//! version : 0.5.35
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
@ -361,7 +361,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//! moment-timezone.js
//! version : 0.5.34
//! version : 0.5.35
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
@ -392,7 +392,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// return moment;
// }
var VERSION = "0.5.34",
var VERSION = "0.5.35",
zones = {},
links = {},
countries = {},

File diff suppressed because one or more lines are too long

View File

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