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 anchor in raw transform
  • Loading branch information
ellatrix authored and oandregal committed Aug 24, 2022
commit 64b8794a3c839faeb261153a16eff47f3073cf32
6 changes: 1 addition & 5 deletions packages/block-library/src/list/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ export default function save( { attributes } ) {
const { ordered, type, reversed, start } = attributes;
const TagName = ordered ? 'ol' : 'ul';
return (
<TagName
reversed={ reversed }
start={ start }
{ ...useBlockProps.save( { type, reversed, start } ) }
>
<TagName { ...useBlockProps.save( { type, reversed, start } ) }>
<InnerBlocks.Content />
</TagName>
);
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/list/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { createBlock } from '@wordpress/blocks';
export function createListBlockFromDOMElement( listElement ) {
const listAttributes = {
ordered: 'OL' === listElement.tagName,
anchor: listElement.id === '' ? undefined : listElement.id,
start: listElement.getAttribute( 'start' )
? parseInt( listElement.getAttribute( 'start' ), 10 )
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ exports[`rawHandler should convert a caption shortcode with link 1`] = `

exports[`rawHandler should convert a list with attributes 1`] = `
"<!-- wp:list {\\"ordered\\":true,\\"type\\":\\"i\\",\\"start\\":2,\\"reversed\\":true} -->
<ol reversed start=\\"2\\" type=\\"i\\"><!-- wp:list-item -->
<ol type=\\"i\\" reversed start=\\"2\\"><!-- wp:list-item -->
<li>1<!-- wp:list {\\"ordered\\":true,\\"type\\":\\"i\\",\\"start\\":2,\\"reversed\\":true} -->
<ol reversed start=\\"2\\" type=\\"i\\"><!-- wp:list-item -->
<ol type=\\"i\\" reversed start=\\"2\\"><!-- wp:list-item -->
<li>1</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list --></li>
Expand Down