diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index ccb5e0d15bf7ec..30e882ed49d801 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -20,12 +20,12 @@ import Autocomplete from '../autocomplete'; import BlockFormatControls from '../block-format-controls'; import FormatToolbar from './format-toolbar'; import { withBlockEditContext } from '../block-edit/context'; -import { ListEdit } from './list-edit'; const wrapperClasses = 'editor-rich-text block-editor-rich-text'; const classes = 'editor-rich-text__editable block-editor-rich-text__editable'; function RichTextWraper( { + children, tagName, value: originalValue, onChange: originalOnChange, @@ -33,7 +33,6 @@ function RichTextWraper( { selectionEnd, onSelectionChange, multiline, - onTagNameChange, inlineToolbar, wrapperClassName, className, @@ -86,14 +85,7 @@ function RichTextWraper( { > { ( { isSelected, value, onChange } ) => - { isSelected && multiline === 'li' && ( - - ) } + { children && children( { value, onChange } ) } { isSelected && ! inlineToolbar && ( diff --git a/packages/block-library/src/list/edit.js b/packages/block-library/src/list/edit.js index efc38c50a63e22..53e0edda0ebf8e 100644 --- a/packages/block-library/src/list/edit.js +++ b/packages/block-library/src/list/edit.js @@ -7,13 +7,9 @@ import { RichText, BlockControls, RichTextShortcut, - InspectorControls, } from '@wordpress/block-editor'; import { Toolbar, - TextControl, - PanelBody, - ToggleControl, } from '@wordpress/components'; import { __unstableIndentListItems as indentListItems, @@ -27,6 +23,7 @@ import { * Internal dependencies */ import { name } from './'; +import OrderedListSettings from './ordered-list-settings'; export default function ListEdit( { attributes, @@ -141,36 +138,12 @@ export default function ListEdit( { > { controls } - { ordered && - - - { - 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" - /> - { - setAttributes( { - // Unset the attribute if not reversed. - reversed: value || undefined, - } ); - } } - /> - - - } + { ordered && ( + ) } ; } diff --git a/packages/block-library/src/list/ordered-list-settings.js b/packages/block-library/src/list/ordered-list-settings.js new file mode 100644 index 00000000000000..4cb845f423d657 --- /dev/null +++ b/packages/block-library/src/list/ordered-list-settings.js @@ -0,0 +1,43 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { InspectorControls } from '@wordpress/block-editor'; +import { + TextControl, + PanelBody, + ToggleControl, +} from '@wordpress/components'; + +const OrderedListSettings = ( { setAttributes, reversed, start } ) => ( + + + { + 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" + /> + { + setAttributes( { + // Unset the attribute if not reversed. + reversed: value || undefined, + } ); + } } + /> + + ); + +export default OrderedListSettings; diff --git a/packages/block-library/src/list/ordered-list-settings.native.js b/packages/block-library/src/list/ordered-list-settings.native.js new file mode 100644 index 00000000000000..43bab31a4330eb --- /dev/null +++ b/packages/block-library/src/list/ordered-list-settings.native.js @@ -0,0 +1,3 @@ +// Mobile has no additional list settings at this time, so render nothing +const AdditionalSettings = () => null; +export default AdditionalSettings;