: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left';
} else if (moveDirection === 'down') {
if (orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right';
* Return a label for the block movement controls depending on block position.
* @param {number} selectedCount Number of blocks selected.
* @param {string} type Block type - in the case of a single block, should
* define its 'type'. I.e. 'Text', 'Heading', 'Image' etc.
* @param {number} firstIndex The index (position - 1) of the first block selected.
* @param {boolean} isFirst This is the first block.
* @param {boolean} isLast This is the last block.
* @param {number} dir Direction of movement (> 0 is considered to be going
* @param {string} orientation The orientation of the block movers, vertical or
* @return {string | undefined} Label for the block movement controls.
function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) {
const position = firstIndex + 1;
return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation);
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %s is the only block, and cannot be moved'), type);
if (dir > 0 && !isLast) {
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1);
// Moving down, and is the last item.
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved down'), type);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved left'), type);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved right'), type);
if (dir < 0 && !isFirst) {
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
(0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1);
if (dir < 0 && isFirst) {
// Moving up, and is the first item.
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved up'), type);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved left'), type);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Type of block (i.e. Text, Image etc)
(0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved right'), type);
* Return a label for the block movement controls depending on block position.
* @param {number} selectedCount Number of blocks selected.
* @param {number} firstIndex The index (position - 1) of the first block selected.
* @param {boolean} isFirst This is the first block.
* @param {boolean} isLast This is the last block.
* @param {number} dir Direction of movement (> 0 is considered to be going
* @param {string} orientation The orientation of the block movers, vertical or
* @return {string | undefined} Label for the block movement controls.
function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) {
const position = firstIndex + 1;
// All blocks are selected
return (0,external_wp_i18n_namespaceObject.__)('All blocks are selected, and cannot be moved');
if (dir > 0 && !isLast) {
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d down by one place'), selectedCount, position);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position);
// moving down, and the selected blocks are the last item
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved down as they are already at the bottom');
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position');
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost position');
if (dir < 0 && !isFirst) {
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d up by one place'), selectedCount, position);
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position);
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position);
if (dir < 0 && isFirst) {
// moving up, and the selected blocks are the first item
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved up as they are already at the top');
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position');
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost position');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js
const getArrowIcon = (direction, orientation) => {
if (direction === 'up') {
if (orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
} else if (direction === 'down') {
if (orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right;
const getMovementDirectionLabel = (moveDirection, orientation) => {
if (moveDirection === 'up') {
if (orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move right') : (0,external_wp_i18n_namespaceObject.__)('Move left');
return (0,external_wp_i18n_namespaceObject.__)('Move up');
} else if (moveDirection === 'down') {
if (orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move left') : (0,external_wp_i18n_namespaceObject.__)('Move right');
return (0,external_wp_i18n_namespaceObject.__)('Move down');
const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({
orientation: moverOrientation,
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton);
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
const blocksCount = normalizedClientIds.length;
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const firstClientId = normalizedClientIds[0];
const blockRootClientId = getBlockRootClientId(firstClientId);
const firstBlockIndex = getBlockIndex(firstClientId);
const lastBlockIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
const blockOrder = getBlockOrder(blockRootClientId);
const block = getBlock(firstClientId);
const isFirstBlock = firstBlockIndex === 0;
const isLastBlock = lastBlockIndex === blockOrder.length - 1;
orientation: blockListOrientation
} = getBlockListSettings(blockRootClientId) || {};
blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
isDisabled: disabled || (direction === 'up' ? isFirstBlock : isLastBlock),
rootClientId: blockRootClientId,
firstIndex: firstBlockIndex,
orientation: moverOrientation || blockListOrientation
}, [clientIds, direction]);
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown;
const onClick = event => {
moverFunction(clientIds, rootClientId);
const descriptionId = `block-editor-block-mover-button__description-${instanceId}`;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: dist_clsx('block-editor-block-mover-button', `is-${direction}-button`),
icon: getArrowIcon(direction, orientation),
label: getMovementDirectionLabel(direction, orientation),
"aria-describedby": descriptionId,
onClick: isDisabled ? null : onClick,
__experimentalIsFocusable: true
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
children: getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation)
const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, {
const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, {
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js
isBlockMoverUpButtonDisabled,
isBlockMoverDownButtonDisabled
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
const firstClientId = normalizedClientIds[0];
const _rootClientId = getBlockRootClientId(firstClientId);
const firstIndex = getBlockIndex(firstClientId);
const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
const blockOrder = getBlockOrder(_rootClientId);
canMove: canMoveBlocks(clientIds),
rootClientId: _rootClientId,
isFirst: firstIndex === 0,
isLast: lastIndex === blockOrder.length - 1,
orientation: getBlockListSettings(_rootClientId)?.orientation
if (!canMove || isFirst && isLast && !rootClientId) {
const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, {
className: dist_clsx('block-editor-block-mover', {
'is-horizontal': orientation === 'horizontal'
children: [!hideDragHandle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, {
children: draggableProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "block-editor-block-mover__drag-handle",
// Should not be able to tab to drag handle as this
// button can only be used with a pointer device.
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "block-editor-block-mover__move-button-container",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverUpButton, {
disabled: isBlockMoverUpButtonDisabled,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverDownButton, {
disabled: isBlockMoverDownButtonDisabled,
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md
/* harmony default export */ const block_mover = (BlockMover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js
clearTimeout: utils_clearTimeout,
setTimeout: utils_setTimeout
const DEBOUNCE_TIMEOUT = 200;
* Hook that creates debounced callbacks when the node is hovered or focused.
* @param {Object} props Component props.
* @param {Object} props.ref Element reference.
* @param {boolean} props.isFocused Whether the component has current focus.
* @param {number} props.highlightParent Whether to highlight the parent block. It defaults in highlighting the selected block.
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
function useDebouncedShowGestures({
debounceTimeout = DEBOUNCE_TIMEOUT
getSelectedBlockClientId,
} = (0,external_wp_data_namespaceObject.useSelect)(store);
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree, []);
const handleOnChange = nextIsFocused => {
if (nextIsFocused && isDistractionFree) {
const selectedBlockClientId = getSelectedBlockClientId();
const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId;
toggleBlockHighlight(clientId, nextIsFocused);