Skip to content

Commit 6774683

Browse files
tellthemachinesellatrixaaronrobertshawglendaviesnztalldan
authored
Update/wp6 3 beta3 (#52234)
* Footnotes: inscrease selector specificity for anchor (#52179) * Patterns: Include template parts for custom areas in Uncategorized category (#52159) * Fix custom patterns console error (#51947) * Fix error with react list key with new custom patterns list in inserter * Update placeholder key * Add comment to explain the different keys * Patterns: Fix missing custom patterns in patterns explorer (#51889) * Add custom patterns to pattern explorer * show custom patterns in the patterns explorer dialog * remove changes from 51877 * Fix up use of async lists * remove a bit of code duplication by adding a new hook * add 51877 fix back to make testing easier * Just assign the key value in one place * Refactor the custom patterns to use the usePatternsState hook * Fix use of async list * Translate strings and remove unneeded fields from pattern object * Try integrating unsynced patterns directly into pattern selectors (#51955) * Include reusable blocks with an undefined sync status in inserter items * Update docs * Remove change to hover dependencies --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * i18n: Add context to the word "Filters" (#52198) * Update home template icon (#52075) * Centralise all permissions lookup in Link UI and enable (#52166) * BlockRemovalWarningModal: Fix incorrect '_n' usage (#52164) * Fix fetching Nav fallback ID flushing Navigation entity cache (#52069) * Only flush the `getEntityRecords` cache if the fallback isn’t already in state * Save the edited entity record to a const and then invert it to determine whether we should invalidate the recordds --------- Co-authored-by: scruffian <ben@scruffian.com> * Block Editor: Unify texts for Create pattern modal (#52151) * Fix history back after entering edit mode from Patterns (#52112) * Add template part icons to the library grid items (#51963) * Patterns: Fix sidebar tab label (#51953) * Patterns: Fix setting of sync status for fully synced patterns (#51952) * Library: Reinstate manage all template parts page (#51961) * Command Palette: fix incorrect path and snackbar message when template part is deleted (#52034) * Command Center: Fix incorrect navigation when deleting template part * removeTemplate: consider title type * Drop-indicator: remove white border. (#52122) * Make Navigation fallback selector private (#51413) * Move selector to become private * adds basic lock functionality * remove useless lock-unlock file * map private selectors to resolvers * Unlock the other usage * only create one fallback per session * Fix core-data duplicate private opt-in * Data: bind resolvers to selectors individually, support private selectors --------- Co-authored-by: Andrei Draganescu <andrei.draganescu@automattic.com> Co-authored-by: scruffian <ben@scruffian.com> Co-authored-by: Jarda Snajdr <jsnajdr@gmail.com> * Focus Mode: Use the symbol icon if a pattern is being edited (#52031) * Footnotes: register meta field for pages (#52024) * Fix unintentional toggling on of distraction free (#52090) * replace toggle with set preference - because I don't read code properly it seems * remove notification * Revert "Updating social link attributes (#51997)" (#52019) This reverts commit c711e2a. * Update home template name (#52048) * Removes unused call (#51988) * Remove ability for user to toggle sync status after pattern creation (#51998) * Fix disable DFM when opening styles command (#52165) * Update custom patterns label to 'My patterns' (#51949) * rename custom patterns to my patterns * Add my patterns label to inserter and show at the top --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * Library: Add sync status to pattern details screen (#51954) * Patterns: Rename Library to Patterns (#52102) * [Library] Add lock icon for theme patterns (#51990) * Add lock icon for theme patterns * Change to class names * Add aria-description * Change wording * Patterns: Use "detached" copy consistently (#51993) * Editor initrial appender: Zero out margins in constrained layouts. (#52026) * Update pattern creation modal in library (#51946) * Fix missing snackbars in Library (#52021) * Make the entire preview clickable in order to enter "edit" mode in focus mode (#51973) * Page Content Focus: Add welcome guides (#52014) * Page Content Focus: Add welcome guides * Don't show when editor guide is active * Just use regular accent/theme color in all guides * slight copy change page guide * Update components changelog * Disable new guides in E2E tests * Use s.w.org videos --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> --------- Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Glen Davies <glendaviesnz@users.noreply.github.com> Co-authored-by: Daniel Richards <daniel.richards@automattic.com> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: James Koster <james@jameskoster.co.uk> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: scruffian <ben@scruffian.com> Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: Carolina Nymark <myazalea@hotmail.com> Co-authored-by: Joen A <1204802+jasmussen@users.noreply.github.com> Co-authored-by: Andrei Draganescu <andrei.draganescu@automattic.com> Co-authored-by: Jarda Snajdr <jsnajdr@gmail.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com> Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: Rich Tabor <hi@richtabor.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
1 parent bb0b403 commit 6774683

File tree

94 files changed

+1009
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1009
-642
lines changed

docs/reference-guides/data/data-core-block-editor.md

-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ _Parameters_
538538
539539
- _state_ `Object`: Editor state.
540540
- _rootClientId_ `?string`: Optional root client ID of block list.
541-
- _syncStatus_ `?string`: Optional sync status to filter pattern blocks by.
542541
543542
_Returns_
544543

docs/reference-guides/data/data-core.md

-12
Original file line numberDiff line numberDiff line change
@@ -329,18 +329,6 @@ _Returns_
329329

330330
- `any`: The entity record's save error.
331331

332-
### getNavigationFallbackId
333-
334-
Retrieve the fallback Navigation.
335-
336-
_Parameters_
337-
338-
- _state_ `State`: Data state.
339-
340-
_Returns_
341-
342-
- `EntityRecordKey | undefined`: The ID for the fallback Navigation post.
343-
344332
### getRawEntityRecord
345333

346334
Returns the entity's record object by key, with its attributes mapped to their raw values.

lib/compat/wordpress-6.3/block-template-utils.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
2929
}
3030
if ( isset( $default_template_types['home'] ) ) {
3131
$default_template_types['home'] = array(
32-
'title' => _x( 'Home', 'Template name', 'gutenberg' ),
32+
'title' => _x( 'Blog Home', 'Template name', 'gutenberg' ),
3333
'description' => __(
3434
'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.',
3535
'gutenberg'

packages/block-editor/src/components/block-mobile-toolbar/block-actions-menu.native.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,12 @@ const BlockActionsMenu = ( {
213213
id: 'convertToRegularBlocksOption',
214214
label:
215215
innerBlockCount > 1
216-
? __( 'Convert to regular blocks' )
217-
: __( 'Convert to regular block' ),
216+
? __( 'Detach patterns' )
217+
: __( 'Detach pattern' ),
218218
value: 'convertToRegularBlocksOption',
219219
onSelect: () => {
220-
const successNotice =
221-
innerBlockCount > 1
222-
? /* translators: %s: name of the reusable block */
223-
__( '%s converted to regular blocks' )
224-
: /* translators: %s: name of the reusable block */
225-
__( '%s converted to regular block' );
220+
/* translators: %s: name of the synced block */
221+
const successNotice = __( '%s detached' );
226222
createSuccessNotice(
227223
sprintf(
228224
successNotice,

packages/block-editor/src/components/block-removal-warning-modal/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Button,
99
__experimentalHStack as HStack,
1010
} from '@wordpress/components';
11-
import { __, _n } from '@wordpress/i18n';
11+
import { __ } from '@wordpress/i18n';
1212

1313
/**
1414
* Internal dependencies
@@ -75,11 +75,9 @@ export function BlockRemovalWarningModal() {
7575
</ul>
7676
) }
7777
<p>
78-
{ _n(
79-
'Removing this block is not advised.',
80-
'Removing these blocks is not advised.',
81-
blockNamesForPrompt.length
82-
) }
78+
{ blockNamesForPrompt.length > 1
79+
? __( 'Removing these blocks is not advised.' )
80+
: __( 'Removing this block is not advised.' ) }
8381
</p>
8482
<HStack justify="right">
8583
<Button variant="tertiary" onClick={ clearRemovalPrompt }>

packages/block-editor/src/components/default-block-appender/content.scss

+11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@
2626
opacity: 0.62;
2727
}
2828

29+
// In "constrained" layout containers, the first and last paragraphs have their margins zeroed out.
30+
// In the case of this appender, it needs to apply those same rules to avoid layout shifts.
31+
// Such shifts happen when the bottom margin of the Title block has been set to less than the default 1em margin of paragraphs.
32+
:where(body .is-layout-constrained) & {
33+
> :first-child:first-child {
34+
margin-block-start: 0;
35+
}
36+
37+
// Since this particular appender will only ever appear on an entirely empty document, we don't account for last-child.
38+
}
39+
2940
// Dropzone.
3041
.components-drop-zone__content-icon {
3142
display: none;

packages/block-editor/src/components/global-styles/filters-panel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
Flex,
2323
FlexItem,
2424
} from '@wordpress/components';
25-
import { __ } from '@wordpress/i18n';
25+
import { __, _x } from '@wordpress/i18n';
2626
import { useCallback, useMemo } from '@wordpress/element';
2727

2828
/**
@@ -77,7 +77,7 @@ function FiltersToolsPanel( {
7777

7878
return (
7979
<ToolsPanel
80-
label={ __( 'Filters' ) }
80+
label={ _x( 'Filters', 'Name for applying graphical effects' ) }
8181
resetAll={ resetAll }
8282
panelId={ panelId }
8383
>

packages/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
5252
onInsertBlocks,
5353
destinationRootClientId
5454
);
55+
5556
const registeredPatternCategories = useMemo(
5657
() =>
5758
patternCategories.map(
@@ -75,7 +76,12 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
7576
);
7677
}
7778
return searchItems( allPatterns, filterValue );
78-
}, [ filterValue, selectedCategory, allPatterns ] );
79+
}, [
80+
filterValue,
81+
allPatterns,
82+
selectedCategory,
83+
registeredPatternCategories,
84+
] );
7985

8086
// Announce search results on change.
8187
useEffect( () => {
@@ -89,7 +95,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
8995
count
9096
);
9197
debouncedSpeak( resultsFoundMessage );
92-
}, [ filterValue, debouncedSpeak ] );
98+
}, [ filterValue, debouncedSpeak, filteredBlockPatterns.length ] );
9399

94100
const currentShownPatterns = useAsyncList( filteredBlockPatterns, {
95101
step: INITIAL_INSERTER_RESULTS,

packages/block-editor/src/components/inserter/block-patterns-tab.js

+8-56
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
Button,
1919
} from '@wordpress/components';
2020
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
21-
import { parse } from '@wordpress/blocks';
2221
import { focus } from '@wordpress/dom';
2322

2423
/**
@@ -28,13 +27,13 @@ import usePatternsState from './hooks/use-patterns-state';
2827
import BlockPatternList from '../block-patterns-list';
2928
import PatternsExplorerModal from './block-patterns-explorer/explorer';
3029
import MobileTabNavigation from './mobile-tab-navigation';
31-
import useBlockTypesState from './hooks/use-block-types-state';
3230

3331
const noop = () => {};
3432

3533
// Preferred order of pattern categories. Any other categories should
3634
// be at the bottom without any re-ordering.
3735
const patternCategoriesOrder = [
36+
'custom',
3837
'featured',
3938
'posts',
4039
'text',
@@ -51,18 +50,6 @@ function usePatternsCategories( rootClientId ) {
5150
rootClientId
5251
);
5352

54-
const [ unsyncedPatterns ] = useBlockTypesState(
55-
rootClientId,
56-
undefined,
57-
'unsynced'
58-
);
59-
60-
const filteredUnsyncedPatterns = useMemo( () => {
61-
return unsyncedPatterns.filter(
62-
( { category: unsyncedPatternCategory } ) =>
63-
unsyncedPatternCategory === 'reusable'
64-
);
65-
}, [ unsyncedPatterns ] );
6653
const hasRegisteredCategory = useCallback(
6754
( pattern ) => {
6855
if ( ! pattern.categories || ! pattern.categories.length ) {
@@ -107,20 +94,9 @@ function usePatternsCategories( rootClientId ) {
10794
label: _x( 'Uncategorized' ),
10895
} );
10996
}
110-
if ( filteredUnsyncedPatterns.length > 0 ) {
111-
categories.push( {
112-
name: 'reusable',
113-
label: _x( 'Custom patterns' ),
114-
} );
115-
}
11697

11798
return categories;
118-
}, [
119-
allCategories,
120-
allPatterns,
121-
filteredUnsyncedPatterns.length,
122-
hasRegisteredCategory,
123-
] );
99+
}, [ allCategories, allPatterns, hasRegisteredCategory ] );
124100

125101
return populatedCategories;
126102
}
@@ -169,24 +145,6 @@ export function BlockPatternsCategoryPanel( {
169145
onInsert,
170146
rootClientId
171147
);
172-
const [ unsyncedPatterns ] = useBlockTypesState(
173-
rootClientId,
174-
onInsert,
175-
'unsynced'
176-
);
177-
const filteredUnsyncedPatterns = useMemo( () => {
178-
return unsyncedPatterns
179-
.filter(
180-
( { category: unsyncedPatternCategory } ) =>
181-
unsyncedPatternCategory === 'reusable'
182-
)
183-
.map( ( syncedPattern ) => ( {
184-
...syncedPattern,
185-
blocks: parse( syncedPattern.content, {
186-
__unstableSkipMigrationLogs: true,
187-
} ),
188-
} ) );
189-
}, [ unsyncedPatterns ] );
190148

191149
const availableCategories = usePatternsCategories( rootClientId );
192150
const currentCategoryPatterns = useMemo(
@@ -208,21 +166,15 @@ export function BlockPatternsCategoryPanel( {
208166

209167
return availablePatternCategories.length === 0;
210168
} ),
211-
[ allPatterns, category ]
169+
[ allPatterns, availableCategories, category.name ]
212170
);
213-
const patterns =
214-
category.name === 'reusable'
215-
? filteredUnsyncedPatterns
216-
: currentCategoryPatterns;
217-
const currentShownPatterns = useAsyncList( patterns );
171+
172+
const categoryPatternsList = useAsyncList( currentCategoryPatterns );
218173

219174
// Hide block pattern preview on unmount.
220175
useEffect( () => () => onHover( null ), [] );
221176

222-
if (
223-
! currentCategoryPatterns.length &&
224-
! filteredUnsyncedPatterns.length
225-
) {
177+
if ( ! currentCategoryPatterns.length ) {
226178
return null;
227179
}
228180

@@ -233,8 +185,8 @@ export function BlockPatternsCategoryPanel( {
233185
</div>
234186
<p>{ category.description }</p>
235187
<BlockPatternList
236-
shownPatterns={ currentShownPatterns }
237-
blockPatterns={ patterns }
188+
shownPatterns={ categoryPatternsList }
189+
blockPatterns={ currentCategoryPatterns }
238190
onClickPattern={ onClick }
239191
onHover={ onHover }
240192
label={ category.label }

packages/block-editor/src/components/inserter/hooks/use-block-types-state.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ import { store as blockEditorStore } from '../../../store';
1919
*
2020
* @param {string=} rootClientId Insertion's root client ID.
2121
* @param {Function} onInsert function called when inserter a list of blocks.
22-
* @param {?string} syncStatus Optional sync status to filter pattern blocks by.
2322
* @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
2423
*/
25-
const useBlockTypesState = ( rootClientId, onInsert, syncStatus ) => {
24+
const useBlockTypesState = ( rootClientId, onInsert ) => {
2625
const { categories, collections, items } = useSelect(
2726
( select ) => {
2827
const { getInserterItems } = select( blockEditorStore );
@@ -31,10 +30,10 @@ const useBlockTypesState = ( rootClientId, onInsert, syncStatus ) => {
3130
return {
3231
categories: getCategories(),
3332
collections: getCollections(),
34-
items: getInserterItems( rootClientId, syncStatus ),
33+
items: getInserterItems( rootClientId ),
3534
};
3635
},
37-
[ rootClientId, syncStatus ]
36+
[ rootClientId ]
3837
);
3938

4039
const onSelectItem = useCallback(
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { useCallback } from '@wordpress/element';
4+
import { useCallback, useMemo } from '@wordpress/element';
55
import { cloneBlock } from '@wordpress/blocks';
66
import { useDispatch, useSelect } from '@wordpress/data';
77
import { __, sprintf } from '@wordpress/i18n';
@@ -12,6 +12,12 @@ import { store as noticesStore } from '@wordpress/notices';
1212
*/
1313
import { store as blockEditorStore } from '../../../store';
1414

15+
const CUSTOM_CATEGORY = {
16+
name: 'custom',
17+
label: __( 'My patterns' ),
18+
description: __( 'Custom patterns add by site users' ),
19+
};
20+
1521
/**
1622
* Retrieves the block patterns inserter state.
1723
*
@@ -25,6 +31,7 @@ const usePatternsState = ( onInsert, rootClientId ) => {
2531
( select ) => {
2632
const { __experimentalGetAllowedPatterns, getSettings } =
2733
select( blockEditorStore );
34+
2835
return {
2936
patterns: __experimentalGetAllowedPatterns( rootClientId ),
3037
patternCategories:
@@ -33,25 +40,34 @@ const usePatternsState = ( onInsert, rootClientId ) => {
3340
},
3441
[ rootClientId ]
3542
);
43+
44+
const allCategories = useMemo(
45+
() => [ ...patternCategories, CUSTOM_CATEGORY ],
46+
[ patternCategories ]
47+
);
48+
3649
const { createSuccessNotice } = useDispatch( noticesStore );
37-
const onClickPattern = useCallback( ( pattern, blocks ) => {
38-
onInsert(
39-
( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),
40-
pattern.name
41-
);
42-
createSuccessNotice(
43-
sprintf(
44-
/* translators: %s: block pattern title. */
45-
__( 'Block pattern "%s" inserted.' ),
46-
pattern.title
47-
),
48-
{
49-
type: 'snackbar',
50-
}
51-
);
52-
}, [] );
53-
54-
return [ patterns, patternCategories, onClickPattern ];
50+
const onClickPattern = useCallback(
51+
( pattern, blocks ) => {
52+
onInsert(
53+
( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),
54+
pattern.name
55+
);
56+
createSuccessNotice(
57+
sprintf(
58+
/* translators: %s: block pattern title. */
59+
__( 'Block pattern "%s" inserted.' ),
60+
pattern.title
61+
),
62+
{
63+
type: 'snackbar',
64+
}
65+
);
66+
},
67+
[ createSuccessNotice, onInsert ]
68+
);
69+
70+
return [ patterns, allCategories, onClickPattern ];
5571
};
5672

5773
export default usePatternsState;

packages/block-editor/src/components/inserter/reusable-blocks-tab.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
6767
post_type: 'wp_block',
6868
} ) }
6969
>
70-
{ __( 'Manage custom patterns' ) }
70+
{ __( 'Manage my patterns' ) }
7171
</Button>
7272
</div>
7373
</>

0 commit comments

Comments
 (0)