Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Show the content of the paragraph and list items in the list view.
  • Loading branch information
juanfra committed Apr 27, 2023
commit 6a7b0fa0ff9766a9cf1acebc88b8a0bfa7605b1c
9 changes: 9 additions & 0 deletions packages/block-library/src/list-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export const settings = {
};
},
transforms,
__experimentalLabel( attributes, { context } ) {
const { content } = attributes;

// In the list view, use the block's content as the label.
// If the content is empty, fall back to the default label.
if ( context === 'list-view' && content ) {
return content;
}
},
};

export const init = () => initBlock( { name, metadata, settings } );
9 changes: 8 additions & 1 deletion packages/block-library/src/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ export const settings = {
},
},
__experimentalLabel( attributes, { context } ) {
const { content } = attributes;

if ( context === 'accessibility' ) {
const { content } = attributes;
return ! content || content.length === 0 ? __( 'Empty' ) : content;
}

// In the list view, use the block's content as the label.
// If the content is empty, fall back to the default label.
if ( context === 'list-view' && content ) {
return content;
}
},
transforms,
deprecated,
Expand Down