Skip to content

Commit

Permalink
Changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Dec 8, 2023
1 parent 26d3e01 commit cc024a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
14 changes: 8 additions & 6 deletions packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit cc024a3

Please sign in to comment.