Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] trunk from WordPress:trunk #70

Merged
merged 14 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ Contains the block elements used to render a post, like the title, date, feature

- **Name:** core/post-template
- **Category:** theme
- **Parent:** core/query
- **Ancestor:** core/query
- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~

## Post Terms
Expand Down Expand Up @@ -724,7 +724,7 @@ Contains the block elements used to render content when no query results are fou

- **Name:** core/query-no-results
- **Category:** theme
- **Parent:** core/query
- **Ancestor:** core/query
- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~

## Pagination
Expand Down
27 changes: 15 additions & 12 deletions packages/block-editor/src/hooks/test/font-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import {
import _fontSize from '../font-size';

const noop = () => {};
const EMPTY_ARRAY = [];
const EMPTY_OBJECT = {};
const fontSizes = [
{
name: 'A larger font',
size: '32px',
slug: 'larger',
},
];

function addUseSettingFilter( callback ) {
addFilter(
Expand Down Expand Up @@ -55,21 +64,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [
{
name: 'A larger font',
size: '32px',
slug: 'larger',
},
];
return fontSizes;
}

if ( 'typography.fluid' === path ) {
return false;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand All @@ -95,15 +98,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [];
return EMPTY_ARRAY;
}

if ( 'typography.fluid' === path ) {
return false;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand Down Expand Up @@ -132,15 +135,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [];
return EMPTY_ARRAY;
}

if ( 'typography.fluid' === path ) {
return true;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand Down
12 changes: 11 additions & 1 deletion packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
useSettings,
useBlockEditingMode,
} from '@wordpress/block-editor';
import { getBlockSupport } from '@wordpress/blocks';
import { formatLtr } from '@wordpress/icons';

/**
Expand All @@ -47,7 +48,7 @@ function hasDropCapDisabled( align ) {
return align === ( isRTL() ? 'left' : 'right' ) || align === 'center';
}

function DropCapControl( { clientId, attributes, setAttributes } ) {
function DropCapControl( { clientId, attributes, setAttributes, name } ) {
// Please do not add a useSelect call to the paragraph block unconditionally.
// Every useSelect added to a (frequently used) block will degrade load
// and type performance. By moving it within InspectorControls, the subscription is
Expand All @@ -69,11 +70,18 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
helpText = __( 'Show a large initial letter.' );
}

const isDropCapControlEnabledByDefault = getBlockSupport(
name,
'typography.defaultControls.dropCap',
false
);

return (
<InspectorControls group="typography">
<ToolsPanelItem
hasValue={ () => !! dropCap }
label={ __( 'Drop cap' ) }
isShownByDefault={ isDropCapControlEnabledByDefault }
onDeselect={ () => setAttributes( { dropCap: undefined } ) }
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
Expand All @@ -99,6 +107,7 @@ function ParagraphBlock( {
setAttributes,
clientId,
isSelected: isSingleSelected,
name,
} ) {
const { align, content, direction, dropCap, placeholder } = attributes;
const blockProps = useBlockProps( {
Expand Down Expand Up @@ -136,6 +145,7 @@ function ParagraphBlock( {
) }
{ isSingleSelected && (
<DropCapControl
name={ name }
clientId={ clientId }
attributes={ attributes }
setAttributes={ setAttributes }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-template/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "core/post-template",
"title": "Post Template",
"category": "theme",
"parent": [ "core/query" ],
"ancestor": [ "core/query" ],
"description": "Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.",
"textdomain": "default",
"usesContext": [
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query-no-results/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "No results",
"category": "theme",
"description": "Contains the block elements used to render content when no query results are found.",
"parent": [ "core/query" ],
"ancestor": [ "core/query" ],
"textdomain": "default",
"usesContext": [ "queryId", "query" ],
"example": {
Expand Down
16 changes: 8 additions & 8 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@

- `GradientPicker`: Add `enableAlpha` prop ([#66974](https://github.com/WordPress/gutenberg/pull/66974))
- `CustomGradientPicker`: Add `enableAlpha` prop ([#66974](https://github.com/WordPress/gutenberg/pull/66974))
- `Menu`: Replace hardcoded white color with theme-ready variable ([#67649](https://github.com/WordPress/gutenberg/pull/67649)).
- `Navigation` (deprecated): Replace hardcoded white color with theme-ready variable ([#67649](https://github.com/WordPress/gutenberg/pull/67649)).
- `ToggleGroupControl`: Replace hardcoded white color with theme-ready variable ([#67649](https://github.com/WordPress/gutenberg/pull/67649)).
- `RangeControl`: Update the design of the range control marks ([#67611](https://github.com/WordPress/gutenberg/pull/67611))
- `BorderBoxControl`: Reduce gap value when unlinked ([#67049](https://github.com/WordPress/gutenberg/pull/67049)).
- `DropdownMenu`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `MenuItem`: Increase height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `MenuItemsChoice`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `Navigation`: Fix active item hover color ([#67732](https://github.com/WordPress/gutenberg/pull/67732)).

### Deprecations

Expand All @@ -22,14 +30,6 @@
- `FormFileUpload`: Deprecate 36px default size ([#67438](https://github.com/WordPress/gutenberg/pull/67438)).
- `FormTokenField`: Deprecate 36px default size ([#67454](https://github.com/WordPress/gutenberg/pull/67454)).


### Enhancements

- `BorderBoxControl`: Reduce gap value when unlinked ([#67049](https://github.com/WordPress/gutenberg/pull/67049)).
- `DropdownMenu`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `MenuItem`: Increase height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `MenuItemsChoice`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).

### Experimental

- `Menu`: throw when subcomponents are not rendered inside top level `Menu` ([#67411](https://github.com/WordPress/gutenberg/pull/67411)).
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/menu/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const baseItem = css`
[aria-disabled='true']
) {
background-color: ${ COLORS.theme.accent };
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };
}

/* Keyboard focus (focus-visible) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ export const ItemBaseUI = styled.li`

&.is-active {
background-color: ${ COLORS.theme.accent };
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };

> button,
.components-button:hover,
> a {
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };
opacity: 1;
}
}
Expand Down
Loading
Loading