From f2b3b174f763319d5507dc689f1dc5795b2a921c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= <4710635+ellatrix@users.noreply.github.com> Date: Tue, 26 Jul 2022 19:30:49 +0200 Subject: [PATCH] List v2: remove Quote transforms as removed by Quote v2 (#42700) --- packages/block-library/src/list/transforms.js | 17 -------- .../block-library/src/list/v2/transforms.js | 42 +------------------ .../editor/various/block-switcher.test.js | 3 +- 3 files changed, 3 insertions(+), 59 deletions(-) diff --git a/packages/block-library/src/list/transforms.js b/packages/block-library/src/list/transforms.js index 32667a99a735af..8f2c768a343b77 100644 --- a/packages/block-library/src/list/transforms.js +++ b/packages/block-library/src/list/transforms.js @@ -161,23 +161,6 @@ const transforms = { } ) ), }, - { - type: 'block', - blocks: [ 'core/pullquote' ], - transform: ( { values, anchor } ) => { - return createBlock( 'core/pullquote', { - value: toHTMLString( { - value: create( { - html: values, - multilineTag: 'li', - multilineWrapperTags: [ 'ul', 'ol' ], - } ), - multilineTag: 'p', - } ), - anchor, - } ); - }, - }, { type: 'block', blocks: [ 'core/table-of-contents' ], diff --git a/packages/block-library/src/list/v2/transforms.js b/packages/block-library/src/list/v2/transforms.js index d357df3d8ed656..ab23c4c75cd916 100644 --- a/packages/block-library/src/list/v2/transforms.js +++ b/packages/block-library/src/list/v2/transforms.js @@ -9,13 +9,8 @@ import { flatMap } from 'lodash'; /** * WordPress dependencies */ -import { createBlock, switchToBlockType } from '@wordpress/blocks'; -import { - __UNSTABLE_LINE_SEPARATOR, - create, - split, - toHTMLString, -} from '@wordpress/rich-text'; +import { createBlock } from '@wordpress/blocks'; +import { create, split, toHTMLString } from '@wordpress/rich-text'; /** * Internal dependencies @@ -83,26 +78,6 @@ const transforms = { ); }, }, - { - type: 'block', - blocks: [ 'core/quote', 'core/pullquote' ], - transform: ( { value, anchor } ) => { - return createBlock( - 'core/list', - { - anchor, - }, - split( - create( { html: value, multilineTag: 'p' } ), - __UNSTABLE_LINE_SEPARATOR - ).map( ( result ) => { - return createBlock( 'core/list-item', { - content: toHTMLString( { value: result } ), - } ); - } ) - ); - }, - }, ...[ '*', '-' ].map( ( prefix ) => ( { type: 'prefix', prefix, @@ -147,19 +122,6 @@ const transforms = { ); }, } ) ), - ...[ 'core/quote', 'core/pullquote' ].map( ( block ) => ( { - type: 'block', - blocks: [ block ], - transform: ( attributes, innerBlocks ) => { - return switchToBlockType( - switchToBlockType( - createBlock( 'core/list', attributes, innerBlocks ), - 'core/paragraph' - ), - block - ); - }, - } ) ), ], }; diff --git a/packages/e2e-tests/specs/editor/various/block-switcher.test.js b/packages/e2e-tests/specs/editor/various/block-switcher.test.js index 7adbac136cd2e1..1b82f1f23ad025 100644 --- a/packages/e2e-tests/specs/editor/various/block-switcher.test.js +++ b/packages/e2e-tests/specs/editor/various/block-switcher.test.js @@ -29,7 +29,7 @@ describe( 'Block Switcher', () => { 'Group', 'Paragraph', 'Heading', - 'Pullquote', + 'Quote', 'Columns', 'Table of Contents', ] ) @@ -55,7 +55,6 @@ describe( 'Block Switcher', () => { expect.arrayContaining( [ 'Group', 'Paragraph', - 'Pullquote', 'Heading', 'Table of Contents', ] )