Skip to content
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
22 changes: 20 additions & 2 deletions packages/block-library/src/list/ordered-list-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
*/
import { __ } from '@wordpress/i18n';
import { InspectorControls } from '@wordpress/block-editor';
import { TextControl, PanelBody, ToggleControl } from '@wordpress/components';
import {
TextControl,
PanelBody,
ToggleControl,
SelectControl,
} from '@wordpress/components';

const OrderedListSettings = ( { setAttributes, reversed, start } ) => (
const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => (
<InspectorControls>
<PanelBody title={ __( 'Ordered list settings' ) }>
<TextControl
Expand All @@ -24,6 +29,19 @@ const OrderedListSettings = ( { setAttributes, reversed, start } ) => (
value={ Number.isInteger( start ) ? start.toString( 10 ) : '' }
step="1"
/>
<SelectControl
__nextHasNoMarginBottom
label={ __( 'Numbering style' ) }
options={ [
{ value: '1', label: __( 'Numbers' ) },
{ value: 'A', label: __( 'Uppercase letters' ) },
{ value: 'a', label: __( 'Lowercase letters' ) },
{ value: 'I', label: __( 'Uppercase Roman numerals' ) },
{ value: 'i', label: __( 'Lowercase Roman numerals' ) },
] }
value={ type }
onChange={ ( newValue ) => setAttributes( { type: newValue } ) }
/>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Reverse list numbering' ) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- wp:list {"ordered":true,"type":"A"} -->
<ol type="A">
<!-- wp:list-item -->
<li>Item 1</li>
<!-- /wp:list-item -->
</ol>
<!-- /wp:list -->
21 changes: 21 additions & 0 deletions test/integration/fixtures/blocks/core__list__ol-with-type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"name": "core/list",
"isValid": true,
"attributes": {
"ordered": true,
"values": "",
"type": "A"
},
"innerBlocks": [
{
"name": "core/list-item",
"isValid": true,
"attributes": {
"content": "Item 1"
},
"innerBlocks": []
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"blockName": "core/list",
"attrs": {
"ordered": true,
"type": "A"
},
"innerBlocks": [
{
"blockName": "core/list-item",
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t<li>Item 1</li>\n\t",
"innerContent": [ "\n\t<li>Item 1</li>\n\t" ]
}
],
"innerHTML": "\n<ol type=\"A\">\n\t\n</ol>\n",
"innerContent": [ "\n<ol type=\"A\">\n\t", null, "\n</ol>\n" ]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:list {"ordered":true,"type":"A"} -->
<ol type="A"><!-- wp:list-item -->
<li>Item 1</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->