diff --git a/editor/components/block-drop-zone/index.js b/editor/components/block-drop-zone/index.js
index 62197d9357d254..eeec9de675ecbc 100644
--- a/editor/components/block-drop-zone/index.js
+++ b/editor/components/block-drop-zone/index.js
@@ -105,6 +105,16 @@ class BlockDropZone extends Component {
}
export default compose(
+ withSelect( ( select ) => {
+ const { canInsertBlockType, getBlockName, getEditorSettings } = select( 'core/editor' );
+ const { templateLock } = getEditorSettings();
+
+ return {
+ isLocked: !! templateLock,
+ canInsertBlockType,
+ getBlockName,
+ };
+ } ),
withDispatch( ( dispatch, ownProps ) => {
const {
insertBlocks,
@@ -132,16 +142,15 @@ export default compose(
updateBlockAttributes( ...args );
},
moveBlockToPosition( uid, fromRootUID, index ) {
- const { rootUID, layout } = ownProps;
- moveBlockToPosition( uid, fromRootUID, rootUID, layout, index );
+ const { canInsertBlockType, getBlockName, rootUID, layout } = ownProps;
+ const blockName = getBlockName( uid );
+ // currently the only constraint to move inside the same parent is locking
+ // locking was already handled
+ // it is not possible to use drag & drop if locking is active
+ if ( rootUID === fromRootUID || canInsertBlockType( blockName, rootUID ) ) {
+ moveBlockToPosition( uid, fromRootUID, rootUID, layout, index );
+ }
},
};
- } ),
- withSelect( ( select ) => {
- const { templateLock } = select( 'core/editor' ).getEditorSettings();
-
- return {
- isLocked: !! templateLock,
- };
} )
)( BlockDropZone );
diff --git a/editor/components/default-block-appender/test/__snapshots__/index.js.snap b/editor/components/default-block-appender/test/__snapshots__/index.js.snap
index 9fee0c9ce14b73..133b199df02e46 100644
--- a/editor/components/default-block-appender/test/__snapshots__/index.js.snap
+++ b/editor/components/default-block-appender/test/__snapshots__/index.js.snap
@@ -5,7 +5,7 @@ exports[`DefaultBlockAppender should append a default block when input focused 1
className="editor-default-block-appender"
data-root-uid=""
>
-
+
-
+
-
+