From 439367240ab0e586fbd2c8a0e744f8e2591376a9 Mon Sep 17 00:00:00 2001 From: benridane <15902112+benridane@users.noreply.github.com> Date: Mon, 10 Oct 2022 18:12:30 +0900 Subject: [PATCH 1/2] Fix outdent in quote block --- .../src/list-item/hooks/use-outdent-list-item.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js index 93472f49dbba8d..d4c034b06e8134 100644 --- a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js +++ b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js @@ -20,12 +20,16 @@ export default function useOutdentListItem( clientId ) { const registry = useRegistry(); const { canOutdent } = useSelect( ( innerSelect ) => { - const { getBlockRootClientId } = innerSelect( blockEditorStore ); + const { getBlockRootClientId, getBlockName } = + innerSelect( blockEditorStore ); const grandParentId = getBlockRootClientId( getBlockRootClientId( clientId ) ); + const grandParentName = getBlockName( grandParentId ); + const isListItem = grandParentName === listItemName; + return { - canOutdent: !! grandParentId, + canOutdent: isListItem, }; }, [ clientId ] From 6623d20887291cacdeae4552f1543305795e767e Mon Sep 17 00:00:00 2001 From: benridane <15902112+benridane@users.noreply.github.com> Date: Mon, 10 Oct 2022 18:13:32 +0900 Subject: [PATCH 2/2] Add e2e test --- test/e2e/specs/editor/blocks/list.spec.js | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index d014402327e158..1f5c01d74d38e8 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -600,6 +600,32 @@ test.describe( 'List', () => { ); } ); + test( 'should create paragraph on Enter in quote block', async ( { + editor, + page, + } ) => { + await editor.insertBlock( { name: 'core/quote' } ); + await page.keyboard.type( '/list' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( 'aaa' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.press( 'Enter' ); + + await expect.poll( editor.getEditedPostContent ).toBe( + ` +
++` + ); + } ); + test( 'should indent and outdent level 1', async ( { editor, page } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' );+
+ + + + +- aaa
+