: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (start < searchText.length) {
const charactersBefore = text.slice(start - searchText.length, start);
if (charactersBefore.toLowerCase() !== searchText) {
return (0,external_wp_richText_namespaceObject.insert)(value, addText);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js
function findSelection(blocks) {
const attributeKey = retrieveSelectedAttribute(blocks[i].attributes);
blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey]
// To do: refactor this to use rich text's selection instead, so
// we no longer have to use on this hack inserting a special
.toString().replace(START_OF_SELECTED_AREA, '');
return [blocks[i].clientId, attributeKey, 0, 0];
const nestedSelection = findSelection(blocks[i].innerBlocks);
/* harmony default export */ const input_rules = (props => element => {
// We must use getValue() here because value may be update
const value = getValue();
const characterBefore = text.slice(start - 1, start);
// The character right before the caret must be a plain space.
if (characterBefore !== ' ') {
const trimmedTextBefore = text.slice(0, start).trim();
const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({
}) => type === 'prefix');
const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, ({
return trimmedTextBefore === prefix;
const content = (0,external_wp_richText_namespaceObject.toHTMLString)({
value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start)
const block = transformation.transform(content);
selectionChange(...findSelection([block]));
registry.dispatch(store).__unstableMarkAutomaticChange();
function onInput(event) {
__unstableAllowPrefixTransformations,
// Only run input rules when inserting text.
if (inputType !== 'insertText' && type !== 'compositionend') {
if (__unstableAllowPrefixTransformations && inputRule()) {
const value = getValue();
const transformed = formatTypes.reduce((accumlator, {
if (__unstableInputRule) {
accumlator = __unstableInputRule(accumlator);
}, preventEventDiscovery(value));
__unstableMarkLastChangeAsPersistent,
__unstableMarkAutomaticChange
} = registry.dispatch(store);
if (transformed !== value) {
__unstableMarkLastChangeAsPersistent();
activeFormats: value.activeFormats
__unstableMarkAutomaticChange();
element.addEventListener('input', onInput);
element.addEventListener('compositionend', onInput);
element.removeEventListener('input', onInput);
element.removeEventListener('compositionend', onInput);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js
* When the browser is about to auto correct, add an undo level so the user can
/* harmony default export */ const insert_replacement_text = (props => element => {
function onInput(event) {
if (event.inputType !== 'insertReplacementText') {
registry.dispatch(store).__unstableMarkLastChangeAsPersistent();
element.addEventListener('beforeinput', onInput);
element.removeEventListener('beforeinput', onInput);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js
* Hook to prevent default behaviors for key combinations otherwise handled
* internally by RichText.
/* harmony default export */ const remove_browser_shortcuts = (() => node => {
function onKeydown(event) {
if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'y') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'z')) {
node.addEventListener('keydown', onKeydown);
node.removeEventListener('keydown', onKeydown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js
/* harmony default export */ const shortcuts = (props => element => {
function onKeyDown(event) {
for (const keyboardShortcut of keyboardShortcuts.current) {
element.addEventListener('keydown', onKeyDown);
element.removeEventListener('keydown', onKeyDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js
/* harmony default export */ const input_events = (props => element => {
function onInput(event) {
for (const keyboardShortcut of inputEvents.current) {
element.addEventListener('input', onInput);
element.removeEventListener('input', onInput);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js
/* harmony default export */ const undo_automatic_change = (props => element => {
function onKeyDown(event) {
if (event.defaultPrevented) {
if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) {
} = registry.select(store);
if (!__experimentalUndo) {
if (!didAutomaticChange()) {
element.addEventListener('keydown', onKeyDown);
element.removeEventListener('keydown', onKeyDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js
function addActiveFormats(value, activeFormats) {
if (activeFormats?.length) {
let index = value.formats.length;
value.formats[index] = [...activeFormats, ...(value.formats[index] || [])];
* Get the multiline tag based on the multiline prop.
* @param {?(string|boolean)} multiline The multiline prop.
* @return {string | undefined} The multiline tag.
function getMultilineTag(multiline) {
if (multiline !== true && multiline !== 'p' && multiline !== 'li') {
return multiline === true ? 'p' : multiline;
function getAllowedFormats({
return getAllowedFormats.EMPTY_ARRAY;
getAllowedFormats.EMPTY_ARRAY = [];
* Creates a link from pasted URL.
* Creates a paragraph block containing a link to the URL, and calls `onReplace`.
* @param {string} url The URL that could not be embedded.
* @param {Function} onReplace Function to call with the created fallback block.
function createLinkInParagraph(url, onReplace) {
const link = /*#__PURE__*/_jsx("a", {
onReplace(createBlock('core/paragraph', {
content: renderToString(link)
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js
/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */
/* harmony default export */ const paste_handler = (props => element => {
function _onPaste(event) {
__unstableEmbedURLOnPaste,
// The event listener is attached to the window, so we need to check if
// the target is the element.
if (event.target !== element) {
if (event.defaultPrevented) {
} = getPasteEventData(event);
// Allows us to ask for this information when we get a report.
window.console.log('Received HTML:\n\n', html);
window.console.log('Received plain text:\n\n', plainText);
onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText));
const isInternal = event.clipboardData.getData('rich-text') === 'true';
function pasteInline(content) {
const transformed = formatTypes.reduce((accumulator, {
// Only allow one transform.
if (__unstablePasteRule && accumulator === value) {
accumulator = __unstablePasteRule(value, {
if (transformed !== value) {
const valueToInsert = (0,external_wp_richText_namespaceObject.create)({
addActiveFormats(valueToInsert, value.activeFormats);
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
// If the data comes from a rich text instance, we can directly use it
// without filtering the data. The filters are only meant for externally
// pasted content and remove inline styles.
onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({
const trimmedPlainText = plainText.trim();
if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) &&
// For the link pasting feature, allow only http(s) protocols.
/^https?:/.test(trimmedPlainText)) {
const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
if (typeof content === 'string') {
} else if (content.length > 0) {
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
onReplace(content, content.length - 1, -1);
} = element.ownerDocument;
// Attach the listener to the window so parent elements have the chance to
// prevent the default behavior.
defaultView.addEventListener('paste', _onPaste);
defaultView.removeEventListener('paste', _onPaste);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js
/* harmony default export */ const event_listeners_delete = (props => element => {
function onKeyDown(event) {
if (event.defaultPrevented) {
if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) {
const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE;
const hasActiveFormats = value.activeFormats && !!value.activeFormats.length;
// Only process delete if the key press occurs at an uncollapsed edge.
if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) {
// Only handle remove on Backspace. This serves dual-purpose of being
// an intentional user interaction distinguishing between Backspace and
// Delete to remove the empty field, but also to avoid merge & remove
// causing destruction of two fields (merge, then removed merged).
else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) {
element.addEventListener('keydown', onKeyDown);
element.removeEventListener('keydown', onKeyDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js