Skip to content

Commit

Permalink
Gutenberg 19.2: Backports for Release (#65252)
Browse files Browse the repository at this point in the history
* Core Data: Fix the 'query._fields' property check inside 'getEntityRecord' resolver (#65079)


Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>

* Site Title, Post Title: Fix typography for blocks with `a` children (#64911)

* Apply styles for element + `a` child when present

* Inherit styles from parent element when present

* Add missing `-font-family` attribute selector

* Interactivity API: Prevent calling `proxifyContext` over an already-proxified context inside the `wp-context` directive (#65090)

* Do not store the proxified context inside  `currentValue.current`.

* Update changelog

Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

---------

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: Rafael Gallani <galani.rafael@gmail.com>
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
  • Loading branch information
9 people authored Sep 11, 2024
1 parent cbf6725 commit 3c06e5b
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 14 deletions.
5 changes: 4 additions & 1 deletion packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@
}
}
},
"style": "wp-block-post-title"
"style": "wp-block-post-title",
"selectors": {
"typography": ".wp-block-post-title, .wp-block-post-title > a"
}
}
24 changes: 24 additions & 0 deletions packages/block-library/src/post-title/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;

&[style*="font-weight"] :where(a) {
font-weight: inherit;
}
&[class*="-font-family"] :where(a),
&[style*="font-family"] :where(a) {
font-family: inherit;
}
&[class*="-font-size"] :where(a),
&[style*="font-size"] :where(a) {
font-size: inherit;
}
&[style*="line-height"] :where(a) {
line-height: inherit;
}
&[style*="font-style"] :where(a) {
font-style: inherit;
}
&[style*="letter-spacing"] :where(a) {
letter-spacing: inherit;
}
&[style*="text-decoration"] :where(a) {
text-decoration: inherit;
}

a {
display: inline-block;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/site-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
}
},
"editorStyle": "wp-block-site-title-editor",
"style": "wp-block-site-title"
"style": "wp-block-site-title",
"selectors": {
"typography": ".wp-block-site-title > span, .wp-block-site-title > a"
}
}
24 changes: 24 additions & 0 deletions packages/block-library/src/site-title/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;

&[style*="font-weight"] :where(a) {
font-weight: inherit;
}
&[class*="-font-family"] :where(a),
&[style*="font-family"] :where(a) {
font-family: inherit;
}
&[class*="-font-size"] :where(a),
&[style*="font-size"] :where(a) {
font-size: inherit;
}
&[style*="line-height"] :where(a) {
line-height: inherit;
}
&[style*="font-style"] :where(a) {
font-style: inherit;
}
&[style*="letter-spacing"] :where(a) {
letter-spacing: inherit;
}
&[style*="text-decoration"] :where(a) {
text-decoration: inherit;
}

:where(a) {
color: inherit;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const getEntityRecord =
}
);

if ( query !== undefined ) {
if ( query !== undefined && query._fields ) {
query = { ...query, include: [ key ] };

// The resolution cache won't consider query as reusable based on the
Expand Down
10 changes: 1 addition & 9 deletions packages/core-data/src/test/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe( 'getEntityRecord', () => {

it( 'accepts a query that overrides default api path', async () => {
const query = { context: 'view', _envelope: '1' };
const queryObj = { include: [ 'post' ], ...query };

const select = {
hasEntityRecords: jest.fn( () => {} ),
Expand All @@ -98,13 +97,6 @@ describe( 'getEntityRecord', () => {
query
)( { dispatch, select, registry } );

// Check resolution cache for an existing entity that fulfills the request with query.
expect( select.hasEntityRecords ).toHaveBeenCalledWith(
'root',
'postType',
queryObj
);

// Trigger apiFetch, test that the query is present in the url.
expect( triggerFetch ).toHaveBeenCalledWith( {
path: '/wp/v2/types/post?context=view&_envelope=1',
Expand All @@ -116,7 +108,7 @@ describe( 'getEntityRecord', () => {
'root',
'postType',
POST_TYPE,
queryObj
query
);

// Locks should have been acquired and released.
Expand Down
4 changes: 4 additions & 0 deletions packages/interactivity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fixes

- Prevent calling `proxifyContext` over an already-proxified context inside `wp-context` ([#65090](https://github.com/WordPress/gutenberg/pull/65090)).

## 6.7.0 (2024-09-05)

### Enhancements
Expand Down
3 changes: 1 addition & 2 deletions packages/interactivity/src/directives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,10 @@ export default () => {
currentValue.current,
deepClone( value ) as object
);
currentValue.current = proxifyContext(
result[ namespace ] = proxifyContext(
currentValue.current,
inheritedValue[ namespace ]
);
result[ namespace ] = currentValue.current;
}
return result;
}, [ defaultEntry, inheritedValue ] );
Expand Down

0 comments on commit 3c06e5b

Please sign in to comment.