Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const ListEdit = ( {
onTagNameChange,
tagName,
value,
onChange,
} ) => (
onTagNameChange && {
icon: 'editor-ul',
title: __( 'Convert to unordered list' ),
isActive: isActiveListType( value, 'ul', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ul' } ) );
if ( isListRootSelected( value ) ) {
onTagNameChange( 'ul' );
}
},
},
onTagNameChange && {
icon: 'editor-ol',
title: __( 'Convert to ordered list' ),
isActive: isActiveListType( value, 'ol', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ol' } ) );
if ( isListRootSelected( value ) ) {
onTagNameChange( 'ol' );
}
},
},
{
icon: 'editor-outdent',
title: __( 'Outdent list item' ),
shortcut: _x( 'Backspace', 'keyboard key' ),
onClick: () => {
onChange( outdentListItems( value ) );
},
},
} }
/>
{
onChange( outdentListItems( value ) );
} }
/>
onTagNameChange && {
icon: 'editor-ul',
title: __( 'Convert to unordered list' ),
isActive: isActiveListType( value, 'ul', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ul' } ) );
if ( isListRootSelected( value ) ) {
onTagNameChange( 'ul' );
}
},
},
onTagNameChange && {
icon: 'editor-ol',
title: __( 'Convert to ordered list' ),
isActive: isActiveListType( value, 'ol', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ol' } ) );
if ( isListRootSelected( value ) ) {
onTagNameChange( 'ol' );
}
},
},
].filter( Boolean ) }
/>
);
} }
/>
{
onChange( outdentListItems( value ) );
} }
/>
{
icon: 'editor-ul',
title: __( 'Convert to unordered list' ),
isActive: isActiveListType( value, 'ul', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ul' } ) );
if ( isListRootSelected( value ) ) {
setAttributes( { ordered: false } );
}
},
},
{
icon: 'editor-ol',
title: __( 'Convert to ordered list' ),
isActive: isActiveListType( value, 'ol', tagName ),
onClick() {
onChange( changeListType( value, { type: 'ol' } ) );
if ( isListRootSelected( value ) ) {
setAttributes( { ordered: true } );
}
},
},
{
icon: 'editor-outdent',
title: __( 'Outdent list item' ),
shortcut: _x( 'Backspace', 'keyboard key' ),
onClick() {
onChange( outdentListItems( value ) );
},
},