: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
"aria-expanded": !hasSingleBlockType ? isOpen : false,
class PrivateInserter extends external_wp_element_namespaceObject.Component {
this.onToggle = this.onToggle.bind(this);
this.renderToggle = this.renderToggle.bind(this);
this.renderContent = this.renderContent.bind(this);
// Surface toggle callback to parent component.
* Render callback to display Dropdown toggle element.
* @param {Object} options
* @param {Function} options.onToggle Callback to invoke when toggle is
* @param {boolean} options.isOpen Whether dropdown is currently open.
* @return {Element} Dropdown toggle element.
renderToggle = defaultRenderToggle,
disabled: disabled || !hasItems,
* Render callback to display Dropdown content element.
* @param {Object} options
* @param {Function} options.onClose Callback to invoke when dropdown is
* @return {Element} Dropdown content element.
// This prop is experimental to give some time for the quick inserter to mature
// Feel free to make them stable after a few releases.
__experimentalIsQuick: isQuick,
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(QuickInserter, {
const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks;
if (onSelectOrClose && typeof onSelectOrClose === 'function') {
onSelectOrClose(firstBlock);
rootClientId: rootClientId,
prioritizePatterns: prioritizePatterns,
selectBlockOnInsert: selectBlockOnInsert
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu, {
rootClientId: rootClientId,
showInserterHelpPanel: showInserterHelpPanel
__experimentalIsQuick: isQuick,
if (hasSingleBlockType || directInsertBlock) {
return this.renderToggle({
onToggle: insertOnlyAllowedBlock
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
className: "block-editor-inserter",
contentClassName: dist_clsx('block-editor-inserter__popover', {
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'),
renderToggle: this.renderToggle,
renderContent: this.renderContent,
const ComposedPrivateInserter = (0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
shouldDirectInsert = true
} = select(external_wp_blocks_namespaceObject.store);
rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
const allowedBlocks = getAllowedBlocks(rootClientId);
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
const settings = getSettings();
const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, 'inserter')?.length === 0;
let allowedBlockType = false;
if (hasSingleBlockType) {
allowedBlockType = allowedBlocks[0];
hasItems: hasInserterItems(rootClientId),
blockTitle: allowedBlockType ? allowedBlockType.title : '',
prioritizePatterns: settings.__experimentalPreferPatternsOnRoot && !rootClientId
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
insertOnlyAllowedBlock() {
if (!hasSingleBlockType && !directInsertBlock) {
function getAdjacentBlockAttributes(attributesToCopy) {
if (!attributesToCopy || !clientId && !rootClientId) {
let adjacentAttributes = {};
// If there is no clientId, then attempt to get attributes
// from the last block within innerBlocks of the root block.
const parentBlock = getBlock(rootClientId);
if (parentBlock?.innerBlocks?.length) {
const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1];
if (directInsertBlock && directInsertBlock?.name === lastInnerBlock.name) {
adjacentAttributes = lastInnerBlock.attributes;
// Otherwise, attempt to get attributes from the
// previous block relative to the current clientId.
const currentBlock = getBlock(clientId);
const previousBlock = getBlock(getPreviousBlockClientId(clientId));
if (currentBlock?.name === previousBlock?.name) {
adjacentAttributes = previousBlock?.attributes || {};
// Copy over only those attributes flagged to be copied.
attributesToCopy.forEach(attribute => {
if (adjacentAttributes.hasOwnProperty(attribute)) {
result[attribute] = adjacentAttributes[attribute];
function getInsertionIndex() {
// If the clientId is defined, we insert at the position of the block.
return getBlockIndex(clientId);
// If there a selected block, we insert after the selected block.
const end = getBlockSelectionEnd();
if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
return getBlockIndex(end) + 1;
// Otherwise, we insert at the end of the current rootClientId.
return getBlockOrder(rootClientId).length;
// Attempt to augment the directInsertBlock with attributes from an adjacent block.
// This ensures styling from nearby blocks is preserved in the newly inserted block.
// See: https://github.com/WordPress/gutenberg/issues/37904
const newAttributes = getAdjacentBlockAttributes(directInsertBlock.attributesToCopy);
blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
...(directInsertBlock.attributes || {}),
blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
insertBlock(blockToInsert, getInsertionIndex(), rootClientId, selectBlockOnInsert);
clientId: blockToInsert?.clientId
const message = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of the block that has been added
(0,external_wp_i18n_namespaceObject.__)('%s block added'), allowedBlockType.title);
(0,external_wp_a11y_namespaceObject.speak)(message);
// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
// a way to detect the global Inserter.
(0,external_wp_compose_namespaceObject.ifCondition)(({
}) => hasItems || !isAppender && !rootClientId && !clientId)])(PrivateInserter);
const Inserter = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComposedPrivateInserter, {
/* harmony default export */ const inserter = (Inserter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js
* Zero width non-breaking space, used as padding for the paragraph when it is
function DefaultBlockAppender({
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const isEmpty = !getBlockCount(rootClientId);
isLocked: !!getTemplateLock(rootClientId),
placeholder: bodyPlaceholder
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block');
insertDefaultBlock(undefined, rootClientId);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
"data-root-client-id": rootClientId || '',
className: dist_clsx('block-editor-default-block-appender', {
'has-visible-prompt': showPrompt
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
// We want this element to be styled as a paragraph by themes.
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Add default block')
// A wrapping container for this one already has the wp-block className.
className: "block-editor-default-block-appender__content",
if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) {
onClick: () => onAppend(),
children: showPrompt ? value : ZWNBSP
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, {
rootClientId: rootClientId,
position: "bottom right",
__experimentalIsQuick: true
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js
function ButtonBlockAppender({
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, {
position: "bottom center",
rootClientId: rootClientId,
__experimentalIsQuick: true,
if (hasSingleBlockType) {
label = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of the block when there is only one
(0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle);
label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
const isToggleButton = !hasSingleBlockType;
let inserterButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
className: dist_clsx(className, 'block-editor-button-block-appender'),
"aria-haspopup": isToggleButton ? 'true' : undefined,
"aria-expanded": isToggleButton ? isOpen : undefined
// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.
// eslint-disable-next-line no-restricted-syntax
children: [!hasSingleBlockType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
if (isToggleButton || hasSingleBlockType) {
inserterButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
* Use `ButtonBlockAppender` instead.
const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, {
alternative: 'wp.blockEditor.ButtonBlockAppender',
return ButtonBlockAppender(props, ref);
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md
/* harmony default export */ const button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonBlockAppender));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js