Editor: update npm packages with critical bug fixes for 6.3.1.
Includes fixes for footnotes and editor styles related crashes, as well as a cut and paste-related crash. Props ramonopoly. See #59151. Built from https://develop.svn.wordpress.org/trunk@56419 git-svn-id: http://core.svn.wordpress.org/trunk@55931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
efdebb621b
commit
69e0187d65
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -34,7 +34,7 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
|
||||||
|
|
||||||
$footnotes = json_decode( $footnotes, true );
|
$footnotes = json_decode( $footnotes, true );
|
||||||
|
|
||||||
if ( count( $footnotes ) === 0 ) {
|
if ( ! is_array( $footnotes ) || count( $footnotes ) === 0 ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ function wp_save_footnotes_meta( $revision_id ) {
|
||||||
|
|
||||||
if ( $footnotes ) {
|
if ( $footnotes ) {
|
||||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||||
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
|
update_metadata( 'post', $revision_id, 'footnotes', wp_slash( $footnotes ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,15 +154,14 @@ function wp_add_footnotes_revisions_to_post_meta( $post ) {
|
||||||
|
|
||||||
if ( $footnotes ) {
|
if ( $footnotes ) {
|
||||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||||
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
|
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', wp_slash( $footnotes ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( array( 'post', 'page' ) as $post_type ) {
|
add_action( 'rest_after_insert_post', 'wp_add_footnotes_revisions_to_post_meta' );
|
||||||
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
|
add_action( 'rest_after_insert_page', 'wp_add_footnotes_revisions_to_post_meta' );
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores the footnotes meta value from the revision.
|
* Restores the footnotes meta value from the revision.
|
||||||
|
@ -176,7 +175,7 @@ function wp_restore_footnotes_from_revision( $post_id, $revision_id ) {
|
||||||
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
|
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
|
||||||
|
|
||||||
if ( $footnotes ) {
|
if ( $footnotes ) {
|
||||||
update_post_meta( $post_id, 'footnotes', $footnotes );
|
update_post_meta( $post_id, 'footnotes', wp_slash( $footnotes ) );
|
||||||
} else {
|
} else {
|
||||||
delete_post_meta( $post_id, 'footnotes' );
|
delete_post_meta( $post_id, 'footnotes' );
|
||||||
}
|
}
|
||||||
|
@ -243,7 +242,7 @@ function _wp_rest_api_autosave_meta( $autosave ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] );
|
update_post_meta( $id, 'footnotes', wp_slash( $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.
|
// 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' );
|
add_action( 'wp_creating_autosave', '_wp_rest_api_autosave_meta' );
|
||||||
|
|
|
@ -46279,6 +46279,8 @@ function useClipboardHandler() {
|
||||||
if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) {
|
if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) {
|
||||||
removeBlocks(selectedBlockClientIds);
|
removeBlocks(selectedBlockClientIds);
|
||||||
} else {
|
} else {
|
||||||
|
event.target.ownerDocument.activeElement.contentEditable = false;
|
||||||
|
|
||||||
__unstableDeleteSelection();
|
__unstableDeleteSelection();
|
||||||
}
|
}
|
||||||
} else if (event.type === 'paste') {
|
} else if (event.type === 'paste') {
|
||||||
|
@ -56118,7 +56120,14 @@ function RichTextWrapper({
|
||||||
}), anchorRef]),
|
}), anchorRef]),
|
||||||
contentEditable: true,
|
contentEditable: true,
|
||||||
suppressContentEditableWarning: true,
|
suppressContentEditableWarning: true,
|
||||||
className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text')
|
className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text') // Setting tabIndex to 0 is unnecessary, the element is already
|
||||||
|
// focusable because it's contentEditable. This also fixes a
|
||||||
|
// Safari bug where it's not possible to Shift+Click multi
|
||||||
|
// select blocks when Shift Clicking into an element with
|
||||||
|
// tabIndex because Safari will focus the element. However,
|
||||||
|
// Safari will correctly ignore nested contentEditable elements.
|
||||||
|
,
|
||||||
|
tabIndex: props.tabIndex === 0 ? null : props.tabIndex
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6356,6 +6356,11 @@ function useEntityBlockEditor(kind, name, {
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateAttributes(attributes) {
|
function updateAttributes(attributes) {
|
||||||
|
// Only attempt to update attributes, if attributes is an object.
|
||||||
|
if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
attributes = { ...attributes
|
attributes = { ...attributes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8968,6 +8968,40 @@ const interfaceLabels = {
|
||||||
footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
|
footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function useEditorStyles() {
|
||||||
|
const {
|
||||||
|
hasThemeStyleSupport,
|
||||||
|
editorSettings
|
||||||
|
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
|
||||||
|
hasThemeStyleSupport: select(store_store).isFeatureActive('themeStyles'),
|
||||||
|
editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings()
|
||||||
|
}), []); // Compute the default styles.
|
||||||
|
|
||||||
|
return (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||||
|
var _editorSettings$style, _editorSettings$style2;
|
||||||
|
|
||||||
|
const presetStyles = (_editorSettings$style = editorSettings.styles?.filter(style => style.__unstableType && style.__unstableType !== 'theme')) !== null && _editorSettings$style !== void 0 ? _editorSettings$style : [];
|
||||||
|
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).
|
||||||
|
|
||||||
|
const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== ((_editorSettings$style2 = editorSettings.styles?.length) !== null && _editorSettings$style2 !== void 0 ? _editorSettings$style2 : 0); // If theme styles are not present or displayed, ensure that
|
||||||
|
// base layout styles are still present in the editor.
|
||||||
|
|
||||||
|
if (!editorSettings.disableLayoutStyles && !hasThemeStyles) {
|
||||||
|
defaultEditorStyles.push({
|
||||||
|
css: getLayoutStyles({
|
||||||
|
style: {},
|
||||||
|
selector: 'body',
|
||||||
|
hasBlockGapSupport: false,
|
||||||
|
hasFallbackGapSupport: true,
|
||||||
|
fallbackGapValue: '0.5em'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasThemeStyles ? editorSettings.styles : defaultEditorStyles;
|
||||||
|
}, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport]);
|
||||||
|
}
|
||||||
|
|
||||||
function Layout() {
|
function Layout() {
|
||||||
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
||||||
const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
|
const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
|
||||||
|
@ -8996,43 +9030,14 @@ function Layout() {
|
||||||
isDistractionFree,
|
isDistractionFree,
|
||||||
showBlockBreadcrumbs,
|
showBlockBreadcrumbs,
|
||||||
isTemplateMode,
|
isTemplateMode,
|
||||||
documentLabel,
|
documentLabel
|
||||||
styles
|
|
||||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||||
const {
|
const {
|
||||||
getEditorSettings,
|
getEditorSettings,
|
||||||
getPostTypeLabel
|
getPostTypeLabel
|
||||||
} = select(external_wp_editor_namespaceObject.store);
|
} = select(external_wp_editor_namespaceObject.store);
|
||||||
const {
|
|
||||||
isFeatureActive
|
|
||||||
} = select(store_store);
|
|
||||||
const editorSettings = getEditorSettings();
|
const editorSettings = getEditorSettings();
|
||||||
const postTypeLabel = getPostTypeLabel();
|
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 {
|
return {
|
||||||
isTemplateMode: select(store_store).isEditingTemplate(),
|
isTemplateMode: select(store_store).isEditingTemplate(),
|
||||||
hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
|
hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
|
||||||
|
@ -9049,10 +9054,10 @@ function Layout() {
|
||||||
isDistractionFree: select(store_store).isFeatureActive('distractionFree'),
|
isDistractionFree: select(store_store).isFeatureActive('distractionFree'),
|
||||||
showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
|
showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
|
||||||
// translators: Default label for the Document in the Block Breadcrumb.
|
// 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
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
const styles = useEditorStyles();
|
||||||
|
|
||||||
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
|
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56418';
|
$wp_version = '6.4-alpha-56419';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue