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 Block: Add typography styles to theme.json #32273

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
56 changes: 56 additions & 0 deletions packages/block-library/src/list/deprecated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* External dependencies
*/


/**
* WordPress dependencies
*/
import { RichText, useBlockProps } from '@wordpress/block-editor';

const blockAttributes = {
ordered: {
type: 'boolean',
default: false,
__experimentalRole: 'content'
},
values: {
type: 'string',
source: 'html',
selector: 'ol,ul',
multiline: 'li',
__unstableMultilineWrapperTags: [ 'ol', 'ul' ],
default: '',
__experimentalRole: 'content'
},
type: {
type: 'string'
},
start: {
type: 'number'
},
reversed: {
type: 'boolean'
},
placeholder: {
type: 'string'
}
};

const deprecated = [
{
attributes: blockAttributes,
save( { attributes } ) {
const { ordered, values, type, reversed, start } = attributes;
const TagName = ordered ? 'ol' : 'ul';

return (
<TagName { ...useBlockProps.save( { type, reversed, start } ) }>
<RichText.Content value={ values } multiline="li" />
</TagName>
);
},
},
];

export default deprecated;
1 change: 1 addition & 0 deletions packages/block-library/src/list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default function ListEdit( {
return (
<>
<RichText
className="wp-block-list"
identifier="values"
multiline="li"
tagName={ tagName }
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { list as icon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import metadata from './block.json';
import save from './save';
Expand Down Expand Up @@ -38,4 +39,5 @@ export const settings = {
},
edit,
save,
deprecated,
};