Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: block-editor.js
ref: reusableBlock.id
[13000] Fix | Delete
},
[13001] Fix | Delete
title: reusableBlock.title?.raw,
[13002] Fix | Delete
icon,
[13003] Fix | Delete
category: 'reusable',
[13004] Fix | Delete
keywords: ['reusable'],
[13005] Fix | Delete
isDisabled: false,
[13006] Fix | Delete
utility: 1,
[13007] Fix | Delete
// Deprecated.
[13008] Fix | Delete
frecency,
[13009] Fix | Delete
content: reusableBlock.content?.raw,
[13010] Fix | Delete
syncStatus: reusableBlock.wp_pattern_sync_status
[13011] Fix | Delete
};
[13012] Fix | Delete
};
[13013] Fix | Delete
const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : [];
[13014] Fix | Delete
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
[13015] Fix | Delete
buildScope: 'inserter'
[13016] Fix | Delete
});
[13017] Fix | Delete
let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)).map(buildBlockTypeInserterItem);
[13018] Fix | Delete
if (options[withRootClientIdOptionKey]) {
[13019] Fix | Delete
blockTypeInserterItems = blockTypeInserterItems.reduce((accumulator, item) => {
[13020] Fix | Delete
item.rootClientId = rootClientId !== null && rootClientId !== void 0 ? rootClientId : '';
[13021] Fix | Delete
while (!canInsertBlockTypeUnmemoized(state, item.name, item.rootClientId)) {
[13022] Fix | Delete
if (!item.rootClientId) {
[13023] Fix | Delete
let sectionRootClientId;
[13024] Fix | Delete
try {
[13025] Fix | Delete
sectionRootClientId = unlock(getSettings(state)).sectionRootClientId;
[13026] Fix | Delete
} catch (e) {}
[13027] Fix | Delete
if (sectionRootClientId && canInsertBlockTypeUnmemoized(state, item.name, sectionRootClientId)) {
[13028] Fix | Delete
item.rootClientId = sectionRootClientId;
[13029] Fix | Delete
} else {
[13030] Fix | Delete
delete item.rootClientId;
[13031] Fix | Delete
}
[13032] Fix | Delete
break;
[13033] Fix | Delete
} else {
[13034] Fix | Delete
const parentClientId = getBlockRootClientId(state, item.rootClientId);
[13035] Fix | Delete
item.rootClientId = parentClientId;
[13036] Fix | Delete
}
[13037] Fix | Delete
}
[13038] Fix | Delete
[13039] Fix | Delete
// We could also add non insertable items and gray them out.
[13040] Fix | Delete
if (item.hasOwnProperty('rootClientId')) {
[13041] Fix | Delete
accumulator.push(item);
[13042] Fix | Delete
}
[13043] Fix | Delete
return accumulator;
[13044] Fix | Delete
}, []);
[13045] Fix | Delete
} else {
[13046] Fix | Delete
blockTypeInserterItems = blockTypeInserterItems.filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
[13047] Fix | Delete
}
[13048] Fix | Delete
const items = blockTypeInserterItems.reduce((accumulator, item) => {
[13049] Fix | Delete
const {
[13050] Fix | Delete
variations = []
[13051] Fix | Delete
} = item;
[13052] Fix | Delete
// Exclude any block type item that is to be replaced by a default variation.
[13053] Fix | Delete
if (!variations.some(({
[13054] Fix | Delete
isDefault
[13055] Fix | Delete
}) => isDefault)) {
[13056] Fix | Delete
accumulator.push(item);
[13057] Fix | Delete
}
[13058] Fix | Delete
if (variations.length) {
[13059] Fix | Delete
const variationMapper = getItemFromVariation(state, item);
[13060] Fix | Delete
accumulator.push(...variations.map(variationMapper));
[13061] Fix | Delete
}
[13062] Fix | Delete
return accumulator;
[13063] Fix | Delete
}, []);
[13064] Fix | Delete
[13065] Fix | Delete
// Ensure core blocks are prioritized in the returned results,
[13066] Fix | Delete
// because third party blocks can be registered earlier than
[13067] Fix | Delete
// the core blocks (usually by using the `init` action),
[13068] Fix | Delete
// thus affecting the display order.
[13069] Fix | Delete
// We don't sort reusable blocks as they are handled differently.
[13070] Fix | Delete
const groupByType = (blocks, block) => {
[13071] Fix | Delete
const {
[13072] Fix | Delete
core,
[13073] Fix | Delete
noncore
[13074] Fix | Delete
} = blocks;
[13075] Fix | Delete
const type = block.name.startsWith('core/') ? core : noncore;
[13076] Fix | Delete
type.push(block);
[13077] Fix | Delete
return blocks;
[13078] Fix | Delete
};
[13079] Fix | Delete
const {
[13080] Fix | Delete
core: coreItems,
[13081] Fix | Delete
noncore: nonCoreItems
[13082] Fix | Delete
} = items.reduce(groupByType, {
[13083] Fix | Delete
core: [],
[13084] Fix | Delete
noncore: []
[13085] Fix | Delete
});
[13086] Fix | Delete
const sortedBlockTypes = [...coreItems, ...nonCoreItems];
[13087] Fix | Delete
return [...sortedBlockTypes, ...syncedPatternInserterItems];
[13088] Fix | Delete
}, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), state.blocks.order, state.preferences.insertUsage, ...getInsertBlockTypeDependants(state, rootClientId)]));
[13089] Fix | Delete
[13090] Fix | Delete
/**
[13091] Fix | Delete
* Determines the items that appear in the available block transforms list.
[13092] Fix | Delete
*
[13093] Fix | Delete
* Each item object contains what's necessary to display a menu item in the
[13094] Fix | Delete
* transform list and handle its selection.
[13095] Fix | Delete
*
[13096] Fix | Delete
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
[13097] Fix | Delete
* that combines block usage frequenty and recency.
[13098] Fix | Delete
*
[13099] Fix | Delete
* Items are returned ordered descendingly by their 'frecency'.
[13100] Fix | Delete
*
[13101] Fix | Delete
* @param {Object} state Editor state.
[13102] Fix | Delete
* @param {Object|Object[]} blocks Block object or array objects.
[13103] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[13104] Fix | Delete
*
[13105] Fix | Delete
* @return {WPEditorTransformItem[]} Items that appear in inserter.
[13106] Fix | Delete
*
[13107] Fix | Delete
* @typedef {Object} WPEditorTransformItem
[13108] Fix | Delete
* @property {string} id Unique identifier for the item.
[13109] Fix | Delete
* @property {string} name The type of block to create.
[13110] Fix | Delete
* @property {string} title Title of the item, as it appears in the inserter.
[13111] Fix | Delete
* @property {string} icon Dashicon for the item, as it appears in the inserter.
[13112] Fix | Delete
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
[13113] Fix | Delete
* this item.
[13114] Fix | Delete
* @property {number} frecency Heuristic that combines frequency and recency.
[13115] Fix | Delete
*/
[13116] Fix | Delete
const getBlockTransformItems = (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => {
[13117] Fix | Delete
const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks];
[13118] Fix | Delete
const buildBlockTypeTransformItem = buildBlockTypeItem(state, {
[13119] Fix | Delete
buildScope: 'transform'
[13120] Fix | Delete
});
[13121] Fix | Delete
const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
[13122] Fix | Delete
const itemsByName = Object.fromEntries(Object.entries(blockTypeTransformItems).map(([, value]) => [value.name, value]));
[13123] Fix | Delete
const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(normalizedBlocks).reduce((accumulator, block) => {
[13124] Fix | Delete
if (itemsByName[block?.name]) {
[13125] Fix | Delete
accumulator.push(itemsByName[block.name]);
[13126] Fix | Delete
}
[13127] Fix | Delete
return accumulator;
[13128] Fix | Delete
}, []);
[13129] Fix | Delete
return orderBy(possibleTransforms, block => itemsByName[block.name].frecency, 'desc');
[13130] Fix | Delete
}, (state, blocks, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), state.preferences.insertUsage, ...getInsertBlockTypeDependants(state, rootClientId)]);
[13131] Fix | Delete
[13132] Fix | Delete
/**
[13133] Fix | Delete
* Determines whether there are items to show in the inserter.
[13134] Fix | Delete
*
[13135] Fix | Delete
* @param {Object} state Editor state.
[13136] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[13137] Fix | Delete
*
[13138] Fix | Delete
* @return {boolean} Items that appear in inserter.
[13139] Fix | Delete
*/
[13140] Fix | Delete
const hasInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, rootClientId = null) => {
[13141] Fix | Delete
const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
[13142] Fix | Delete
if (hasBlockType) {
[13143] Fix | Delete
return true;
[13144] Fix | Delete
}
[13145] Fix | Delete
const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0;
[13146] Fix | Delete
return hasReusableBlock;
[13147] Fix | Delete
});
[13148] Fix | Delete
[13149] Fix | Delete
/**
[13150] Fix | Delete
* Returns the list of allowed inserter blocks for inner blocks children.
[13151] Fix | Delete
*
[13152] Fix | Delete
* @param {Object} state Editor state.
[13153] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[13154] Fix | Delete
*
[13155] Fix | Delete
* @return {Array?} The list of allowed block types.
[13156] Fix | Delete
*/
[13157] Fix | Delete
const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => {
[13158] Fix | Delete
if (!rootClientId) {
[13159] Fix | Delete
return;
[13160] Fix | Delete
}
[13161] Fix | Delete
const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
[13162] Fix | Delete
const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0;
[13163] Fix | Delete
if (hasReusableBlock) {
[13164] Fix | Delete
blockTypes.push('core/block');
[13165] Fix | Delete
}
[13166] Fix | Delete
return blockTypes;
[13167] Fix | Delete
}, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), ...getInsertBlockTypeDependants(state, rootClientId)]));
[13168] Fix | Delete
const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => {
[13169] Fix | Delete
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', {
[13170] Fix | Delete
alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks',
[13171] Fix | Delete
since: '6.2',
[13172] Fix | Delete
version: '6.4'
[13173] Fix | Delete
});
[13174] Fix | Delete
return getAllowedBlocks(state, rootClientId);
[13175] Fix | Delete
}, (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId));
[13176] Fix | Delete
[13177] Fix | Delete
/**
[13178] Fix | Delete
* Returns the block to be directly inserted by the block appender.
[13179] Fix | Delete
*
[13180] Fix | Delete
* @param {Object} state Editor state.
[13181] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[13182] Fix | Delete
*
[13183] Fix | Delete
* @return {WPDirectInsertBlock|undefined} The block type to be directly inserted.
[13184] Fix | Delete
*
[13185] Fix | Delete
* @typedef {Object} WPDirectInsertBlock
[13186] Fix | Delete
* @property {string} name The type of block.
[13187] Fix | Delete
* @property {?Object} attributes Attributes to pass to the newly created block.
[13188] Fix | Delete
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
[13189] Fix | Delete
*/
[13190] Fix | Delete
function getDirectInsertBlock(state, rootClientId = null) {
[13191] Fix | Delete
var _state$blockListSetti;
[13192] Fix | Delete
if (!rootClientId) {
[13193] Fix | Delete
return;
[13194] Fix | Delete
}
[13195] Fix | Delete
const {
[13196] Fix | Delete
defaultBlock,
[13197] Fix | Delete
directInsert
[13198] Fix | Delete
} = (_state$blockListSetti = state.blockListSettings[rootClientId]) !== null && _state$blockListSetti !== void 0 ? _state$blockListSetti : {};
[13199] Fix | Delete
if (!defaultBlock || !directInsert) {
[13200] Fix | Delete
return;
[13201] Fix | Delete
}
[13202] Fix | Delete
return defaultBlock;
[13203] Fix | Delete
}
[13204] Fix | Delete
function __experimentalGetDirectInsertBlock(state, rootClientId = null) {
[13205] Fix | Delete
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', {
[13206] Fix | Delete
alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
[13207] Fix | Delete
since: '6.3',
[13208] Fix | Delete
version: '6.4'
[13209] Fix | Delete
});
[13210] Fix | Delete
return getDirectInsertBlock(state, rootClientId);
[13211] Fix | Delete
}
[13212] Fix | Delete
const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, patternName) => {
[13213] Fix | Delete
const pattern = unlock(select(STORE_NAME)).getPatternBySlug(patternName);
[13214] Fix | Delete
return pattern ? getParsedPattern(pattern) : null;
[13215] Fix | Delete
});
[13216] Fix | Delete
const getAllowedPatternsDependants = select => (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(state, rootClientId)];
[13217] Fix | Delete
[13218] Fix | Delete
/**
[13219] Fix | Delete
* Returns the list of allowed patterns for inner blocks children.
[13220] Fix | Delete
*
[13221] Fix | Delete
* @param {Object} state Editor state.
[13222] Fix | Delete
* @param {?string} rootClientId Optional target root client ID.
[13223] Fix | Delete
*
[13224] Fix | Delete
* @return {Array?} The list of allowed patterns.
[13225] Fix | Delete
*/
[13226] Fix | Delete
const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
[13227] Fix | Delete
return (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => {
[13228] Fix | Delete
const {
[13229] Fix | Delete
getAllPatterns
[13230] Fix | Delete
} = unlock(select(STORE_NAME));
[13231] Fix | Delete
const patterns = getAllPatterns();
[13232] Fix | Delete
const {
[13233] Fix | Delete
allowedBlockTypes
[13234] Fix | Delete
} = getSettings(state);
[13235] Fix | Delete
const parsedPatterns = patterns.filter(({
[13236] Fix | Delete
inserter = true
[13237] Fix | Delete
}) => !!inserter).map(getParsedPattern);
[13238] Fix | Delete
const availableParsedPatterns = parsedPatterns.filter(({
[13239] Fix | Delete
blocks
[13240] Fix | Delete
}) => checkAllowListRecursive(blocks, allowedBlockTypes));
[13241] Fix | Delete
const patternsAllowed = availableParsedPatterns.filter(({
[13242] Fix | Delete
blocks
[13243] Fix | Delete
}) => blocks.every(({
[13244] Fix | Delete
name
[13245] Fix | Delete
}) => canInsertBlockType(state, name, rootClientId)));
[13246] Fix | Delete
return patternsAllowed;
[13247] Fix | Delete
}, getAllowedPatternsDependants(select));
[13248] Fix | Delete
});
[13249] Fix | Delete
[13250] Fix | Delete
/**
[13251] Fix | Delete
* Returns the list of patterns based on their declared `blockTypes`
[13252] Fix | Delete
* and a block's name.
[13253] Fix | Delete
* Patterns can use `blockTypes` to integrate in work flows like
[13254] Fix | Delete
* suggesting appropriate patterns in a Placeholder state(during insertion)
[13255] Fix | Delete
* or blocks transformations.
[13256] Fix | Delete
*
[13257] Fix | Delete
* @param {Object} state Editor state.
[13258] Fix | Delete
* @param {string|string[]} blockNames Block's name or array of block names to find matching pattens.
[13259] Fix | Delete
* @param {?string} rootClientId Optional target root client ID.
[13260] Fix | Delete
*
[13261] Fix | Delete
* @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
[13262] Fix | Delete
*/
[13263] Fix | Delete
const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames, rootClientId = null) => {
[13264] Fix | Delete
if (!blockNames) {
[13265] Fix | Delete
return selectors_EMPTY_ARRAY;
[13266] Fix | Delete
}
[13267] Fix | Delete
const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns(rootClientId);
[13268] Fix | Delete
const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
[13269] Fix | Delete
const filteredPatterns = patterns.filter(pattern => pattern?.blockTypes?.some?.(blockName => normalizedBlockNames.includes(blockName)));
[13270] Fix | Delete
if (filteredPatterns.length === 0) {
[13271] Fix | Delete
return selectors_EMPTY_ARRAY;
[13272] Fix | Delete
}
[13273] Fix | Delete
return filteredPatterns;
[13274] Fix | Delete
}, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
[13275] Fix | Delete
const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
[13276] Fix | Delete
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', {
[13277] Fix | Delete
alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',
[13278] Fix | Delete
since: '6.2',
[13279] Fix | Delete
version: '6.4'
[13280] Fix | Delete
});
[13281] Fix | Delete
return select(STORE_NAME).getPatternsByBlockTypes;
[13282] Fix | Delete
});
[13283] Fix | Delete
[13284] Fix | Delete
/**
[13285] Fix | Delete
* Determines the items that appear in the available pattern transforms list.
[13286] Fix | Delete
*
[13287] Fix | Delete
* For now we only handle blocks without InnerBlocks and take into account
[13288] Fix | Delete
* the `__experimentalRole` property of blocks' attributes for the transformation.
[13289] Fix | Delete
*
[13290] Fix | Delete
* We return the first set of possible eligible block patterns,
[13291] Fix | Delete
* by checking the `blockTypes` property. We still have to recurse through
[13292] Fix | Delete
* block pattern's blocks and try to find matches from the selected blocks.
[13293] Fix | Delete
* Now this happens in the consumer to avoid heavy operations in the selector.
[13294] Fix | Delete
*
[13295] Fix | Delete
* @param {Object} state Editor state.
[13296] Fix | Delete
* @param {Object[]} blocks The selected blocks.
[13297] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[13298] Fix | Delete
*
[13299] Fix | Delete
* @return {WPBlockPattern[]} Items that are eligible for a pattern transformation.
[13300] Fix | Delete
*/
[13301] Fix | Delete
const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => {
[13302] Fix | Delete
if (!blocks) {
[13303] Fix | Delete
return selectors_EMPTY_ARRAY;
[13304] Fix | Delete
}
[13305] Fix | Delete
/**
[13306] Fix | Delete
* For now we only handle blocks without InnerBlocks and take into account
[13307] Fix | Delete
* the `__experimentalRole` property of blocks' attributes for the transformation.
[13308] Fix | Delete
* Note that the blocks have been retrieved through `getBlock`, which doesn't
[13309] Fix | Delete
* return the inner blocks of an inner block controller, so we still need
[13310] Fix | Delete
* to check for this case too.
[13311] Fix | Delete
*/
[13312] Fix | Delete
if (blocks.some(({
[13313] Fix | Delete
clientId,
[13314] Fix | Delete
innerBlocks
[13315] Fix | Delete
}) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) {
[13316] Fix | Delete
return selectors_EMPTY_ARRAY;
[13317] Fix | Delete
}
[13318] Fix | Delete
[13319] Fix | Delete
// Create a Set of the selected block names that is used in patterns filtering.
[13320] Fix | Delete
const selectedBlockNames = Array.from(new Set(blocks.map(({
[13321] Fix | Delete
name
[13322] Fix | Delete
}) => name)));
[13323] Fix | Delete
/**
[13324] Fix | Delete
* Here we will return first set of possible eligible block patterns,
[13325] Fix | Delete
* by checking the `blockTypes` property. We still have to recurse through
[13326] Fix | Delete
* block pattern's blocks and try to find matches from the selected blocks.
[13327] Fix | Delete
* Now this happens in the consumer to avoid heavy operations in the selector.
[13328] Fix | Delete
*/
[13329] Fix | Delete
return select(STORE_NAME).getPatternsByBlockTypes(selectedBlockNames, rootClientId);
[13330] Fix | Delete
}, (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
[13331] Fix | Delete
[13332] Fix | Delete
/**
[13333] Fix | Delete
* Returns the Block List settings of a block, if any exist.
[13334] Fix | Delete
*
[13335] Fix | Delete
* @param {Object} state Editor state.
[13336] Fix | Delete
* @param {?string} clientId Block client ID.
[13337] Fix | Delete
*
[13338] Fix | Delete
* @return {?Object} Block settings of the block if set.
[13339] Fix | Delete
*/
[13340] Fix | Delete
function getBlockListSettings(state, clientId) {
[13341] Fix | Delete
return state.blockListSettings[clientId];
[13342] Fix | Delete
}
[13343] Fix | Delete
[13344] Fix | Delete
/**
[13345] Fix | Delete
* Returns the editor settings.
[13346] Fix | Delete
*
[13347] Fix | Delete
* @param {Object} state Editor state.
[13348] Fix | Delete
*
[13349] Fix | Delete
* @return {Object} The editor settings object.
[13350] Fix | Delete
*/
[13351] Fix | Delete
function getSettings(state) {
[13352] Fix | Delete
return state.settings;
[13353] Fix | Delete
}
[13354] Fix | Delete
[13355] Fix | Delete
/**
[13356] Fix | Delete
* Returns true if the most recent block change is be considered persistent, or
[13357] Fix | Delete
* false otherwise. A persistent change is one committed by BlockEditorProvider
[13358] Fix | Delete
* via its `onChange` callback, in addition to `onInput`.
[13359] Fix | Delete
*
[13360] Fix | Delete
* @param {Object} state Block editor state.
[13361] Fix | Delete
*
[13362] Fix | Delete
* @return {boolean} Whether the most recent block change was persistent.
[13363] Fix | Delete
*/
[13364] Fix | Delete
function isLastBlockChangePersistent(state) {
[13365] Fix | Delete
return state.blocks.isPersistentChange;
[13366] Fix | Delete
}
[13367] Fix | Delete
[13368] Fix | Delete
/**
[13369] Fix | Delete
* Returns the block list settings for an array of blocks, if any exist.
[13370] Fix | Delete
*
[13371] Fix | Delete
* @param {Object} state Editor state.
[13372] Fix | Delete
* @param {Array} clientIds Block client IDs.
[13373] Fix | Delete
*
[13374] Fix | Delete
* @return {Object} An object where the keys are client ids and the values are
[13375] Fix | Delete
* a block list setting object.
[13376] Fix | Delete
*/
[13377] Fix | Delete
const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds = []) => {
[13378] Fix | Delete
return clientIds.reduce((blockListSettingsForBlocks, clientId) => {
[13379] Fix | Delete
if (!state.blockListSettings[clientId]) {
[13380] Fix | Delete
return blockListSettingsForBlocks;
[13381] Fix | Delete
}
[13382] Fix | Delete
return {
[13383] Fix | Delete
...blockListSettingsForBlocks,
[13384] Fix | Delete
[clientId]: state.blockListSettings[clientId]
[13385] Fix | Delete
};
[13386] Fix | Delete
}, {});
[13387] Fix | Delete
}, state => [state.blockListSettings]);
[13388] Fix | Delete
[13389] Fix | Delete
/**
[13390] Fix | Delete
* Returns the title of a given reusable block
[13391] Fix | Delete
*
[13392] Fix | Delete
* @param {Object} state Global application state.
[13393] Fix | Delete
* @param {number|string} ref The shared block's ID.
[13394] Fix | Delete
*
[13395] Fix | Delete
* @return {string} The reusable block saved title.
[13396] Fix | Delete
*/
[13397] Fix | Delete
const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, ref) => {
[13398] Fix | Delete
external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle", {
[13399] Fix | Delete
since: '6.6',
[13400] Fix | Delete
version: '6.8'
[13401] Fix | Delete
});
[13402] Fix | Delete
const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find(block => block.id === ref);
[13403] Fix | Delete
if (!reusableBlock) {
[13404] Fix | Delete
return null;
[13405] Fix | Delete
}
[13406] Fix | Delete
return reusableBlock.title?.raw;
[13407] Fix | Delete
}, () => [unlock(select(STORE_NAME)).getReusableBlocks()]));
[13408] Fix | Delete
[13409] Fix | Delete
/**
[13410] Fix | Delete
* Returns true if the most recent block change is be considered ignored, or
[13411] Fix | Delete
* false otherwise. An ignored change is one not to be committed by
[13412] Fix | Delete
* BlockEditorProvider, neither via `onChange` nor `onInput`.
[13413] Fix | Delete
*
[13414] Fix | Delete
* @param {Object} state Block editor state.
[13415] Fix | Delete
*
[13416] Fix | Delete
* @return {boolean} Whether the most recent block change was ignored.
[13417] Fix | Delete
*/
[13418] Fix | Delete
function __unstableIsLastBlockChangeIgnored(state) {
[13419] Fix | Delete
// TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be
[13420] Fix | Delete
// ignored if in-fact they result in a change in blocks state. The current
[13421] Fix | Delete
// need to ignore changes not a result of user interaction should be
[13422] Fix | Delete
// accounted for in the refactoring of reusable blocks as occurring within
[13423] Fix | Delete
// their own separate block editor / state (#7119).
[13424] Fix | Delete
return state.blocks.isIgnoredChange;
[13425] Fix | Delete
}
[13426] Fix | Delete
[13427] Fix | Delete
/**
[13428] Fix | Delete
* Returns the block attributes changed as a result of the last dispatched
[13429] Fix | Delete
* action.
[13430] Fix | Delete
*
[13431] Fix | Delete
* @param {Object} state Block editor state.
[13432] Fix | Delete
*
[13433] Fix | Delete
* @return {Object<string,Object>} Subsets of block attributes changed, keyed
[13434] Fix | Delete
* by block client ID.
[13435] Fix | Delete
*/
[13436] Fix | Delete
function __experimentalGetLastBlockAttributeChanges(state) {
[13437] Fix | Delete
return state.lastBlockAttributesChange;
[13438] Fix | Delete
}
[13439] Fix | Delete
[13440] Fix | Delete
/**
[13441] Fix | Delete
* Returns whether the navigation mode is enabled.
[13442] Fix | Delete
*
[13443] Fix | Delete
* @param {Object} state Editor state.
[13444] Fix | Delete
*
[13445] Fix | Delete
* @return {boolean} Is navigation mode enabled.
[13446] Fix | Delete
*/
[13447] Fix | Delete
function isNavigationMode(state) {
[13448] Fix | Delete
return state.editorMode === 'navigation';
[13449] Fix | Delete
}
[13450] Fix | Delete
[13451] Fix | Delete
/**
[13452] Fix | Delete
* Returns the current editor mode.
[13453] Fix | Delete
*
[13454] Fix | Delete
* @param {Object} state Editor state.
[13455] Fix | Delete
*
[13456] Fix | Delete
* @return {string} the editor mode.
[13457] Fix | Delete
*/
[13458] Fix | Delete
function __unstableGetEditorMode(state) {
[13459] Fix | Delete
return state.editorMode;
[13460] Fix | Delete
}
[13461] Fix | Delete
[13462] Fix | Delete
/**
[13463] Fix | Delete
* Returns whether block moving mode is enabled.
[13464] Fix | Delete
*
[13465] Fix | Delete
* @param {Object} state Editor state.
[13466] Fix | Delete
*
[13467] Fix | Delete
* @return {string} Client Id of moving block.
[13468] Fix | Delete
*/
[13469] Fix | Delete
function selectors_hasBlockMovingClientId(state) {
[13470] Fix | Delete
return state.hasBlockMovingClientId;
[13471] Fix | Delete
}
[13472] Fix | Delete
[13473] Fix | Delete
/**
[13474] Fix | Delete
* Returns true if the last change was an automatic change, false otherwise.
[13475] Fix | Delete
*
[13476] Fix | Delete
* @param {Object} state Global application state.
[13477] Fix | Delete
*
[13478] Fix | Delete
* @return {boolean} Whether the last change was automatic.
[13479] Fix | Delete
*/
[13480] Fix | Delete
function didAutomaticChange(state) {
[13481] Fix | Delete
return !!state.automaticChangeStatus;
[13482] Fix | Delete
}
[13483] Fix | Delete
[13484] Fix | Delete
/**
[13485] Fix | Delete
* Returns true if the current highlighted block matches the block clientId.
[13486] Fix | Delete
*
[13487] Fix | Delete
* @param {Object} state Global application state.
[13488] Fix | Delete
* @param {string} clientId The block to check.
[13489] Fix | Delete
*
[13490] Fix | Delete
* @return {boolean} Whether the block is currently highlighted.
[13491] Fix | Delete
*/
[13492] Fix | Delete
function isBlockHighlighted(state, clientId) {
[13493] Fix | Delete
return state.highlightedBlock === clientId;
[13494] Fix | Delete
}
[13495] Fix | Delete
[13496] Fix | Delete
/**
[13497] Fix | Delete
* Checks if a given block has controlled inner blocks.
[13498] Fix | Delete
*
[13499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function