diff --git a/editor/modes/visual-editor/block-list.js b/editor/modes/visual-editor/block-list.js
index 2782ea5ab63027..3a4fd2bfb951b8 100644
--- a/editor/modes/visual-editor/block-list.js
+++ b/editor/modes/visual-editor/block-list.js
@@ -209,8 +209,8 @@ class VisualEditorBlockList extends Component {
return (
- { !! blocks.length && }
- { flatMap( blocks, ( uid, index ) => [
+ { !! blocks.length && }
+ { flatMap( blocks, ( uid ) => [
,
] ) }
{ ! blocks.length &&
diff --git a/editor/modes/visual-editor/sibling-inserter.js b/editor/modes/visual-editor/sibling-inserter.js
index f0cec18cd6705a..5ebea979d87895 100644
--- a/editor/modes/visual-editor/sibling-inserter.js
+++ b/editor/modes/visual-editor/sibling-inserter.js
@@ -15,6 +15,7 @@ import { focus } from '@wordpress/utils';
*/
import { Inserter } from '../../components';
import {
+ getBlockUids,
getBlockInsertionPoint,
isBlockInsertionPointVisible,
isBlockWithinSelection,
@@ -126,12 +127,16 @@ class VisualEditorSiblingInserter extends Component {
}
export default connect(
- ( state, ownProps ) => {
+ ( state, { uid } ) => {
+ const blockIndex = uid ? getBlockUids( state ).indexOf( uid ) : -1;
+ const insertIndex = blockIndex > -1 ? blockIndex + 1 : 0;
+
return {
- shouldDisable: isBlockWithinSelection( state, ownProps.uid ),
+ shouldDisable: isBlockWithinSelection( state, uid ),
+ insertIndex,
showInsertionPoint: (
isBlockInsertionPointVisible( state ) &&
- getBlockInsertionPoint( state ) === ownProps.insertIndex
+ getBlockInsertionPoint( state ) === insertIndex
),
};
}