From cc024a3df43bdb6c33d3435414e6a68bfb8a606e Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Fri, 8 Dec 2023 16:04:34 +1200 Subject: [PATCH] Changes from code review --- packages/block-library/src/block/edit.js | 14 ++++++++------ .../header-edit-mode/document-actions/index.js | 11 +++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/block-library/src/block/edit.js b/packages/block-library/src/block/edit.js index 1c67649cfa0304..0af183e0e2b8ca 100644 --- a/packages/block-library/src/block/edit.js +++ b/packages/block-library/src/block/edit.js @@ -55,12 +55,14 @@ function getPartiallySyncedAttributes( block ) { const fullAlignments = [ 'full', 'wide', 'left', 'right' ]; -function setBlockEditMode( setEditMode, block ) { - const editMode = isPartiallySynced( block ) ? 'contentOnly' : 'disabled'; - setEditMode( block.clientId, editMode ); - block.innerBlocks.forEach( ( innerBlock ) => - setBlockEditMode( setEditMode, innerBlock ) - ); +function setBlockEditMode( setEditMode, blocks ) { + blocks.forEach( ( block ) => { + const editMode = isPartiallySynced( block ) + ? 'contentOnly' + : 'disabled'; + setEditMode( block.clientId, editMode ); + setBlockEditMode( setEditMode, block.innerBlocks ); + } ); } const useInferredLayout = ( blocks, parentLayout ) => { diff --git a/packages/edit-site/src/components/header-edit-mode/document-actions/index.js b/packages/edit-site/src/components/header-edit-mode/document-actions/index.js index e9960657053a1a..eca5abb729be68 100644 --- a/packages/edit-site/src/components/header-edit-mode/document-actions/index.js +++ b/packages/edit-site/src/components/header-edit-mode/document-actions/index.js @@ -27,7 +27,7 @@ import { displayShortcut } from '@wordpress/keycodes'; import { store as coreStore } from '@wordpress/core-data'; import { store as editorStore } from '@wordpress/editor'; import { useRef, useState, useEffect } from '@wordpress/element'; -import { getQueryArgs } from '@wordpress/url'; +import { getQueryArgs, addQueryArgs } from '@wordpress/url'; /** * Internal dependencies @@ -147,9 +147,12 @@ function TemplateDocumentActions( { className, onBack } ) { const { refererId } = getQueryArgs( window.location.href ); - if ( ! onBack && refererId ) { - onBack = () => - ( document.location = `post.php?post=${ refererId }&action=edit` ); + if ( ! onBack && ! isNaN( refererId ) ) { + const url = addQueryArgs( 'post.php', { + action: 'edit', + post: refererId, + } ); + onBack = () => ( document.location = url ); } return (