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
if (parsedPattern) {
[10500] Fix | Delete
return parsedPattern;
[10501] Fix | Delete
}
[10502] Fix | Delete
parsedPattern = parsePattern(pattern);
[10503] Fix | Delete
parsedPatternCache.set(pattern, parsedPattern);
[10504] Fix | Delete
return parsedPattern;
[10505] Fix | Delete
}
[10506] Fix | Delete
const checkAllowList = (list, item, defaultResult = null) => {
[10507] Fix | Delete
if (typeof list === 'boolean') {
[10508] Fix | Delete
return list;
[10509] Fix | Delete
}
[10510] Fix | Delete
if (Array.isArray(list)) {
[10511] Fix | Delete
// TODO: when there is a canonical way to detect that we are editing a post
[10512] Fix | Delete
// the following check should be changed to something like:
[10513] Fix | Delete
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
[10514] Fix | Delete
if (list.includes('core/post-content') && item === null) {
[10515] Fix | Delete
return true;
[10516] Fix | Delete
}
[10517] Fix | Delete
return list.includes(item);
[10518] Fix | Delete
}
[10519] Fix | Delete
return defaultResult;
[10520] Fix | Delete
};
[10521] Fix | Delete
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
[10522] Fix | Delete
if (typeof allowedBlockTypes === 'boolean') {
[10523] Fix | Delete
return allowedBlockTypes;
[10524] Fix | Delete
}
[10525] Fix | Delete
const blocksQueue = [...blocks];
[10526] Fix | Delete
while (blocksQueue.length > 0) {
[10527] Fix | Delete
const block = blocksQueue.shift();
[10528] Fix | Delete
const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true);
[10529] Fix | Delete
if (!isAllowed) {
[10530] Fix | Delete
return false;
[10531] Fix | Delete
}
[10532] Fix | Delete
block.innerBlocks?.forEach(innerBlock => {
[10533] Fix | Delete
blocksQueue.push(innerBlock);
[10534] Fix | Delete
});
[10535] Fix | Delete
}
[10536] Fix | Delete
return true;
[10537] Fix | Delete
};
[10538] Fix | Delete
const getAllPatternsDependants = select => state => {
[10539] Fix | Delete
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns, unlock(select(STORE_NAME)).getReusableBlocks()];
[10540] Fix | Delete
};
[10541] Fix | Delete
function getInsertBlockTypeDependants(state, rootClientId) {
[10542] Fix | Delete
return [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes];
[10543] Fix | Delete
}
[10544] Fix | Delete
[10545] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
[10546] Fix | Delete
/**
[10547] Fix | Delete
* Recursive stable sorting comparator function.
[10548] Fix | Delete
*
[10549] Fix | Delete
* @param {string|Function} field Field to sort by.
[10550] Fix | Delete
* @param {Array} items Items to sort.
[10551] Fix | Delete
* @param {string} order Order, 'asc' or 'desc'.
[10552] Fix | Delete
* @return {Function} Comparison function to be used in a `.sort()`.
[10553] Fix | Delete
*/
[10554] Fix | Delete
const comparator = (field, items, order) => {
[10555] Fix | Delete
return (a, b) => {
[10556] Fix | Delete
let cmpA, cmpB;
[10557] Fix | Delete
if (typeof field === 'function') {
[10558] Fix | Delete
cmpA = field(a);
[10559] Fix | Delete
cmpB = field(b);
[10560] Fix | Delete
} else {
[10561] Fix | Delete
cmpA = a[field];
[10562] Fix | Delete
cmpB = b[field];
[10563] Fix | Delete
}
[10564] Fix | Delete
if (cmpA > cmpB) {
[10565] Fix | Delete
return order === 'asc' ? 1 : -1;
[10566] Fix | Delete
} else if (cmpB > cmpA) {
[10567] Fix | Delete
return order === 'asc' ? -1 : 1;
[10568] Fix | Delete
}
[10569] Fix | Delete
const orderA = items.findIndex(item => item === a);
[10570] Fix | Delete
const orderB = items.findIndex(item => item === b);
[10571] Fix | Delete
[10572] Fix | Delete
// Stable sort: maintaining original array order
[10573] Fix | Delete
if (orderA > orderB) {
[10574] Fix | Delete
return 1;
[10575] Fix | Delete
} else if (orderB > orderA) {
[10576] Fix | Delete
return -1;
[10577] Fix | Delete
}
[10578] Fix | Delete
return 0;
[10579] Fix | Delete
};
[10580] Fix | Delete
};
[10581] Fix | Delete
[10582] Fix | Delete
/**
[10583] Fix | Delete
* Order items by a certain key.
[10584] Fix | Delete
* Supports decorator functions that allow complex picking of a comparison field.
[10585] Fix | Delete
* Sorts in ascending order by default, but supports descending as well.
[10586] Fix | Delete
* Stable sort - maintains original order of equal items.
[10587] Fix | Delete
*
[10588] Fix | Delete
* @param {Array} items Items to order.
[10589] Fix | Delete
* @param {string|Function} field Field to order by.
[10590] Fix | Delete
* @param {string} order Sorting order, `asc` or `desc`.
[10591] Fix | Delete
* @return {Array} Sorted items.
[10592] Fix | Delete
*/
[10593] Fix | Delete
function orderBy(items, field, order = 'asc') {
[10594] Fix | Delete
return items.concat().sort(comparator(field, items, order));
[10595] Fix | Delete
}
[10596] Fix | Delete
[10597] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js
[10598] Fix | Delete
/**
[10599] Fix | Delete
* WordPress dependencies
[10600] Fix | Delete
*/
[10601] Fix | Delete
[10602] Fix | Delete
[10603] Fix | Delete
const INSERTER_PATTERN_TYPES = {
[10604] Fix | Delete
user: 'user',
[10605] Fix | Delete
theme: 'theme',
[10606] Fix | Delete
directory: 'directory'
[10607] Fix | Delete
};
[10608] Fix | Delete
const INSERTER_SYNC_TYPES = {
[10609] Fix | Delete
full: 'fully',
[10610] Fix | Delete
unsynced: 'unsynced'
[10611] Fix | Delete
};
[10612] Fix | Delete
const allPatternsCategory = {
[10613] Fix | Delete
name: 'allPatterns',
[10614] Fix | Delete
label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns')
[10615] Fix | Delete
};
[10616] Fix | Delete
const myPatternsCategory = {
[10617] Fix | Delete
name: 'myPatterns',
[10618] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('My patterns')
[10619] Fix | Delete
};
[10620] Fix | Delete
function isPatternFiltered(pattern, sourceFilter, syncFilter) {
[10621] Fix | Delete
const isUserPattern = pattern.name.startsWith('core/block');
[10622] Fix | Delete
const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory');
[10623] Fix | Delete
[10624] Fix | Delete
// If theme source selected, filter out user created patterns and those from
[10625] Fix | Delete
// the core patterns directory.
[10626] Fix | Delete
if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) {
[10627] Fix | Delete
return true;
[10628] Fix | Delete
}
[10629] Fix | Delete
[10630] Fix | Delete
// If the directory source is selected, filter out user created patterns
[10631] Fix | Delete
// and those bundled with the theme.
[10632] Fix | Delete
if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) {
[10633] Fix | Delete
return true;
[10634] Fix | Delete
}
[10635] Fix | Delete
[10636] Fix | Delete
// If user source selected, filter out theme patterns.
[10637] Fix | Delete
if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) {
[10638] Fix | Delete
return true;
[10639] Fix | Delete
}
[10640] Fix | Delete
[10641] Fix | Delete
// Filter by sync status.
[10642] Fix | Delete
if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') {
[10643] Fix | Delete
return true;
[10644] Fix | Delete
}
[10645] Fix | Delete
if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) {
[10646] Fix | Delete
return true;
[10647] Fix | Delete
}
[10648] Fix | Delete
return false;
[10649] Fix | Delete
}
[10650] Fix | Delete
[10651] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/object.js
[10652] Fix | Delete
/**
[10653] Fix | Delete
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
[10654] Fix | Delete
* new object. Treats nullish initial values as empty objects. Clones any
[10655] Fix | Delete
* nested objects. Supports arrays, too.
[10656] Fix | Delete
*
[10657] Fix | Delete
* @param {Object} object Object to set a value in.
[10658] Fix | Delete
* @param {number|string|Array} path Path in the object to modify.
[10659] Fix | Delete
* @param {*} value New value to set.
[10660] Fix | Delete
* @return {Object} Cloned object with the new value set.
[10661] Fix | Delete
*/
[10662] Fix | Delete
function setImmutably(object, path, value) {
[10663] Fix | Delete
// Normalize path
[10664] Fix | Delete
path = Array.isArray(path) ? [...path] : [path];
[10665] Fix | Delete
[10666] Fix | Delete
// Shallowly clone the base of the object
[10667] Fix | Delete
object = Array.isArray(object) ? [...object] : {
[10668] Fix | Delete
...object
[10669] Fix | Delete
};
[10670] Fix | Delete
const leaf = path.pop();
[10671] Fix | Delete
[10672] Fix | Delete
// Traverse object from root to leaf, shallowly cloning at each level
[10673] Fix | Delete
let prev = object;
[10674] Fix | Delete
for (const key of path) {
[10675] Fix | Delete
const lvl = prev[key];
[10676] Fix | Delete
prev = prev[key] = Array.isArray(lvl) ? [...lvl] : {
[10677] Fix | Delete
...lvl
[10678] Fix | Delete
};
[10679] Fix | Delete
}
[10680] Fix | Delete
prev[leaf] = value;
[10681] Fix | Delete
return object;
[10682] Fix | Delete
}
[10683] Fix | Delete
[10684] Fix | Delete
/**
[10685] Fix | Delete
* Helper util to return a value from a certain path of the object.
[10686] Fix | Delete
* Path is specified as either:
[10687] Fix | Delete
* - a string of properties, separated by dots, for example: "x.y".
[10688] Fix | Delete
* - an array of properties, for example `[ 'x', 'y' ]`.
[10689] Fix | Delete
* You can also specify a default value in case the result is nullish.
[10690] Fix | Delete
*
[10691] Fix | Delete
* @param {Object} object Input object.
[10692] Fix | Delete
* @param {string|Array} path Path to the object property.
[10693] Fix | Delete
* @param {*} defaultValue Default value if the value at the specified path is nullish.
[10694] Fix | Delete
* @return {*} Value of the object property at the specified path.
[10695] Fix | Delete
*/
[10696] Fix | Delete
const getValueFromObjectPath = (object, path, defaultValue) => {
[10697] Fix | Delete
var _value;
[10698] Fix | Delete
const arrayPath = Array.isArray(path) ? path : path.split('.');
[10699] Fix | Delete
let value = object;
[10700] Fix | Delete
arrayPath.forEach(fieldName => {
[10701] Fix | Delete
value = value?.[fieldName];
[10702] Fix | Delete
});
[10703] Fix | Delete
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
[10704] Fix | Delete
};
[10705] Fix | Delete
[10706] Fix | Delete
/**
[10707] Fix | Delete
* Helper util to filter out objects with duplicate values for a given property.
[10708] Fix | Delete
*
[10709] Fix | Delete
* @param {Object[]} array Array of objects to filter.
[10710] Fix | Delete
* @param {string} property Property to filter unique values by.
[10711] Fix | Delete
*
[10712] Fix | Delete
* @return {Object[]} Array of objects with unique values for the specified property.
[10713] Fix | Delete
*/
[10714] Fix | Delete
function uniqByProperty(array, property) {
[10715] Fix | Delete
const seen = new Set();
[10716] Fix | Delete
return array.filter(item => {
[10717] Fix | Delete
const value = item[property];
[10718] Fix | Delete
return seen.has(value) ? false : seen.add(value);
[10719] Fix | Delete
});
[10720] Fix | Delete
}
[10721] Fix | Delete
[10722] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js
[10723] Fix | Delete
/**
[10724] Fix | Delete
* WordPress dependencies
[10725] Fix | Delete
*/
[10726] Fix | Delete
[10727] Fix | Delete
[10728] Fix | Delete
[10729] Fix | Delete
/**
[10730] Fix | Delete
* Internal dependencies
[10731] Fix | Delete
*/
[10732] Fix | Delete
[10733] Fix | Delete
[10734] Fix | Delete
const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
[10735] Fix | Delete
const deprecatedFlags = {
[10736] Fix | Delete
'color.palette': settings => settings.colors,
[10737] Fix | Delete
'color.gradients': settings => settings.gradients,
[10738] Fix | Delete
'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors,
[10739] Fix | Delete
'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
[10740] Fix | Delete
'typography.fontSizes': settings => settings.fontSizes,
[10741] Fix | Delete
'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
[10742] Fix | Delete
'typography.lineHeight': settings => settings.enableCustomLineHeight,
[10743] Fix | Delete
'spacing.units': settings => {
[10744] Fix | Delete
if (settings.enableCustomUnits === undefined) {
[10745] Fix | Delete
return;
[10746] Fix | Delete
}
[10747] Fix | Delete
if (settings.enableCustomUnits === true) {
[10748] Fix | Delete
return ['px', 'em', 'rem', 'vh', 'vw', '%'];
[10749] Fix | Delete
}
[10750] Fix | Delete
return settings.enableCustomUnits;
[10751] Fix | Delete
},
[10752] Fix | Delete
'spacing.padding': settings => settings.enableCustomSpacing
[10753] Fix | Delete
};
[10754] Fix | Delete
const prefixedFlags = {
[10755] Fix | Delete
/*
[10756] Fix | Delete
* These were only available in the plugin
[10757] Fix | Delete
* and can be removed when the minimum WordPress version
[10758] Fix | Delete
* for the plugin is 5.9.
[10759] Fix | Delete
*/
[10760] Fix | Delete
'border.customColor': 'border.color',
[10761] Fix | Delete
'border.customStyle': 'border.style',
[10762] Fix | Delete
'border.customWidth': 'border.width',
[10763] Fix | Delete
'typography.customFontStyle': 'typography.fontStyle',
[10764] Fix | Delete
'typography.customFontWeight': 'typography.fontWeight',
[10765] Fix | Delete
'typography.customLetterSpacing': 'typography.letterSpacing',
[10766] Fix | Delete
'typography.customTextDecorations': 'typography.textDecoration',
[10767] Fix | Delete
'typography.customTextTransforms': 'typography.textTransform',
[10768] Fix | Delete
/*
[10769] Fix | Delete
* These were part of WordPress 5.8 and we need to keep them.
[10770] Fix | Delete
*/
[10771] Fix | Delete
'border.customRadius': 'border.radius',
[10772] Fix | Delete
'spacing.customMargin': 'spacing.margin',
[10773] Fix | Delete
'spacing.customPadding': 'spacing.padding',
[10774] Fix | Delete
'typography.customLineHeight': 'typography.lineHeight'
[10775] Fix | Delete
};
[10776] Fix | Delete
[10777] Fix | Delete
/**
[10778] Fix | Delete
* Remove `custom` prefixes for flags that did not land in 5.8.
[10779] Fix | Delete
*
[10780] Fix | Delete
* This provides continued support for `custom` prefixed properties. It will
[10781] Fix | Delete
* be removed once third party devs have had sufficient time to update themes,
[10782] Fix | Delete
* plugins, etc.
[10783] Fix | Delete
*
[10784] Fix | Delete
* @see https://github.com/WordPress/gutenberg/pull/34485
[10785] Fix | Delete
*
[10786] Fix | Delete
* @param {string} path Path to desired value in settings.
[10787] Fix | Delete
* @return {string} The value for defined setting.
[10788] Fix | Delete
*/
[10789] Fix | Delete
const removeCustomPrefixes = path => {
[10790] Fix | Delete
return prefixedFlags[path] || path;
[10791] Fix | Delete
};
[10792] Fix | Delete
function getBlockSettings(state, clientId, ...paths) {
[10793] Fix | Delete
const blockName = getBlockName(state, clientId);
[10794] Fix | Delete
const candidates = [];
[10795] Fix | Delete
if (clientId) {
[10796] Fix | Delete
let id = clientId;
[10797] Fix | Delete
do {
[10798] Fix | Delete
const name = getBlockName(state, id);
[10799] Fix | Delete
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) {
[10800] Fix | Delete
candidates.push(id);
[10801] Fix | Delete
}
[10802] Fix | Delete
} while (id = state.blocks.parents.get(id));
[10803] Fix | Delete
}
[10804] Fix | Delete
return paths.map(path => {
[10805] Fix | Delete
if (blockedPaths.includes(path)) {
[10806] Fix | Delete
// eslint-disable-next-line no-console
[10807] Fix | Delete
console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
[10808] Fix | Delete
return undefined;
[10809] Fix | Delete
}
[10810] Fix | Delete
[10811] Fix | Delete
// 0. Allow third parties to filter the block's settings at runtime.
[10812] Fix | Delete
let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName);
[10813] Fix | Delete
if (undefined !== result) {
[10814] Fix | Delete
return result;
[10815] Fix | Delete
}
[10816] Fix | Delete
const normalizedPath = removeCustomPrefixes(path);
[10817] Fix | Delete
[10818] Fix | Delete
// 1. Take settings from the block instance or its ancestors.
[10819] Fix | Delete
// Start from the current block and work our way up the ancestors.
[10820] Fix | Delete
for (const candidateClientId of candidates) {
[10821] Fix | Delete
var _getValueFromObjectPa;
[10822] Fix | Delete
const candidateAtts = getBlockAttributes(state, candidateClientId);
[10823] Fix | Delete
result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath);
[10824] Fix | Delete
if (result !== undefined) {
[10825] Fix | Delete
// Stop the search for more distant ancestors and move on.
[10826] Fix | Delete
break;
[10827] Fix | Delete
}
[10828] Fix | Delete
}
[10829] Fix | Delete
[10830] Fix | Delete
// 2. Fall back to the settings from the block editor store (__experimentalFeatures).
[10831] Fix | Delete
const settings = getSettings(state);
[10832] Fix | Delete
if (result === undefined && blockName) {
[10833] Fix | Delete
result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath);
[10834] Fix | Delete
}
[10835] Fix | Delete
if (result === undefined) {
[10836] Fix | Delete
result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath);
[10837] Fix | Delete
}
[10838] Fix | Delete
[10839] Fix | Delete
// Return if the setting was found in either the block instance or the store.
[10840] Fix | Delete
if (result !== undefined) {
[10841] Fix | Delete
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) {
[10842] Fix | Delete
var _ref, _result$custom;
[10843] Fix | Delete
return (_ref = (_result$custom = result.custom) !== null && _result$custom !== void 0 ? _result$custom : result.theme) !== null && _ref !== void 0 ? _ref : result.default;
[10844] Fix | Delete
}
[10845] Fix | Delete
return result;
[10846] Fix | Delete
}
[10847] Fix | Delete
[10848] Fix | Delete
// 3. Otherwise, use deprecated settings.
[10849] Fix | Delete
const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
[10850] Fix | Delete
if (deprecatedSettingsValue !== undefined) {
[10851] Fix | Delete
return deprecatedSettingsValue;
[10852] Fix | Delete
}
[10853] Fix | Delete
[10854] Fix | Delete
// 4. Fallback for typography.dropCap:
[10855] Fix | Delete
// This is only necessary to support typography.dropCap.
[10856] Fix | Delete
// when __experimentalFeatures are not present (core without plugin).
[10857] Fix | Delete
// To remove when __experimentalFeatures are ported to core.
[10858] Fix | Delete
return normalizedPath === 'typography.dropCap' ? true : undefined;
[10859] Fix | Delete
});
[10860] Fix | Delete
}
[10861] Fix | Delete
[10862] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
[10863] Fix | Delete
/**
[10864] Fix | Delete
* WordPress dependencies
[10865] Fix | Delete
*/
[10866] Fix | Delete
[10867] Fix | Delete
[10868] Fix | Delete
/**
[10869] Fix | Delete
* Internal dependencies
[10870] Fix | Delete
*/
[10871] Fix | Delete
[10872] Fix | Delete
[10873] Fix | Delete
[10874] Fix | Delete
[10875] Fix | Delete
[10876] Fix | Delete
[10877] Fix | Delete
[10878] Fix | Delete
[10879] Fix | Delete
/**
[10880] Fix | Delete
* Returns true if the block interface is hidden, or false otherwise.
[10881] Fix | Delete
*
[10882] Fix | Delete
* @param {Object} state Global application state.
[10883] Fix | Delete
*
[10884] Fix | Delete
* @return {boolean} Whether the block toolbar is hidden.
[10885] Fix | Delete
*/
[10886] Fix | Delete
function private_selectors_isBlockInterfaceHidden(state) {
[10887] Fix | Delete
return state.isBlockInterfaceHidden;
[10888] Fix | Delete
}
[10889] Fix | Delete
[10890] Fix | Delete
/**
[10891] Fix | Delete
* Gets the client ids of the last inserted blocks.
[10892] Fix | Delete
*
[10893] Fix | Delete
* @param {Object} state Global application state.
[10894] Fix | Delete
* @return {Array|undefined} Client Ids of the last inserted block(s).
[10895] Fix | Delete
*/
[10896] Fix | Delete
function getLastInsertedBlocksClientIds(state) {
[10897] Fix | Delete
return state?.lastBlockInserted?.clientIds;
[10898] Fix | Delete
}
[10899] Fix | Delete
function getBlockWithoutAttributes(state, clientId) {
[10900] Fix | Delete
return state.blocks.byClientId.get(clientId);
[10901] Fix | Delete
}
[10902] Fix | Delete
[10903] Fix | Delete
/**
[10904] Fix | Delete
* Returns true if all of the descendants of a block with the given client ID
[10905] Fix | Delete
* have an editing mode of 'disabled', or false otherwise.
[10906] Fix | Delete
*
[10907] Fix | Delete
* @param {Object} state Global application state.
[10908] Fix | Delete
* @param {string} clientId The block client ID.
[10909] Fix | Delete
*
[10910] Fix | Delete
* @return {boolean} Whether the block descendants are disabled.
[10911] Fix | Delete
*/
[10912] Fix | Delete
const isBlockSubtreeDisabled = (state, clientId) => {
[10913] Fix | Delete
const isChildSubtreeDisabled = childClientId => {
[10914] Fix | Delete
return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled);
[10915] Fix | Delete
};
[10916] Fix | Delete
return getBlockOrder(state, clientId).every(isChildSubtreeDisabled);
[10917] Fix | Delete
};
[10918] Fix | Delete
function getEnabledClientIdsTreeUnmemoized(state, rootClientId) {
[10919] Fix | Delete
const blockOrder = getBlockOrder(state, rootClientId);
[10920] Fix | Delete
const result = [];
[10921] Fix | Delete
for (const clientId of blockOrder) {
[10922] Fix | Delete
const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId);
[10923] Fix | Delete
if (getBlockEditingMode(state, clientId) !== 'disabled') {
[10924] Fix | Delete
result.push({
[10925] Fix | Delete
clientId,
[10926] Fix | Delete
innerBlocks
[10927] Fix | Delete
});
[10928] Fix | Delete
} else {
[10929] Fix | Delete
result.push(...innerBlocks);
[10930] Fix | Delete
}
[10931] Fix | Delete
}
[10932] Fix | Delete
return result;
[10933] Fix | Delete
}
[10934] Fix | Delete
[10935] Fix | Delete
/**
[10936] Fix | Delete
* Returns a tree of block objects with only clientID and innerBlocks set.
[10937] Fix | Delete
* Blocks with a 'disabled' editing mode are not included.
[10938] Fix | Delete
*
[10939] Fix | Delete
* @param {Object} state Global application state.
[10940] Fix | Delete
* @param {?string} rootClientId Optional root client ID of block list.
[10941] Fix | Delete
*
[10942] Fix | Delete
* @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
[10943] Fix | Delete
*/
[10944] Fix | Delete
const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
[10945] Fix | Delete
[10946] Fix | Delete
/**
[10947] Fix | Delete
* Returns a list of a given block's ancestors, from top to bottom. Blocks with
[10948] Fix | Delete
* a 'disabled' editing mode are excluded.
[10949] Fix | Delete
*
[10950] Fix | Delete
* @see getBlockParents
[10951] Fix | Delete
*
[10952] Fix | Delete
* @param {Object} state Global application state.
[10953] Fix | Delete
* @param {string} clientId The block client ID.
[10954] Fix | Delete
* @param {boolean} ascending Order results from bottom to top (true) or top
[10955] Fix | Delete
* to bottom (false).
[10956] Fix | Delete
*/
[10957] Fix | Delete
const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => {
[10958] Fix | Delete
return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled');
[10959] Fix | Delete
}, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
[10960] Fix | Delete
[10961] Fix | Delete
/**
[10962] Fix | Delete
* Selector that returns the data needed to display a prompt when certain
[10963] Fix | Delete
* blocks are removed, or `false` if no such prompt is requested.
[10964] Fix | Delete
*
[10965] Fix | Delete
* @param {Object} state Global application state.
[10966] Fix | Delete
*
[10967] Fix | Delete
* @return {Object|false} Data for removal prompt display, if any.
[10968] Fix | Delete
*/
[10969] Fix | Delete
function getRemovalPromptData(state) {
[10970] Fix | Delete
return state.removalPromptData;
[10971] Fix | Delete
}
[10972] Fix | Delete
[10973] Fix | Delete
/**
[10974] Fix | Delete
* Returns true if removal prompt exists, or false otherwise.
[10975] Fix | Delete
*
[10976] Fix | Delete
* @param {Object} state Global application state.
[10977] Fix | Delete
*
[10978] Fix | Delete
* @return {boolean} Whether removal prompt exists.
[10979] Fix | Delete
*/
[10980] Fix | Delete
function getBlockRemovalRules(state) {
[10981] Fix | Delete
return state.blockRemovalRules;
[10982] Fix | Delete
}
[10983] Fix | Delete
[10984] Fix | Delete
/**
[10985] Fix | Delete
* Returns the client ID of the block settings menu that is currently open.
[10986] Fix | Delete
*
[10987] Fix | Delete
* @param {Object} state Global application state.
[10988] Fix | Delete
* @return {string|null} The client ID of the block menu that is currently open.
[10989] Fix | Delete
*/
[10990] Fix | Delete
function getOpenedBlockSettingsMenu(state) {
[10991] Fix | Delete
return state.openedBlockSettingsMenu;
[10992] Fix | Delete
}
[10993] Fix | Delete
[10994] Fix | Delete
/**
[10995] Fix | Delete
* Returns all style overrides, intended to be merged with global editor styles.
[10996] Fix | Delete
*
[10997] Fix | Delete
* Overrides are sorted to match the order of the blocks they relate to. This
[10998] Fix | Delete
* is useful to maintain correct CSS cascade order.
[10999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function