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

Tweak list block #64025

Merged
merged 5 commits into from
Jul 31, 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 @@ -410,7 +410,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress

## List

Create a bulleted or numbered list. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list))
An organized collection of items displayed in a specific order. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list))

- **Name:** core/list
- **Category:** text
Expand All @@ -420,7 +420,7 @@ Create a bulleted or numbered list. ([Source](https://github.com/WordPress/guten

## List item

Create a list item. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list-item))
An individual item within a list. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list-item))

- **Name:** core/list-item
- **Category:** text
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/list-item/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"category": "text",
"parent": [ "core/list" ],
"allowedBlocks": [ "core/list" ],
"description": "Create a list item.",
"description": "An individual item within a list.",
richtabor marked this conversation as resolved.
Show resolved Hide resolved
"textdomain": "default",
"attributes": {
"placeholder": {
Expand All @@ -25,8 +25,8 @@
"color": {
"gradients": true,
"link": true,
"background": true,
"__experimentalDefaultControls": {
"background": true,
"text": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "List",
"category": "text",
"allowedBlocks": [ "core/list-item" ],
"description": "Create a bulleted or numbered list.",
"description": "An organized collection of items displayed in a specific order.",
"keywords": [ "bullet list", "ordered list", "numbered list" ],
"textdomain": "default",
"attributes": {
Expand Down
38 changes: 20 additions & 18 deletions packages/block-library/src/list/ordered-list-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,10 @@ import {
const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => (
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<TextControl
__nextHasNoMarginBottom
label={ __( 'Start value' ) }
type="number"
onChange={ ( value ) => {
const int = parseInt( value, 10 );

setAttributes( {
// It should be possible to unset the value,
// e.g. with an empty string.
start: isNaN( int ) ? undefined : int,
} );
} }
value={ Number.isInteger( start ) ? start.toString( 10 ) : '' }
step="1"
/>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Numbering style' ) }
label={ __( 'List style' ) }
options={ [
{
label: __( 'Numbers' ),
Expand All @@ -57,9 +42,26 @@ const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => (
value={ type }
onChange={ ( newValue ) => setAttributes( { type: newValue } ) }
/>
<TextControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Start value' ) }
type="number"
onChange={ ( value ) => {
const int = parseInt( value, 10 );

setAttributes( {
// It should be possible to unset the value,
// e.g. with an empty string.
start: isNaN( int ) ? undefined : int,
} );
} }
value={ Number.isInteger( start ) ? start.toString( 10 ) : '' }
step="1"
/>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Reverse list numbering' ) }
label={ __( 'Reverse order' ) }
checked={ reversed || false }
onChange={ ( value ) => {
setAttributes( {
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/list/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ describe( 'List block', () => {
() => screen.getByTestId( 'block-settings-modal' ).props.isVisible
);

const reverseButton = screen.getByLabelText(
/Reverse list numbering\. Off/
);
const reverseButton = screen.getByLabelText( /Reverse order\. Off/ );
fireEvent.press( reverseButton );

expect( getEditorHtml() ).toMatchSnapshot();
Expand Down
Loading