From 64b8794a3c839faeb261153a16eff47f3073cf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Tue, 23 Aug 2022 16:42:40 +0200 Subject: [PATCH] Restore anchor in raw transform --- packages/block-library/src/list/save.js | 6 +----- packages/block-library/src/list/utils.js | 1 + .../__snapshots__/blocks-raw-handling.test.js.snap | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/list/save.js b/packages/block-library/src/list/save.js index ef167799ca343..c74893f38b67b 100644 --- a/packages/block-library/src/list/save.js +++ b/packages/block-library/src/list/save.js @@ -7,11 +7,7 @@ export default function save( { attributes } ) { const { ordered, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return ( - + ); diff --git a/packages/block-library/src/list/utils.js b/packages/block-library/src/list/utils.js index 2d56b266bf56c..61d1cbef89234 100644 --- a/packages/block-library/src/list/utils.js +++ b/packages/block-library/src/list/utils.js @@ -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, diff --git a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap index 6280447c4ae99..6c341c815e035 100644 --- a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap +++ b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap @@ -127,9 +127,9 @@ exports[`rawHandler should convert a caption shortcode with link 1`] = ` exports[`rawHandler should convert a list with attributes 1`] = ` " -
    +
    1. 1 -
        +
        1. 1