diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md
index 20d6ebfe5291a..8b0f24e60fb7b 100644
--- a/docs/reference-guides/data/data-core-block-editor.md
+++ b/docs/reference-guides/data/data-core-block-editor.md
@@ -538,7 +538,6 @@ _Parameters_
- _state_ `Object`: Editor state.
- _rootClientId_ `?string`: Optional root client ID of block list.
-- _syncStatus_ `?string`: Optional sync status to filter pattern blocks by.
_Returns_
diff --git a/docs/reference-guides/data/data-core.md b/docs/reference-guides/data/data-core.md
index 8db3a26dd0977..a66c0991e3d27 100644
--- a/docs/reference-guides/data/data-core.md
+++ b/docs/reference-guides/data/data-core.md
@@ -329,18 +329,6 @@ _Returns_
- `any`: The entity record's save error.
-### getNavigationFallbackId
-
-Retrieve the fallback Navigation.
-
-_Parameters_
-
-- _state_ `State`: Data state.
-
-_Returns_
-
-- `EntityRecordKey | undefined`: The ID for the fallback Navigation post.
-
### getRawEntityRecord
Returns the entity's record object by key, with its attributes mapped to their raw values.
diff --git a/lib/compat/wordpress-6.3/block-template-utils.php b/lib/compat/wordpress-6.3/block-template-utils.php
index cdd870db2d081..cc367f66dd42d 100644
--- a/lib/compat/wordpress-6.3/block-template-utils.php
+++ b/lib/compat/wordpress-6.3/block-template-utils.php
@@ -29,7 +29,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
}
if ( isset( $default_template_types['home'] ) ) {
$default_template_types['home'] = array(
- 'title' => _x( 'Home', 'Template name', 'gutenberg' ),
+ 'title' => _x( 'Blog Home', 'Template name', 'gutenberg' ),
'description' => __(
'Displays the latest posts as either the site homepage or as the "Posts page" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.',
'gutenberg'
diff --git a/packages/block-editor/src/components/block-mobile-toolbar/block-actions-menu.native.js b/packages/block-editor/src/components/block-mobile-toolbar/block-actions-menu.native.js
index e896d6054a8ff..48be5cb8a9c00 100644
--- a/packages/block-editor/src/components/block-mobile-toolbar/block-actions-menu.native.js
+++ b/packages/block-editor/src/components/block-mobile-toolbar/block-actions-menu.native.js
@@ -213,16 +213,12 @@ const BlockActionsMenu = ( {
id: 'convertToRegularBlocksOption',
label:
innerBlockCount > 1
- ? __( 'Convert to regular blocks' )
- : __( 'Convert to regular block' ),
+ ? __( 'Detach patterns' )
+ : __( 'Detach pattern' ),
value: 'convertToRegularBlocksOption',
onSelect: () => {
- const successNotice =
- innerBlockCount > 1
- ? /* translators: %s: name of the reusable block */
- __( '%s converted to regular blocks' )
- : /* translators: %s: name of the reusable block */
- __( '%s converted to regular block' );
+ /* translators: %s: name of the synced block */
+ const successNotice = __( '%s detached' );
createSuccessNotice(
sprintf(
successNotice,
diff --git a/packages/block-editor/src/components/block-removal-warning-modal/index.js b/packages/block-editor/src/components/block-removal-warning-modal/index.js
index 2e16d2834d2ce..2ed65481f6895 100644
--- a/packages/block-editor/src/components/block-removal-warning-modal/index.js
+++ b/packages/block-editor/src/components/block-removal-warning-modal/index.js
@@ -8,7 +8,7 @@ import {
Button,
__experimentalHStack as HStack,
} from '@wordpress/components';
-import { __, _n } from '@wordpress/i18n';
+import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
@@ -75,11 +75,9 @@ export function BlockRemovalWarningModal() {
) }
- { _n(
- 'Removing this block is not advised.',
- 'Removing these blocks is not advised.',
- blockNamesForPrompt.length
- ) }
+ { blockNamesForPrompt.length > 1
+ ? __( 'Removing these blocks is not advised.' )
+ : __( 'Removing this block is not advised.' ) }
diff --git a/packages/block-editor/src/components/default-block-appender/content.scss b/packages/block-editor/src/components/default-block-appender/content.scss
index 9eecf9a7e007a..48aac077096c2 100644
--- a/packages/block-editor/src/components/default-block-appender/content.scss
+++ b/packages/block-editor/src/components/default-block-appender/content.scss
@@ -26,6 +26,17 @@
opacity: 0.62;
}
+ // In "constrained" layout containers, the first and last paragraphs have their margins zeroed out.
+ // In the case of this appender, it needs to apply those same rules to avoid layout shifts.
+ // Such shifts happen when the bottom margin of the Title block has been set to less than the default 1em margin of paragraphs.
+ :where(body .is-layout-constrained) & {
+ > :first-child:first-child {
+ margin-block-start: 0;
+ }
+
+ // Since this particular appender will only ever appear on an entirely empty document, we don't account for last-child.
+ }
+
// Dropzone.
.components-drop-zone__content-icon {
display: none;
diff --git a/packages/block-editor/src/components/global-styles/filters-panel.js b/packages/block-editor/src/components/global-styles/filters-panel.js
index e2ee95696d5d4..ef972de3f13cd 100644
--- a/packages/block-editor/src/components/global-styles/filters-panel.js
+++ b/packages/block-editor/src/components/global-styles/filters-panel.js
@@ -22,7 +22,7 @@ import {
Flex,
FlexItem,
} from '@wordpress/components';
-import { __ } from '@wordpress/i18n';
+import { __, _x } from '@wordpress/i18n';
import { useCallback, useMemo } from '@wordpress/element';
/**
@@ -77,7 +77,7 @@ function FiltersToolsPanel( {
return (
diff --git a/packages/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js b/packages/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js
index a4e3c91cba4ba..fda1a00c1a07d 100644
--- a/packages/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js
+++ b/packages/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js
@@ -52,6 +52,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
onInsertBlocks,
destinationRootClientId
);
+
const registeredPatternCategories = useMemo(
() =>
patternCategories.map(
@@ -75,7 +76,12 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
);
}
return searchItems( allPatterns, filterValue );
- }, [ filterValue, selectedCategory, allPatterns ] );
+ }, [
+ filterValue,
+ allPatterns,
+ selectedCategory,
+ registeredPatternCategories,
+ ] );
// Announce search results on change.
useEffect( () => {
@@ -89,7 +95,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
count
);
debouncedSpeak( resultsFoundMessage );
- }, [ filterValue, debouncedSpeak ] );
+ }, [ filterValue, debouncedSpeak, filteredBlockPatterns.length ] );
const currentShownPatterns = useAsyncList( filteredBlockPatterns, {
step: INITIAL_INSERTER_RESULTS,
diff --git a/packages/block-editor/src/components/inserter/block-patterns-tab.js b/packages/block-editor/src/components/inserter/block-patterns-tab.js
index 578791e880269..f66d27ac06170 100644
--- a/packages/block-editor/src/components/inserter/block-patterns-tab.js
+++ b/packages/block-editor/src/components/inserter/block-patterns-tab.js
@@ -18,7 +18,6 @@ import {
Button,
} from '@wordpress/components';
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
-import { parse } from '@wordpress/blocks';
import { focus } from '@wordpress/dom';
/**
@@ -28,13 +27,13 @@ import usePatternsState from './hooks/use-patterns-state';
import BlockPatternList from '../block-patterns-list';
import PatternsExplorerModal from './block-patterns-explorer/explorer';
import MobileTabNavigation from './mobile-tab-navigation';
-import useBlockTypesState from './hooks/use-block-types-state';
const noop = () => {};
// Preferred order of pattern categories. Any other categories should
// be at the bottom without any re-ordering.
const patternCategoriesOrder = [
+ 'custom',
'featured',
'posts',
'text',
@@ -51,18 +50,6 @@ function usePatternsCategories( rootClientId ) {
rootClientId
);
- const [ unsyncedPatterns ] = useBlockTypesState(
- rootClientId,
- undefined,
- 'unsynced'
- );
-
- const filteredUnsyncedPatterns = useMemo( () => {
- return unsyncedPatterns.filter(
- ( { category: unsyncedPatternCategory } ) =>
- unsyncedPatternCategory === 'reusable'
- );
- }, [ unsyncedPatterns ] );
const hasRegisteredCategory = useCallback(
( pattern ) => {
if ( ! pattern.categories || ! pattern.categories.length ) {
@@ -107,20 +94,9 @@ function usePatternsCategories( rootClientId ) {
label: _x( 'Uncategorized' ),
} );
}
- if ( filteredUnsyncedPatterns.length > 0 ) {
- categories.push( {
- name: 'reusable',
- label: _x( 'Custom patterns' ),
- } );
- }
return categories;
- }, [
- allCategories,
- allPatterns,
- filteredUnsyncedPatterns.length,
- hasRegisteredCategory,
- ] );
+ }, [ allCategories, allPatterns, hasRegisteredCategory ] );
return populatedCategories;
}
@@ -169,24 +145,6 @@ export function BlockPatternsCategoryPanel( {
onInsert,
rootClientId
);
- const [ unsyncedPatterns ] = useBlockTypesState(
- rootClientId,
- onInsert,
- 'unsynced'
- );
- const filteredUnsyncedPatterns = useMemo( () => {
- return unsyncedPatterns
- .filter(
- ( { category: unsyncedPatternCategory } ) =>
- unsyncedPatternCategory === 'reusable'
- )
- .map( ( syncedPattern ) => ( {
- ...syncedPattern,
- blocks: parse( syncedPattern.content, {
- __unstableSkipMigrationLogs: true,
- } ),
- } ) );
- }, [ unsyncedPatterns ] );
const availableCategories = usePatternsCategories( rootClientId );
const currentCategoryPatterns = useMemo(
@@ -208,21 +166,15 @@ export function BlockPatternsCategoryPanel( {
return availablePatternCategories.length === 0;
} ),
- [ allPatterns, category ]
+ [ allPatterns, availableCategories, category.name ]
);
- const patterns =
- category.name === 'reusable'
- ? filteredUnsyncedPatterns
- : currentCategoryPatterns;
- const currentShownPatterns = useAsyncList( patterns );
+
+ const categoryPatternsList = useAsyncList( currentCategoryPatterns );
// Hide block pattern preview on unmount.
useEffect( () => () => onHover( null ), [] );
- if (
- ! currentCategoryPatterns.length &&
- ! filteredUnsyncedPatterns.length
- ) {
+ if ( ! currentCategoryPatterns.length ) {
return null;
}
@@ -233,8 +185,8 @@ export function BlockPatternsCategoryPanel( {
{ category.description }
{
+const useBlockTypesState = ( rootClientId, onInsert ) => {
const { categories, collections, items } = useSelect(
( select ) => {
const { getInserterItems } = select( blockEditorStore );
@@ -31,10 +30,10 @@ const useBlockTypesState = ( rootClientId, onInsert, syncStatus ) => {
return {
categories: getCategories(),
collections: getCollections(),
- items: getInserterItems( rootClientId, syncStatus ),
+ items: getInserterItems( rootClientId ),
};
},
- [ rootClientId, syncStatus ]
+ [ rootClientId ]
);
const onSelectItem = useCallback(
diff --git a/packages/block-editor/src/components/inserter/hooks/use-patterns-state.js b/packages/block-editor/src/components/inserter/hooks/use-patterns-state.js
index ca287b95c43b9..805a89ca8ff0c 100644
--- a/packages/block-editor/src/components/inserter/hooks/use-patterns-state.js
+++ b/packages/block-editor/src/components/inserter/hooks/use-patterns-state.js
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
-import { useCallback } from '@wordpress/element';
+import { useCallback, useMemo } from '@wordpress/element';
import { cloneBlock } from '@wordpress/blocks';
import { useDispatch, useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
@@ -12,6 +12,12 @@ import { store as noticesStore } from '@wordpress/notices';
*/
import { store as blockEditorStore } from '../../../store';
+const CUSTOM_CATEGORY = {
+ name: 'custom',
+ label: __( 'My patterns' ),
+ description: __( 'Custom patterns add by site users' ),
+};
+
/**
* Retrieves the block patterns inserter state.
*
@@ -25,6 +31,7 @@ const usePatternsState = ( onInsert, rootClientId ) => {
( select ) => {
const { __experimentalGetAllowedPatterns, getSettings } =
select( blockEditorStore );
+
return {
patterns: __experimentalGetAllowedPatterns( rootClientId ),
patternCategories:
@@ -33,25 +40,34 @@ const usePatternsState = ( onInsert, rootClientId ) => {
},
[ rootClientId ]
);
+
+ const allCategories = useMemo(
+ () => [ ...patternCategories, CUSTOM_CATEGORY ],
+ [ patternCategories ]
+ );
+
const { createSuccessNotice } = useDispatch( noticesStore );
- const onClickPattern = useCallback( ( pattern, blocks ) => {
- onInsert(
- ( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),
- pattern.name
- );
- createSuccessNotice(
- sprintf(
- /* translators: %s: block pattern title. */
- __( 'Block pattern "%s" inserted.' ),
- pattern.title
- ),
- {
- type: 'snackbar',
- }
- );
- }, [] );
-
- return [ patterns, patternCategories, onClickPattern ];
+ const onClickPattern = useCallback(
+ ( pattern, blocks ) => {
+ onInsert(
+ ( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),
+ pattern.name
+ );
+ createSuccessNotice(
+ sprintf(
+ /* translators: %s: block pattern title. */
+ __( 'Block pattern "%s" inserted.' ),
+ pattern.title
+ ),
+ {
+ type: 'snackbar',
+ }
+ );
+ },
+ [ createSuccessNotice, onInsert ]
+ );
+
+ return [ patterns, allCategories, onClickPattern ];
};
export default usePatternsState;
diff --git a/packages/block-editor/src/components/inserter/reusable-blocks-tab.js b/packages/block-editor/src/components/inserter/reusable-blocks-tab.js
index 65930fa9fcd4a..c16d5f1a78e54 100644
--- a/packages/block-editor/src/components/inserter/reusable-blocks-tab.js
+++ b/packages/block-editor/src/components/inserter/reusable-blocks-tab.js
@@ -67,7 +67,7 @@ export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
post_type: 'wp_block',
} ) }
>
- { __( 'Manage custom patterns' ) }
+ { __( 'Manage my patterns' ) }
>
diff --git a/packages/block-editor/src/components/list-view/style.scss b/packages/block-editor/src/components/list-view/style.scss
index 0924e98b3f5d4..ab041af51aa1e 100644
--- a/packages/block-editor/src/components/list-view/style.scss
+++ b/packages/block-editor/src/components/list-view/style.scss
@@ -408,8 +408,7 @@ $block-navigation-max-indent: 8;
.block-editor-list-view-drop-indicator__line {
background: var(--wp-admin-theme-color);
- height: 6px;
- border: 1px solid $white;
+ height: 4px;
border-radius: 4px;
}
}
diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js
index 05d00f65b1fd3..fc314636d1195 100644
--- a/packages/block-editor/src/store/selectors.js
+++ b/packages/block-editor/src/store/selectors.js
@@ -1945,7 +1945,6 @@ const buildBlockTypeItem =
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
- * @param {?string} syncStatus Optional sync status to filter pattern blocks by.
*
* @return {WPEditorInserterItem[]} Items that appear in inserter.
*
@@ -1962,11 +1961,7 @@ const buildBlockTypeItem =
* @property {number} frecency Heuristic that combines frequency and recency.
*/
export const getInserterItems = createSelector(
- ( state, rootClientId = null, syncStatus ) => {
- const buildBlockTypeInserterItem = buildBlockTypeItem( state, {
- buildScope: 'inserter',
- } );
-
+ ( state, rootClientId = null ) => {
/*
* Matches block comment delimiters amid serialized content.
*
@@ -2031,13 +2026,7 @@ export const getInserterItems = createSelector(
};
};
- const blockTypeInserterItems = getBlockTypes()
- .filter( ( blockType ) =>
- canIncludeBlockTypeInInserter( state, blockType, rootClientId )
- )
- .map( buildBlockTypeInserterItem );
-
- const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(
+ const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(
state,
'core/block',
rootClientId
@@ -2045,13 +2034,25 @@ export const getInserterItems = createSelector(
? getReusableBlocks( state )
.filter(
( reusableBlock ) =>
- syncStatus === reusableBlock.meta?.sync_status ||
- ( ! syncStatus &&
- reusableBlock.meta?.sync_status === '' )
+ // Filter to either fully synced patterns (sync_status === 'fully'),
+ // or old school reusable blocks (sync_status === '').
+ reusableBlock.meta?.sync_status === 'fully' ||
+ reusableBlock.meta?.sync_status === '' ||
+ ! reusableBlock.meta?.sync_status
)
.map( buildReusableBlockInserterItem )
: [];
+ const buildBlockTypeInserterItem = buildBlockTypeItem( state, {
+ buildScope: 'inserter',
+ } );
+
+ const blockTypeInserterItems = getBlockTypes()
+ .filter( ( blockType ) =>
+ canIncludeBlockTypeInInserter( state, blockType, rootClientId )
+ )
+ .map( buildBlockTypeInserterItem );
+
const items = blockTypeInserterItems.reduce( ( accumulator, item ) => {
const { variations = [] } = item;
// Exclude any block type item that is to be replaced by a default variation.
@@ -2082,7 +2083,7 @@ export const getInserterItems = createSelector(
{ core: [], noncore: [] }
);
const sortedBlockTypes = [ ...coreItems, ...nonCoreItems ];
- return [ ...sortedBlockTypes, ...reusableBlockInserterItems ];
+ return [ ...sortedBlockTypes, ...syncedPatternInserterItems ];
},
( state, rootClientId ) => [
state.blockListSettings[ rootClientId ],
@@ -2306,10 +2307,32 @@ const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
return true;
};
+function getUnsyncedPatterns( state ) {
+ const reusableBlocks =
+ state?.settings?.__experimentalReusableBlocks ?? EMPTY_ARRAY;
+
+ return reusableBlocks
+ .filter(
+ ( reusableBlock ) => reusableBlock.meta?.sync_status === 'unsynced'
+ )
+ .map( ( reusableBlock ) => {
+ return {
+ name: `core/block/${ reusableBlock.id }`,
+ title: reusableBlock.title.raw,
+ categories: [ 'custom' ],
+ content: reusableBlock.content.raw,
+ };
+ } );
+}
+
export const __experimentalGetParsedPattern = createSelector(
( state, patternName ) => {
const patterns = state.settings.__experimentalBlockPatterns;
- const pattern = patterns.find( ( { name } ) => name === patternName );
+ const unsyncedPatterns = getUnsyncedPatterns( state );
+
+ const pattern = [ ...patterns, ...unsyncedPatterns ].find(
+ ( { name } ) => name === patternName
+ );
if ( ! pattern ) {
return null;
}
@@ -2320,14 +2343,20 @@ export const __experimentalGetParsedPattern = createSelector(
} ),
};
},
- ( state ) => [ state.settings.__experimentalBlockPatterns ]
+ ( state ) => [
+ state.settings.__experimentalBlockPatterns,
+ state.settings.__experimentalReusableBlocks,
+ ]
);
const getAllAllowedPatterns = createSelector(
( state ) => {
const patterns = state.settings.__experimentalBlockPatterns;
+ const unsyncedPatterns = getUnsyncedPatterns( state );
+
const { allowedBlockTypes } = getSettings( state );
- const parsedPatterns = patterns
+
+ const parsedPatterns = [ ...patterns, ...unsyncedPatterns ]
.filter( ( { inserter = true } ) => !! inserter )
.map( ( { name } ) =>
__experimentalGetParsedPattern( state, name )
@@ -2339,6 +2368,7 @@ const getAllAllowedPatterns = createSelector(
},
( state ) => [
state.settings.__experimentalBlockPatterns,
+ state.settings.__experimentalReusableBlocks,
state.settings.allowedBlockTypes,
]
);
@@ -2365,6 +2395,7 @@ export const __experimentalGetAllowedPatterns = createSelector(
},
( state, rootClientId ) => [
state.settings.__experimentalBlockPatterns,
+ state.settings.__experimentalReusableBlocks,
state.settings.allowedBlockTypes,
state.settings.templateLock,
state.blockListSettings[ rootClientId ],
diff --git a/packages/block-library/src/block/edit.js b/packages/block-library/src/block/edit.js
index cc1ec16aeedc2..0b1f3b01b75b9 100644
--- a/packages/block-library/src/block/edit.js
+++ b/packages/block-library/src/block/edit.js
@@ -119,8 +119,8 @@ export default function ReusableBlockEdit( { attributes: { ref }, clientId } ) {
onClick={ () => convertBlockToStatic( clientId ) }
label={
innerBlockCount > 1
- ? __( 'Convert to regular blocks' )
- : __( 'Convert to regular block' )
+ ? __( 'Detach patterns' )
+ : __( 'Detach pattern' )
}
icon={ ungroup }
showTooltip
diff --git a/packages/block-library/src/block/edit.native.js b/packages/block-library/src/block/edit.native.js
index e72aee3858eaf..3466baa6bad71 100644
--- a/packages/block-library/src/block/edit.native.js
+++ b/packages/block-library/src/block/edit.native.js
@@ -132,12 +132,8 @@ export default function ReusableBlockEdit( {
}
const onConvertToRegularBlocks = useCallback( () => {
- const successNotice =
- innerBlockCount > 1
- ? /* translators: %s: name of the reusable block */
- __( '%s converted to regular blocks' )
- : /* translators: %s: name of the reusable block */
- __( '%s converted to regular block' );
+ /* translators: %s: name of the synced block */
+ const successNotice = __( '%s detached' );
createSuccessNotice( sprintf( successNotice, title ) );
clearSelectedBlock();
@@ -182,17 +178,17 @@ export default function ReusableBlockEdit( {
{ innerBlockCount > 1
? __(
- 'Alternatively, you can detach and edit these blocks separately by tapping “Convert to regular blocks”.'
+ 'Alternatively, you can detach and edit these blocks separately by tapping “Detach patterns”.'
)
: __(
- 'Alternatively, you can detach and edit this block separately by tapping “Convert to regular block”.'
+ 'Alternatively, you can detach and edit this block separately by tapping “Detach pattern”.'
) }
1
- ? __( 'Convert to regular blocks' )
- : __( 'Convert to regular block' )
+ ? __( 'Detach patterns' )
+ : __( 'Detach pattern' )
}
separatorType="topFullWidth"
onPress={ onConvertToRegularBlocks }
diff --git a/packages/block-library/src/footnotes/index.php b/packages/block-library/src/footnotes/index.php
index b7be0542d7a0f..e4bd8dcdeaac2 100644
--- a/packages/block-library/src/footnotes/index.php
+++ b/packages/block-library/src/footnotes/index.php
@@ -59,15 +59,17 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
* Registers the `core/footnotes` block on the server.
*/
function register_block_core_footnotes() {
- register_post_meta(
- 'post',
- 'footnotes',
- array(
- 'show_in_rest' => true,
- 'single' => true,
- 'type' => 'string',
- )
- );
+ foreach ( array( 'post', 'page' ) as $post_type ) {
+ register_post_meta(
+ $post_type,
+ 'footnotes',
+ array(
+ 'show_in_rest' => true,
+ 'single' => true,
+ 'type' => 'string',
+ )
+ );
+ }
register_block_type_from_metadata(
__DIR__ . '/footnotes',
array(
diff --git a/packages/block-library/src/footnotes/style.scss b/packages/block-library/src/footnotes/style.scss
index b5540b70e6f0f..4debba0560f17 100644
--- a/packages/block-library/src/footnotes/style.scss
+++ b/packages/block-library/src/footnotes/style.scss
@@ -3,7 +3,7 @@
counter-reset: footnotes;
}
-.fn {
+[data-fn].fn {
vertical-align: super;
font-size: smaller;
counter-increment: footnotes;
@@ -11,7 +11,7 @@
text-indent: -9999999px;
}
-.fn::after {
+[data-fn].fn::after {
content: "[" counter(footnotes) "]";
text-indent: 0;
float: left;
diff --git a/packages/block-library/src/navigation-link/edit.js b/packages/block-library/src/navigation-link/edit.js
index 539e1c6d92a98..b91015313f403 100644
--- a/packages/block-library/src/navigation-link/edit.js
+++ b/packages/block-library/src/navigation-link/edit.js
@@ -35,10 +35,7 @@ import {
} from '@wordpress/dom';
import { decodeEntities } from '@wordpress/html-entities';
import { link as linkIcon, addSubmenu } from '@wordpress/icons';
-import {
- store as coreStore,
- useResourcePermissions,
-} from '@wordpress/core-data';
+import { store as coreStore } from '@wordpress/core-data';
import { useMergeRefs } from '@wordpress/compose';
/**
@@ -184,9 +181,6 @@ export default function NavigationLinkEdit( {
const itemLabelPlaceholder = __( 'Add label…' );
const ref = useRef();
- const pagesPermissions = useResourcePermissions( 'pages' );
- const postsPermissions = useResourcePermissions( 'posts' );
-
const {
innerBlocks,
isAtMaxNesting,
@@ -322,13 +316,6 @@ export default function NavigationLinkEdit( {
setIsLinkOpen( false );
}
- let userCanCreate = false;
- if ( ! type || type === 'page' ) {
- userCanCreate = pagesPermissions.canCreate;
- } else if ( type === 'post' ) {
- userCanCreate = postsPermissions.canCreate;
- }
-
const {
textColor,
customTextColor,
@@ -589,7 +576,6 @@ export default function NavigationLinkEdit( {
link={ attributes }
onClose={ () => setIsLinkOpen( false ) }
anchor={ popoverAnchor }
- hasCreateSuggestion={ userCanCreate }
onRemove={ removeLink }
onChange={ ( updatedValue ) => {
updateAttributes(
diff --git a/packages/block-library/src/navigation-link/link-ui.js b/packages/block-library/src/navigation-link/link-ui.js
index 782d1fff4a01b..950cac9cfb87b 100644
--- a/packages/block-library/src/navigation-link/link-ui.js
+++ b/packages/block-library/src/navigation-link/link-ui.js
@@ -10,7 +10,10 @@ import {
store as blockEditorStore,
} from '@wordpress/block-editor';
import { createInterpolateElement, useMemo } from '@wordpress/element';
-import { store as coreStore } from '@wordpress/core-data';
+import {
+ store as coreStore,
+ useResourcePermissions,
+} from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';
import { switchToBlockType } from '@wordpress/blocks';
import { useSelect, useDispatch } from '@wordpress/data';
@@ -125,6 +128,8 @@ function LinkControlTransforms( { clientId } ) {
export function LinkUI( props ) {
const { saveEntityRecord } = useDispatch( coreStore );
+ const pagesPermissions = useResourcePermissions( 'pages' );
+ const postsPermissions = useResourcePermissions( 'posts' );
async function handleCreate( pageTitle ) {
const postType = props.link.type || 'page';
@@ -155,6 +160,13 @@ export function LinkUI( props ) {
const { label, url, opensInNewTab, type, kind } = props.link;
+ let userCanCreate = false;
+ if ( ! type || type === 'page' ) {
+ userCanCreate = pagesPermissions.canCreate;
+ } else if ( type === 'post' ) {
+ userCanCreate = postsPermissions.canCreate;
+ }
+
// Memoize link value to avoid overriding the LinkControl's internal state.
// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.
const link = useMemo(
@@ -179,7 +191,7 @@ export function LinkUI( props ) {
className={ props.className }
value={ link }
showInitialSuggestions={ true }
- withCreateSuggestion={ props.hasCreateSuggestion }
+ withCreateSuggestion={ userCanCreate }
createSuggestion={ handleCreate }
createSuggestionButtonText={ ( searchTerm ) => {
let format;
diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js
index 2fe86825bb6b1..7ec990d5b7389 100644
--- a/packages/block-library/src/navigation/edit/index.js
+++ b/packages/block-library/src/navigation/edit/index.js
@@ -69,7 +69,6 @@ import ManageMenusButton from './manage-menus-button';
import MenuInspectorControls from './menu-inspector-controls';
import DeletedNavigationWarning from './deleted-navigation-warning';
import { unlock } from '../../lock-unlock';
-
const { useBlockEditingMode } = unlock( blockEditorPrivateApis );
function Navigation( {
@@ -224,7 +223,7 @@ function Navigation( {
// that automatically saves the menu as an entity when changes are made to the inner blocks.
const hasUnsavedBlocks = hasUncontrolledInnerBlocks && ! isEntityAvailable;
- const { getNavigationFallbackId } = useSelect( coreStore );
+ const { getNavigationFallbackId } = unlock( useSelect( coreStore ) );
const navigationFallbackId = ! ( ref || hasUnsavedBlocks )
? getNavigationFallbackId()
diff --git a/packages/block-library/src/navigation/edit/menu-inspector-controls.js b/packages/block-library/src/navigation/edit/menu-inspector-controls.js
index 8743b51fc6720..9fd4bc3e33d41 100644
--- a/packages/block-library/src/navigation/edit/menu-inspector-controls.js
+++ b/packages/block-library/src/navigation/edit/menu-inspector-controls.js
@@ -60,7 +60,6 @@ function AdditionalBlockContent( { block, insertedBlock, setInsertedBlock } ) {
onClose={ () => {
setInsertedBlock( null );
} }
- hasCreateSuggestion={ false }
onChange={ ( updatedValue ) => {
updateAttributes(
updatedValue,
diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php
index 1e5c4cf5de6fb..51ed9374c9bcd 100644
--- a/packages/block-library/src/social-link/index.php
+++ b/packages/block-library/src/social-link/index.php
@@ -47,8 +47,8 @@ function render_block_core_social_link( $attributes, $content, $block ) {
$icon = block_core_social_link_get_icon( $service );
$wrapper_attributes = get_block_wrapper_attributes(
array(
- 'class' => esc_attr( 'wp-social-link wp-social-link-' . $service . block_core_social_link_get_color_classes( $block->context ) ),
- 'style' => esc_attr( block_core_social_link_get_color_styles( $block->context ) ),
+ 'class' => 'wp-social-link wp-social-link-' . $service . block_core_social_link_get_color_classes( $block->context ),
+ 'style' => block_core_social_link_get_color_styles( $block->context ),
)
);
diff --git a/packages/components/src/guide/icons.tsx b/packages/components/src/guide/icons.tsx
index 1c47180ae0b11..36146611dc299 100644
--- a/packages/components/src/guide/icons.tsx
+++ b/packages/components/src/guide/icons.tsx
@@ -3,13 +3,8 @@
*/
import { SVG, Circle } from '@wordpress/primitives';
-export const PageControlIcon = ( { isSelected }: { isSelected: boolean } ) => (
+export const PageControlIcon = () => (
-
+
);
diff --git a/packages/components/src/guide/index.tsx b/packages/components/src/guide/index.tsx
index 38f8d07d8c0ef..e6a2d4c1252eb 100644
--- a/packages/components/src/guide/index.tsx
+++ b/packages/components/src/guide/index.tsx
@@ -111,6 +111,7 @@ function Guide( {
1 }
onRequestClose={ onFinish }
onKeyDown={ ( event ) => {
if ( event.code === 'ArrowLeft' ) {
@@ -144,6 +145,7 @@ function Guide( {
{ canGoBack && (
{ __( 'Previous' ) }
@@ -152,6 +154,7 @@ function Guide( {
{ canGoForward && (
{ __( 'Next' ) }
@@ -160,6 +163,7 @@ function Guide( {
{ ! canGoForward && (
{ finishButtonText }
diff --git a/packages/components/src/guide/page-control.tsx b/packages/components/src/guide/page-control.tsx
index 6e5951923ab38..468670c6ad9b9 100644
--- a/packages/components/src/guide/page-control.tsx
+++ b/packages/components/src/guide/page-control.tsx
@@ -28,11 +28,7 @@ export default function PageControl( {
>
- }
+ icon={ }
aria-label={ sprintf(
/* translators: 1: current page number 2: total number of pages */
__( 'Page %1$d of %2$d' ),
diff --git a/packages/components/src/guide/style.scss b/packages/components/src/guide/style.scss
index 5731f81de10ed..b2516edeff135 100644
--- a/packages/components/src/guide/style.scss
+++ b/packages/components/src/guide/style.scss
@@ -29,7 +29,7 @@
&:hover {
svg {
- fill: #fff;
+ fill: $white;
}
}
}
@@ -57,7 +57,7 @@
&__footer {
align-content: center;
display: flex;
- height: 30px;
+ height: $button-size;
justify-content: center;
margin: 0 0 $grid-unit-30 0;
padding: 0 $grid-unit-40;
@@ -78,6 +78,11 @@
height: 30px;
min-width: 20px;
margin: -6px 0;
+ color: $gray-200;
+ }
+
+ li[aria-current="step"] .components-button {
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color));
}
}
}
@@ -85,7 +90,6 @@
.components-modal__frame.components-guide {
border: none;
min-width: 312px;
- height: 80vh;
max-height: 575px;
@media ( max-width: $break-small ) {
@@ -98,34 +102,14 @@
&.components-guide__back-button,
&.components-guide__forward-button,
&.components-guide__finish-button {
- height: 30px;
position: absolute;
}
- &.components-guide__back-button,
- &.components-guide__forward-button {
- font-size: $default-font-size;
- padding: 4px 2px;
-
- &.has-text svg {
- margin: 0;
- }
-
- &:hover {
- text-decoration: underline;
- }
- }
-
&.components-guide__back-button {
left: $grid-unit-40;
}
- &.components-guide__forward-button {
- right: $grid-unit-40;
- color: #1386bf;
- font-weight: bold;
- }
-
+ &.components-guide__forward-button,
&.components-guide__finish-button {
right: $grid-unit-40;
}
diff --git a/packages/core-commands/src/admin-navigation-commands.js b/packages/core-commands/src/admin-navigation-commands.js
index 577e7258df0b6..a72b0c7dd5ab9 100644
--- a/packages/core-commands/src/admin-navigation-commands.js
+++ b/packages/core-commands/src/admin-navigation-commands.js
@@ -24,7 +24,7 @@ export function useAdminNavigationCommands() {
} );
useCommand( {
name: 'core/manage-reusable-blocks',
- label: __( 'Manage all custom patterns' ),
+ label: __( 'Manage all of my patterns' ),
callback: () => {
document.location.href = 'edit.php?post_type=wp_block';
},
diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js
index 6331afd058de3..8f2003d0e08a2 100644
--- a/packages/core-commands/src/site-editor-navigation-commands.js
+++ b/packages/core-commands/src/site-editor-navigation-commands.js
@@ -203,7 +203,7 @@ function useSiteEditorBasicNavigationCommands() {
icon: symbolFilled,
callback: ( { close } ) => {
const args = {
- path: '/library',
+ path: '/patterns',
};
const targetUrl = addQueryArgs( 'site-editor.php', args );
if ( isSiteEditor ) {
diff --git a/packages/core-data/README.md b/packages/core-data/README.md
index ade2293efe167..63e6e28db08d5 100644
--- a/packages/core-data/README.md
+++ b/packages/core-data/README.md
@@ -506,18 +506,6 @@ _Returns_
- `any`: The entity record's save error.
-### getNavigationFallbackId
-
-Retrieve the fallback Navigation.
-
-_Parameters_
-
-- _state_ `State`: Data state.
-
-_Returns_
-
-- `EntityRecordKey | undefined`: The ID for the fallback Navigation post.
-
### getRawEntityRecord
Returns the entity's record object by key, with its attributes mapped to their raw values.
diff --git a/packages/core-data/src/index.js b/packages/core-data/src/index.js
index c2b491fa8c1ea..98509d9f0383b 100644
--- a/packages/core-data/src/index.js
+++ b/packages/core-data/src/index.js
@@ -13,6 +13,8 @@ import * as resolvers from './resolvers';
import createLocksActions from './locks/actions';
import { rootEntitiesConfig, getMethodName } from './entities';
import { STORE_NAME } from './name';
+import { unlock } from './private-apis';
+import { getNavigationFallbackId } from './private-selectors';
// The entity selectors/resolvers and actions are shortcuts to their generic equivalents
// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)
@@ -62,7 +64,10 @@ const storeConfig = () => ( {
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*/
export const store = createReduxStore( STORE_NAME, storeConfig() );
-register( store );
+unlock( store ).registerPrivateSelectors( {
+ getNavigationFallbackId,
+} );
+register( store ); // Register store after unlocking private selectors to allow resolvers to use them.
export { default as EntityProvider } from './entity-provider';
export * from './entity-provider';
diff --git a/packages/core-data/src/private-selectors.ts b/packages/core-data/src/private-selectors.ts
index 0ac2c75023969..1e253b900e1cb 100644
--- a/packages/core-data/src/private-selectors.ts
+++ b/packages/core-data/src/private-selectors.ts
@@ -4,6 +4,7 @@
import type { State, UndoEdit } from './selectors';
type Optional< T > = T | undefined;
+type EntityRecordKey = string | number;
/**
* Returns the previous edit from the current undo offset
@@ -28,3 +29,15 @@ export function getUndoEdits( state: State ): Optional< UndoEdit[] > {
export function getRedoEdits( state: State ): Optional< UndoEdit[] > {
return state.undo.list[ state.undo.list.length + state.undo.offset ];
}
+
+/**
+ * Retrieve the fallback Navigation.
+ *
+ * @param state Data state.
+ * @return The ID for the fallback Navigation post.
+ */
+export function getNavigationFallbackId(
+ state: State
+): EntityRecordKey | undefined {
+ return state.navigationFallbackId;
+}
diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js
index 32baa691ddd82..93dcfd6ee9014 100644
--- a/packages/core-data/src/resolvers.js
+++ b/packages/core-data/src/resolvers.js
@@ -573,7 +573,7 @@ export const getBlockPatternCategories =
export const getNavigationFallbackId =
() =>
- async ( { dispatch } ) => {
+ async ( { dispatch, select } ) => {
const fallback = await apiFetch( {
path: addQueryArgs( '/wp-block-editor/v1/navigation-fallback', {
_embed: true,
@@ -585,8 +585,15 @@ export const getNavigationFallbackId =
dispatch.receiveNavigationFallbackId( fallback?.id );
if ( record ) {
- const invalidateNavigationQueries = true;
-
+ // If the fallback is already in the store, don't invalidate navigation queries.
+ // Otherwise, invalidate the cache for the scenario where there were no Navigation
+ // posts in the state and the fallback created one.
+ const existingFallbackEntityRecord = select.getEntityRecord(
+ 'postType',
+ 'wp_navigation',
+ fallback?.id
+ );
+ const invalidateNavigationQueries = ! existingFallbackEntityRecord;
dispatch.receiveEntityRecords(
'postType',
'wp_navigation',
diff --git a/packages/core-data/src/selectors.ts b/packages/core-data/src/selectors.ts
index a6b7774d37094..142d24a9d2b8d 100644
--- a/packages/core-data/src/selectors.ts
+++ b/packages/core-data/src/selectors.ts
@@ -1257,18 +1257,6 @@ export function getBlockPatternCategories( state: State ): Array< any > {
return state.blockPatternCategories;
}
-/**
- * Retrieve the fallback Navigation.
- *
- * @param state Data state.
- * @return The ID for the fallback Navigation post.
- */
-export function getNavigationFallbackId(
- state: State
-): EntityRecordKey | undefined {
- return state.navigationFallbackId;
-}
-
/**
* Returns the revisions of the current global styles theme.
*
diff --git a/packages/data/src/redux-store/index.js b/packages/data/src/redux-store/index.js
index 7b1c0d2991e69..518dd82164026 100644
--- a/packages/data/src/redux-store/index.js
+++ b/packages/data/src/redux-store/index.js
@@ -105,10 +105,10 @@ function createBindingCache( bind ) {
const cache = new WeakMap();
return {
- get( item ) {
+ get( item, itemName ) {
let boundItem = cache.get( item );
if ( ! boundItem ) {
- boundItem = bind( item );
+ boundItem = bind( item, itemName );
cache.set( item, boundItem );
}
return boundItem;
@@ -198,7 +198,7 @@ export default function createReduxStore( key, options ) {
get: ( target, prop ) => {
const privateAction = privateActions[ prop ];
return privateAction
- ? boundPrivateActions.get( privateAction )
+ ? boundPrivateActions.get( privateAction, prop )
: actions[ prop ];
},
} );
@@ -210,7 +210,11 @@ export default function createReduxStore( key, options ) {
lock( actions, allActions );
- function bindSelector( selector ) {
+ const resolvers = options.resolvers
+ ? mapResolvers( options.resolvers )
+ : {};
+
+ function bindSelector( selector, selectorName ) {
if ( selector.isRegistrySelector ) {
selector.registry = registry;
}
@@ -218,8 +222,20 @@ export default function createReduxStore( key, options ) {
const state = store.__unstableOriginalGetState();
return selector( state.root, ...args );
};
- boundSelector.hasResolver = false;
- return boundSelector;
+
+ const resolver = resolvers[ selectorName ];
+ if ( ! resolver ) {
+ boundSelector.hasResolver = false;
+ return boundSelector;
+ }
+
+ return mapSelectorWithResolver(
+ boundSelector,
+ selectorName,
+ resolver,
+ store,
+ resolversCache
+ );
}
function bindMetadataSelector( selector ) {
@@ -231,35 +247,26 @@ export default function createReduxStore( key, options ) {
return boundSelector;
}
- let selectors = {
+ const selectors = {
...mapValues( metadataSelectors, bindMetadataSelector ),
...mapValues( options.selectors, bindSelector ),
};
- let resolvers;
- if ( options.resolvers ) {
- resolvers = mapResolvers( options.resolvers );
- selectors = mapSelectorsWithResolvers(
- selectors,
- resolvers,
- store,
- resolversCache
- );
- }
-
const boundPrivateSelectors = createBindingCache( bindSelector );
// Pre-bind the private selectors that have been registered by the time of
// instantiation, so that registry selectors are bound to the registry.
- for ( const privateSelector of Object.values( privateSelectors ) ) {
- boundPrivateSelectors.get( privateSelector );
+ for ( const [ selectorName, selector ] of Object.entries(
+ privateSelectors
+ ) ) {
+ boundPrivateSelectors.get( selector, selectorName );
}
const allSelectors = new Proxy( () => {}, {
get: ( target, prop ) => {
const privateSelector = privateSelectors[ prop ];
return privateSelector
- ? boundPrivateSelectors.get( privateSelector )
+ ? boundPrivateSelectors.get( privateSelector, prop )
: selectors[ prop ];
},
} );
@@ -509,22 +516,24 @@ function mapResolvers( resolvers ) {
}
/**
- * Returns resolvers with matched selectors for a given namespace.
+ * Returns a selector with a matched resolver.
* Resolvers are side effects invoked once per argument set of a given selector call,
* used in ensuring that the data needs for the selector are satisfied.
*
- * @param {Object} selectors The current selectors to be modified.
- * @param {Object} resolvers Resolvers to register.
+ * @param {Object} selector The selector function to be bound.
+ * @param {string} selectorName The selector name.
+ * @param {Object} resolver Resolver to call.
* @param {Object} store The redux store to which the resolvers should be mapped.
* @param {Object} resolversCache Resolvers Cache.
*/
-function mapSelectorsWithResolvers(
- selectors,
- resolvers,
+function mapSelectorWithResolver(
+ selector,
+ selectorName,
+ resolver,
store,
resolversCache
) {
- function fulfillSelector( resolver, selectorName, args ) {
+ function fulfillSelector( args ) {
const state = store.getState();
if (
@@ -570,17 +579,10 @@ function mapSelectorsWithResolvers(
}, 0 );
}
- return mapValues( selectors, ( selector, selectorName ) => {
- const resolver = resolvers[ selectorName ];
- if ( ! resolver ) {
- return selector;
- }
-
- const selectorResolver = ( ...args ) => {
- fulfillSelector( resolver, selectorName, args );
- return selector( ...args );
- };
- selectorResolver.hasResolver = true;
- return selectorResolver;
- } );
+ const selectorResolver = ( ...args ) => {
+ fulfillSelector( args );
+ return selector( ...args );
+ };
+ selectorResolver.hasResolver = true;
+ return selectorResolver;
}
diff --git a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts
index f703597edecf5..a7f3697b701e7 100644
--- a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts
+++ b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts
@@ -44,6 +44,14 @@ export async function visitSiteEditor(
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );
+
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuidePage', false );
+
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuideTemplate', false );
} );
}
diff --git a/packages/e2e-test-utils/src/site-editor.js b/packages/e2e-test-utils/src/site-editor.js
index 619fc8b9cf630..b4e5f2373e098 100644
--- a/packages/e2e-test-utils/src/site-editor.js
+++ b/packages/e2e-test-utils/src/site-editor.js
@@ -17,68 +17,23 @@ const SELECTORS = {
* Skips the welcome guide popping up to first time users of the site editor
*/
export async function disableSiteEditorWelcomeGuide() {
- // This code prioritizes using the preferences store. However, performance
- // tests run on older versions of the codebase where the preferences store
- // doesn't exist. Some backwards compatibility has been built-in so that
- // those tests continue to work there. This can be removed once WordPress
- // 6.0 is released, as the older version used by the performance tests will
- // then include the preferences store.
- // See https://github.com/WordPress/gutenberg/pull/39300.
- const isWelcomeGuideActive = await page.evaluate( () => {
- // TODO - remove if statement after WordPress 6.0 is released.
- if ( ! wp.data.select( 'core/preferences' ) ) {
- return wp.data
- .select( 'core/edit-site' )
- .isFeatureActive( 'welcomeGuide' );
- }
-
- return !! wp.data
- .select( 'core/preferences' )
- ?.get( 'core/edit-site', 'welcomeGuide' );
- } );
- const isWelcomeGuideStyesActive = await page.evaluate( () => {
- // TODO - remove if statement after WordPress 6.0 is released.
- if ( ! wp.data.select( 'core/preferences' ) ) {
- return wp.data
- .select( 'core/edit-site' )
- .isFeatureActive( 'welcomeGuideStyles' );
- }
-
- return !! wp.data
- .select( 'core/preferences' )
- ?.get( 'core/edit-site', 'welcomeGuideStyles' );
+ await page.evaluate( () => {
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuide', false );
+
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuideStyles', false );
+
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuidePage', false );
+
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'welcomeGuideTemplate', false );
} );
-
- if ( isWelcomeGuideActive ) {
- await page.evaluate( () => {
- // TODO - remove if statement after WordPress 6.0 is released.
- if ( ! wp.data.dispatch( 'core/preferences' ) ) {
- wp.data
- .dispatch( 'core/edit-site' )
- .toggleFeature( 'welcomeGuide' );
- return;
- }
-
- wp.data
- .dispatch( 'core/preferences' )
- .toggle( 'core/edit-site', 'welcomeGuide' );
- } );
- }
-
- if ( isWelcomeGuideStyesActive ) {
- await page.evaluate( () => {
- // TODO - remove if statement after WordPress 6.0 is released.
- if ( ! wp.data.dispatch( 'core/preferences' ) ) {
- wp.data
- .dispatch( 'core/edit-site' )
- .toggleFeature( 'welcomeGuideStyles' );
- return;
- }
- wp.data
- .dispatch( 'core/preferences' )
- .toggle( 'core/edit-site', 'welcomeGuideStyles' );
- } );
- }
}
/**
diff --git a/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js b/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
index 6d9eaa562b48f..1ffd4e2414336 100644
--- a/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
@@ -113,7 +113,7 @@ describe( 'Reusable blocks', () => {
await insertReusableBlock( 'Surprised greeting block' );
// Convert block to a regular block.
- await clickBlockToolbarButton( 'Convert to regular block' );
+ await clickBlockToolbarButton( 'Detach pattern' );
// Check that we have a paragraph block on the page.
const paragraphBlock = await canvas().$(
@@ -221,7 +221,7 @@ describe( 'Reusable blocks', () => {
await insertReusableBlock( 'Multi-selection reusable block' );
// Convert block to a regular block.
- await clickBlockToolbarButton( 'Convert to regular blocks' );
+ await clickBlockToolbarButton( 'Detach patterns' );
// Check that we have two paragraph blocks on the page.
expect( await getEditedPostContent() ).toMatchSnapshot();
@@ -353,7 +353,7 @@ describe( 'Reusable blocks', () => {
// Convert back to regular blocks.
await clickBlockToolbarButton( 'Select Pattern' );
- await clickBlockToolbarButton( 'Convert to regular block' );
+ await clickBlockToolbarButton( 'Detach pattern' );
await page.waitForXPath( selector, {
hidden: true,
} );
diff --git a/packages/edit-site/src/components/add-new-template/new-template.js b/packages/edit-site/src/components/add-new-template/new-template.js
index 0c6ab03899cc8..31ddd754562db 100644
--- a/packages/edit-site/src/components/add-new-template/new-template.js
+++ b/packages/edit-site/src/components/add-new-template/new-template.js
@@ -34,7 +34,7 @@ import {
page,
plus,
pin,
- postList,
+ verse,
search,
tag,
} from '@wordpress/icons';
@@ -78,7 +78,7 @@ const DEFAULT_TEMPLATE_SLUGS = [
const TEMPLATE_ICONS = {
'front-page': home,
- home: postList,
+ home: verse,
single: pin,
page,
archive,
diff --git a/packages/edit-site/src/components/block-editor/editor-canvas.js b/packages/edit-site/src/components/block-editor/editor-canvas.js
index fad43f0410640..34c23cc699bc2 100644
--- a/packages/edit-site/src/components/block-editor/editor-canvas.js
+++ b/packages/edit-site/src/components/block-editor/editor-canvas.js
@@ -87,7 +87,9 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
// which isn't a requirement in auto resize mode.
enableResizing ? 'min-height:0!important;' : ''
}}body{position:relative; ${
- canvasMode === 'view' ? 'cursor: pointer;' : ''
+ canvasMode === 'view'
+ ? 'cursor: pointer; height: 100vh'
+ : ''
}}}`
}
{ children }
diff --git a/packages/edit-site/src/components/create-pattern-modal/index.js b/packages/edit-site/src/components/create-pattern-modal/index.js
index 2cef6b21ebbba..7906cb2352c7b 100644
--- a/packages/edit-site/src/components/create-pattern-modal/index.js
+++ b/packages/edit-site/src/components/create-pattern-modal/index.js
@@ -18,7 +18,7 @@ import { useDispatch } from '@wordpress/data';
/**
* Internal dependencies
*/
-import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-library/utils';
+import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils';
export default function CreatePatternModal( {
closeModal,
@@ -26,7 +26,7 @@ export default function CreatePatternModal( {
onError,
} ) {
const [ name, setName ] = useState( '' );
- const [ syncType, setSyncType ] = useState( SYNC_TYPES.full );
+ const [ syncType, setSyncType ] = useState( SYNC_TYPES.unsynced );
const [ isSubmitting, setIsSubmitting ] = useState( false );
const onSyncChange = () => {
@@ -54,7 +54,10 @@ export default function CreatePatternModal( {
title: name || __( 'Untitled Pattern' ),
content: '',
status: 'publish',
- meta: { sync_status: syncType },
+ meta:
+ syncType === SYNC_TYPES.unsynced
+ ? { sync_status: syncType }
+ : undefined,
},
{ throwOnError: true }
);
@@ -77,8 +80,6 @@ export default function CreatePatternModal( {
onRequestClose={ closeModal }
overlayClassName="edit-site-create-pattern-modal"
>
- { __( 'Turn this block into a pattern to reuse later' ) }
-