@wordpress/block-editor 15.1.1-next.0f6f9d12c.0 → 15.2.1-next.e256d081a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 15.2.0 (2025-08-20)
6
+
5
7
  ## 15.1.0 (2025-08-07)
6
8
 
7
9
  ## 15.0.0 (2025-07-23)
@@ -115,6 +115,9 @@ function getDropTargetPosition(blocksData, position, orientation = 'vertical', o
115
115
  blockOrientation
116
116
  }) => {
117
117
  const rect = getBoundingClientRect();
118
+ if (!rect) {
119
+ return;
120
+ }
118
121
  let [distance, edge] = (0, _math.getDistanceToNearestEdge)(position, rect, allowedEdges);
119
122
  // If the the point is close to a side, prioritize that side.
120
123
  const [sideDistance, sideEdge] = (0, _math.getDistanceToNearestEdge)(position, rect, ['left', 'right']);
@@ -310,7 +313,10 @@ function useBlockDropZone({
310
313
  const clientId = block.clientId;
311
314
  return {
312
315
  isUnmodifiedDefaultBlock: (0, _blocks.isUnmodifiedDefaultBlock)(block),
313
- getBoundingClientRect: () => ownerDocument.getElementById(`block-${clientId}`).getBoundingClientRect(),
316
+ getBoundingClientRect: () => {
317
+ const blockElement = ownerDocument.getElementById(`block-${clientId}`);
318
+ return blockElement ? blockElement.getBoundingClientRect() : null;
319
+ },
314
320
  blockIndex: getBlockIndex(clientId),
315
321
  blockOrientation: getBlockListSettings(clientId)?.orientation
316
322
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_compose","_i18n","_blocks","_useOnBlockDrop","_interopRequireDefault","_math","_store","_lockUnlock","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","height","isRightToLeft","isRTL","width","forEach","isUnmodifiedDefaultBlock","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","isInsertionPoint","targetToCheck","ownerDocument","defaultView","HTMLElement","closest","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","useRegistry","dropTarget","setDropTarget","useState","index","operation","getBlockVariations","getGroupingBlockName","useSelect","blocksStore","canInsertBlockType","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","isDragging","isGroupable","isZoomOut","getSectionRootClientId","getBlockParents","unlock","blockEditorStore","showInsertionPoint","hideInsertionPoint","startDragging","stopDragging","useDispatch","onBlockDrop","useOnBlockDrop","throttled","useThrottle","useCallback","event","draggedBlockClientIds","targetParents","isTargetWithinDraggedBlocks","some","clientId","isBlockDroppingAllowed","sectionRootClientId","blocks","length","batch","getIsUnmodifiedDefaultBlock","getElementById","dropTargetPosition","x","clientX","y","clientY","undefined","targetIndex","isTargetIndexEmptyDefaultBlock","targetBlock","areAllImages","canInsertGalleryBlock","areGroupableBlocks","groupBlockVariations","canInsertRow","find","insertionPointClientId","useDropZone","onDrop","onDragOver","currentTarget","onDragLeave","relatedTarget","target","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * Checks if the given element is an insertion point.\n *\n * @param {EventTarget|null} targetToCheck - The element to check.\n * @param {Document} ownerDocument - The owner document of the element.\n * @return {boolean} True if the element is a insertion point, false otherwise.\n */\nfunction isInsertionPoint( targetToCheck, ownerDocument ) {\n\tconst { defaultView } = ownerDocument;\n\n\treturn !! (\n\t\tdefaultView &&\n\t\ttargetToCheck instanceof defaultView.HTMLElement &&\n\t\ttargetToCheck.closest( '[data-is-insertion-point]' )\n\t);\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType, getBlockVariations, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t\tisDragging,\n\t\tisGroupable,\n\t\tisZoomOut,\n\t\tgetSectionRootClientId,\n\t\tgetBlockParents,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tstartDragging,\n\t\tstopDragging,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tif ( ! isDragging() ) {\n\t\t\t\t\t// When dragging from the desktop, no drag start event is fired.\n\t\t\t\t\t// So, ensure that the drag state is set when the user drags over a drop zone.\n\t\t\t\t\tstartDragging();\n\t\t\t\t}\n\n\t\t\t\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\t\t\t\tconst targetParents = [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t...getBlockParents( targetRootClientId, true ),\n\t\t\t\t];\n\n\t\t\t\t// Check if the target is within any of the dragged blocks.\n\t\t\t\tconst isTargetWithinDraggedBlocks = draggedBlockClientIds.some(\n\t\t\t\t\t( clientId ) => targetParents.includes( clientId )\n\t\t\t\t);\n\n\t\t\t\tif ( isTargetWithinDraggedBlocks ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tdraggedBlockClientIds\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t// In Zoom Out mode, if the target is not the section root provided by settings then\n\t\t\t\t// do not allow dropping as the drop target is not within the root (that which is\n\t\t\t\t// treated as \"the content\" by Zoom Out Mode).\n\t\t\t\tif (\n\t\t\t\t\tisZoomOut() &&\n\t\t\t\t\tsectionRootClientId !== targetRootClientId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t\t\townerDocument\n\t\t\t\t\t\t\t\t.getElementById( `block-${ clientId }` )\n\t\t\t\t\t\t\t\t.getBoundingClientRect(),\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst dropTargetPosition = getDropTargetPosition(\n\t\t\t\t\tblocksData,\n\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t{\n\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tdropTargetPosition;\n\n\t\t\t\tconst isTargetIndexEmptyDefaultBlock =\n\t\t\t\t\tblocksData[ targetIndex ]?.isUnmodifiedDefaultBlock;\n\n\t\t\t\tif (\n\t\t\t\t\tisZoomOut() &&\n\t\t\t\t\t! isTargetIndexEmptyDefaultBlock &&\n\t\t\t\t\toperation !== 'insert'\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetBlock = blocks[ targetIndex ];\n\t\t\t\t\tconst areAllImages = [\n\t\t\t\t\t\ttargetBlock.name,\n\t\t\t\t\t\t...draggedBlockNames,\n\t\t\t\t\t].every( ( name ) => name === 'core/image' );\n\t\t\t\t\tconst canInsertGalleryBlock = canInsertBlockType(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t);\n\t\t\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t\t\ttargetBlock.clientId,\n\t\t\t\t\t\tgetDraggedBlockClientIds(),\n\t\t\t\t\t] );\n\t\t\t\t\tconst groupBlockVariations = getBlockVariations(\n\t\t\t\t\t\tgetGroupingBlockName(),\n\t\t\t\t\t\t'block'\n\t\t\t\t\t);\n\t\t\t\t\tconst canInsertRow =\n\t\t\t\t\t\tgroupBlockVariations &&\n\t\t\t\t\t\tgroupBlockVariations.find(\n\t\t\t\t\t\t\t( { name } ) => name === 'group-row'\n\t\t\t\t\t\t);\n\n\t\t\t\t\t// If the dragged blocks and the target block are all images,\n\t\t\t\t\t// check if it is creatable either a Row variation or a Gallery block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tareAllImages &&\n\t\t\t\t\t\t! canInsertGalleryBlock &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If the dragged blocks and the target block are not all images,\n\t\t\t\t\t// check if it is creatable a Row variation.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! areAllImages &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tisDragging,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t\tisZoomOut,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tstartDragging,\n\t\t\t\tshowInsertionPoint,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tisGroupable,\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetGroupingBlockName,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave( event ) {\n\t\t\tconst { ownerDocument } = event.currentTarget;\n\n\t\t\t// If the drag event is leaving the drop zone and entering an insertion point,\n\t\t\t// do not hide the insertion point as it is conceptually within the dropzone.\n\t\t\tif (\n\t\t\t\tisInsertionPoint( event.relatedTarget, ownerDocument ) ||\n\t\t\t\tisInsertionPoint( event.target, ownerDocument )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tstopDragging();\n\t\t\thideInsertionPoint();\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAQA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAzBA;AACA;AACA;;AAaA;AACA;AACA;;AAUA,MAAMU,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,4BAA4B,GAAG,GAAG;AACxC,MAAMC,2BAA2B,GAAG,GAAG;;AAEvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CACpCC,UAAU,EACVC,QAAQ,EACRC,WAAW,GAAG,UAAU,EACxBC,OAAO,GAAG,CAAC,CAAC,EACX;EACD,MAAMC,YAAY,GACjBF,WAAW,KAAK,YAAY,GACzB,CAAE,MAAM,EAAE,OAAO,CAAE,GACnB,CAAE,KAAK,EAAE,QAAQ,CAAE;EAEvB,IAAIG,YAAY,GAAG,CAAC;EACpB,IAAIC,cAAc,GAAG,QAAQ;EAC7B,IAAIC,WAAW,GAAGC,QAAQ;EAC1B,IAAIC,gBAAgB,GAAG,IAAI;EAC3B,IAAIC,WAAW,GAAG,OAAO;EAEzB,MAAM;IACLC,eAAe;IACfC,sBAAsB;IACtBC,cAAc,GAAG;EAClB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AAM,CAAC,CAAC;MAClB7C,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACD8C,SAASA,CAAA,EAAG;MACXxC,SAAS,CAACuC,MAAM,CAAC,CAAC;MAClB3C,YAAY,CAAC,CAAC;MACdF,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_compose","_i18n","_blocks","_useOnBlockDrop","_interopRequireDefault","_math","_store","_lockUnlock","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","height","isRightToLeft","isRTL","width","forEach","isUnmodifiedDefaultBlock","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","isInsertionPoint","targetToCheck","ownerDocument","defaultView","HTMLElement","closest","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","useRegistry","dropTarget","setDropTarget","useState","index","operation","getBlockVariations","getGroupingBlockName","useSelect","blocksStore","canInsertBlockType","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","isDragging","isGroupable","isZoomOut","getSectionRootClientId","getBlockParents","unlock","blockEditorStore","showInsertionPoint","hideInsertionPoint","startDragging","stopDragging","useDispatch","onBlockDrop","useOnBlockDrop","throttled","useThrottle","useCallback","event","draggedBlockClientIds","targetParents","isTargetWithinDraggedBlocks","some","clientId","isBlockDroppingAllowed","sectionRootClientId","blocks","length","batch","getIsUnmodifiedDefaultBlock","blockElement","getElementById","dropTargetPosition","x","clientX","y","clientY","undefined","targetIndex","isTargetIndexEmptyDefaultBlock","targetBlock","areAllImages","canInsertGalleryBlock","areGroupableBlocks","groupBlockVariations","canInsertRow","find","insertionPointClientId","useDropZone","onDrop","onDragOver","currentTarget","onDragLeave","relatedTarget","target","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tif ( ! rect ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * Checks if the given element is an insertion point.\n *\n * @param {EventTarget|null} targetToCheck - The element to check.\n * @param {Document} ownerDocument - The owner document of the element.\n * @return {boolean} True if the element is a insertion point, false otherwise.\n */\nfunction isInsertionPoint( targetToCheck, ownerDocument ) {\n\tconst { defaultView } = ownerDocument;\n\n\treturn !! (\n\t\tdefaultView &&\n\t\ttargetToCheck instanceof defaultView.HTMLElement &&\n\t\ttargetToCheck.closest( '[data-is-insertion-point]' )\n\t);\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType, getBlockVariations, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t\tisDragging,\n\t\tisGroupable,\n\t\tisZoomOut,\n\t\tgetSectionRootClientId,\n\t\tgetBlockParents,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tstartDragging,\n\t\tstopDragging,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tif ( ! isDragging() ) {\n\t\t\t\t\t// When dragging from the desktop, no drag start event is fired.\n\t\t\t\t\t// So, ensure that the drag state is set when the user drags over a drop zone.\n\t\t\t\t\tstartDragging();\n\t\t\t\t}\n\n\t\t\t\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\t\t\t\tconst targetParents = [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t...getBlockParents( targetRootClientId, true ),\n\t\t\t\t];\n\n\t\t\t\t// Check if the target is within any of the dragged blocks.\n\t\t\t\tconst isTargetWithinDraggedBlocks = draggedBlockClientIds.some(\n\t\t\t\t\t( clientId ) => targetParents.includes( clientId )\n\t\t\t\t);\n\n\t\t\t\tif ( isTargetWithinDraggedBlocks ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tdraggedBlockClientIds\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t// In Zoom Out mode, if the target is not the section root provided by settings then\n\t\t\t\t// do not allow dropping as the drop target is not within the root (that which is\n\t\t\t\t// treated as \"the content\" by Zoom Out Mode).\n\t\t\t\tif (\n\t\t\t\t\tisZoomOut() &&\n\t\t\t\t\tsectionRootClientId !== targetRootClientId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () => {\n\t\t\t\t\t\t\tconst blockElement = ownerDocument.getElementById(\n\t\t\t\t\t\t\t\t`block-${ clientId }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn blockElement\n\t\t\t\t\t\t\t\t? blockElement.getBoundingClientRect()\n\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst dropTargetPosition = getDropTargetPosition(\n\t\t\t\t\tblocksData,\n\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t{\n\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tdropTargetPosition;\n\n\t\t\t\tconst isTargetIndexEmptyDefaultBlock =\n\t\t\t\t\tblocksData[ targetIndex ]?.isUnmodifiedDefaultBlock;\n\n\t\t\t\tif (\n\t\t\t\t\tisZoomOut() &&\n\t\t\t\t\t! isTargetIndexEmptyDefaultBlock &&\n\t\t\t\t\toperation !== 'insert'\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetBlock = blocks[ targetIndex ];\n\t\t\t\t\tconst areAllImages = [\n\t\t\t\t\t\ttargetBlock.name,\n\t\t\t\t\t\t...draggedBlockNames,\n\t\t\t\t\t].every( ( name ) => name === 'core/image' );\n\t\t\t\t\tconst canInsertGalleryBlock = canInsertBlockType(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t);\n\t\t\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t\t\ttargetBlock.clientId,\n\t\t\t\t\t\tgetDraggedBlockClientIds(),\n\t\t\t\t\t] );\n\t\t\t\t\tconst groupBlockVariations = getBlockVariations(\n\t\t\t\t\t\tgetGroupingBlockName(),\n\t\t\t\t\t\t'block'\n\t\t\t\t\t);\n\t\t\t\t\tconst canInsertRow =\n\t\t\t\t\t\tgroupBlockVariations &&\n\t\t\t\t\t\tgroupBlockVariations.find(\n\t\t\t\t\t\t\t( { name } ) => name === 'group-row'\n\t\t\t\t\t\t);\n\n\t\t\t\t\t// If the dragged blocks and the target block are all images,\n\t\t\t\t\t// check if it is creatable either a Row variation or a Gallery block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tareAllImages &&\n\t\t\t\t\t\t! canInsertGalleryBlock &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If the dragged blocks and the target block are not all images,\n\t\t\t\t\t// check if it is creatable a Row variation.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! areAllImages &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tisDragging,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t\tisZoomOut,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tstartDragging,\n\t\t\t\tshowInsertionPoint,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tisGroupable,\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetGroupingBlockName,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave( event ) {\n\t\t\tconst { ownerDocument } = event.currentTarget;\n\n\t\t\t// If the drag event is leaving the drop zone and entering an insertion point,\n\t\t\t// do not hide the insertion point as it is conceptually within the dropzone.\n\t\t\tif (\n\t\t\t\tisInsertionPoint( event.relatedTarget, ownerDocument ) ||\n\t\t\t\tisInsertionPoint( event.target, ownerDocument )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tstopDragging();\n\t\t\thideInsertionPoint();\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAQA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAzBA;AACA;AACA;;AAaA;AACA;AACA;;AAUA,MAAMU,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,4BAA4B,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vBD,wBAAwB,EACxB1C,YAAY,EACZgD,sBAAsB,EACtBD,SAAS,EACTP,SAAS,EACTD,oBAAoB,EACpBjE,eAAe,EACfmD,mBAAmB,EACnBgB,aAAa,EACbd,QAAQ,EACR2B,aAAa,EACbF,kBAAkB,EAClBd,kBAAkB,EAClBQ,WAAW,EACXZ,kBAAkB,EAClBC,oBAAoB,CAEtB,CAAC,EACD,GACD,CAAC;EAED,OAAO,IAAAyD,kCAAW,EAAE;IACnBtH,eAAe;IACfoD,UAAU;IACVmE,MAAM,EAAEpC,WAAW;IACnBqC,UAAUA,CAAEhC,KAAK,EAAG;MACnB;MACA;MACA;MACAH,SAAS,CAAEG,KAAK,EAAEA,KAAK,CAACiC,aAAa,CAAC9E,aAAc,CAAC;IACtD,CAAC;IACD+E,WAAWA,CAAElC,KAAK,EAAG;MACpB,MAAM;QAAE7C;MAAc,CAAC,GAAG6C,KAAK,CAACiC,aAAa;;MAE7C;MACA;MACA,IACChF,gBAAgB,CAAE+C,KAAK,CAACmC,aAAa,EAAEhF,aAAc,CAAC,IACtDF,gBAAgB,CAAE+C,KAAK,CAACoC,MAAM,EAAEjF,aAAc,CAAC,EAC9C;QACD;MACD;MAEA0C,SAAS,CAACwC,MAAM,CAAC,CAAC;MAClB9C,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACD+C,SAASA,CAAA,EAAG;MACXzC,SAAS,CAACwC,MAAM,CAAC,CAAC;MAClB5C,YAAY,CAAC,CAAC;MACdF,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -190,18 +190,25 @@ function receiveBlocks(blocks) {
190
190
  /**
191
191
  * Action that updates attributes of multiple blocks with the specified client IDs.
192
192
  *
193
- * @param {string|string[]} clientIds Block client IDs.
194
- * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
195
- * uniqueByBlock is true.
196
- * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes
193
+ * @param {string|string[]} clientIds Block client IDs.
194
+ * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if `options.uniqueByBlock` is true.
195
+ * @param {Object} options Updating options.
196
+ * @param {boolean} [options.uniqueByBlock=false] Whether each block in clientIds array has a unique set of attributes.
197
197
  * @return {Object} Action object.
198
198
  */
199
- function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
199
+ function updateBlockAttributes(clientIds, attributes, options = {
200
+ uniqueByBlock: false
201
+ }) {
202
+ if (typeof options === 'boolean') {
203
+ options = {
204
+ uniqueByBlock: options
205
+ };
206
+ }
200
207
  return {
201
208
  type: 'UPDATE_BLOCK_ATTRIBUTES',
202
209
  clientIds: castArray(clientIds),
203
210
  attributes,
204
- uniqueByBlock
211
+ options
205
212
  };
206
213
  }
207
214