Editor: update npm packages with bug fixes for 6.3 RC2.
Includes miscellaneous bug fixes for 6.3 RC12. Props ramonopoly, audrasjb, swissspidy, peterwilsoncc, joemcgill. Fixes #58804. Built from https://develop.svn.wordpress.org/trunk@56298 git-svn-id: http://core.svn.wordpress.org/trunk@55810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
119459806f
commit
baf1c9d87a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,8 @@
|
|||
/**
|
||||
* Function that recursively renders a list of nested comments.
|
||||
*
|
||||
* @since 6.3.0 Changed render_block_context priority to `1`.
|
||||
*
|
||||
* @global int $comment_depth
|
||||
*
|
||||
* @param WP_Comment[] $comments The array of comments.
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
/**
|
||||
* Renders the `core/footnotes` block on the server.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
|
@ -57,6 +59,8 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
|
|||
|
||||
/**
|
||||
* Registers the `core/footnotes` block on the server.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*/
|
||||
function register_block_core_footnotes() {
|
||||
foreach ( array( 'post', 'page' ) as $post_type ) {
|
||||
|
@ -78,3 +82,133 @@ function register_block_core_footnotes() {
|
|||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_footnotes' );
|
||||
|
||||
/**
|
||||
* Saves the footnotes meta value to the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_save_footnotes_meta( $revision_id ) {
|
||||
$post_id = wp_is_post_revision( $revision_id );
|
||||
|
||||
if ( $post_id ) {
|
||||
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'wp_after_insert_post', 'wp_save_footnotes_meta' );
|
||||
|
||||
/**
|
||||
* Keeps track of the revision ID for "rest_after_insert_{$post_type}".
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
|
||||
*
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_keep_footnotes_revision_id( $revision_id ) {
|
||||
global $wp_temporary_footnote_revision_id;
|
||||
$wp_temporary_footnote_revision_id = $revision_id;
|
||||
}
|
||||
add_action( '_wp_put_post_revision', 'wp_keep_footnotes_revision_id' );
|
||||
|
||||
/**
|
||||
* This is a specific fix for the REST API. The REST API doesn't update
|
||||
* the post and post meta in one go (through `meta_input`). While it
|
||||
* does fix the `wp_after_insert_post` hook to be called correctly after
|
||||
* updating meta, it does NOT fix hooks such as post_updated and
|
||||
* save_post, which are normally also fired after post meta is updated
|
||||
* in `wp_insert_post()`. Unfortunately, `wp_save_post_revision` is
|
||||
* added to the `post_updated` action, which means the meta is not
|
||||
* available at the time, so we have to add it afterwards through the
|
||||
* `"rest_after_insert_{$post_type}"` action.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
|
||||
*
|
||||
* @param WP_Post $post The post object.
|
||||
*/
|
||||
function wp_add_footnotes_revisions_to_post_meta( $post ) {
|
||||
global $wp_temporary_footnote_revision_id;
|
||||
|
||||
if ( $wp_temporary_footnote_revision_id ) {
|
||||
$revision = get_post( $wp_temporary_footnote_revision_id );
|
||||
|
||||
if ( ! $revision ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id = $revision->post_parent;
|
||||
|
||||
// Just making sure we're updating the right revision.
|
||||
if ( $post->ID === $post_id ) {
|
||||
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( array( 'post', 'page' ) as $post_type ) {
|
||||
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the footnotes meta value from the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_restore_footnotes_from_revision( $post_id, $revision_id ) {
|
||||
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
update_post_meta( $post_id, 'footnotes', $footnotes );
|
||||
} else {
|
||||
delete_post_meta( $post_id, 'footnotes' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_restore_post_revision', 'wp_restore_footnotes_from_revision', 10, 2 );
|
||||
|
||||
/**
|
||||
* Adds the footnotes field to the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param array $fields The revision fields.
|
||||
* @return array The revision fields.
|
||||
*/
|
||||
function wp_add_footnotes_to_revision( $fields ) {
|
||||
$fields['footnotes'] = __( 'Footnotes' );
|
||||
return $fields;
|
||||
}
|
||||
add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' );
|
||||
|
||||
/**
|
||||
* Gets the footnotes field from the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param string $revision_field The field value, but $revision->$field
|
||||
* (footnotes) does not exist.
|
||||
* @param string $field The field name, in this case "footnotes".
|
||||
* @param object $revision The revision object to compare against.
|
||||
* @return string The field value.
|
||||
*/
|
||||
function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) {
|
||||
return get_metadata( 'post', $revision->ID, $field, true );
|
||||
}
|
||||
add_filter( 'wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 );
|
||||
|
|
|
@ -22,6 +22,8 @@ function register_block_core_pattern() {
|
|||
/**
|
||||
* Renders the `core/pattern` block on the server.
|
||||
*
|
||||
* @since 6.3.0 Backwards compatibility: blocks with no `syncStatus` attribute do not receive block wrapper.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
*
|
||||
* @return string Returns the output of the pattern.
|
||||
|
|
|
@ -34,6 +34,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
|
|||
/**
|
||||
* Renders the `core/post-template` block on the server.
|
||||
*
|
||||
* @since 6.3.0 Changed render_block_context priority to `1`.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
/**
|
||||
* Renders the `core/post-title` block on the server.
|
||||
*
|
||||
* @since 6.3.0 Omitting the $post argument from the `get_the_title`.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
* @param WP_Block $block Block instance.
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
/**
|
||||
* Dynamically renders the `core/search` block.
|
||||
*
|
||||
* @since 6.3.0 Using block.json `viewScript` to register script, and update `view_script_handles()` only when needed.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The saved content.
|
||||
* @param WP_Block $block The parsed block.
|
||||
|
|
|
@ -360,6 +360,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
|
|||
}
|
||||
@media (min-width:960px){
|
||||
.block-editor-block-contextual-toolbar.is-fixed{
|
||||
width:auto;
|
||||
}
|
||||
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
|
||||
width:calc(100% - 496px);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -360,6 +360,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
|
|||
}
|
||||
@media (min-width:960px){
|
||||
.block-editor-block-contextual-toolbar.is-fixed{
|
||||
width:auto;
|
||||
}
|
||||
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed{
|
||||
width:calc(100% - 496px);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1671,6 +1671,9 @@ body.is-fullscreen-mode .edit-site-list-header{
|
|||
width:300px;
|
||||
}
|
||||
}
|
||||
.edit-site-patterns .edit-site-patterns__sync-status-filter-option:not([aria-checked=true]){
|
||||
color:#949494;
|
||||
}
|
||||
.edit-site-patterns .edit-site-patterns__sync-status-filter-option:active{
|
||||
background:#757575;
|
||||
color:#f0f0f0;
|
||||
|
@ -2540,7 +2543,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
top:0;
|
||||
width:100%;
|
||||
}
|
||||
.edit-site-layout__canvas:has(.edit-site-layout__resizable-frame-oversized){
|
||||
.edit-site-layout__canvas.is-right-aligned{
|
||||
justify-content:flex-end;
|
||||
}
|
||||
.edit-site-layout__canvas>div{
|
||||
|
@ -3156,8 +3159,12 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
.edit-site-site-hub .edit-site-site-hub__site-title,.edit-site-site-hub .edit-site-site-hub_toggle-command-center{
|
||||
transition:opacity .1s ease;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-title.is-transparent,.edit-site-site-hub .edit-site-site-hub_toggle-command-center.is-transparent{
|
||||
opacity:0 !important;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link{
|
||||
flex-grow:0;
|
||||
margin-left:var(--wp-admin-border-width-focus);
|
||||
}
|
||||
@media (min-width:480px){
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link{
|
||||
|
@ -3166,9 +3173,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
}
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link:focus{
|
||||
box-shadow:none;
|
||||
opacity:1;
|
||||
outline:none;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link svg{
|
||||
fill:#e0e0e0;
|
||||
|
@ -3187,6 +3192,9 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
height:60px;
|
||||
width:60px;
|
||||
}
|
||||
.edit-site-site-hub__view-mode-toggle-container.has-transparent-background{
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
.edit-site-site-hub__text-content{
|
||||
overflow:hidden;
|
||||
|
@ -3346,13 +3354,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
.edit-site-resizable-frame__inner{
|
||||
position:relative;
|
||||
}
|
||||
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__site-title,body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub_toggle-command-center{
|
||||
opacity:0 !important;
|
||||
}
|
||||
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__view-mode-toggle-container{
|
||||
background-color:initial;
|
||||
}
|
||||
|
||||
body:has(.edit-site-resizable-frame__inner.is-resizing){
|
||||
cursor:col-resize;
|
||||
user-select:none;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1671,6 +1671,9 @@ body.is-fullscreen-mode .edit-site-list-header{
|
|||
width:300px;
|
||||
}
|
||||
}
|
||||
.edit-site-patterns .edit-site-patterns__sync-status-filter-option:not([aria-checked=true]){
|
||||
color:#949494;
|
||||
}
|
||||
.edit-site-patterns .edit-site-patterns__sync-status-filter-option:active{
|
||||
background:#757575;
|
||||
color:#f0f0f0;
|
||||
|
@ -2540,7 +2543,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
top:0;
|
||||
width:100%;
|
||||
}
|
||||
.edit-site-layout__canvas:has(.edit-site-layout__resizable-frame-oversized){
|
||||
.edit-site-layout__canvas.is-right-aligned{
|
||||
justify-content:flex-end;
|
||||
}
|
||||
.edit-site-layout__canvas>div{
|
||||
|
@ -3156,8 +3159,12 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
.edit-site-site-hub .edit-site-site-hub__site-title,.edit-site-site-hub .edit-site-site-hub_toggle-command-center{
|
||||
transition:opacity .1s ease;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-title.is-transparent,.edit-site-site-hub .edit-site-site-hub_toggle-command-center.is-transparent{
|
||||
opacity:0 !important;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link{
|
||||
flex-grow:0;
|
||||
margin-right:var(--wp-admin-border-width-focus);
|
||||
}
|
||||
@media (min-width:480px){
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link{
|
||||
|
@ -3166,9 +3173,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
}
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link:focus{
|
||||
box-shadow:none;
|
||||
opacity:1;
|
||||
outline:none;
|
||||
}
|
||||
.edit-site-site-hub .edit-site-site-hub__site-view-link svg{
|
||||
fill:#e0e0e0;
|
||||
|
@ -3187,6 +3192,9 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
height:60px;
|
||||
width:60px;
|
||||
}
|
||||
.edit-site-site-hub__view-mode-toggle-container.has-transparent-background{
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
.edit-site-site-hub__text-content{
|
||||
overflow:hidden;
|
||||
|
@ -3346,13 +3354,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
|||
.edit-site-resizable-frame__inner{
|
||||
position:relative;
|
||||
}
|
||||
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__site-title,body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub_toggle-command-center{
|
||||
opacity:0 !important;
|
||||
}
|
||||
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__view-mode-toggle-container{
|
||||
background-color:initial;
|
||||
}
|
||||
|
||||
body:has(.edit-site-resizable-frame__inner.is-resizing){
|
||||
cursor:col-resize;
|
||||
user-select:none;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27773,7 +27773,8 @@ const usePatternsState = (onInsert, rootClientId) => {
|
|||
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||
/* translators: %s: block pattern title. */
|
||||
(0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), {
|
||||
type: 'snackbar'
|
||||
type: 'snackbar',
|
||||
id: 'block-pattern-inserted-notice'
|
||||
});
|
||||
}, [createSuccessNotice, onInsert]);
|
||||
return [patterns, allCategories, onClickPattern];
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23713,12 +23713,116 @@ const image_deprecated_v5 = {
|
|||
};
|
||||
/**
|
||||
* Deprecation for adding width and height as style rules on the inner img.
|
||||
* It also updates the widht and height attributes to be strings instead of numbers.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/31366
|
||||
*/
|
||||
|
||||
const image_deprecated_v6 = {
|
||||
attributes: {
|
||||
align: {
|
||||
type: 'string'
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'img',
|
||||
attribute: 'src',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
alt: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'img',
|
||||
attribute: 'alt',
|
||||
default: '',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
caption: {
|
||||
type: 'string',
|
||||
source: 'html',
|
||||
selector: 'figcaption',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'img',
|
||||
attribute: 'title',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
href: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'figure > a',
|
||||
attribute: 'href',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
rel: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'figure > a',
|
||||
attribute: 'rel'
|
||||
},
|
||||
linkClass: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'figure > a',
|
||||
attribute: 'class'
|
||||
},
|
||||
id: {
|
||||
type: 'number',
|
||||
__experimentalRole: 'content'
|
||||
},
|
||||
width: {
|
||||
type: 'number'
|
||||
},
|
||||
height: {
|
||||
type: 'number'
|
||||
},
|
||||
aspectRatio: {
|
||||
type: 'string'
|
||||
},
|
||||
scale: {
|
||||
type: 'string'
|
||||
},
|
||||
sizeSlug: {
|
||||
type: 'string'
|
||||
},
|
||||
linkDestination: {
|
||||
type: 'string'
|
||||
},
|
||||
linkTarget: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
selector: 'figure > a',
|
||||
attribute: 'target'
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
anchor: true,
|
||||
behaviors: {
|
||||
lightbox: true
|
||||
},
|
||||
color: {
|
||||
text: false,
|
||||
background: false
|
||||
},
|
||||
filter: {
|
||||
duotone: true
|
||||
},
|
||||
__experimentalBorder: {
|
||||
color: true,
|
||||
radius: true,
|
||||
width: true,
|
||||
__experimentalSkipSerialization: true,
|
||||
__experimentalDefaultControls: {
|
||||
color: true,
|
||||
radius: true,
|
||||
width: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
save({
|
||||
attributes
|
||||
}) {
|
||||
|
@ -23740,7 +23844,7 @@ const image_deprecated_v6 = {
|
|||
title
|
||||
} = attributes;
|
||||
const newRel = !rel ? undefined : rel;
|
||||
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)(attributes);
|
||||
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
|
||||
const classes = classnames_default()({
|
||||
[`align${align}`]: align,
|
||||
[`size-${sizeSlug}`]: sizeSlug,
|
||||
|
@ -56068,7 +56172,7 @@ function TemplatePartImportControls({
|
|||
type: "submit",
|
||||
isBusy: isBusy,
|
||||
"aria-disabled": isBusy || !selectedSidebar
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Import')))));
|
||||
}, (0,external_wp_i18n_namespaceObject._x)('Import', 'button label')))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/advanced-controls.js
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10761,7 +10761,7 @@ function __unstableSerializeAndClean(blocks) {
|
|||
// single freeform block as legacy content and apply
|
||||
// pre-block-editor removep'd content formatting.
|
||||
|
||||
if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName()) {
|
||||
if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === 'core/freeform') {
|
||||
content = (0,external_wp_autop_namespaceObject.removep)(content);
|
||||
}
|
||||
|
||||
|
@ -13800,7 +13800,7 @@ function normalizeRawBlock(rawBlock, options) {
|
|||
// automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
|
||||
// meaning there are no negative consequences to repeated autop calls.
|
||||
|
||||
if (rawBlockName === fallbackBlockName && !options?.__unstableSkipAutop) {
|
||||
if (rawBlockName === fallbackBlockName && rawBlockName === 'core/freeform' && !options?.__unstableSkipAutop) {
|
||||
rawInnerHTML = (0,external_wp_autop_namespaceObject.autop)(rawInnerHTML).trim();
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3886,11 +3886,12 @@ function useFocusOnMount(focusOnMount = 'firstElement') {
|
|||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
/** @type {Element|null} */
|
||||
|
||||
let origin = null;
|
||||
/**
|
||||
* When opening modals/sidebars/dialogs, the focus
|
||||
* must move to the opened area and return to the
|
||||
* previously focused element when closed.
|
||||
* The current hook implements the returning behavior.
|
||||
* Adds the unmount behavior of returning focus to the element which had it
|
||||
* previously as is expected for roles like menus or dialogs.
|
||||
*
|
||||
* @param {() => void} [onFocusReturn] Overrides the default return behavior.
|
||||
* @return {import('react').RefCallback<HTMLElement>} Element Ref.
|
||||
|
@ -3935,6 +3936,9 @@ function useFocusReturn(onFocusReturn) {
|
|||
const isFocused = ref.current?.contains(ref.current?.ownerDocument.activeElement);
|
||||
|
||||
if (ref.current?.isConnected && !isFocused) {
|
||||
var _origin;
|
||||
|
||||
(_origin = origin) !== null && _origin !== void 0 ? _origin : origin = focusedBeforeMount.current;
|
||||
return;
|
||||
} // Defer to the component's own explicit focus return behavior, if
|
||||
// specified. This allows for support that the `onFocusReturn`
|
||||
|
@ -3945,9 +3949,11 @@ function useFocusReturn(onFocusReturn) {
|
|||
if (onFocusReturnRef.current) {
|
||||
onFocusReturnRef.current();
|
||||
} else {
|
||||
/** @type {null | HTMLElement} */
|
||||
focusedBeforeMount.current?.focus();
|
||||
/** @type {null|HTMLElement} */
|
||||
(!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus();
|
||||
}
|
||||
|
||||
origin = null;
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8948,6 +8948,10 @@ function StartPageOptions() {
|
|||
|
||||
|
||||
|
||||
|
||||
const {
|
||||
getLayoutStyles
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
const interfaceLabels = {
|
||||
/* translators: accessibility text for the editor top bar landmark region. */
|
||||
header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
|
||||
|
@ -8965,9 +8969,7 @@ const interfaceLabels = {
|
|||
footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
|
||||
};
|
||||
|
||||
function Layout({
|
||||
styles
|
||||
}) {
|
||||
function Layout() {
|
||||
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
||||
const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
|
||||
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
|
||||
|
@ -8995,14 +8997,43 @@ function Layout({
|
|||
isDistractionFree,
|
||||
showBlockBreadcrumbs,
|
||||
isTemplateMode,
|
||||
documentLabel
|
||||
documentLabel,
|
||||
styles
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getEditorSettings,
|
||||
getPostTypeLabel
|
||||
} = select(external_wp_editor_namespaceObject.store);
|
||||
const {
|
||||
isFeatureActive
|
||||
} = select(store_store);
|
||||
const editorSettings = getEditorSettings();
|
||||
const postTypeLabel = getPostTypeLabel();
|
||||
const hasThemeStyles = isFeatureActive('themeStyles');
|
||||
const themeStyles = [];
|
||||
const presetStyles = [];
|
||||
editorSettings.styles?.forEach(style => {
|
||||
if (!style.__unstableType || style.__unstableType === 'theme') {
|
||||
themeStyles.push(style);
|
||||
} else {
|
||||
presetStyles.push(style);
|
||||
}
|
||||
});
|
||||
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
||||
// base layout styles are still present in the editor.
|
||||
|
||||
if (!editorSettings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
||||
defaultEditorStyles.push({
|
||||
css: getLayoutStyles({
|
||||
style: {},
|
||||
selector: 'body',
|
||||
hasBlockGapSupport: false,
|
||||
hasFallbackGapSupport: true,
|
||||
fallbackGapValue: '0.5em'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
isTemplateMode: select(store_store).isEditingTemplate(),
|
||||
hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
|
||||
|
@ -9019,7 +9050,8 @@ function Layout({
|
|||
isDistractionFree: select(store_store).isFeatureActive('distractionFree'),
|
||||
showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
|
||||
// translators: Default label for the Document in the Block Breadcrumb.
|
||||
documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
|
||||
documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
|
||||
styles: hasThemeStyles && themeStyles.length ? editorSettings.styles : defaultEditorStyles
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
@ -9472,7 +9504,6 @@ function useCommonCommands() {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -9485,9 +9516,6 @@ function useCommonCommands() {
|
|||
const {
|
||||
ExperimentalEditorProvider
|
||||
} = unlock(external_wp_editor_namespaceObject.privateApis);
|
||||
const {
|
||||
getLayoutStyles
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
const {
|
||||
useCommands
|
||||
} = unlock(external_wp_coreCommands_namespaceObject.privateApis);
|
||||
|
@ -9506,7 +9534,6 @@ function Editor({
|
|||
focusMode,
|
||||
isDistractionFree,
|
||||
hasInlineToolbar,
|
||||
hasThemeStyles,
|
||||
post,
|
||||
preferredStyleVariations,
|
||||
hiddenBlockTypes,
|
||||
|
@ -9519,7 +9546,6 @@ function Editor({
|
|||
|
||||
const {
|
||||
isFeatureActive,
|
||||
__experimentalGetPreviewDeviceType,
|
||||
isEditingTemplate,
|
||||
getEditedPostTemplate,
|
||||
getHiddenBlockTypes
|
||||
|
@ -9554,11 +9580,10 @@ function Editor({
|
|||
const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
||||
const canEditTemplate = canUser('create', 'templates');
|
||||
return {
|
||||
hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
|
||||
hasFixedToolbar: isFeatureActive('fixedToolbar'),
|
||||
focusMode: isFeatureActive('focusMode'),
|
||||
isDistractionFree: isFeatureActive('distractionFree'),
|
||||
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
||||
hasThemeStyles: isFeatureActive('themeStyles'),
|
||||
preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'),
|
||||
hiddenBlockTypes: getHiddenBlockTypes(),
|
||||
blockTypes: getBlockTypes(),
|
||||
|
@ -9602,33 +9627,6 @@ function Editor({
|
|||
|
||||
return result;
|
||||
}, [settings, hasFixedToolbar, hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
|
||||
const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
const themeStyles = [];
|
||||
const presetStyles = [];
|
||||
settings.styles?.forEach(style => {
|
||||
if (!style.__unstableType || style.__unstableType === 'theme') {
|
||||
themeStyles.push(style);
|
||||
} else {
|
||||
presetStyles.push(style);
|
||||
}
|
||||
});
|
||||
const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
||||
// base layout styles are still present in the editor.
|
||||
|
||||
if (!settings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
||||
defaultEditorStyles.push({
|
||||
css: getLayoutStyles({
|
||||
style: {},
|
||||
selector: 'body',
|
||||
hasBlockGapSupport: false,
|
||||
hasFallbackGapSupport: true,
|
||||
fallbackGapValue: '0.5em'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
|
||||
}, [settings, hasThemeStyles]);
|
||||
|
||||
if (!post) {
|
||||
return null;
|
||||
|
@ -9643,9 +9641,7 @@ function Editor({
|
|||
...props
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_commands_namespaceObject.CommandMenu, null), (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, {
|
||||
postId: postId
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(components_layout, {
|
||||
styles: styles
|
||||
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))));
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(components_layout, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))));
|
||||
}
|
||||
|
||||
/* harmony default export */ var editor = (Editor);
|
||||
|
@ -9952,9 +9948,10 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|||
});
|
||||
|
||||
(0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); // Check if the block list view should be open by default.
|
||||
// If `distractionFree` mode is enabled, the block list view should not be open.
|
||||
|
||||
|
||||
if ((0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('showListViewByDefault')) {
|
||||
if ((0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('showListViewByDefault') && !(0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('distractionFree')) {
|
||||
(0,external_wp_data_namespaceObject.dispatch)(store_store).setIsListViewOpened(true);
|
||||
}
|
||||
|
||||
|
|
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
|
@ -39,7 +39,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"ReusableBlocksMenuItems": function() { return /* reexport */ reusable_blocks_menu_items; },
|
||||
"ReusableBlocksMenuItems": function() { return /* reexport */ ReusableBlocksMenuItems; },
|
||||
"store": function() { return /* reexport */ store; }
|
||||
});
|
||||
|
||||
|
@ -309,14 +309,16 @@ function ReusableBlockConvertButton({
|
|||
} = select(external_wp_coreData_namespaceObject.store);
|
||||
const {
|
||||
getBlocksByClientId,
|
||||
canInsertBlockType
|
||||
canInsertBlockType,
|
||||
getBlockRootClientId
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined);
|
||||
const blocks = (_getBlocksByClientId = getBlocksByClientId(clientIds)) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [];
|
||||
const isReusable = blocks.length === 1 && blocks[0] && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]) && !!select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', blocks[0].attributes.ref);
|
||||
|
||||
const _canConvert = // Hide when this is already a reusable block.
|
||||
!isReusable && // Hide when reusable blocks are disabled.
|
||||
canInsertBlockType('core/block', rootClientId) && blocks.every(block => // Guard against the case where a regular block has *just* been converted.
|
||||
canInsertBlockType('core/block', rootId) && blocks.every(block => // Guard against the case where a regular block has *just* been converted.
|
||||
!!block && // Hide on invalid blocks.
|
||||
block.isValid && // Hide when block doesn't support being made reusable.
|
||||
(0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'reusable', true)) && // Hide when current doesn't have permission to do that.
|
||||
|
@ -489,11 +491,10 @@ function ReusableBlocksManageButton({
|
|||
|
||||
|
||||
|
||||
|
||||
function ReusableBlocksMenuItems({
|
||||
clientIds,
|
||||
rootClientId
|
||||
}) {
|
||||
const clientIds = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientIds(), []);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlockConvertButton, {
|
||||
clientIds: clientIds,
|
||||
rootClientId: rootClientId
|
||||
|
@ -502,18 +503,6 @@ function ReusableBlocksMenuItems({
|
|||
}));
|
||||
}
|
||||
|
||||
/* harmony default export */ var reusable_blocks_menu_items = ((0,external_wp_data_namespaceObject.withSelect)(select => {
|
||||
const {
|
||||
getSelectedBlockClientIds,
|
||||
getBlockRootClientId
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
const clientIds = getSelectedBlockClientIds();
|
||||
return {
|
||||
clientIds,
|
||||
rootClientId: clientIds?.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined
|
||||
};
|
||||
})(ReusableBlocksMenuItems));
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56296';
|
||||
$wp_version = '6.4-alpha-56298';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue