From 3a6aa4235df79395675576782dfefb9a08cdf2a9 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Thu, 5 Dec 2024 17:16:19 +0000 Subject: [PATCH 1/3] Fix: Write Mode Block Movers appear when content block is immediate child of a section. --- packages/block-editor/src/store/selectors.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 31ee6778da8d0..480dfd5c83fc4 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1871,10 +1871,15 @@ export function canMoveBlock( state, clientId ) { } const rootClientId = getBlockRootClientId( state, clientId ); - if ( getTemplateLock( state, rootClientId ) === 'all' ) { + const templateLock = getTemplateLock( state, rootClientId ); + if ( + getTemplateLock( state, rootClientId ) === 'all' || + templateLock === 'contentOnly' + ) { return false; } - return getBlockEditingMode( state, rootClientId ) !== 'disabled'; + const editingMode = getBlockEditingMode( state, rootClientId ); + return editingMode !== 'disabled' && editingMode !== 'contentOnly'; } /** From d090fca1e9567f607a917e935da84f872b5644e1 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Wed, 18 Dec 2024 16:48:38 +0000 Subject: [PATCH 2/3] fix reported case --- packages/block-editor/src/store/selectors.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 480dfd5c83fc4..d87050eff17c3 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1878,8 +1878,13 @@ export function canMoveBlock( state, clientId ) { ) { return false; } - const editingMode = getBlockEditingMode( state, rootClientId ); - return editingMode !== 'disabled' && editingMode !== 'contentOnly'; + const rootEditingMode = getBlockEditingMode( state, rootClientId ); + const blockEditingMode = getBlockEditingMode( state, clientId ); + return ( + rootEditingMode !== 'disabled' && + ( rootEditingMode !== 'contentOnly' || + blockEditingMode !== 'contentOnly' ) + ); } /** From e5f1422efed70cb4e73161aab7b52d88455a8de3 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 27 Dec 2024 19:06:29 +0000 Subject: [PATCH 3/3] remove partial fix --- packages/block-editor/src/store/selectors.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index d87050eff17c3..2ea098c9ab5ab 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1878,13 +1878,7 @@ export function canMoveBlock( state, clientId ) { ) { return false; } - const rootEditingMode = getBlockEditingMode( state, rootClientId ); - const blockEditingMode = getBlockEditingMode( state, clientId ); - return ( - rootEditingMode !== 'disabled' && - ( rootEditingMode !== 'contentOnly' || - blockEditingMode !== 'contentOnly' ) - ); + return getBlockEditingMode( state, rootClientId ) !== 'disabled'; } /**