Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use wp-block classname
  • Loading branch information
talldan committed Jun 25, 2021
commit e45fbcbb6633fc9c75feb2a72ee7048fea28019a
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ export function getNearestBlockIndex( elements, position, orientation ) {
let candidateDistance;

elements.forEach( ( element, index ) => {
// Ensure the element is a block. It should have the `wp-block` class.
if ( ! element.classList.contains( 'wp-block' ) ) {
return;
}

const rect = element.getBoundingClientRect();
const [ distance, edge ] = getDistanceToNearestEdge(
position,
Expand Down Expand Up @@ -106,9 +101,8 @@ export default function useBlockDropZone( {
const throttled = useThrottle(
useCallback( ( event, currentTarget ) => {
const blockElements = Array.from( currentTarget.children ).filter(
( element ) => {
return element.nodeName !== 'STYLE';
}
// Ensure the element is a block. It should have the `wp-block` class.
( element ) => element.classList.contains( 'wp-block' )
);
const targetIndex = getNearestBlockIndex(
blockElements,
Expand Down