Skip to content

Commit bcef74e

Browse files
tellthemachinesMamadukaglendaviesnzramonjdmcsf
authored
First batch of pre-6.3 RC1 updates (#52544)
* Site Editor: Restore quick inserter 'Browse all' button (#52529) * Site Editor: Restore quick inserter 'Browse all' button * Remove leftover comment * Patterns: update the title of Pattern block in the block inspector card (#52010) * Site Editor Pages: load the appropriate template if posts page set (#52266) * This commit: - links the posts page to the homepage template when a post page is set - abstracts logic to get page item props * The Posts Page resolves to display the Home or Index template only. Adding a check to skip the Front Page * Showing homepage settings for posts pages that are set as the post page in reading settings * Post pages that have been set to display posts will redirect to first the home template, then the index template. The fallback is the post id of the page. * Reverted refactor of packages/edit-site/src/components/sidebar-navigation-screen-page/index.js Will do it in a follow up * Allow editing existing footnote from formats toolbar (#52506) * Block Editor: Display variation icon in the 'BlockDraggable' component (#52502) * Patterns: add option to set sync status when adding from wp-admin patterns list (#52352) * Show a modal to set sync status if adding pattern from pattern list page * Make sure the modal loads if post settings panel not open * don't load modal component at all if not new post * Simplify the sync status so undefined always = synced * Update packages/editor/src/components/post-sync-status/index.js --------- Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Revise LinkControl suggestions UI to use MenuItem (#50978) * Use "link" instead of "URL" for URL_TYPE * Use MenuItem for search create button * Use sentence case for "Create page" * Use a MenuGroup for search results * Use MenuItem for search item * Refactoring styles (WIP) * Preserve whitespace in results text * Reinstate result item information including permalink * Remove debugging CSS code * Reinstate CSS to control size of rich previews favicon * Remove other commented out CSS code * Reinstate selected styles * Remove more redundant CSS * Add some basic results hover/focus styling. Needs improving * Improve icon alignment * Update tests to handle wording changes * Remove inconsistent hover/focus style MenuItem already has hover/focus styles * Reinstate is-selected visual state * Update test to make sense in context of #51011 See #51011 * Fix locator for result text --------- Co-authored-by: Dave Smith <getdavemail@gmail.com> * Fix LinkControl mark highlight to bold (#52517) * Add 'reusable' keyword to Pattern blocks (#52543) * Fix missing Add Template Part button in Template Parts page (#52542) * Tweak copy for the reusable block rename hint (#52581) * Trim footnote anchors from excerpts (#52518) * Trim footnote anchors from excerpts * Add comments, fix spacing, appease linter * Site Editor: Reset device preview type when exiting the editing mode (#52566) * Make "My patterns" permanently visible (#52531) * Hide site hub when resizing frame upwards to avoid overlap (#52180) * Fix "Manage all patterns" link appearance (#52532) * Fix "Manage all patterns" link * Update focus style * Update navigation menu title size & weight in detail panels (#52477) * Update menu title size * Adjust font weight * Site Editor Patterns: Ensure sidebar does not shrink when long pattern titles are used (#52547) * Edit Site: Select templateType from the store inside the useSiteEditorSettings hook (#52503) * Add width to ensure ellipsis is applied (#52575) * Cover Block: Fix block deprecation when fixed background is enabled (#51612) * ResizableFrame: Make keyboard accessible (#52443) * ResizableFrame: Make keyboard accessible * Fix outline in Safari * Use proper CSS modifier * Add aria-label to button * Keep handle enlarged when resizing (Safari) * Add back visually hidden help text * Don't switch to edit mode * Make the handle a role="separator" * Revert to `button` * Switch description text to `div hidden` * Prevent keydown event default when right/left arrow * Change minimum frame width to 320px * Mention shift key in description text * Only render resize handle when in View mode * Fix importing classic menus (#52573) * use the same create hook for classic import * Remove redundant arg to hook --------- Co-authored-by: Dave Smith <getdavemail@gmail.com> * Site Editor: Fix navigation menu sidebar actions order and label (#52592) * Avoid errors in Dimension visualizers when switching between iframed and non-iframed editors (#52588) * Patterns: Add client side pagination to patterns list (#52538) Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> * Site Editor: Make sidebar back button go *back* instead of *up* if possible (#52456) * Navigator: Add replace option to goTo() and goToParent() * Site Editor: Make sidebar back button go back instead of up if possible * Adapt template part hint copy (#52527) * Try "panel" instead of "page" * Update template-part-hint.js --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Glen Davies <glendaviesnz@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Co-authored-by: Rich Tabor <hi@richtabor.com> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com> Co-authored-by: James Koster <james@jameskoster.co.uk> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: arthur791004 <arthur.chu@automattic.com> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Lena Morita <lena@jaguchi.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info> Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
1 parent 86ecd96 commit bcef74e

File tree

52 files changed

+847
-519
lines changed

Some content is hidden

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

52 files changed

+847
-519
lines changed

docs/reference-guides/core-blocks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add a user’s avatar. ([Source](https://github.com/WordPress/gutenberg/tree/tru
3838

3939
## Pattern
4040

41-
Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/block))
41+
Create and save content to reuse across your site. Update the pattern, and the changes apply everywhere it’s used. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/block))
4242

4343
- **Name:** core/block
4444
- **Category:** reusable
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Compatiblity filters for improved footnotes support.
4+
*
5+
* In core, this could be fixed directly in key functions.
6+
*
7+
* @package gutenberg
8+
*/
9+
10+
/**
11+
* Trims footnote anchors from content.
12+
*
13+
* @param string $content HTML content.
14+
* @return string Filtered content.
15+
*/
16+
function gutenberg_trim_footnotes( $content ) {
17+
if ( ! doing_filter( 'get_the_excerpt' ) ) {
18+
return $content;
19+
}
20+
21+
static $footnote_pattern = '_<sup data-fn="[^"]+" class="[^"]+">\s*<a href="[^"]+" id="[^"]+">\d+</a>\s*</sup>_';
22+
return preg_replace( $footnote_pattern, '', $content );
23+
}
24+
25+
add_filter( 'the_content', 'gutenberg_trim_footnotes' );

lib/load.php

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function gutenberg_is_experiment_enabled( $name ) {
5757
require_once __DIR__ . '/compat/wordpress-6.3/link-template.php';
5858
require_once __DIR__ . '/compat/wordpress-6.3/block-patterns.php';
5959
require_once __DIR__ . '/compat/wordpress-6.3/class-gutenberg-rest-blocks-controller.php';
60+
require_once __DIR__ . '/compat/wordpress-6.3/footnotes.php';
6061

6162
// Experimental.
6263
if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) {

packages/block-editor/src/components/block-draggable/index.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,25 @@ const BlockDraggable = ( {
2222
} ) => {
2323
const { srcRootClientId, isDraggable, icon } = useSelect(
2424
( select ) => {
25-
const { canMoveBlocks, getBlockRootClientId, getBlockName } =
26-
select( blockEditorStore );
27-
const { getBlockType } = select( blocksStore );
25+
const {
26+
canMoveBlocks,
27+
getBlockRootClientId,
28+
getBlockName,
29+
getBlockAttributes,
30+
} = select( blockEditorStore );
31+
const { getBlockType, getActiveBlockVariation } =
32+
select( blocksStore );
2833
const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
2934
const blockName = getBlockName( clientIds[ 0 ] );
35+
const variation = getActiveBlockVariation(
36+
blockName,
37+
getBlockAttributes( clientIds[ 0 ] )
38+
);
3039

3140
return {
3241
srcRootClientId: rootClientId,
3342
isDraggable: canMoveBlocks( clientIds, rootClientId ),
34-
icon: getBlockType( blockName )?.icon,
43+
icon: variation?.icon || getBlockType( blockName )?.icon,
3544
};
3645
},
3746
[ clientIds ]

packages/block-editor/src/components/inserter/reusable-block-rename-hint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function ReusableBlocksRenameHint() {
2929
<div ref={ ref } className="reusable-blocks-menu-items__rename-hint">
3030
<div className="reusable-blocks-menu-items__rename-hint-content">
3131
{ __(
32-
'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'
32+
'Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.'
3333
) }
3434
</div>
3535
<Button

packages/block-editor/src/components/link-control/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
88
// order to handle it as a unique case.
99
export const CREATE_TYPE = '__CREATE__';
1010
export const TEL_TYPE = 'tel';
11-
export const URL_TYPE = 'URL';
11+
export const URL_TYPE = 'link';
1212
export const MAILTO_TYPE = 'mailto';
1313
export const INTERNAL_TYPE = 'internal';
1414

packages/block-editor/src/components/link-control/search-create-button.js

+8-26
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
/**
2-
* External dependencies
3-
*/
4-
import classnames from 'classnames';
5-
61
/**
72
* WordPress dependencies
83
*/
94
import { __, sprintf } from '@wordpress/i18n';
10-
import { Button } from '@wordpress/components';
5+
import { MenuItem } from '@wordpress/components';
116
import { createInterpolateElement } from '@wordpress/element';
12-
import { Icon, plus } from '@wordpress/icons';
7+
import { plus } from '@wordpress/icons';
138

149
export const LinkControlSearchCreate = ( {
1510
searchTerm,
1611
onClick,
1712
itemProps,
18-
isSelected,
1913
buttonText,
2014
} ) => {
2115
if ( ! searchTerm ) {
@@ -40,27 +34,15 @@ export const LinkControlSearchCreate = ( {
4034
}
4135

4236
return (
43-
<Button
37+
<MenuItem
4438
{ ...itemProps }
45-
className={ classnames(
46-
'block-editor-link-control__search-create block-editor-link-control__search-item',
47-
{
48-
'is-selected': isSelected,
49-
}
50-
) }
39+
iconPosition="left"
40+
icon={ plus }
41+
className="block-editor-link-control__search-item"
5142
onClick={ onClick }
5243
>
53-
<Icon
54-
className="block-editor-link-control__search-item-icon"
55-
icon={ plus }
56-
/>
57-
58-
<span className="block-editor-link-control__search-item-header">
59-
<span className="block-editor-link-control__search-item-title">
60-
{ text }
61-
</span>
62-
</span>
63-
</Button>
44+
{ text }
45+
</MenuItem>
6446
);
6547
};
6648

packages/block-editor/src/components/link-control/search-item.js

+21-43
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
/**
2-
* External dependencies
3-
*/
4-
import classnames from 'classnames';
5-
61
/**
72
* WordPress dependencies
83
*/
9-
import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
104
import { __ } from '@wordpress/i18n';
11-
import { Button, TextHighlight } from '@wordpress/components';
5+
import { MenuItem, TextHighlight } from '@wordpress/components';
126
import {
137
Icon,
148
globe,
@@ -19,6 +13,7 @@ import {
1913
file,
2014
} from '@wordpress/icons';
2115
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
16+
import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
2217

2318
const ICONS_MAP = {
2419
post: postList,
@@ -52,50 +47,33 @@ function SearchItemIcon( { isURL, suggestion } ) {
5247
export const LinkControlSearchItem = ( {
5348
itemProps,
5449
suggestion,
55-
isSelected = false,
50+
searchTerm,
5651
onClick,
5752
isURL = false,
58-
searchTerm = '',
5953
shouldShowType = false,
6054
} ) => {
55+
const info = isURL
56+
? __( 'Press ENTER to add this link' )
57+
: filterURLForDisplay( safeDecodeURI( suggestion?.url ) );
58+
6159
return (
62-
<Button
60+
<MenuItem
6361
{ ...itemProps }
62+
info={ info }
63+
iconPosition="left"
64+
icon={
65+
<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
66+
}
6467
onClick={ onClick }
65-
className={ classnames( 'block-editor-link-control__search-item', {
66-
'is-selected': isSelected,
67-
'is-url': isURL,
68-
'is-entity': ! isURL,
69-
} ) }
68+
shortcut={ shouldShowType && getVisualTypeName( suggestion ) }
69+
className="block-editor-link-control__search-item"
7070
>
71-
<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
72-
73-
<span className="block-editor-link-control__search-item-header">
74-
<span className="block-editor-link-control__search-item-title">
75-
<TextHighlight
76-
// The component expects a plain text string.
77-
text={ stripHTML( suggestion.title ) }
78-
highlight={ searchTerm }
79-
/>
80-
</span>
81-
<span
82-
aria-hidden={ ! isURL }
83-
className="block-editor-link-control__search-item-info"
84-
>
85-
{ ! isURL &&
86-
( filterURLForDisplay(
87-
safeDecodeURI( suggestion.url )
88-
) ||
89-
'' ) }
90-
{ isURL && __( 'Press ENTER to add this link' ) }
91-
</span>
92-
</span>
93-
{ shouldShowType && suggestion.type && (
94-
<span className="block-editor-link-control__search-item-type">
95-
{ getVisualTypeName( suggestion ) }
96-
</span>
97-
) }
98-
</Button>
71+
<TextHighlight
72+
// The component expects a plain text string.
73+
text={ stripHTML( suggestion.title ) }
74+
highlight={ searchTerm }
75+
/>
76+
</MenuItem>
9977
);
10078
};
10179

packages/block-editor/src/components/link-control/search-results.js

+48-46
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* WordPress dependencies
33
*/
44
import { __, sprintf } from '@wordpress/i18n';
5-
import { VisuallyHidden } from '@wordpress/components';
5+
import { VisuallyHidden, MenuGroup } from '@wordpress/components';
66

77
/**
88
* External dependencies
@@ -72,59 +72,61 @@ export default function LinkControlSearchResults( {
7272
className={ resultsListClasses }
7373
aria-labelledby={ searchResultsLabelId }
7474
>
75-
{ suggestions.map( ( suggestion, index ) => {
76-
if (
77-
shouldShowCreateSuggestion &&
78-
CREATE_TYPE === suggestion.type
79-
) {
75+
<MenuGroup>
76+
{ suggestions.map( ( suggestion, index ) => {
77+
if (
78+
shouldShowCreateSuggestion &&
79+
CREATE_TYPE === suggestion.type
80+
) {
81+
return (
82+
<LinkControlSearchCreate
83+
searchTerm={ currentInputValue }
84+
buttonText={ createSuggestionButtonText }
85+
onClick={ () =>
86+
handleSuggestionClick( suggestion )
87+
}
88+
// Intentionally only using `type` here as
89+
// the constant is enough to uniquely
90+
// identify the single "CREATE" suggestion.
91+
key={ suggestion.type }
92+
itemProps={ buildSuggestionItemProps(
93+
suggestion,
94+
index
95+
) }
96+
isSelected={ index === selectedSuggestion }
97+
/>
98+
);
99+
}
100+
101+
// If we're not handling "Create" suggestions above then
102+
// we don't want them in the main results so exit early.
103+
if ( CREATE_TYPE === suggestion.type ) {
104+
return null;
105+
}
106+
80107
return (
81-
<LinkControlSearchCreate
82-
searchTerm={ currentInputValue }
83-
buttonText={ createSuggestionButtonText }
84-
onClick={ () =>
85-
handleSuggestionClick( suggestion )
86-
}
87-
// Intentionally only using `type` here as
88-
// the constant is enough to uniquely
89-
// identify the single "CREATE" suggestion.
90-
key={ suggestion.type }
108+
<LinkControlSearchItem
109+
key={ `${ suggestion.id }-${ suggestion.type }` }
91110
itemProps={ buildSuggestionItemProps(
92111
suggestion,
93112
index
94113
) }
114+
suggestion={ suggestion }
115+
index={ index }
116+
onClick={ () => {
117+
handleSuggestionClick( suggestion );
118+
} }
95119
isSelected={ index === selectedSuggestion }
120+
isURL={ LINK_ENTRY_TYPES.includes(
121+
suggestion.type
122+
) }
123+
searchTerm={ currentInputValue }
124+
shouldShowType={ shouldShowSuggestionsTypes }
125+
isFrontPage={ suggestion?.isFrontPage }
96126
/>
97127
);
98-
}
99-
100-
// If we're not handling "Create" suggestions above then
101-
// we don't want them in the main results so exit early.
102-
if ( CREATE_TYPE === suggestion.type ) {
103-
return null;
104-
}
105-
106-
return (
107-
<LinkControlSearchItem
108-
key={ `${ suggestion.id }-${ suggestion.type }` }
109-
itemProps={ buildSuggestionItemProps(
110-
suggestion,
111-
index
112-
) }
113-
suggestion={ suggestion }
114-
index={ index }
115-
onClick={ () => {
116-
handleSuggestionClick( suggestion );
117-
} }
118-
isSelected={ index === selectedSuggestion }
119-
isURL={ LINK_ENTRY_TYPES.includes(
120-
suggestion.type
121-
) }
122-
searchTerm={ currentInputValue }
123-
shouldShowType={ shouldShowSuggestionsTypes }
124-
isFrontPage={ suggestion?.isFrontPage }
125-
/>
126-
);
127-
} ) }
128+
} ) }
129+
</MenuGroup>
128130
</div>
129131
</div>
130132
);

0 commit comments

Comments
 (0)