Editor: Update Packages with the latest bug fixes for 6.5 RC 2
It includes all the backports from this Gutenberg PR https://github.com/WordPress/gutenberg/pull/59756/ Props get_dave, swissspidy, bernhard-reiter, youknowriad. See #60315. Built from https://develop.svn.wordpress.org/trunk@57814 git-svn-id: http://core.svn.wordpress.org/trunk@57315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
18050c7ffa
commit
8a7d013dfd
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -543,8 +543,7 @@ class WP_Navigation_Block_Renderer {
|
|||
/**
|
||||
* Gets the nav element directives.
|
||||
*
|
||||
* @param bool $is_interactive Whether the block is interactive.
|
||||
* @param array $attributes The block attributes.
|
||||
* @param bool $is_interactive Whether the block is interactive.
|
||||
* @return string the directives for the navigation element.
|
||||
*/
|
||||
private static function get_nav_element_directives( $is_interactive ) {
|
||||
|
@ -1458,13 +1457,26 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
|
|||
/**
|
||||
* Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API.
|
||||
*
|
||||
* @param WP_Post $post Post object.
|
||||
* @access private
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param stdClass $post Post object.
|
||||
* @return stdClass The updated post object.
|
||||
*/
|
||||
function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
||||
// We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
|
||||
// all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
|
||||
/*
|
||||
* We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
|
||||
* all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
|
||||
*/
|
||||
$blocks = parse_blocks( $post->post_content );
|
||||
$markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, $post );
|
||||
|
||||
/*
|
||||
* Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
|
||||
* we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
|
||||
* used as context for hooked blocks insertion).
|
||||
* We thus have to look it up from the DB,based on `$post->ID`.
|
||||
*/
|
||||
$markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, get_post( $post->ID ) );
|
||||
|
||||
$root_nav_block = parse_blocks( $markup )[0];
|
||||
$ignored_hooked_blocks = isset( $root_nav_block['attrs']['metadata']['ignoredHookedBlocks'] )
|
||||
|
@ -1480,25 +1492,32 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
|||
update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
|
||||
}
|
||||
|
||||
$serialized_inner_blocks = block_core_navigation_remove_serialized_parent_block( $markup );
|
||||
|
||||
wp_update_post(
|
||||
array(
|
||||
'ID' => $post->ID,
|
||||
'post_content' => $serialized_inner_blocks,
|
||||
)
|
||||
);
|
||||
$post->post_content = block_core_navigation_remove_serialized_parent_block( $markup );
|
||||
return $post;
|
||||
}
|
||||
|
||||
// Before adding our filter, we verify if it's already added in Core.
|
||||
// However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
// Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
$rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ignore_hooked_blocks_meta';
|
||||
/*
|
||||
* Before adding our filter, we verify if it's already added in Core.
|
||||
* However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
* Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
*/
|
||||
$rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ignore_hooked_blocks_meta'; // phpcs:ignore Generic.Strings.UnnecessaryStringConcat.Found
|
||||
|
||||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
||||
add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
|
||||
/*
|
||||
* Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
* that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
*/
|
||||
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
||||
add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta' );
|
||||
}
|
||||
|
||||
/*
|
||||
* Previous versions of Gutenberg were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
|
||||
* function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
|
||||
* To avoid collisions, we need to remove the filter from that action if it's present.
|
||||
*/
|
||||
if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
||||
remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1506,7 +1525,6 @@ if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'r
|
|||
*
|
||||
* @param WP_REST_Response $response The response object.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @return WP_REST_Response The response object.
|
||||
*/
|
||||
function block_core_navigation_insert_hooked_blocks_into_rest_response( $response, $post ) {
|
||||
|
@ -1525,13 +1543,17 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
|
|||
return $response;
|
||||
}
|
||||
|
||||
// Before adding our filter, we verify if it's already added in Core.
|
||||
// However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
// Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
/*
|
||||
* Before adding our filter, we verify if it's already added in Core.
|
||||
* However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
* Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
*/
|
||||
$rest_prepare_wp_navigation_core_callback = 'block_core_navigation_' . 'insert_hooked_blocks_into_rest_response';
|
||||
|
||||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
/*
|
||||
* Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
* that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
*/
|
||||
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback ) ) {
|
||||
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
|
||||
}
|
||||
|
|
|
@ -386,12 +386,13 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
scroll-padding-bottom:64px;
|
||||
width:100%;
|
||||
}
|
||||
.dataviews-wrapper>div{
|
||||
min-height:100%;
|
||||
}
|
||||
|
||||
.dataviews-filters__view-actions{
|
||||
flex-shrink:0;
|
||||
margin-bottom:12px;
|
||||
padding:12px 32px 0;
|
||||
position:sticky;
|
||||
right:0;
|
||||
}
|
||||
.dataviews-filters__view-actions .components-search-control .components-base-control__field{
|
||||
max-width:240px;
|
||||
|
@ -406,15 +407,14 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
}
|
||||
|
||||
.dataviews-pagination{
|
||||
-webkit-backdrop-filter:blur(6px);
|
||||
backdrop-filter:blur(6px);
|
||||
background-color:#fffc;
|
||||
background-color:#fff;
|
||||
border-top:1px solid #f0f0f0;
|
||||
bottom:0;
|
||||
color:#757575;
|
||||
margin-top:auto;
|
||||
flex-shrink:0;
|
||||
padding:12px 32px;
|
||||
position:sticky;
|
||||
right:0;
|
||||
}
|
||||
|
||||
.dataviews-pagination__page-selection{
|
||||
|
@ -498,6 +498,11 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
.dataviews-view-table tr.is-selected:hover{
|
||||
background-color:rgba(var(--wp-admin-theme-color--rgb), .08);
|
||||
}
|
||||
.dataviews-view-table thead{
|
||||
inset-block-start:0;
|
||||
position:sticky;
|
||||
z-index:1;
|
||||
}
|
||||
.dataviews-view-table thead tr{
|
||||
border:0;
|
||||
}
|
||||
|
@ -509,10 +514,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
padding-bottom:8px;
|
||||
padding-right:4px;
|
||||
padding-top:8px;
|
||||
position:sticky;
|
||||
text-transform:uppercase;
|
||||
top:-1px;
|
||||
z-index:1;
|
||||
}
|
||||
.dataviews-view-table tbody td{
|
||||
vertical-align:top;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -386,12 +386,13 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
scroll-padding-bottom:64px;
|
||||
width:100%;
|
||||
}
|
||||
.dataviews-wrapper>div{
|
||||
min-height:100%;
|
||||
}
|
||||
|
||||
.dataviews-filters__view-actions{
|
||||
flex-shrink:0;
|
||||
left:0;
|
||||
margin-bottom:12px;
|
||||
padding:12px 32px 0;
|
||||
position:sticky;
|
||||
}
|
||||
.dataviews-filters__view-actions .components-search-control .components-base-control__field{
|
||||
max-width:240px;
|
||||
|
@ -406,13 +407,12 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
}
|
||||
|
||||
.dataviews-pagination{
|
||||
-webkit-backdrop-filter:blur(6px);
|
||||
backdrop-filter:blur(6px);
|
||||
background-color:#fffc;
|
||||
background-color:#fff;
|
||||
border-top:1px solid #f0f0f0;
|
||||
bottom:0;
|
||||
color:#757575;
|
||||
margin-top:auto;
|
||||
flex-shrink:0;
|
||||
left:0;
|
||||
padding:12px 32px;
|
||||
position:sticky;
|
||||
}
|
||||
|
@ -498,6 +498,11 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
.dataviews-view-table tr.is-selected:hover{
|
||||
background-color:rgba(var(--wp-admin-theme-color--rgb), .08);
|
||||
}
|
||||
.dataviews-view-table thead{
|
||||
inset-block-start:0;
|
||||
position:sticky;
|
||||
z-index:1;
|
||||
}
|
||||
.dataviews-view-table thead tr{
|
||||
border:0;
|
||||
}
|
||||
|
@ -509,10 +514,7 @@ body.is-fullscreen-mode .interface-interface-skeleton{
|
|||
padding-bottom:8px;
|
||||
padding-left:4px;
|
||||
padding-top:8px;
|
||||
position:sticky;
|
||||
text-transform:uppercase;
|
||||
top:-1px;
|
||||
z-index:1;
|
||||
}
|
||||
.dataviews-view-table tbody td{
|
||||
vertical-align:top;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36899,6 +36899,10 @@ function useMovingAnimation({
|
|||
});
|
||||
return () => {
|
||||
controller.stop();
|
||||
controller.set({
|
||||
x: 0,
|
||||
y: 0
|
||||
});
|
||||
};
|
||||
}, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
|
||||
return ref;
|
||||
|
@ -50741,7 +50745,7 @@ const connection = (0,external_React_.createElement)(external_wp_primitives_name
|
|||
height: "24",
|
||||
viewBox: "0 0 24 24",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
"fill-rule": "evenodd"
|
||||
fillRule: "evenodd"
|
||||
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M5 19L8 16L5 19Z"
|
||||
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
|
@ -63925,19 +63929,19 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
|
|||
});
|
||||
const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context);
|
||||
const isTemplate = blockContext?.templateSlug !== undefined;
|
||||
const getBlockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
return select(external_wp_blocks_namespaceObject.store).getBlockStyles;
|
||||
}, []);
|
||||
const {
|
||||
getBlockStyles
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
|
||||
return (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
var _mergedConfig$styles$;
|
||||
var _updatedConfig$styles;
|
||||
if (!mergedConfig?.styles || !mergedConfig?.settings) {
|
||||
return [];
|
||||
}
|
||||
mergedConfig = updateConfigWithSeparator(mergedConfig);
|
||||
const updatedConfig = updateConfigWithSeparator(mergedConfig);
|
||||
const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles);
|
||||
const customProperties = toCustomProperties(mergedConfig, blockSelectors);
|
||||
const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
|
||||
const svgs = toSvgFilters(mergedConfig, blockSelectors);
|
||||
const customProperties = toCustomProperties(updatedConfig, blockSelectors);
|
||||
const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
|
||||
const svgs = toSvgFilters(updatedConfig, blockSelectors);
|
||||
const styles = [{
|
||||
css: customProperties,
|
||||
isGlobalStyles: true
|
||||
|
@ -63947,7 +63951,7 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
|
|||
},
|
||||
// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
|
||||
{
|
||||
css: (_mergedConfig$styles$ = mergedConfig.styles.css) !== null && _mergedConfig$styles$ !== void 0 ? _mergedConfig$styles$ : '',
|
||||
css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '',
|
||||
isGlobalStyles: true
|
||||
}, {
|
||||
assets: svgs,
|
||||
|
@ -63959,16 +63963,16 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
|
|||
// If there are, get the block selector and push the selector together with
|
||||
// the CSS value to the 'stylesheets' array.
|
||||
(0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach(blockType => {
|
||||
if (mergedConfig.styles.blocks[blockType.name]?.css) {
|
||||
if (updatedConfig.styles.blocks[blockType.name]?.css) {
|
||||
const selector = blockSelectors[blockType.name].selector;
|
||||
styles.push({
|
||||
css: processCSSNesting(mergedConfig.styles.blocks[blockType.name]?.css, selector),
|
||||
css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector),
|
||||
isGlobalStyles: true
|
||||
});
|
||||
}
|
||||
});
|
||||
return [styles, mergedConfig.settings];
|
||||
}, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
|
||||
return [styles, updatedConfig.settings];
|
||||
}, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, isTemplate, getBlockStyles]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6926,7 +6926,9 @@ function code_save_save({
|
|||
// prevent embedding in PHP. Ideally checks for the code block,
|
||||
// or pre/code tags, should be made on the PHP side?
|
||||
,
|
||||
value: utils_escape(attributes.content.toString())
|
||||
value: utils_escape(typeof attributes.content === 'string' ? attributes.content : attributes.content.toHTMLString({
|
||||
preserveWhiteSpace: true
|
||||
}))
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -32473,7 +32475,7 @@ function NavigationMenuSelector({
|
|||
}) {
|
||||
/* translators: %s: The name of a menu. */
|
||||
const createActionLabel = (0,external_wp_i18n_namespaceObject.__)("Create from '%s'");
|
||||
const [isCreatingMenu, setIsCreatingMenu] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [isUpdatingMenuRef, setIsUpdatingMenuRef] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
actionLabel = actionLabel || createActionLabel;
|
||||
const {
|
||||
menus: classicMenus
|
||||
|
@ -32496,10 +32498,11 @@ function NavigationMenuSelector({
|
|||
return {
|
||||
value: id,
|
||||
label,
|
||||
ariaLabel: (0,external_wp_i18n_namespaceObject.sprintf)(actionLabel, label)
|
||||
ariaLabel: (0,external_wp_i18n_namespaceObject.sprintf)(actionLabel, label),
|
||||
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
|
||||
};
|
||||
}) || [];
|
||||
}, [navigationMenus, actionLabel]);
|
||||
}, [navigationMenus, actionLabel, isResolvingNavigationMenus, hasResolvedNavigationMenus, isUpdatingMenuRef]);
|
||||
const hasNavigationMenus = !!navigationMenus?.length;
|
||||
const hasClassicMenus = !!classicMenus?.length;
|
||||
const showNavigationMenus = !!canSwitchNavigationMenu;
|
||||
|
@ -32508,7 +32511,7 @@ function NavigationMenuSelector({
|
|||
const noBlockMenus = !hasNavigationMenus && hasResolvedNavigationMenus;
|
||||
const menuUnavailable = hasResolvedNavigationMenus && currentMenuId === null;
|
||||
let selectorLabel = '';
|
||||
if (isCreatingMenu || isResolvingNavigationMenus) {
|
||||
if (isResolvingNavigationMenus) {
|
||||
selectorLabel = (0,external_wp_i18n_namespaceObject.__)('Loading…');
|
||||
} else if (noMenuSelected || noBlockMenus || menuUnavailable) {
|
||||
// Note: classic Menus may be available.
|
||||
|
@ -32518,10 +32521,10 @@ function NavigationMenuSelector({
|
|||
selectorLabel = currentTitle;
|
||||
}
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
if (isCreatingMenu && (createNavigationMenuIsSuccess || createNavigationMenuIsError)) {
|
||||
setIsCreatingMenu(false);
|
||||
if (isUpdatingMenuRef && (createNavigationMenuIsSuccess || createNavigationMenuIsError)) {
|
||||
setIsUpdatingMenuRef(false);
|
||||
}
|
||||
}, [hasResolvedNavigationMenus, createNavigationMenuIsSuccess, canUserCreateNavigationMenu, createNavigationMenuIsError, isCreatingMenu, menuUnavailable, noBlockMenus, noMenuSelected]);
|
||||
}, [hasResolvedNavigationMenus, createNavigationMenuIsSuccess, canUserCreateNavigationMenu, createNavigationMenuIsError, isUpdatingMenuRef, menuUnavailable, noBlockMenus, noMenuSelected]);
|
||||
const NavigationMenuSelectorDropdown = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
|
||||
label: selectorLabel,
|
||||
icon: more_vertical,
|
||||
|
@ -32535,35 +32538,35 @@ function NavigationMenuSelector({
|
|||
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
|
||||
value: currentMenuId,
|
||||
onSelect: menuId => {
|
||||
setIsCreatingMenu(true);
|
||||
onSelectNavigationMenu(menuId);
|
||||
onClose();
|
||||
},
|
||||
choices: menuChoices,
|
||||
disabled: isCreatingMenu
|
||||
choices: menuChoices
|
||||
})), showClassicMenus && hasClassicMenus && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Import Classic Menus')
|
||||
}, classicMenus?.map(menu => {
|
||||
const label = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menu.name);
|
||||
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
onClick: () => {
|
||||
setIsCreatingMenu(true);
|
||||
onSelectClassicMenu(menu);
|
||||
onClick: async () => {
|
||||
setIsUpdatingMenuRef(true);
|
||||
await onSelectClassicMenu(menu);
|
||||
setIsUpdatingMenuRef(false);
|
||||
onClose();
|
||||
},
|
||||
key: menu.id,
|
||||
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(createActionLabel, label),
|
||||
disabled: isCreatingMenu
|
||||
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
|
||||
}, label);
|
||||
})), canUserCreateNavigationMenu && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Tools')
|
||||
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
disabled: isCreatingMenu,
|
||||
onClick: () => {
|
||||
onClick: async () => {
|
||||
setIsUpdatingMenuRef(true);
|
||||
await onCreateNew();
|
||||
setIsUpdatingMenuRef(false);
|
||||
onClose();
|
||||
onCreateNew();
|
||||
setIsCreatingMenu(true);
|
||||
}
|
||||
},
|
||||
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Create new menu')))));
|
||||
return NavigationMenuSelectorDropdown;
|
||||
}
|
||||
|
@ -34697,8 +34700,8 @@ function Navigation({
|
|||
isSuccess: createNavigationMenuIsSuccess,
|
||||
isError: createNavigationMenuIsError
|
||||
} = useCreateNavigationMenu(clientId);
|
||||
const createUntitledEmptyNavigationMenu = () => {
|
||||
createNavigationMenu('');
|
||||
const createUntitledEmptyNavigationMenu = async () => {
|
||||
await createNavigationMenu('');
|
||||
};
|
||||
const {
|
||||
hasUncontrolledInnerBlocks,
|
||||
|
@ -48981,7 +48984,8 @@ function ReusableBlockEdit({
|
|||
userCanEdit,
|
||||
getBlockEditingMode,
|
||||
onNavigateToEntityRecord,
|
||||
editingMode
|
||||
editingMode,
|
||||
hasPatternOverridesSource
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
canUser
|
||||
|
@ -48991,6 +48995,9 @@ function ReusableBlockEdit({
|
|||
getSettings,
|
||||
getBlockEditingMode: _getBlockEditingMode
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
const {
|
||||
getBlockBindingsSource
|
||||
} = unlock(select(external_wp_blocks_namespaceObject.store));
|
||||
const blocks = getBlocks(patternClientId);
|
||||
const canEdit = canUser('update', 'blocks', ref);
|
||||
|
||||
|
@ -49000,7 +49007,8 @@ function ReusableBlockEdit({
|
|||
userCanEdit: canEdit,
|
||||
getBlockEditingMode: _getBlockEditingMode,
|
||||
onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord,
|
||||
editingMode: _getBlockEditingMode(patternClientId)
|
||||
editingMode: _getBlockEditingMode(patternClientId),
|
||||
hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides')
|
||||
};
|
||||
}, [patternClientId, ref]);
|
||||
|
||||
|
@ -49008,9 +49016,9 @@ function ReusableBlockEdit({
|
|||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
setBlockEditMode(setBlockEditingMode, innerBlocks,
|
||||
// Disable editing if the pattern itself is disabled.
|
||||
editingMode === 'disabled' ? 'disabled' : undefined);
|
||||
}, [editingMode, innerBlocks, setBlockEditingMode]);
|
||||
const canOverrideBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => hasOverridableBlocks(innerBlocks), [innerBlocks]);
|
||||
editingMode === 'disabled' || !hasPatternOverridesSource ? 'disabled' : undefined);
|
||||
}, [editingMode, innerBlocks, setBlockEditingMode, hasPatternOverridesSource]);
|
||||
const canOverrideBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => hasPatternOverridesSource && hasOverridableBlocks(innerBlocks), [hasPatternOverridesSource, innerBlocks]);
|
||||
const initialBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
var _editedRecord$blocks$;
|
||||
return (// Clone the blocks to generate new client IDs.
|
||||
|
@ -49029,11 +49037,12 @@ function ReusableBlockEdit({
|
|||
registry.batch(() => {
|
||||
setBlockEditingMode(patternClientId, 'default');
|
||||
syncDerivedUpdates(() => {
|
||||
replaceInnerBlocks(patternClientId, applyInitialContentValuesToInnerBlocks(initialBlocks, initialContent.current, defaultContent.current, legacyIdMap.current));
|
||||
const blocks = hasPatternOverridesSource ? applyInitialContentValuesToInnerBlocks(initialBlocks, initialContent.current, defaultContent.current, legacyIdMap.current) : initialBlocks;
|
||||
replaceInnerBlocks(patternClientId, blocks);
|
||||
});
|
||||
setBlockEditingMode(patternClientId, originalEditingMode);
|
||||
});
|
||||
}, [__unstableMarkNextChangeAsNotPersistent, patternClientId, initialBlocks, replaceInnerBlocks, registry, getBlockEditingMode, setBlockEditingMode, syncDerivedUpdates]);
|
||||
}, [hasPatternOverridesSource, __unstableMarkNextChangeAsNotPersistent, patternClientId, initialBlocks, replaceInnerBlocks, registry, getBlockEditingMode, setBlockEditingMode, syncDerivedUpdates]);
|
||||
const {
|
||||
alignment,
|
||||
layout
|
||||
|
@ -49055,6 +49064,9 @@ function ReusableBlockEdit({
|
|||
// Sync the `content` attribute from the updated blocks to the pattern block.
|
||||
// `syncDerivedUpdates` is used here to avoid creating an additional undo level.
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
if (!hasPatternOverridesSource) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
getBlocks
|
||||
} = registry.select(external_wp_blockEditor_namespaceObject.store);
|
||||
|
@ -49070,7 +49082,7 @@ function ReusableBlockEdit({
|
|||
});
|
||||
}
|
||||
}, external_wp_blockEditor_namespaceObject.store);
|
||||
}, [syncDerivedUpdates, patternClientId, registry, setAttributes]);
|
||||
}, [hasPatternOverridesSource, syncDerivedUpdates, patternClientId, registry, setAttributes]);
|
||||
const handleEditOriginal = () => {
|
||||
onNavigateToEntityRecord({
|
||||
postId: ref,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4155,6 +4155,100 @@ function EditPostPreferencesModal() {
|
|||
});
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/init-pattern-modal/index.js
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
const {
|
||||
ReusableBlocksRenameHint
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
function InitPatternModal() {
|
||||
const {
|
||||
editPost
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
|
||||
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined);
|
||||
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
|
||||
const {
|
||||
postType,
|
||||
isNewPost
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getEditedPostAttribute,
|
||||
isCleanNewPost
|
||||
} = select(external_wp_editor_namespaceObject.store);
|
||||
return {
|
||||
postType: getEditedPostAttribute('type'),
|
||||
isNewPost: isCleanNewPost()
|
||||
};
|
||||
}, []);
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
if (isNewPost && postType === 'wp_block') {
|
||||
setIsModalOpen(true);
|
||||
}
|
||||
// We only want the modal to open when the page is first loaded.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
if (postType !== 'wp_block' || !isNewPost) {
|
||||
return null;
|
||||
}
|
||||
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isModalOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
|
||||
title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'),
|
||||
onRequestClose: () => {
|
||||
setIsModalOpen(false);
|
||||
},
|
||||
overlayClassName: "reusable-blocks-menu-items__convert-modal"
|
||||
}, (0,external_React_namespaceObject.createElement)("form", {
|
||||
onSubmit: event => {
|
||||
event.preventDefault();
|
||||
setIsModalOpen(false);
|
||||
editPost({
|
||||
title,
|
||||
meta: {
|
||||
wp_pattern_sync_status: syncType
|
||||
}
|
||||
});
|
||||
}
|
||||
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||
spacing: "5"
|
||||
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
|
||||
value: title,
|
||||
onChange: setTitle,
|
||||
placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'),
|
||||
className: "patterns-create-modal__name-input",
|
||||
__nextHasNoMarginBottom: true,
|
||||
__next40pxDefaultSize: true
|
||||
}), (0,external_React_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
|
||||
label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'),
|
||||
help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'),
|
||||
checked: !syncType,
|
||||
onChange: () => {
|
||||
setSyncType(!syncType ? 'unsynced' : undefined);
|
||||
}
|
||||
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
justify: "right"
|
||||
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "primary",
|
||||
type: "submit",
|
||||
disabled: !title,
|
||||
__experimentalIsFocusable: true
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
|
@ -6824,6 +6918,7 @@ function useCommonCommands() {
|
|||
|
||||
|
||||
|
||||
|
||||
const {
|
||||
getLayoutStyles
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
|
@ -7058,7 +7153,7 @@ function Layout({
|
|||
previous: previousShortcut,
|
||||
next: nextShortcut
|
||||
}
|
||||
}), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatusModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
|
||||
}), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(InitPatternModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
|
||||
onError: onPluginAreaError
|
||||
}), !isDistractionFree && (0,external_React_namespaceObject.createElement)(settings_sidebar, null));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -20389,9 +20389,7 @@ function ViewTable({
|
|||
desc: 'descending'
|
||||
};
|
||||
const primaryField = fields.find(field => field.id === view.layout.primaryField);
|
||||
return (0,external_React_.createElement)("div", {
|
||||
className: "dataviews-view-table-wrapper"
|
||||
}, (0,external_React_.createElement)("table", {
|
||||
return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_.createElement)("table", {
|
||||
className: "dataviews-view-table",
|
||||
"aria-busy": isLoading,
|
||||
"aria-describedby": tableNoticeId
|
||||
|
@ -24270,26 +24268,40 @@ function KeyboardShortcutsRegister() {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
function KeyboardShortcutsGlobal() {
|
||||
const {
|
||||
__experimentalGetDirtyEntityRecords,
|
||||
isSavingEntityRecord
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
|
||||
const {
|
||||
hasNonPostEntityChanges
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
|
||||
const {
|
||||
getCanvasMode
|
||||
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
|
||||
const {
|
||||
setIsSaveViewOpened
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
|
||||
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => {
|
||||
event.preventDefault();
|
||||
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
||||
const isDirty = !!dirtyEntityRecords.length;
|
||||
const hasDirtyEntities = !!dirtyEntityRecords.length;
|
||||
const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
|
||||
if (!isSaving && isDirty) {
|
||||
setIsSaveViewOpened(true);
|
||||
const _hasNonPostEntityChanges = hasNonPostEntityChanges();
|
||||
const isViewMode = getCanvasMode() === 'view';
|
||||
if ((!hasDirtyEntities || !_hasNonPostEntityChanges || isSaving) && !isViewMode) {
|
||||
return;
|
||||
}
|
||||
// At this point, we know that there are dirty entities, other than
|
||||
// the edited post, and we're not in the process of saving, so open
|
||||
// save view.
|
||||
setIsSaveViewOpened(true);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
@ -26679,6 +26691,32 @@ async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Unloads the font face and remove it from the browser.
|
||||
* It also removes it from the iframe document.
|
||||
*
|
||||
* Note that Font faces that were added to the set using the CSS @font-face rule
|
||||
* remain connected to the corresponding CSS, and cannot be deleted.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.
|
||||
*/
|
||||
function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') {
|
||||
const unloadFontFace = fonts => {
|
||||
fonts.forEach(f => {
|
||||
if (f.family === formatFontFaceName(fontFace.fontFamily) && f.weight === fontFace.fontWeight && f.style === fontFace.fontStyle) {
|
||||
fonts.delete(f);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (removeFrom === 'document' || removeFrom === 'all') {
|
||||
unloadFontFace(document.fonts);
|
||||
}
|
||||
if (removeFrom === 'iframe' || removeFrom === 'all') {
|
||||
const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument;
|
||||
unloadFontFace(iframeDocument.fonts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the display source from a font face src.
|
||||
*
|
||||
|
@ -26772,7 +26810,7 @@ async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|||
// Handle network errors or other fetch-related errors
|
||||
results.errors.push({
|
||||
data: fontFacesData[index],
|
||||
message: `Fetch error: ${result.reason.message}`
|
||||
message: result.reason.message
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -27094,6 +27132,7 @@ function FontLibraryProvider({
|
|||
}
|
||||
installationErrors = installationErrors.concat(unsucessfullyInstalledFontFaces);
|
||||
}
|
||||
installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []);
|
||||
if (fontFamiliesToActivate.length > 0) {
|
||||
// Activate the font family (add the font family to the global styles).
|
||||
activateCustomFontFamilies(fontFamiliesToActivate);
|
||||
|
@ -27103,10 +27142,9 @@ function FontLibraryProvider({
|
|||
refreshLibrary();
|
||||
}
|
||||
if (installationErrors.length > 0) {
|
||||
throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Specific error message returned from server. */
|
||||
(0,external_wp_i18n_namespaceObject.__)('There were some errors installing fonts. %s'), installationErrors.reduce((errorMessageCollection, error) => {
|
||||
return `${errorMessageCollection} ${error.message}`;
|
||||
}, '')));
|
||||
const installError = new Error((0,external_wp_i18n_namespaceObject.__)('There was an error installing fonts.'));
|
||||
installError.installationErrors = installationErrors;
|
||||
throw installError;
|
||||
}
|
||||
} finally {
|
||||
setIsInstalling(false);
|
||||
|
@ -27145,6 +27183,11 @@ function FontLibraryProvider({
|
|||
...fontFamilies,
|
||||
[font.source]: newCustomFonts
|
||||
});
|
||||
if (font.fontFace) {
|
||||
font.fontFace.forEach(face => {
|
||||
unloadFontFaceInBrowser(face, 'all');
|
||||
});
|
||||
}
|
||||
};
|
||||
const activateCustomFontFamilies = fontsToAdd => {
|
||||
// Merge the existing custom fonts with the new fonts.
|
||||
|
@ -27175,6 +27218,12 @@ function FontLibraryProvider({
|
|||
...fontFamilies,
|
||||
[font.source]: newFonts
|
||||
});
|
||||
const isFaceActivated = isFontActivated(font.slug, face.fontStyle, face.fontWeight, font.source);
|
||||
if (isFaceActivated) {
|
||||
loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all');
|
||||
} else {
|
||||
unloadFontFaceInBrowser(face, 'all');
|
||||
}
|
||||
};
|
||||
const loadFontFaceAsset = async fontFace => {
|
||||
// If the font doesn't have a src, don't load it.
|
||||
|
@ -28143,8 +28192,8 @@ function FontCollection({
|
|||
spacing: 2
|
||||
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||
// translators: %s: Total number of pages.
|
||||
(0,external_wp_i18n_namespaceObject._x)('Page <CurrenPageControl /> of %s', 'paging'), totalPages), {
|
||||
CurrenPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||
(0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
|
||||
CurrentPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
|
||||
value: page,
|
||||
options: [...Array(totalPages)].map((e, i) => {
|
||||
|
@ -32082,29 +32131,42 @@ function UploadFonts() {
|
|||
* @param {Array} files The files to be filtered
|
||||
* @return {void}
|
||||
*/
|
||||
const handleFilesUpload = files => {
|
||||
const handleFilesUpload = async files => {
|
||||
setNotice(null);
|
||||
setIsUploading(true);
|
||||
const uniqueFilenames = new Set();
|
||||
const selectedFiles = [...files];
|
||||
const allowedFiles = selectedFiles.filter(file => {
|
||||
if (uniqueFilenames.has(file.name)) {
|
||||
return false; // Discard duplicates
|
||||
let hasInvalidFiles = false;
|
||||
|
||||
// Use map to create a promise for each file check, then filter with Promise.all.
|
||||
const checkFilesPromises = selectedFiles.map(async file => {
|
||||
const isFont = await isFontFile(file);
|
||||
if (!isFont) {
|
||||
hasInvalidFiles = true;
|
||||
return null; // Return null for invalid files.
|
||||
}
|
||||
// Eliminates files that are not allowed
|
||||
// Check for duplicates
|
||||
if (uniqueFilenames.has(file.name)) {
|
||||
return null; // Return null for duplicates.
|
||||
}
|
||||
// Check if the file extension is allowed.
|
||||
const fileExtension = file.name.split('.').pop().toLowerCase();
|
||||
if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) {
|
||||
uniqueFilenames.add(file.name);
|
||||
return true; // Keep file if the extension is allowed
|
||||
return file; // Return the file if it passes all checks.
|
||||
}
|
||||
return false; // Discard file extension not allowed
|
||||
return null; // Return null for disallowed file extensions.
|
||||
});
|
||||
|
||||
// Filter out the nulls after all promises have resolved.
|
||||
const allowedFiles = (await Promise.all(checkFilesPromises)).filter(file => null !== file);
|
||||
if (allowedFiles.length > 0) {
|
||||
loadFiles(allowedFiles);
|
||||
} else {
|
||||
const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)('Sorry, you are not allowed to upload this file type.') : (0,external_wp_i18n_namespaceObject.__)('No fonts found to install.');
|
||||
setNotice({
|
||||
type: 'error',
|
||||
message: (0,external_wp_i18n_namespaceObject.__)('No fonts found to install.')
|
||||
message
|
||||
});
|
||||
setIsUploading(false);
|
||||
}
|
||||
|
@ -32125,6 +32187,23 @@ function UploadFonts() {
|
|||
handleInstall(fontFacesLoaded);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a file is a valid Font file.
|
||||
*
|
||||
* @param {File} file The file to be checked.
|
||||
* @return {boolean} Whether the file is a valid font file.
|
||||
*/
|
||||
async function isFontFile(file) {
|
||||
const font = new Font('Uploaded Font');
|
||||
try {
|
||||
const buffer = await readFileAsArrayBuffer(file);
|
||||
await font.fromDataBuffer(buffer, 'font');
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a function to read the file as array buffer
|
||||
async function readFileAsArrayBuffer(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -32177,7 +32256,8 @@ function UploadFonts() {
|
|||
} catch (error) {
|
||||
setNotice({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
message: error.message,
|
||||
errors: error?.installationErrors
|
||||
});
|
||||
}
|
||||
setIsUploading(false);
|
||||
|
@ -32190,8 +32270,11 @@ function UploadFonts() {
|
|||
className: "font-library-modal__local-fonts"
|
||||
}, notice && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
|
||||
status: notice.type,
|
||||
__unstableHTML: true,
|
||||
onRemove: () => setNotice(null)
|
||||
}, notice.message), isUploading && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)("div", {
|
||||
}, notice.message, notice.errors && (0,external_React_.createElement)("ul", null, notice.errors.map((error, index) => (0,external_React_.createElement)("li", {
|
||||
key: index
|
||||
}, error)))), isUploading && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)("div", {
|
||||
className: "font-library-modal__upload-area"
|
||||
}, (0,external_React_.createElement)(upload_fonts_ProgressBar, null))), !isUploading && (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, {
|
||||
accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.${ext}`).join(','),
|
||||
|
@ -32207,7 +32290,7 @@ function UploadFonts() {
|
|||
margin: 2
|
||||
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
||||
className: "font-library-modal__upload-area__text"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .tff, .otf, .woff, and .woff2.'))));
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.'))));
|
||||
}
|
||||
/* harmony default export */ const upload_fonts = (UploadFonts);
|
||||
|
||||
|
@ -36028,7 +36111,7 @@ function useNavigateToPreviousEntityRecord() {
|
|||
const history = use_site_editor_settings_useHistory();
|
||||
const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType);
|
||||
const didComeFromEditorCanvas = previousLocation?.params.postId && previousLocation?.params.postType && previousLocation?.params.canvas === 'edit';
|
||||
const didComeFromEditorCanvas = previousLocation?.params.canvas === 'edit';
|
||||
const showBackButton = isFocusMode && didComeFromEditorCanvas;
|
||||
return showBackButton ? () => history.back() : undefined;
|
||||
// Disable reason: previousLocation changes when the component updates for any reason, not
|
||||
|
@ -36544,8 +36627,8 @@ const pagination_Pagination = (0,external_wp_element_namespaceObject.memo)(funct
|
|||
className: "dataviews-pagination__page-selection"
|
||||
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||
// translators: %s: Total number of pages.
|
||||
(0,external_wp_i18n_namespaceObject._x)('Page <CurrenPageControl /> of %s', 'paging'), totalPages), {
|
||||
CurrenPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||
(0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
|
||||
CurrentPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
|
||||
value: view.page,
|
||||
options: Array.from(Array(totalPages)).map((_, i) => {
|
||||
|
@ -42355,9 +42438,6 @@ function DataViews({
|
|||
const hasPossibleBulkAction = dataviews_useSomeItemHasAPossibleBulkAction(actions, data);
|
||||
return (0,external_React_.createElement)("div", {
|
||||
className: "dataviews-wrapper"
|
||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||
spacing: 3,
|
||||
justify: "flex-start"
|
||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
alignment: "top",
|
||||
justify: "start",
|
||||
|
@ -42404,7 +42484,7 @@ function DataViews({
|
|||
view: view,
|
||||
onChangeView: onChangeView,
|
||||
paginationInfo: paginationInfo
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/header.js
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1414,7 +1414,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|||
PostStickyCheck: () => (/* reexport */ PostStickyCheck),
|
||||
PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton),
|
||||
PostSyncStatus: () => (/* reexport */ PostSyncStatus),
|
||||
PostSyncStatusModal: () => (/* reexport */ PostSyncStatusModal),
|
||||
PostTaxonomies: () => (/* reexport */ post_taxonomies),
|
||||
PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck),
|
||||
PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector),
|
||||
|
@ -5328,8 +5327,8 @@ unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
|
|||
const {
|
||||
registerBlockBindingsSource
|
||||
} = unlock((0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store));
|
||||
registerBlockBindingsSource(pattern_overrides);
|
||||
registerBlockBindingsSource(post_meta);
|
||||
if (false) {}
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","compose"]
|
||||
const external_wp_compose_namespaceObject = window["wp"]["compose"];
|
||||
|
@ -13062,18 +13061,11 @@ function PostSwitchToDraftButton() {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const {
|
||||
ReusableBlocksRenameHint
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
function PostSyncStatus() {
|
||||
const {
|
||||
syncStatus,
|
||||
|
@ -13100,70 +13092,6 @@ function PostSyncStatus() {
|
|||
className: "editor-post-sync-status__value"
|
||||
}, syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'Text that indicates that the pattern is not synchronized') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'Text that indicates that the pattern is synchronized')));
|
||||
}
|
||||
function PostSyncStatusModal() {
|
||||
const {
|
||||
editPost
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
|
||||
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined);
|
||||
const {
|
||||
postType,
|
||||
isNewPost
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getEditedPostAttribute,
|
||||
isCleanNewPost
|
||||
} = select(store_store);
|
||||
return {
|
||||
postType: getEditedPostAttribute('type'),
|
||||
isNewPost: isCleanNewPost()
|
||||
};
|
||||
}, []);
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
if (isNewPost && postType === 'wp_block') {
|
||||
setIsModalOpen(true);
|
||||
}
|
||||
// We only want the modal to open when the page is first loaded.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
const setSyncStatus = () => {
|
||||
editPost({
|
||||
meta: {
|
||||
wp_pattern_sync_status: syncType
|
||||
}
|
||||
});
|
||||
};
|
||||
if (postType !== 'wp_block' || !isNewPost) {
|
||||
return null;
|
||||
}
|
||||
return (0,external_React_.createElement)(external_React_.Fragment, null, isModalOpen && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
|
||||
title: (0,external_wp_i18n_namespaceObject.__)('Set pattern sync status'),
|
||||
onRequestClose: () => {
|
||||
setIsModalOpen(false);
|
||||
},
|
||||
overlayClassName: "reusable-blocks-menu-items__convert-modal"
|
||||
}, (0,external_React_.createElement)("form", {
|
||||
onSubmit: event => {
|
||||
event.preventDefault();
|
||||
setIsModalOpen(false);
|
||||
setSyncStatus();
|
||||
}
|
||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||
spacing: "5"
|
||||
}, (0,external_React_.createElement)(ReusableBlocksRenameHint, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
|
||||
label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'),
|
||||
help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'),
|
||||
checked: !syncType,
|
||||
onChange: () => {
|
||||
setSyncType(!syncType ? 'unsynced' : undefined);
|
||||
}
|
||||
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
justify: "right"
|
||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "primary",
|
||||
type: "submit"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -664,7 +664,8 @@ function InlineLinkUI({
|
|||
onChange,
|
||||
onFocusOutside,
|
||||
stopAddingLink,
|
||||
contentRef
|
||||
contentRef,
|
||||
focusOnMount
|
||||
}) {
|
||||
const richLinkTextValue = getRichTextValueFromSelection(value, isActive);
|
||||
|
||||
|
@ -830,7 +831,9 @@ function InlineLinkUI({
|
|||
onFocusOutside: onFocusOutside,
|
||||
placement: "bottom",
|
||||
offset: 10,
|
||||
shift: true
|
||||
shift: true,
|
||||
focusOnMount: focusOnMount,
|
||||
constrainTabbing: true
|
||||
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
|
||||
value: linkValue,
|
||||
onChange: onChangeLink,
|
||||
|
@ -905,9 +908,37 @@ function link_Edit({
|
|||
onFocus,
|
||||
contentRef
|
||||
}) {
|
||||
const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [editingLink, setEditingLink] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [creatingLink, setCreatingLink] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
|
||||
// We only need to store the button element that opened the popover. We can ignore the other states, as they will be handled by the onFocus prop to return to the rich text field.
|
||||
const [openedBy, setOpenedBy] = (0,external_wp_element_namespaceObject.useState)(null);
|
||||
|
||||
// Manages whether the Link UI popover should autofocus when shown.
|
||||
const [shouldAutoFocus, setShouldAutoFocus] = (0,external_wp_element_namespaceObject.useState)(true);
|
||||
function setIsEditingLink(isEditing, {
|
||||
autoFocus = true
|
||||
} = {}) {
|
||||
setEditingLink(isEditing);
|
||||
setShouldAutoFocus(autoFocus);
|
||||
}
|
||||
function setIsCreatingLink(isCreating) {
|
||||
// Don't add a new link if there is already an active link.
|
||||
// The two states are mutually exclusive.
|
||||
if (isCreating === true && isActive) {
|
||||
return;
|
||||
}
|
||||
setCreatingLink(isCreating);
|
||||
}
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
// When the link becomes inactive (i.e. isActive is false), reset the editingLink state
|
||||
// and the creatingLink state. This means that if the Link UI is displayed and the link
|
||||
// becomes inactive (e.g. used arrow keys to move cursor outside of link bounds), the UI will close.
|
||||
if (!isActive) {
|
||||
setEditingLink(false);
|
||||
setCreatingLink(false);
|
||||
}
|
||||
}, [isActive]);
|
||||
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
|
||||
const editableContentElement = contentRef.current;
|
||||
if (!editableContentElement) {
|
||||
|
@ -917,13 +948,18 @@ function link_Edit({
|
|||
// There is a situation whereby there is an existing link in the rich text
|
||||
// and the user clicks on the leftmost edge of that link and fails to activate
|
||||
// the link format, but the click event still fires on the `<a>` element.
|
||||
// This causes the `addingLink` state to be set to `true` and the link UI
|
||||
// This causes the `editingLink` state to be set to `true` and the link UI
|
||||
// to be rendered in "creating" mode. We need to check isActive to see if
|
||||
// we have an active link format.
|
||||
if (event.target.tagName !== 'A' || !isActive) {
|
||||
if (!event.target.closest('[contenteditable] a') ||
|
||||
// other formats (e.g. bold) may be nested within the link.
|
||||
!isActive) {
|
||||
setIsEditingLink(false);
|
||||
return;
|
||||
}
|
||||
setAddingLink(true);
|
||||
setIsEditingLink(true, {
|
||||
autoFocus: false
|
||||
});
|
||||
}
|
||||
editableContentElement.addEventListener('click', handleClick);
|
||||
return () => {
|
||||
|
@ -931,6 +967,7 @@ function link_Edit({
|
|||
};
|
||||
}, [contentRef, isActive]);
|
||||
function addLink(target) {
|
||||
setShouldAutoFocus(true);
|
||||
const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value));
|
||||
if (!isActive && text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) {
|
||||
onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
|
||||
|
@ -950,7 +987,11 @@ function link_Edit({
|
|||
if (target) {
|
||||
setOpenedBy(target);
|
||||
}
|
||||
setAddingLink(true);
|
||||
if (!isActive) {
|
||||
setIsCreatingLink(true);
|
||||
} else {
|
||||
setIsEditingLink(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -969,7 +1010,9 @@ function link_Edit({
|
|||
// Otherwise, we rely on the passed in onFocus to return focus to the rich text field.
|
||||
|
||||
// Close the popover
|
||||
setAddingLink(false);
|
||||
setIsEditingLink(false);
|
||||
setIsCreatingLink(false);
|
||||
|
||||
// Return focus to the toolbar button or the rich text field
|
||||
if (openedBy?.tagName === 'BUTTON') {
|
||||
openedBy.focus();
|
||||
|
@ -987,13 +1030,15 @@ function link_Edit({
|
|||
// 4. Press Escape
|
||||
// 5. Focus should be on the Options button
|
||||
function onFocusOutside() {
|
||||
setAddingLink(false);
|
||||
setIsEditingLink(false);
|
||||
setIsCreatingLink(false);
|
||||
setOpenedBy(null);
|
||||
}
|
||||
function onRemoveFormat() {
|
||||
onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, link_name));
|
||||
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
|
||||
}
|
||||
const isEditingActiveLink = editingLink && isActive;
|
||||
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
|
||||
type: "primary",
|
||||
character: "k",
|
||||
|
@ -1009,19 +1054,20 @@ function link_Edit({
|
|||
onClick: event => {
|
||||
addLink(event.currentTarget);
|
||||
},
|
||||
isActive: isActive || addingLink,
|
||||
isActive: isActive || editingLink,
|
||||
shortcutType: "primary",
|
||||
shortcutCharacter: "k",
|
||||
"aria-haspopup": "true",
|
||||
"aria-expanded": addingLink
|
||||
}), addingLink && (0,external_React_namespaceObject.createElement)(inline, {
|
||||
"aria-expanded": editingLink
|
||||
}), (isEditingActiveLink || creatingLink) && (0,external_React_namespaceObject.createElement)(inline, {
|
||||
stopAddingLink: stopAddingLink,
|
||||
onFocusOutside: onFocusOutside,
|
||||
isActive: isActive,
|
||||
activeAttributes: activeAttributes,
|
||||
value: value,
|
||||
onChange: onChange,
|
||||
contentRef: contentRef
|
||||
contentRef: contentRef,
|
||||
focusOnMount: shouldAutoFocus ? 'firstElement' : false
|
||||
}));
|
||||
}
|
||||
const build_module_link_link = {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -159,7 +159,12 @@ const handlers = {
|
|||
try {
|
||||
value = await it.value;
|
||||
} catch (e) {
|
||||
setNamespace(ns);
|
||||
setScope(scope);
|
||||
gen.throw(e);
|
||||
} finally {
|
||||
resetScope();
|
||||
resetNamespace();
|
||||
}
|
||||
if (it.done) break;
|
||||
}
|
||||
|
@ -871,6 +876,11 @@ function kebabToCamelCase(str) {
|
|||
|
||||
// Assigned objects should be ignore during proxification.
|
||||
const contextAssignedObjects = new WeakMap();
|
||||
|
||||
// Store the context proxy and fallback for each object in the context.
|
||||
const contextObjectToProxy = new WeakMap();
|
||||
const contextProxyToObject = new WeakMap();
|
||||
const contextObjectToFallback = new WeakMap();
|
||||
const isPlainObject = item => item && typeof item === 'object' && item.constructor === Object;
|
||||
const descriptor = Reflect.getOwnPropertyDescriptor;
|
||||
|
||||
|
@ -888,45 +898,74 @@ const descriptor = Reflect.getOwnPropertyDescriptor;
|
|||
*
|
||||
* @return {Object} The wrapped context object.
|
||||
*/
|
||||
const proxifyContext = (current, inherited = {}) => new Proxy(current, {
|
||||
get: (target, k) => {
|
||||
// Always subscribe to prop changes in the current context.
|
||||
const currentProp = target[k];
|
||||
const proxifyContext = (current, inherited = {}) => {
|
||||
// Update the fallback object reference when it changes.
|
||||
contextObjectToFallback.set(current, inherited);
|
||||
if (!contextObjectToProxy.has(current)) {
|
||||
const proxy = new Proxy(current, {
|
||||
get: (target, k) => {
|
||||
const fallback = contextObjectToFallback.get(current);
|
||||
// Always subscribe to prop changes in the current context.
|
||||
const currentProp = target[k];
|
||||
|
||||
// Return the inherited prop when missing in target.
|
||||
if (!(k in target) && k in inherited) {
|
||||
return inherited[k];
|
||||
}
|
||||
// Return the inherited prop when missing in target.
|
||||
if (!(k in target) && k in fallback) {
|
||||
return fallback[k];
|
||||
}
|
||||
|
||||
// Proxify plain objects that are not listed in `ignore`.
|
||||
if (k in target && !contextAssignedObjects.get(target)?.has(k) && isPlainObject(deepsignal_module_p(target, k))) {
|
||||
return proxifyContext(currentProp, inherited[k]);
|
||||
}
|
||||
// Proxify plain objects that were not directly assigned.
|
||||
if (k in target && !contextAssignedObjects.get(target)?.has(k) && isPlainObject(deepsignal_module_p(target, k))) {
|
||||
return proxifyContext(currentProp, fallback[k]);
|
||||
}
|
||||
|
||||
/*
|
||||
* For other cases, return the value from target, also subscribing
|
||||
* to changes in the parent context when the current prop is
|
||||
* not defined.
|
||||
*/
|
||||
return k in target ? currentProp : inherited[k];
|
||||
},
|
||||
set: (target, k, value) => {
|
||||
const obj = k in target || !(k in inherited) ? target : inherited;
|
||||
// Return the stored proxy for `currentProp` when it exists.
|
||||
if (contextObjectToProxy.has(currentProp)) {
|
||||
return contextObjectToProxy.get(currentProp);
|
||||
}
|
||||
|
||||
// Values that are objects should not be proxified so they point to
|
||||
// the original object and don't inherit unexpected properties.
|
||||
if (value && typeof value === 'object') {
|
||||
if (!contextAssignedObjects.has(obj)) {
|
||||
contextAssignedObjects.set(obj, new Set());
|
||||
}
|
||||
contextAssignedObjects.get(obj).add(k);
|
||||
}
|
||||
obj[k] = value;
|
||||
return true;
|
||||
},
|
||||
ownKeys: target => [...new Set([...Object.keys(inherited), ...Object.keys(target)])],
|
||||
getOwnPropertyDescriptor: (target, k) => descriptor(target, k) || descriptor(inherited, k)
|
||||
});
|
||||
/*
|
||||
* For other cases, return the value from target, also
|
||||
* subscribing to changes in the parent context when the current
|
||||
* prop is not defined.
|
||||
*/
|
||||
return k in target ? currentProp : fallback[k];
|
||||
},
|
||||
set: (target, k, value) => {
|
||||
const fallback = contextObjectToFallback.get(current);
|
||||
const obj = k in target || !(k in fallback) ? target : fallback;
|
||||
|
||||
/*
|
||||
* Assigned object values should not be proxified so they point
|
||||
* to the original object and don't inherit unexpected
|
||||
* properties.
|
||||
*/
|
||||
if (value && typeof value === 'object') {
|
||||
if (!contextAssignedObjects.has(obj)) {
|
||||
contextAssignedObjects.set(obj, new Set());
|
||||
}
|
||||
contextAssignedObjects.get(obj).add(k);
|
||||
}
|
||||
|
||||
/*
|
||||
* When the value is a proxy, it's because it comes from the
|
||||
* context, so the inner value is assigned instead.
|
||||
*/
|
||||
if (contextProxyToObject.has(value)) {
|
||||
const innerValue = contextProxyToObject.get(value);
|
||||
obj[k] = innerValue;
|
||||
} else {
|
||||
obj[k] = value;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
ownKeys: target => [...new Set([...Object.keys(contextObjectToFallback.get(current)), ...Object.keys(target)])],
|
||||
getOwnPropertyDescriptor: (target, k) => descriptor(target, k) || descriptor(contextObjectToFallback.get(current), k)
|
||||
});
|
||||
contextObjectToProxy.set(current, proxy);
|
||||
contextProxyToObject.set(proxy, current);
|
||||
}
|
||||
return contextObjectToProxy.get(current);
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively update values within a deepSignal object.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -326,19 +326,32 @@ class MediaUpload extends external_wp_element_namespaceObject.Component {
|
|||
const {
|
||||
wp
|
||||
} = window;
|
||||
const {
|
||||
value: featuredImageId,
|
||||
multiple,
|
||||
allowedTypes
|
||||
} = this.props;
|
||||
const featuredImageFrame = getFeaturedImageMediaFrame();
|
||||
const attachments = getAttachmentsCollection(this.props.value);
|
||||
const attachments = getAttachmentsCollection(featuredImageId);
|
||||
const selection = new wp.media.model.Selection(attachments.models, {
|
||||
props: attachments.props.toJSON()
|
||||
});
|
||||
this.frame = new featuredImageFrame({
|
||||
mimeType: this.props.allowedTypes,
|
||||
mimeType: allowedTypes,
|
||||
state: 'featured-image',
|
||||
multiple: this.props.multiple,
|
||||
multiple,
|
||||
selection,
|
||||
editing: this.props.value ? true : false
|
||||
editing: featuredImageId
|
||||
});
|
||||
wp.media.frame = this.frame;
|
||||
// In order to select the current featured image when opening
|
||||
// the media library we have to set the appropriate settings.
|
||||
// Currently they are set in php for the post editor, but
|
||||
// not for site editor.
|
||||
wp.media.view.settings.post = {
|
||||
...wp.media.view.settings.post,
|
||||
featuredImageId: featuredImageId || -1
|
||||
};
|
||||
}
|
||||
componentWillUnmount() {
|
||||
this.frame?.remove();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1132,10 +1132,13 @@ function RenamePatternCategoryModal({
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
function removeBindings(bindings, syncedAttributes) {
|
||||
let updatedBindings = {};
|
||||
for (const attributeName of syncedAttributes) {
|
||||
|
@ -1168,13 +1171,22 @@ function useSetPatternBindings({
|
|||
setAttributes
|
||||
}, currentPostType) {
|
||||
var _attributes$metadata$, _usePrevious;
|
||||
const hasPatternOverridesSource = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getBlockBindingsSource
|
||||
} = unlock(select(external_wp_blocks_namespaceObject.store));
|
||||
|
||||
// For editing link to the site editor if the theme and user permissions support it.
|
||||
return !!getBlockBindingsSource('core/pattern-overrides');
|
||||
}, []);
|
||||
const metadataName = (_attributes$metadata$ = attributes?.metadata?.name) !== null && _attributes$metadata$ !== void 0 ? _attributes$metadata$ : '';
|
||||
const prevMetadataName = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(metadataName)) !== null && _usePrevious !== void 0 ? _usePrevious : '';
|
||||
const bindings = attributes?.metadata?.bindings;
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
// Bindings should only be created when editing a wp_block post type,
|
||||
// and also when there's a change to the user-given name for the block.
|
||||
if (currentPostType !== 'wp_block' || metadataName === prevMetadataName) {
|
||||
// Also check that the pattern overrides source is registered.
|
||||
if (!hasPatternOverridesSource || currentPostType !== 'wp_block' || metadataName === prevMetadataName) {
|
||||
return;
|
||||
}
|
||||
const syncedAttributes = PARTIAL_SYNCING_SUPPORTED_BLOCKS[name];
|
||||
|
@ -1207,7 +1219,7 @@ function useSetPatternBindings({
|
|||
}
|
||||
});
|
||||
}
|
||||
}, [bindings, prevMetadataName, metadataName, currentPostType, name, attributes.metadata, setAttributes]);
|
||||
}, [hasPatternOverridesSource, bindings, prevMetadataName, metadataName, currentPostType, name, attributes.metadata, setAttributes]);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/reset-overrides-control.js
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1105,6 +1105,7 @@ function isEqualUntil(a, b, index) {
|
|||
}
|
||||
function toTree({
|
||||
value,
|
||||
preserveWhiteSpace,
|
||||
createEmpty,
|
||||
append,
|
||||
getLastChild,
|
||||
|
@ -1220,7 +1221,7 @@ function toTree({
|
|||
}
|
||||
// Ensure pointer is text node.
|
||||
pointer = append(getParent(pointer), '');
|
||||
} else if (character === '\n') {
|
||||
} else if (!preserveWhiteSpace && character === '\n') {
|
||||
pointer = append(getParent(pointer), {
|
||||
type: 'br',
|
||||
attributes: isEditableTree ? {
|
||||
|
@ -1279,16 +1280,19 @@ function toTree({
|
|||
/**
|
||||
* Create an HTML string from a Rich Text value.
|
||||
*
|
||||
* @param {Object} $1 Named argements.
|
||||
* @param {RichTextValue} $1.value Rich text value.
|
||||
* @param {Object} $1 Named argements.
|
||||
* @param {RichTextValue} $1.value Rich text value.
|
||||
* @param {boolean} [$1.preserveWhiteSpace] Preserves newlines if true.
|
||||
*
|
||||
* @return {string} HTML string.
|
||||
*/
|
||||
function toHTMLString({
|
||||
value
|
||||
value,
|
||||
preserveWhiteSpace
|
||||
}) {
|
||||
const tree = toTree({
|
||||
value,
|
||||
preserveWhiteSpace,
|
||||
createEmpty,
|
||||
append,
|
||||
getLastChild,
|
||||
|
@ -1536,9 +1540,12 @@ class RichTextData {
|
|||
}
|
||||
// We could expose `toHTMLElement` at some point as well, but we'd only use
|
||||
// it internally.
|
||||
toHTMLString() {
|
||||
toHTMLString({
|
||||
preserveWhiteSpace
|
||||
} = {}) {
|
||||
return this.originalHTML || toHTMLString({
|
||||
value: this.#value
|
||||
value: this.#value,
|
||||
preserveWhiteSpace
|
||||
});
|
||||
}
|
||||
valueOf() {
|
||||
|
@ -3178,6 +3185,15 @@ function useAnchor({
|
|||
const wasActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive);
|
||||
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
|
||||
if (!editableContentElement) return;
|
||||
function callback() {
|
||||
setAnchor(getAnchor(editableContentElement, tagName, className));
|
||||
}
|
||||
function attach() {
|
||||
ownerDocument.addEventListener('selectionchange', callback);
|
||||
}
|
||||
function detach() {
|
||||
ownerDocument.removeEventListener('selectionchange', callback);
|
||||
}
|
||||
const {
|
||||
ownerDocument
|
||||
} = editableContentElement;
|
||||
|
@ -3189,7 +3205,15 @@ function useAnchor({
|
|||
// When we _remove_ the color, it switches from a `<mark>` element to a virtual anchor.
|
||||
wasActive && !isActive) {
|
||||
setAnchor(getAnchor(editableContentElement, tagName, className));
|
||||
attach();
|
||||
}
|
||||
editableContentElement.addEventListener('focusin', attach);
|
||||
editableContentElement.addEventListener('focusout', detach);
|
||||
return () => {
|
||||
detach();
|
||||
editableContentElement.removeEventListener('focusin', attach);
|
||||
editableContentElement.removeEventListener('focusout', detach);
|
||||
};
|
||||
}, [editableContentElement, tagName, className, isActive, wasActive]);
|
||||
return anchor;
|
||||
}
|
||||
|
@ -4037,7 +4061,8 @@ function useRichText({
|
|||
};
|
||||
if (typeof value === 'string') {
|
||||
_value.current = toHTMLString({
|
||||
value: newRecord
|
||||
value: newRecord,
|
||||
preserveWhiteSpace
|
||||
});
|
||||
} else {
|
||||
_value.current = new RichTextData(newRecord);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-alpha-57811';
|
||||
$wp_version = '6.6-alpha-57814';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue