Skip to content

Commit

Permalink
Fix insertion point
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 15, 2021
1 parent 7640ad4 commit 8c6d51d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,16 @@ export default function useInsertionPoint( ref ) {
return;
}

const rootClientId = event.target.getAttribute( 'data-block' );
let rootClientId;
if ( ! event.target.classList.contains( 'is-root-container' ) ) {
const blockElement = event.target.classList.contains(
'wp-block'
)
? event.target
: event.target.closest( '.wp-block' );
rootClientId = blockElement.getAttribute( 'data-block' );
}

const orientation =
getBlockListSettings( rootClientId )?.orientation || 'vertical';
const rect = event.target.getBoundingClientRect();
Expand Down

0 comments on commit 8c6d51d

Please sign in to comment.