: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
setHasControlledInnerBlocks,
__unstableMarkNextChangeAsNotPersistent
} = registry.dispatch(store);
} = registry.select(store);
const isControlled = (0,external_wp_data_namespaceObject.useSelect)(select => {
return !clientId || select(store).areInnerBlocksControlled(clientId);
const pendingChanges = (0,external_wp_element_namespaceObject.useRef)({
const subscribed = (0,external_wp_element_namespaceObject.useRef)(false);
const setControlledBlocks = () => {
// We don't need to persist this change because we only replace
// controlled inner blocks when the change was caused by an entity,
// and so it would already be persisted.
__unstableMarkNextChangeAsNotPersistent();
// It is important to batch here because otherwise,
// as soon as `setHasControlledInnerBlocks` is called
// the effect to restore might be triggered
// before the actual blocks get set properly in state.
setHasControlledInnerBlocks(clientId, true);
const storeBlocks = controlledBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
if (subscribed.current) {
pendingChanges.current.incoming = storeBlocks;
__unstableMarkNextChangeAsNotPersistent();
replaceInnerBlocks(clientId, storeBlocks);
if (subscribed.current) {
pendingChanges.current.incoming = controlledBlocks;
resetBlocks(controlledBlocks);
// Clean up the changes made by setControlledBlocks() when the component
// containing useBlockSync() unmounts.
const unsetControlledBlocks = () => {
__unstableMarkNextChangeAsNotPersistent();
setHasControlledInnerBlocks(clientId, false);
__unstableMarkNextChangeAsNotPersistent();
replaceInnerBlocks(clientId, []);
// Add a subscription to the block-editor registry to detect when changes
// have been made. This lets us inform the data source of changes. This
// is an effect so that the subscriber can run synchronously without
// waiting for React renders for changes.
const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput);
const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange);
(0,external_wp_element_namespaceObject.useEffect)(() => {
onInputRef.current = onInput;
onChangeRef.current = onChange;
// Determine if blocks need to be reset when they change.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (pendingChanges.current.outgoing.includes(controlledBlocks)) {
// Skip block reset if the value matches expected outbound sync
// triggered by this component by a preceding change detection.
// Only skip if the value matches expectation, since a reset should
// still occur if the value is modified (not equal by reference),
// to allow that the consumer may apply modifications to reflect
if (pendingChanges.current.outgoing[pendingChanges.current.outgoing.length - 1] === controlledBlocks) {
pendingChanges.current.outgoing = [];
} else if (getBlocks(clientId) !== controlledBlocks) {
// Reset changing value in all other cases than the sync described
// above. Since this can be reached in an update following an out-
// bound sync, unset the outbound value to avoid considering it in
pendingChanges.current.outgoing = [];
if (controlledSelection) {
resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition);
}, [controlledBlocks, clientId]);
const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// On mount, controlled blocks are already set in the effect above.
if (!isMounted.current) {
isMounted.current = true;
// When the block becomes uncontrolled, it means its inner state has been reset
// we need to take the blocks again from the external value property.
pendingChanges.current.outgoing = [];
(0,external_wp_element_namespaceObject.useEffect)(() => {
getSelectedBlocksInitialCaretPosition,
isLastBlockChangePersistent,
__unstableIsLastBlockChangeIgnored,
} = registry.select(store);
let blocks = getBlocks(clientId);
let isPersistent = isLastBlockChangePersistent();
let previousAreBlocksDifferent = false;
subscribed.current = true;
const unsubscribe = registry.subscribe(() => {
// Sometimes, when changing block lists, lingering subscriptions
// might trigger before they are cleaned up. If the block for which
// the subscription runs is no longer in the store, this would clear
// its parent entity's block list. To avoid this, we bail out if
// the subscription is triggering for a block (`clientId !== null`)
// and its block name can't be found because it's not on the list.
// (`getBlockName( clientId ) === null`).
if (clientId !== null && getBlockName(clientId) === null) {
// When RESET_BLOCKS on parent blocks get called, the controlled blocks
// can reset to uncontrolled, in these situations, it means we need to populate
// the blocks again from the external blocks (the value property here)
// and we should stop triggering onChange
const isStillControlled = !clientId || areInnerBlocksControlled(clientId);
if (!isStillControlled) {
const newIsPersistent = isLastBlockChangePersistent();
const newBlocks = getBlocks(clientId);
const areBlocksDifferent = newBlocks !== blocks;
if (areBlocksDifferent && (pendingChanges.current.incoming || __unstableIsLastBlockChangeIgnored())) {
pendingChanges.current.incoming = null;
isPersistent = newIsPersistent;
// Since we often dispatch an action to mark the previous action as
// persistent, we need to make sure that the blocks changed on the
// previous action before committing the change.
const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent;
if (areBlocksDifferent || didPersistenceChange) {
isPersistent = newIsPersistent;
// We know that onChange/onInput will update controlledBlocks.
// We need to be aware that it was caused by an outgoing change
// so that we do not treat it as an incoming change later on,
// which would cause a block reset.
pendingChanges.current.outgoing.push(blocks);
// Inform the controlling entity that changes have been made to
// the block-editor store they should be aware about.
const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
const undoIgnore = undoIgnoreBlocks.has(blocks);
undoIgnoreBlocks.delete(blocks);
selectionStart: getSelectionStart(),
selectionEnd: getSelectionEnd(),
initialPosition: getSelectedBlocksInitialCaretPosition()
previousAreBlocksDifferent = areBlocksDifferent;
subscribed.current = false;
}, [registry, clientId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js
function KeyboardShortcuts() {
function KeyboardShortcutsRegister() {
// Registering the shortcuts.
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
name: 'core/block-editor/duplicate',
description: (0,external_wp_i18n_namespaceObject.__)('Duplicate the selected block(s).'),
modifier: 'primaryShift',
name: 'core/block-editor/remove',
description: (0,external_wp_i18n_namespaceObject.__)('Remove the selected block(s).'),
name: 'core/block-editor/insert-before',
description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block before the selected block(s).'),
name: 'core/block-editor/insert-after',
description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block after the selected block(s).'),
name: 'core/block-editor/delete-multi-selection',
description: (0,external_wp_i18n_namespaceObject.__)('Delete selection.'),
name: 'core/block-editor/select-all',
description: (0,external_wp_i18n_namespaceObject.__)('Select all text when typing. Press again to select all blocks.'),
name: 'core/block-editor/unselect',
description: (0,external_wp_i18n_namespaceObject.__)('Clear selection.'),
name: 'core/block-editor/multi-text-selection',
description: (0,external_wp_i18n_namespaceObject.__)('Select text across multiple blocks.'),
name: 'core/block-editor/focus-toolbar',
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the nearest toolbar.'),
name: 'core/block-editor/move-up',
description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) up.'),
name: 'core/block-editor/move-down',
description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) down.'),
name: 'core/block-editor/collapse-list-view',
description: (0,external_wp_i18n_namespaceObject.__)('Collapse all other items.'),
name: 'core/block-editor/group',
description: (0,external_wp_i18n_namespaceObject.__)('Create a group block from the selected multiple blocks.'),
KeyboardShortcuts.Register = KeyboardShortcutsRegister;
/* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js
/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
const ExperimentalBlockEditorProvider = with_registry_provider(props => {
stripExperimentalSettings = false
__experimentalUpdateSettings
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
(0,external_wp_element_namespaceObject.useEffect)(() => {
__experimentalUpdateSettings({
__internalIsInitialized: true
stripExperimentalSettings,
}, [settings, stripExperimentalSettings, __experimentalUpdateSettings]);
// Syncs the entity provider with changes in the block-editor store.
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, {
children: [!settings?.__unstableIsPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts.Register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, {
const BlockEditorProvider = props => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, {
stripExperimentalSettings: true,
/* harmony default export */ const provider = (BlockEditorProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js
* Pass the returned ref callback to an element that should clear block
* selection. Selection will only be cleared if the element is clicked directly,
* not if a child element is clicked.
* @return {import('react').RefCallback} Ref callback.
function useBlockSelectionClearer() {
} = (0,external_wp_data_namespaceObject.useSelect)(store);
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
clearBlockSelection: isEnabled
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
function onMouseDown(event) {
if (!hasSelectedBlock() && !hasMultiSelection()) {
// Only handle clicks on the element, not the children.
if (event.target !== node) {
node.addEventListener('mousedown', onMouseDown);
node.removeEventListener('mousedown', onMouseDown);
}, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled]);
function BlockSelectionClearer(props) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
ref: useBlockSelectionClearer(),
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js
function selector(select) {
getMultiSelectedBlockClientIds,
getSelectedBlockClientId,
getSelectedBlocksInitialCaretPosition,
__unstableIsFullySelected
isMultiSelecting: isMultiSelecting(),
multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
hasMultiSelection: hasMultiSelection(),
selectedBlockClientId: getSelectedBlockClientId(),
initialPosition: getSelectedBlocksInitialCaretPosition(),
isFullSelection: __unstableIsFullySelected()
function useMultiSelection() {
multiSelectedBlockClientIds,
} = (0,external_wp_data_namespaceObject.useSelect)(selector, []);