Skip to content

Commit

Permalink
Merge branch 'trunk' of personal.github.com:WordPress/gutenberg into …
Browse files Browse the repository at this point in the history
…fix/issue-56020
  • Loading branch information
akasunil committed Jun 17, 2024
2 parents f641ce9 + 48e81e9 commit 5aa8d5c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"babel-plugin-transform-remove-console": "6.9.4",
"benchmark": "2.1.4",
"browserslist": "4.22.2",
"caniuse-lite": "1.0.30001579",
"caniuse-lite": "1.0.30001636",
"chalk": "4.1.1",
"change-case": "4.1.2",
"client-zip": "^2.4.5",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/quote/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function QuoteEdit( {
}
addLabel={ __( 'Add citation' ) }
removeLabel={ __( 'Remove citation' ) }
excludeElementClassName
className="wp-block-quote__citation"
insertBlocksAfter={ insertBlocksAfter }
{ ...( ! isWebPlatform ? { textAlign } : {} ) }
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/utils/caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function Caption( {
placeholder = __( 'Add caption' ),
label = __( 'Caption text' ),
showToolbarButton = true,
excludeElementClassName,
className,
readOnly,
tagName = 'figcaption',
Expand Down Expand Up @@ -70,6 +71,7 @@ export function Caption( {
},
[ isCaptionEmpty ]
);

return (
<>
{ showToolbarButton && (
Expand All @@ -96,7 +98,9 @@ export function Caption( {
tagName={ tagName }
className={ clsx(
className,
__experimentalGetElementClassName( 'caption' )
excludeElementClassName
? ''
: __experimentalGetElementClassName( 'caption' )
) }
ref={ ref }
aria-label={ label }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,16 @@ export default async function fetchLinkSuggestions(
* @param search
*/
export function sortResults( results: SearchResult[], search: string ) {
const searchTokens = new Set( tokenize( search ) );
const searchTokens = tokenize( search );

const scores = {};
for ( const result of results ) {
if ( result.title ) {
const titleTokens = tokenize( result.title );
const matchingTokens = titleTokens.filter( ( token ) =>
searchTokens.has( token )
const matchingTokens = titleTokens.filter( ( titleToken ) =>
searchTokens.some( ( searchToken ) =>
titleToken.includes( searchToken )
)
);
scores[ result.id ] = matchingTokens.length / titleTokens.length;
} else {
Expand Down
35 changes: 35 additions & 0 deletions test/e2e/specs/editor/various/block-bindings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,41 @@ test.describe( 'Block bindings', () => {
).toHaveText( 'new value' );
} );

// Related issue: https://github.com/WordPress/gutenberg/issues/62347
test( 'should be possible to use symbols and numbers as the custom field value', async ( {
editor,
} ) => {
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
anchor: 'paragraph-binding',
content: 'paragraph default content',
metadata: {
bindings: {
content: {
source: 'core/post-meta',
args: { key: 'text_custom_field' },
},
},
},
},
} );
const paragraphBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Paragraph',
} );

await expect( paragraphBlock ).toHaveAttribute(
'contenteditable',
'true'
);
await paragraphBlock.fill( '$10.00' );
// Check the value of the custom field is being updated by visiting the frontend.
const previewPage = await editor.openPreviewPage();
await expect(
previewPage.locator( '#paragraph-binding' )
).toHaveText( '$10.00' );
} );

test( 'should be possible to edit the value of the url custom field from the button', async ( {
editor,
page,
Expand Down

0 comments on commit 5aa8d5c

Please sign in to comment.