Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "insert before/after" not showing for blocks in site editor (Word…
Browse files Browse the repository at this point in the history
…Press#62530)

Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>
Co-authored-by: noisysocks <noisysocks@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
* Fix insert before & after not showing for blocks in templates

* Use block editing mode
kevin940726 authored and patil-vipul committed Jun 17, 2024
1 parent c7d3c02 commit 3e1d320
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions packages/block-editor/src/components/block-actions/index.js
Original file line number Diff line number Diff line change
@@ -31,12 +31,10 @@ export default function BlockActions( {
getDirectInsertBlock,
canMoveBlocks,
canRemoveBlocks,
getBlockEditingMode,
} = select( blockEditorStore );

const blocks = getBlocksByClientId( clientIds );
const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
const rootBlockEditingMode = getBlockEditingMode( rootClientId );
const canInsertDefaultBlock = canInsertBlockType(
getDefaultBlockName(),
rootClientId
@@ -48,9 +46,7 @@ export default function BlockActions( {
return {
canMove: canMoveBlocks( clientIds, rootClientId ),
canRemove: canRemoveBlocks( clientIds, rootClientId ),
canInsertBlock:
( canInsertDefaultBlock || !! directInsertBlock ) &&
rootBlockEditingMode === 'default',
canInsertBlock: canInsertDefaultBlock || !! directInsertBlock,
canCopyStyles: blocks.every( ( block ) => {
return (
!! block &&
Original file line number Diff line number Diff line change
@@ -256,7 +256,7 @@ export function BlockSettingsDropdown( {
{ __( 'Duplicate' ) }
</MenuItem>
) }
{ canInsertBlock && (
{ canInsertBlock && ! isContentOnly && (
<>
<MenuItem
onClick={ pipe(

0 comments on commit 3e1d320

Please sign in to comment.