Editor: second update of npm packages for 6.3 RC3.

Includes bug fixes for footnotes, patterns, command palette, top toolbar and other small regressions.

Props andrewserong, spacedmonkey.
See #58926.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
isabel_brison 2023-08-01 08:01:54 +00:00
parent 8fa9aad5e6
commit 3e103142ab
30 changed files with 6261 additions and 6132 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

@ -211,4 +211,77 @@ add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' );
function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) { function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) {
return get_metadata( 'post', $revision->ID, $field, true ); return get_metadata( 'post', $revision->ID, $field, true );
} }
add_filter( 'wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 ); add_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 );
/**
* The REST API autosave endpoint doesn't save meta, so we can use the
* `wp_creating_autosave` when it updates an exiting autosave, and
* `_wp_put_post_revision` when it creates a new autosave.
*
* @since 6.3.0
*
* @param int|array $autosave The autosave ID or array.
*/
function _wp_rest_api_autosave_meta( $autosave ) {
// Ensure it's a REST API request.
if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
return;
}
$body = rest_get_server()->get_raw_data();
$body = json_decode( $body, true );
if ( ! isset( $body['meta']['footnotes'] ) ) {
return;
}
// `wp_creating_autosave` passes the array,
// `_wp_put_post_revision` passes the ID.
$id = is_int( $autosave ) ? $autosave : $autosave['ID'];
if ( ! $id ) {
return;
}
update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] );
}
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L391C1-L391C1.
add_action( 'wp_creating_autosave', '_wp_rest_api_autosave_meta' );
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L398.
// Then https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/revision.php#L367.
add_action( '_wp_put_post_revision', '_wp_rest_api_autosave_meta' );
/**
* This is a workaround for the autosave endpoint returning early if the
* revision field are equal. The problem is that "footnotes" is not real
* revision post field, so there's nothing to compare against.
*
* This trick sets the "footnotes" field (value doesn't matter), which will
* cause the autosave endpoint to always update the latest revision. That should
* be fine, it should be ok to update the revision even if nothing changed. Of
* course, this is temporary fix.
*
* @since 6.3.0
*
* @param WP_Post $prepared_post The prepared post object.
* @param WP_REST_Request $request The request object.
*
* See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L365-L384.
* See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L219.
*/
function _wp_rest_api_force_autosave_difference( $prepared_post, $request ) {
// We only want to be altering POST requests.
if ( $request->get_method() !== 'POST' ) {
return $prepared_post;
}
// Only alter requests for the '/autosaves' route.
if ( substr( $request->get_route(), -strlen( '/autosaves' ) ) !== '/autosaves' ) {
return $prepared_post;
}
$prepared_post->footnotes = '[]';
return $prepared_post;
}
add_filter( 'rest_pre_insert_post', '_wp_rest_api_force_autosave_difference', 10, 2 );

View File

@ -221,6 +221,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
.block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty){ .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty){
display:none; display:none;
} }
.block-editor-block-contextual-toolbar.is-collapsed:after{
background:linear-gradient(270deg, #fff, transparent);
content:"";
height:100%;
position:absolute;
right:100%;
width:48px;
}
@media (min-width:782px){ @media (min-width:782px){
.block-editor-block-contextual-toolbar.is-fixed{ .block-editor-block-contextual-toolbar.is-fixed{
border-bottom:none; border-bottom:none;
@ -363,7 +371,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
width:auto; width:auto;
} }
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
width:calc(100% - 496px); width:calc(100% - 536px);
} }
} }
.block-editor-block-list__block-selection-button{ .block-editor-block-list__block-selection-button{

File diff suppressed because one or more lines are too long

View File

@ -221,6 +221,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
.block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty){ .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty){
display:none; display:none;
} }
.block-editor-block-contextual-toolbar.is-collapsed:after{
background:linear-gradient(90deg, #fff, transparent);
content:"";
height:100%;
left:100%;
position:absolute;
width:48px;
}
@media (min-width:782px){ @media (min-width:782px){
.block-editor-block-contextual-toolbar.is-fixed{ .block-editor-block-contextual-toolbar.is-fixed{
border-bottom:none; border-bottom:none;
@ -363,7 +371,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
width:auto; width:auto;
} }
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
width:calc(100% - 496px); width:calc(100% - 536px);
} }
} }
.block-editor-block-list__block-selection-button{ .block-editor-block-list__block-selection-button{

File diff suppressed because one or more lines are too long

View File

@ -770,6 +770,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
.edit-post-header-toolbar__left{ .edit-post-header-toolbar__left{
align-items:center; align-items:center;
display:inline-flex; display:inline-flex;
margin-left:8px;
padding-right:8px; padding-right:8px;
} }
@media (min-width:600px){ @media (min-width:600px){

File diff suppressed because one or more lines are too long

View File

@ -770,6 +770,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
.edit-post-header-toolbar__left{ .edit-post-header-toolbar__left{
align-items:center; align-items:center;
display:inline-flex; display:inline-flex;
margin-right:8px;
padding-left:8px; padding-left:8px;
} }
@media (min-width:600px){ @media (min-width:600px){

File diff suppressed because one or more lines are too long

View File

@ -1300,6 +1300,9 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
min-width:0; min-width:0;
width:min(100%, 450px); width:min(100%, 450px);
} }
.has-fixed-toolbar .edit-site-document-actions{
width:min(100%, 380px);
}
.edit-site-document-actions .components-button:hover{ .edit-site-document-actions .components-button:hover{
background:#e0e0e0; background:#e0e0e0;
color:var(--wp-block-synced-color); color:var(--wp-block-synced-color);
@ -2479,28 +2482,28 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
height:100%; height:100%;
} }
.edit-site-layout__sidebar{ .edit-site-layout__sidebar-region{
flex-shrink:0; flex-shrink:0;
width:100vw; width:100vw;
z-index:1; z-index:1;
} }
@media (min-width:782px){ @media (min-width:782px){
.edit-site-layout__sidebar{ .edit-site-layout__sidebar-region{
width:360px; width:360px;
} }
} }
.edit-site-layout.is-full-canvas .edit-site-layout__sidebar{ .edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region{
height:100vh; height:100vh;
position:fixed !important; position:fixed !important;
right:0; right:0;
top:0; top:0;
} }
.edit-site-layout__sidebar>div{ .edit-site-layout__sidebar-region .edit-site-layout__sidebar{
display:flex; display:flex;
flex-direction:column; flex-direction:column;
height:100%; height:100%;
} }
.edit-site-layout__sidebar .resizable-editor__drag-handle{ .edit-site-layout__sidebar-region .resizable-editor__drag-handle{
left:0; left:0;
} }
@ -2829,6 +2832,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
.edit-site-sidebar-navigation-screen__main{ .edit-site-sidebar-navigation-screen__main{
flex-grow:1; flex-grow:1;
margin-bottom:16px;
}
.edit-site-sidebar-navigation-screen__main.has-footer{
margin-bottom:0;
} }
.edit-site-sidebar-navigation-screen__content{ .edit-site-sidebar-navigation-screen__content{

File diff suppressed because one or more lines are too long

View File

@ -1300,6 +1300,9 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
min-width:0; min-width:0;
width:min(100%, 450px); width:min(100%, 450px);
} }
.has-fixed-toolbar .edit-site-document-actions{
width:min(100%, 380px);
}
.edit-site-document-actions .components-button:hover{ .edit-site-document-actions .components-button:hover{
background:#e0e0e0; background:#e0e0e0;
color:var(--wp-block-synced-color); color:var(--wp-block-synced-color);
@ -2479,28 +2482,28 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
height:100%; height:100%;
} }
.edit-site-layout__sidebar{ .edit-site-layout__sidebar-region{
flex-shrink:0; flex-shrink:0;
width:100vw; width:100vw;
z-index:1; z-index:1;
} }
@media (min-width:782px){ @media (min-width:782px){
.edit-site-layout__sidebar{ .edit-site-layout__sidebar-region{
width:360px; width:360px;
} }
} }
.edit-site-layout.is-full-canvas .edit-site-layout__sidebar{ .edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region{
height:100vh; height:100vh;
left:0; left:0;
position:fixed !important; position:fixed !important;
top:0; top:0;
} }
.edit-site-layout__sidebar>div{ .edit-site-layout__sidebar-region .edit-site-layout__sidebar{
display:flex; display:flex;
flex-direction:column; flex-direction:column;
height:100%; height:100%;
} }
.edit-site-layout__sidebar .resizable-editor__drag-handle{ .edit-site-layout__sidebar-region .resizable-editor__drag-handle{
right:0; right:0;
} }
@ -2829,6 +2832,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
.edit-site-sidebar-navigation-screen__main{ .edit-site-sidebar-navigation-screen__main{
flex-grow:1; flex-grow:1;
margin-bottom:16px;
}
.edit-site-sidebar-navigation-screen__main.has-footer{
margin-bottom:0;
} }
.edit-site-sidebar-navigation-screen__content{ .edit-site-sidebar-navigation-screen__content{

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -24407,8 +24407,8 @@ function image_Image({
ref: imageRef, ref: imageRef,
className: borderProps.className, className: borderProps.className,
style: { style: {
width: width && height || aspectRatio ? '100%' : 'inherit', width: width && height || aspectRatio ? '100%' : undefined,
height: width && height || aspectRatio ? '100%' : 'inherit', height: width && height || aspectRatio ? '100%' : undefined,
objectFit: scale, objectFit: scale,
...borderProps.style ...borderProps.style
} }
@ -35988,6 +35988,11 @@ const nextpage_init = () => initBlock({
/**
* Internal dependencies
*/
const PatternEdit = ({ const PatternEdit = ({
attributes, attributes,
@ -35997,7 +36002,14 @@ const PatternEdit = ({
const { const {
replaceBlocks, replaceBlocks,
__unstableMarkNextChangeAsNotPersistent __unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); // Run this effect when the component loads. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
setBlockEditingMode
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store));
const {
getBlockRootClientId,
getBlockEditingMode
} = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); // Run this effect when the component loads.
// This adds the Pattern's contents to the post. // This adds the Pattern's contents to the post.
// This change won't be saved. // This change won't be saved.
// It will continue to pull from the pattern file unless changes are made to its respective template part. // It will continue to pull from the pattern file unless changes are made to its respective template part.
@ -36010,16 +36022,27 @@ const PatternEdit = ({
// because nested pattern blocks cannot be inserted if the parent block supports // because nested pattern blocks cannot be inserted if the parent block supports
// inner blocks but doesn't have blockSettings in the state. // inner blocks but doesn't have blockSettings in the state.
window.queueMicrotask(() => { window.queueMicrotask(() => {
// Clone blocks from the pattern before insertion to ensure they receive const rootClientId = getBlockRootClientId(clientId); // Clone blocks from the pattern before insertion to ensure they receive
// distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628. // distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628.
const clonedBlocks = selectedPattern.blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); const clonedBlocks = selectedPattern.blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
const rootEditingMode = getBlockEditingMode(rootClientId); // Temporarily set the root block to default mode to allow replacing the pattern.
// This could happen when the page is disabling edits of non-content blocks.
__unstableMarkNextChangeAsNotPersistent(); __unstableMarkNextChangeAsNotPersistent();
replaceBlocks(clientId, clonedBlocks); setBlockEditingMode(rootClientId, 'default');
__unstableMarkNextChangeAsNotPersistent();
replaceBlocks(clientId, clonedBlocks); // Restore the root block's original mode.
__unstableMarkNextChangeAsNotPersistent();
setBlockEditingMode(rootClientId, rootEditingMode);
}); });
} }
}, [clientId, selectedPattern?.blocks, __unstableMarkNextChangeAsNotPersistent, replaceBlocks]); }, [clientId, selectedPattern?.blocks, __unstableMarkNextChangeAsNotPersistent, replaceBlocks, getBlockEditingMode, setBlockEditingMode, getBlockRootClientId]);
const props = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(); const props = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_wp_element_namespaceObject.createElement)("div", { ...props return (0,external_wp_element_namespaceObject.createElement)("div", { ...props
}); });
@ -58650,6 +58673,8 @@ const {
usesContextKey usesContextKey
} = unlock(external_wp_blockEditor_namespaceObject.privateApis); } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const formatName = 'core/footnote'; const formatName = 'core/footnote';
const POST_CONTENT_BLOCK_NAME = 'core/post-content';
const SYNCED_PATTERN_BLOCK_NAME = 'core/block';
const format = { const format = {
title: (0,external_wp_i18n_namespaceObject.__)('Footnote'), title: (0,external_wp_i18n_namespaceObject.__)('Footnote'),
tagName: 'sup', tagName: 'sup',
@ -58670,11 +58695,27 @@ const format = {
const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const { const {
getSelectedBlockClientId, getSelectedBlockClientId,
getBlocks,
getBlockRootClientId, getBlockRootClientId,
getBlockName, getBlockName,
getBlocks getBlockParentsByBlockName
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const footnotesBlockType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockType(format_name)); const footnotesBlockType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockType(format_name));
/*
* This useSelect exists because we need to use its return value
* outside the event callback.
*/
const isBlockWithinPattern = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockParentsByBlockName: _getBlockParentsByBlockName,
getSelectedBlockClientId: _getSelectedBlockClientId
} = select(external_wp_blockEditor_namespaceObject.store);
const parentCoreBlocks = _getBlockParentsByBlockName(_getSelectedBlockClientId(), SYNCED_PATTERN_BLOCK_NAME);
return parentCoreBlocks && parentCoreBlocks.length > 0;
}, []);
const { const {
selectionChange, selectionChange,
insertBlock insertBlock
@ -58686,6 +58727,11 @@ const format = {
if (postType !== 'post' && postType !== 'page') { if (postType !== 'post' && postType !== 'page') {
return null; return null;
} // Checks if the selected block lives within a pattern.
if (isBlockWithinPattern) {
return null;
} }
function onClick() { function onClick() {
@ -58706,12 +58752,22 @@ const format = {
}, value.end, value.end); }, value.end, value.end);
newValue.start = newValue.end - 1; newValue.start = newValue.end - 1;
onChange(newValue); onChange(newValue);
} // BFS search to find the first footnote block. }
const selectedClientId = getSelectedBlockClientId();
/*
* Attempts to find a common parent post content block.
* This allows for locating blocks within a page edited in the site editor.
*/
const parentPostContent = getBlockParentsByBlockName(selectedClientId, POST_CONTENT_BLOCK_NAME); // When called with a post content block, getBlocks will return
// the block with controlled inner blocks included.
const blocks = parentPostContent.length ? getBlocks(parentPostContent[0]) : getBlocks(); // BFS search to find the first footnote block.
let fnBlock = null; let fnBlock = null;
{ {
const queue = [...getBlocks()]; const queue = [...blocks];
while (queue.length) { while (queue.length) {
const block = queue.shift(); const block = queue.shift();
@ -58728,10 +58784,9 @@ const format = {
// insert it at the bottom. // insert it at the bottom.
if (!fnBlock) { if (!fnBlock) {
const clientId = getSelectedBlockClientId(); let rootClientId = getBlockRootClientId(selectedClientId);
let rootClientId = getBlockRootClientId(clientId);
while (rootClientId && getBlockName(rootClientId) !== 'core/post-content') { while (rootClientId && getBlockName(rootClientId) !== POST_CONTENT_BLOCK_NAME) {
rootClientId = getBlockRootClientId(rootClientId); rootClientId = getBlockRootClientId(rootClientId);
} }

File diff suppressed because one or more lines are too long

View File

@ -10516,15 +10516,15 @@ function getBlockProps(props = {}) {
function getInnerBlocksProps(props = {}) { function getInnerBlocksProps(props = {}) {
const { const {
innerBlocks innerBlocks
} = innerBlocksPropsProvider; } = innerBlocksPropsProvider; // Allow a different component to be passed to getSaveElement to handle
const [firstBlock] = innerBlocks !== null && innerBlocks !== void 0 ? innerBlocks : []; // inner blocks, bypassing the default serialisation.
if (!firstBlock) return props; // If the innerBlocks passed to `getSaveElement` are not blocks but already
// components, return the props as is. This is the case for if (!Array.isArray(innerBlocks)) {
// `getRichTextValues`. return { ...props,
children: innerBlocks
};
} // Value is an array of blocks, so defer to block serializer.
if (!firstBlock.clientId) return { ...props,
children: innerBlocks
}; // Value is an array of blocks, so defer to block serializer.
const html = serialize(innerBlocks, { const html = serialize(innerBlocks, {
isInnerBlocks: true isInnerBlocks: true

File diff suppressed because one or more lines are too long

View File

@ -3949,7 +3949,11 @@ function CommandMenu() {
} }
}); });
}, [registerShortcut]); }, [registerShortcut]);
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/commands', event => { (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/commands',
/** @type {import('react').KeyboardEventHandler} */
event => {
// Bails to avoid obscuring the effect of the preceding handler(s).
if (event.defaultPrevented) return;
event.preventDefault(); event.preventDefault();
if (isOpen) { if (isOpen) {

File diff suppressed because one or more lines are too long

View File

@ -2196,7 +2196,7 @@ const saveEntityRecord = (kind, name, record, {
...record ...record
}; };
data = Object.keys(data).reduce((acc, key) => { data = Object.keys(data).reduce((acc, key) => {
if (['title', 'excerpt', 'content'].includes(key)) { if (['title', 'excerpt', 'content', 'meta'].includes(key)) {
acc[key] = data[key]; acc[key] = data[key];
} }

File diff suppressed because one or more lines are too long

View File

@ -5454,6 +5454,10 @@ function SidebarButton(props) {
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js
/**
* External dependencies
*/
/** /**
* WordPress dependencies * WordPress dependencies
*/ */
@ -5463,6 +5467,7 @@ function SidebarButton(props) {
/** /**
* Internal dependencies * Internal dependencies
*/ */
@ -5502,7 +5507,9 @@ function SidebarNavigationScreen({
const theme = getTheme(currentlyPreviewingTheme()); const theme = getTheme(currentlyPreviewingTheme());
const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "edit-site-sidebar-navigation-screen__main", className: classnames_default()('edit-site-sidebar-navigation-screen__main', {
'has-footer': !!footer
}),
spacing: 0, spacing: 0,
justify: "flex-start" justify: "flex-start"
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
@ -7009,36 +7016,9 @@ function SidebarNavigationScreenGlobalStylesContent() {
} }
function SidebarNavigationScreenGlobalStylesFooter({ function SidebarNavigationScreenGlobalStylesFooter({
modifiedDateTime,
onClickRevisions onClickRevisions
}) { }) {
const {
revisions,
isLoading
} = useGlobalStylesRevisions();
const {
revisionsCount
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _globalStyles$_links$;
const {
getEntityRecord,
__experimentalGetCurrentGlobalStylesId
} = select(external_wp_coreData_namespaceObject.store);
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
return {
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
};
}, []);
const hasRevisions = revisionsCount >= 2;
const modified = revisions?.[0]?.modified;
if (!hasRevisions || isLoading || !modified) {
return null;
}
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "edit-site-sidebar-navigation-screen-global-styles__footer" className: "edit-site-sidebar-navigation-screen-global-styles__footer"
}, (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationItem, { }, (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationItem, {
@ -7054,8 +7034,8 @@ function SidebarNavigationScreenGlobalStylesFooter({
}, (0,external_wp_element_namespaceObject.createElement)("span", { }, (0,external_wp_element_namespaceObject.createElement)("span", {
className: "edit-site-sidebar-navigation-screen-global-styles__revisions__label" className: "edit-site-sidebar-navigation-screen-global-styles__revisions__label"
}, (0,external_wp_i18n_namespaceObject.__)('Last modified')), (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)("time", { }, (0,external_wp_i18n_namespaceObject.__)('Last modified')), (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)("time", {
dateTime: modified dateTime: modifiedDateTime
}, (0,external_wp_date_namespaceObject.humanTimeDiff)(modified))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { }, (0,external_wp_date_namespaceObject.humanTimeDiff)(modifiedDateTime))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
icon: library_backup, icon: library_backup,
style: { style: {
fill: 'currentcolor' fill: 'currentcolor'
@ -7064,6 +7044,10 @@ function SidebarNavigationScreenGlobalStylesFooter({
} }
function SidebarNavigationScreenGlobalStyles() { function SidebarNavigationScreenGlobalStyles() {
const {
revisions,
isLoading: isLoadingRevisions
} = useGlobalStylesRevisions();
const { const {
openGeneralSidebar, openGeneralSidebar,
setIsListViewOpened setIsListViewOpened
@ -7084,15 +7068,27 @@ function SidebarNavigationScreenGlobalStyles() {
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store);
const { const {
isViewMode, isViewMode,
isStyleBookOpened isStyleBookOpened,
revisionsCount
} = (0,external_wp_data_namespaceObject.useSelect)(select => { } = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _globalStyles$_links$;
const { const {
getCanvasMode, getCanvasMode,
getEditorCanvasContainerView getEditorCanvasContainerView
} = unlock(select(store_store)); } = unlock(select(store_store));
const {
getEntityRecord,
__experimentalGetCurrentGlobalStylesId
} = select(external_wp_coreData_namespaceObject.store);
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
return { return {
isViewMode: 'view' === getCanvasMode(), isViewMode: 'view' === getCanvasMode(),
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView() isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
}; };
}, []); }, []);
const turnOffDistractionFreeMode = (0,external_wp_element_namespaceObject.useCallback)(() => { const turnOffDistractionFreeMode = (0,external_wp_element_namespaceObject.useCallback)(() => {
@ -7127,12 +7123,17 @@ function SidebarNavigationScreenGlobalStyles() {
// has been set to 'global-styles-revisions'. // has been set to 'global-styles-revisions'.
setEditorCanvasContainerView('global-styles-revisions'); setEditorCanvasContainerView('global-styles-revisions');
}, [openGlobalStyles, setEditorCanvasContainerView]); }, [openGlobalStyles, setEditorCanvasContainerView]); // If there are no revisions, do not render a footer.
const hasRevisions = revisionsCount >= 2;
const modifiedDateTime = revisions?.[0]?.modified;
const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreen, { return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreen, {
title: (0,external_wp_i18n_namespaceObject.__)('Styles'), title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'), description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'),
content: (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreenGlobalStylesContent, null), content: (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreenGlobalStylesContent, null),
footer: (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreenGlobalStylesFooter, { footer: shouldShowGlobalStylesFooter && (0,external_wp_element_namespaceObject.createElement)(SidebarNavigationScreenGlobalStylesFooter, {
modifiedDateTime: modifiedDateTime,
onClickRevisions: openRevisions onClickRevisions: openRevisions
}), }),
actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)(SidebarButton, { actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)(SidebarButton, {
@ -10915,7 +10916,7 @@ function NavigationMenuContent({
showAppender: false showAppender: false
}), (0,external_wp_element_namespaceObject.createElement)("div", { }), (0,external_wp_element_namespaceObject.createElement)("div", {
className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor" className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor"
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, null)))); }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, null)));
} }
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js
@ -17064,7 +17065,7 @@ function useDisableNonPageContentBlocks() {
}, []); }, []);
} }
const withDisableNonPageContentBlocks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { const withDisableNonPageContentBlocks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
const isDescendentOfQueryLoop = !!props.context.queryId; const isDescendentOfQueryLoop = props.context.queryId !== undefined;
const isPageContent = PAGE_CONTENT_BLOCK_TYPES.includes(props.name) && !isDescendentOfQueryLoop; const isPageContent = PAGE_CONTENT_BLOCK_TYPES.includes(props.name) && !isDescendentOfQueryLoop;
const mode = isPageContent ? 'contentOnly' : undefined; const mode = isPageContent ? 'contentOnly' : undefined;
disable_non_page_content_blocks_useBlockEditingMode(mode); disable_non_page_content_blocks_useBlockEditingMode(mode);
@ -23794,6 +23795,9 @@ function Layout() {
} }
}, (0,external_wp_element_namespaceObject.createElement)(HeaderEditMode, null)))), (0,external_wp_element_namespaceObject.createElement)("div", { }, (0,external_wp_element_namespaceObject.createElement)(HeaderEditMode, null)))), (0,external_wp_element_namespaceObject.createElement)("div", {
className: "edit-site-layout__content" className: "edit-site-layout__content"
}, (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
className: "edit-site-layout__sidebar-region"
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
// The sidebar is needed for routing on mobile // The sidebar is needed for routing on mobile
// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003), // (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
@ -23810,8 +23814,6 @@ function Layout() {
ease: 'easeOut' ease: 'easeOut'
}, },
className: "edit-site-layout__sidebar" className: "edit-site-layout__sidebar"
}, (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation')
}, (0,external_wp_element_namespaceObject.createElement)(sidebar, null))), (0,external_wp_element_namespaceObject.createElement)(SavePanel, null), showCanvas && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage && (0,external_wp_element_namespaceObject.createElement)(PageMain, null), isEditorPage && (0,external_wp_element_namespaceObject.createElement)("div", { }, (0,external_wp_element_namespaceObject.createElement)(sidebar, null))), (0,external_wp_element_namespaceObject.createElement)(SavePanel, null), showCanvas && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage && (0,external_wp_element_namespaceObject.createElement)(PageMain, null), isEditorPage && (0,external_wp_element_namespaceObject.createElement)("div", {
className: classnames_default()('edit-site-layout__canvas-container', { className: classnames_default()('edit-site-layout__canvas-container', {
'is-resizing': isResizing 'is-resizing': isResizing

File diff suppressed because one or more lines are too long

View File

@ -2896,10 +2896,10 @@ const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegis
if (hasChangedContent(state)) { if (hasChangedContent(state)) {
return true; return true;
} // If the title or excerpt has changed, the post is autosaveable. } // If title, excerpt, or meta have changed, the post is autosaveable.
return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
}); });
/** /**
* Return true if the post being edited is being scheduled. Preferring the * Return true if the post being edited is being scheduled. Preferring the

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.4-alpha-56331'; $wp_version = '6.4-alpha-56332';
/** /**
* 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.