From 04265ccc1e4764129f91ef690c6f2d61867760f0 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 22 Mar 2022 09:21:00 +0100 Subject: [PATCH] List block v2: Add start, ordered and reversed list block attributes (#39605) --- packages/block-library/src/list/v2/edit.js | 65 +++++++++++++++++++++- packages/block-library/src/list/v2/save.js | 12 +++- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/list/v2/edit.js b/packages/block-library/src/list/v2/edit.js index a8641aa338a9fd..bde902f8774ce3 100644 --- a/packages/block-library/src/list/v2/edit.js +++ b/packages/block-library/src/list/v2/edit.js @@ -1,18 +1,77 @@ /** * WordPress dependencies */ -import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor'; +import { + BlockControls, + useBlockProps, + useInnerBlocksProps, +} from '@wordpress/block-editor'; +import { ToolbarButton } from '@wordpress/components'; +import { isRTL, __ } from '@wordpress/i18n'; +import { + formatListBullets, + formatListBulletsRTL, + formatListNumbered, + formatListNumberedRTL, +} from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import OrderedListSettings from '../ordered-list-settings'; const TEMPLATE = [ [ 'core/list-item' ] ]; -function Edit() { +function Edit( { attributes, setAttributes } ) { const blockProps = useBlockProps(); const innerBlocksProps = useInnerBlocksProps( blockProps, { allowedBlocks: [ 'core/list-item' ], template: TEMPLATE, } ); + const { ordered, reversed, start } = attributes; + const TagName = ordered ? 'ol' : 'ul'; + + const controls = ( + + { + setAttributes( { ordered: false } ); + } } + /> + { + setAttributes( { ordered: true } ); + } } + /> + + ); - return