diff --git a/packages/block-library/src/block/edit.js b/packages/block-library/src/block/edit.js index 1c67649cfa030..0af183e0e2b8c 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 e9960657053a1..eca5abb729be6 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 (