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

List: use nested blocks #42711

Merged
merged 17 commits into from
Aug 24, 2022
Prev Previous commit
Next Next commit
Restore example
  • Loading branch information
ellatrix authored and oandregal committed Aug 24, 2022
commit aa0dc921db9a7ab6778ef870a16cba3fe463d8fa
42 changes: 25 additions & 17 deletions packages/block-library/src/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { list as icon } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -18,24 +19,31 @@ export { metadata, name };

const settings = {
icon,
// example: {
// attributes: {
// values: '<li>Alice.</li><li>The White Rabbit.</li><li>The Cheshire Cat.</li><li>The Mad Hatter.</li><li>The Queen of Hearts.</li>',
// },
// },
example: {
innerBlocks: [
{
name: 'core/list-item',
attributes: { content: __( 'Alice.' ) },
},
{
name: 'core/list-item',
attributes: { content: __( 'The White Rabbit.' ) },
},
{
name: 'core/list-item',
attributes: { content: __( 'The Cheshire Cat.' ) },
},
{
name: 'core/list-item',
attributes: { content: __( 'The Mad Hatter.' ) },
},
{
name: 'core/list-item',
attributes: { content: __( 'The Queen of Hearts.' ) },
},
],
},
transforms,
// merge( attributes, attributesToMerge ) {
// const { values } = attributesToMerge;

// if ( ! values || values === '<li></li>' ) {
// return attributes;
// }

// return {
// ...attributes,
// values: attributes.values + values,
// };
// },
edit,
save,
deprecated,
Expand Down