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: core-data.js
* @param kind Entity kind.
[4500] Fix | Delete
* @param name Entity name.
[4501] Fix | Delete
*
[4502] Fix | Delete
* @return Entity config
[4503] Fix | Delete
*/
[4504] Fix | Delete
function getEntityConfig(state, kind, name) {
[4505] Fix | Delete
return state.entities.config?.find(config => config.kind === kind && config.name === name);
[4506] Fix | Delete
}
[4507] Fix | Delete
[4508] Fix | Delete
/**
[4509] Fix | Delete
* GetEntityRecord is declared as a *callable interface* with
[4510] Fix | Delete
* two signatures to work around the fact that TypeScript doesn't
[4511] Fix | Delete
* allow currying generic functions:
[4512] Fix | Delete
*
[4513] Fix | Delete
* ```ts
[4514] Fix | Delete
* type CurriedState = F extends ( state: any, ...args: infer P ) => infer R
[4515] Fix | Delete
* ? ( ...args: P ) => R
[4516] Fix | Delete
* : F;
[4517] Fix | Delete
* type Selector = <K extends string | number>(
[4518] Fix | Delete
* state: any,
[4519] Fix | Delete
* kind: K,
[4520] Fix | Delete
* key: K extends string ? 'string value' : false
[4521] Fix | Delete
* ) => K;
[4522] Fix | Delete
* type BadlyInferredSignature = CurriedState< Selector >
[4523] Fix | Delete
* // BadlyInferredSignature evaluates to:
[4524] Fix | Delete
* // (kind: string number, key: false | "string value") => string number
[4525] Fix | Delete
* ```
[4526] Fix | Delete
*
[4527] Fix | Delete
* The signature without the state parameter shipped as CurriedSignature
[4528] Fix | Delete
* is used in the return value of `select( coreStore )`.
[4529] Fix | Delete
*
[4530] Fix | Delete
* See https://github.com/WordPress/gutenberg/pull/41578 for more details.
[4531] Fix | Delete
*/
[4532] Fix | Delete
[4533] Fix | Delete
/**
[4534] Fix | Delete
* Returns the Entity's record object by key. Returns `null` if the value is not
[4535] Fix | Delete
* yet received, undefined if the value entity is known to not exist, or the
[4536] Fix | Delete
* entity object if it exists and is received.
[4537] Fix | Delete
*
[4538] Fix | Delete
* @param state State tree
[4539] Fix | Delete
* @param kind Entity kind.
[4540] Fix | Delete
* @param name Entity name.
[4541] Fix | Delete
* @param key Record's key
[4542] Fix | Delete
* @param query Optional query. If requesting specific
[4543] Fix | Delete
* fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".
[4544] Fix | Delete
*
[4545] Fix | Delete
* @return Record.
[4546] Fix | Delete
*/
[4547] Fix | Delete
const getEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key, query) => {
[4548] Fix | Delete
var _query$context;
[4549] Fix | Delete
const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
[4550] Fix | Delete
if (!queriedState) {
[4551] Fix | Delete
return undefined;
[4552] Fix | Delete
}
[4553] Fix | Delete
const context = (_query$context = query?.context) !== null && _query$context !== void 0 ? _query$context : 'default';
[4554] Fix | Delete
if (query === undefined) {
[4555] Fix | Delete
// If expecting a complete item, validate that completeness.
[4556] Fix | Delete
if (!queriedState.itemIsComplete[context]?.[key]) {
[4557] Fix | Delete
return undefined;
[4558] Fix | Delete
}
[4559] Fix | Delete
return queriedState.items[context][key];
[4560] Fix | Delete
}
[4561] Fix | Delete
const item = queriedState.items[context]?.[key];
[4562] Fix | Delete
if (item && query._fields) {
[4563] Fix | Delete
var _getNormalizedCommaSe;
[4564] Fix | Delete
const filteredItem = {};
[4565] Fix | Delete
const fields = (_getNormalizedCommaSe = get_normalized_comma_separable(query._fields)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
[4566] Fix | Delete
for (let f = 0; f < fields.length; f++) {
[4567] Fix | Delete
const field = fields[f].split('.');
[4568] Fix | Delete
let value = item;
[4569] Fix | Delete
field.forEach(fieldName => {
[4570] Fix | Delete
value = value?.[fieldName];
[4571] Fix | Delete
});
[4572] Fix | Delete
setNestedValue(filteredItem, field, value);
[4573] Fix | Delete
}
[4574] Fix | Delete
return filteredItem;
[4575] Fix | Delete
}
[4576] Fix | Delete
return item;
[4577] Fix | Delete
}, (state, kind, name, recordId, query) => {
[4578] Fix | Delete
var _query$context2;
[4579] Fix | Delete
const context = (_query$context2 = query?.context) !== null && _query$context2 !== void 0 ? _query$context2 : 'default';
[4580] Fix | Delete
return [state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]];
[4581] Fix | Delete
});
[4582] Fix | Delete
[4583] Fix | Delete
/**
[4584] Fix | Delete
* Normalizes `recordKey`s that look like numeric IDs to numbers.
[4585] Fix | Delete
*
[4586] Fix | Delete
* @param args EntityRecordArgs the selector arguments.
[4587] Fix | Delete
* @return EntityRecordArgs the normalized arguments.
[4588] Fix | Delete
*/
[4589] Fix | Delete
getEntityRecord.__unstableNormalizeArgs = args => {
[4590] Fix | Delete
const newArgs = [...args];
[4591] Fix | Delete
const recordKey = newArgs?.[2];
[4592] Fix | Delete
[4593] Fix | Delete
// If recordKey looks to be a numeric ID then coerce to number.
[4594] Fix | Delete
newArgs[2] = isNumericID(recordKey) ? Number(recordKey) : recordKey;
[4595] Fix | Delete
return newArgs;
[4596] Fix | Delete
};
[4597] Fix | Delete
[4598] Fix | Delete
/**
[4599] Fix | Delete
* Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.
[4600] Fix | Delete
*
[4601] Fix | Delete
* @param state State tree
[4602] Fix | Delete
* @param kind Entity kind.
[4603] Fix | Delete
* @param name Entity name.
[4604] Fix | Delete
* @param key Record's key
[4605] Fix | Delete
*
[4606] Fix | Delete
* @return Record.
[4607] Fix | Delete
*/
[4608] Fix | Delete
function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
[4609] Fix | Delete
return getEntityRecord(state, kind, name, key);
[4610] Fix | Delete
}
[4611] Fix | Delete
[4612] Fix | Delete
/**
[4613] Fix | Delete
* Returns the entity's record object by key,
[4614] Fix | Delete
* with its attributes mapped to their raw values.
[4615] Fix | Delete
*
[4616] Fix | Delete
* @param state State tree.
[4617] Fix | Delete
* @param kind Entity kind.
[4618] Fix | Delete
* @param name Entity name.
[4619] Fix | Delete
* @param key Record's key.
[4620] Fix | Delete
*
[4621] Fix | Delete
* @return Object with the entity's raw attributes.
[4622] Fix | Delete
*/
[4623] Fix | Delete
const getRawEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key) => {
[4624] Fix | Delete
const record = getEntityRecord(state, kind, name, key);
[4625] Fix | Delete
return record && Object.keys(record).reduce((accumulator, _key) => {
[4626] Fix | Delete
if (isRawAttribute(getEntityConfig(state, kind, name), _key)) {
[4627] Fix | Delete
var _record$_key$raw;
[4628] Fix | Delete
// Because edits are the "raw" attribute values,
[4629] Fix | Delete
// we return those from record selectors to make rendering,
[4630] Fix | Delete
// comparisons, and joins with edits easier.
[4631] Fix | Delete
accumulator[_key] = (_record$_key$raw = record[_key]?.raw) !== null && _record$_key$raw !== void 0 ? _record$_key$raw : record[_key];
[4632] Fix | Delete
} else {
[4633] Fix | Delete
accumulator[_key] = record[_key];
[4634] Fix | Delete
}
[4635] Fix | Delete
return accumulator;
[4636] Fix | Delete
}, {});
[4637] Fix | Delete
}, (state, kind, name, recordId, query) => {
[4638] Fix | Delete
var _query$context3;
[4639] Fix | Delete
const context = (_query$context3 = query?.context) !== null && _query$context3 !== void 0 ? _query$context3 : 'default';
[4640] Fix | Delete
return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]];
[4641] Fix | Delete
});
[4642] Fix | Delete
[4643] Fix | Delete
/**
[4644] Fix | Delete
* Returns true if records have been received for the given set of parameters,
[4645] Fix | Delete
* or false otherwise.
[4646] Fix | Delete
*
[4647] Fix | Delete
* @param state State tree
[4648] Fix | Delete
* @param kind Entity kind.
[4649] Fix | Delete
* @param name Entity name.
[4650] Fix | Delete
* @param query Optional terms query. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
[4651] Fix | Delete
*
[4652] Fix | Delete
* @return Whether entity records have been received.
[4653] Fix | Delete
*/
[4654] Fix | Delete
function hasEntityRecords(state, kind, name, query) {
[4655] Fix | Delete
return Array.isArray(getEntityRecords(state, kind, name, query));
[4656] Fix | Delete
}
[4657] Fix | Delete
[4658] Fix | Delete
/**
[4659] Fix | Delete
* GetEntityRecord is declared as a *callable interface* with
[4660] Fix | Delete
* two signatures to work around the fact that TypeScript doesn't
[4661] Fix | Delete
* allow currying generic functions.
[4662] Fix | Delete
*
[4663] Fix | Delete
* @see GetEntityRecord
[4664] Fix | Delete
* @see https://github.com/WordPress/gutenberg/pull/41578
[4665] Fix | Delete
*/
[4666] Fix | Delete
[4667] Fix | Delete
/**
[4668] Fix | Delete
* Returns the Entity's records.
[4669] Fix | Delete
*
[4670] Fix | Delete
* @param state State tree
[4671] Fix | Delete
* @param kind Entity kind.
[4672] Fix | Delete
* @param name Entity name.
[4673] Fix | Delete
* @param query Optional terms query. If requesting specific
[4674] Fix | Delete
* fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
[4675] Fix | Delete
*
[4676] Fix | Delete
* @return Records.
[4677] Fix | Delete
*/
[4678] Fix | Delete
const getEntityRecords = (state, kind, name, query) => {
[4679] Fix | Delete
// Queried data state is prepopulated for all known entities. If this is not
[4680] Fix | Delete
// assigned for the given parameters, then it is known to not exist.
[4681] Fix | Delete
const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
[4682] Fix | Delete
if (!queriedState) {
[4683] Fix | Delete
return null;
[4684] Fix | Delete
}
[4685] Fix | Delete
return getQueriedItems(queriedState, query);
[4686] Fix | Delete
};
[4687] Fix | Delete
[4688] Fix | Delete
/**
[4689] Fix | Delete
* Returns the Entity's total available records for a given query (ignoring pagination).
[4690] Fix | Delete
*
[4691] Fix | Delete
* @param state State tree
[4692] Fix | Delete
* @param kind Entity kind.
[4693] Fix | Delete
* @param name Entity name.
[4694] Fix | Delete
* @param query Optional terms query. If requesting specific
[4695] Fix | Delete
* fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
[4696] Fix | Delete
*
[4697] Fix | Delete
* @return number | null.
[4698] Fix | Delete
*/
[4699] Fix | Delete
const getEntityRecordsTotalItems = (state, kind, name, query) => {
[4700] Fix | Delete
// Queried data state is prepopulated for all known entities. If this is not
[4701] Fix | Delete
// assigned for the given parameters, then it is known to not exist.
[4702] Fix | Delete
const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
[4703] Fix | Delete
if (!queriedState) {
[4704] Fix | Delete
return null;
[4705] Fix | Delete
}
[4706] Fix | Delete
return getQueriedTotalItems(queriedState, query);
[4707] Fix | Delete
};
[4708] Fix | Delete
[4709] Fix | Delete
/**
[4710] Fix | Delete
* Returns the number of available pages for the given query.
[4711] Fix | Delete
*
[4712] Fix | Delete
* @param state State tree
[4713] Fix | Delete
* @param kind Entity kind.
[4714] Fix | Delete
* @param name Entity name.
[4715] Fix | Delete
* @param query Optional terms query. If requesting specific
[4716] Fix | Delete
* fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
[4717] Fix | Delete
*
[4718] Fix | Delete
* @return number | null.
[4719] Fix | Delete
*/
[4720] Fix | Delete
const getEntityRecordsTotalPages = (state, kind, name, query) => {
[4721] Fix | Delete
// Queried data state is prepopulated for all known entities. If this is not
[4722] Fix | Delete
// assigned for the given parameters, then it is known to not exist.
[4723] Fix | Delete
const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
[4724] Fix | Delete
if (!queriedState) {
[4725] Fix | Delete
return null;
[4726] Fix | Delete
}
[4727] Fix | Delete
if (query.per_page === -1) {
[4728] Fix | Delete
return 1;
[4729] Fix | Delete
}
[4730] Fix | Delete
const totalItems = getQueriedTotalItems(queriedState, query);
[4731] Fix | Delete
if (!totalItems) {
[4732] Fix | Delete
return totalItems;
[4733] Fix | Delete
}
[4734] Fix | Delete
// If `per_page` is not set and the query relies on the defaults of the
[4735] Fix | Delete
// REST endpoint, get the info from query's meta.
[4736] Fix | Delete
if (!query.per_page) {
[4737] Fix | Delete
return getQueriedTotalPages(queriedState, query);
[4738] Fix | Delete
}
[4739] Fix | Delete
return Math.ceil(totalItems / query.per_page);
[4740] Fix | Delete
};
[4741] Fix | Delete
/**
[4742] Fix | Delete
* Returns the list of dirty entity records.
[4743] Fix | Delete
*
[4744] Fix | Delete
* @param state State tree.
[4745] Fix | Delete
*
[4746] Fix | Delete
* @return The list of updated records
[4747] Fix | Delete
*/
[4748] Fix | Delete
const __experimentalGetDirtyEntityRecords = (0,external_wp_data_namespaceObject.createSelector)(state => {
[4749] Fix | Delete
const {
[4750] Fix | Delete
entities: {
[4751] Fix | Delete
records
[4752] Fix | Delete
}
[4753] Fix | Delete
} = state;
[4754] Fix | Delete
const dirtyRecords = [];
[4755] Fix | Delete
Object.keys(records).forEach(kind => {
[4756] Fix | Delete
Object.keys(records[kind]).forEach(name => {
[4757] Fix | Delete
const primaryKeys = Object.keys(records[kind][name].edits).filter(primaryKey =>
[4758] Fix | Delete
// The entity record must exist (not be deleted),
[4759] Fix | Delete
// and it must have edits.
[4760] Fix | Delete
getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
[4761] Fix | Delete
if (primaryKeys.length) {
[4762] Fix | Delete
const entityConfig = getEntityConfig(state, kind, name);
[4763] Fix | Delete
primaryKeys.forEach(primaryKey => {
[4764] Fix | Delete
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
[4765] Fix | Delete
dirtyRecords.push({
[4766] Fix | Delete
// We avoid using primaryKey because it's transformed into a string
[4767] Fix | Delete
// when it's used as an object key.
[4768] Fix | Delete
key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined,
[4769] Fix | Delete
title: entityConfig?.getTitle?.(entityRecord) || '',
[4770] Fix | Delete
name,
[4771] Fix | Delete
kind
[4772] Fix | Delete
});
[4773] Fix | Delete
});
[4774] Fix | Delete
}
[4775] Fix | Delete
});
[4776] Fix | Delete
});
[4777] Fix | Delete
return dirtyRecords;
[4778] Fix | Delete
}, state => [state.entities.records]);
[4779] Fix | Delete
[4780] Fix | Delete
/**
[4781] Fix | Delete
* Returns the list of entities currently being saved.
[4782] Fix | Delete
*
[4783] Fix | Delete
* @param state State tree.
[4784] Fix | Delete
*
[4785] Fix | Delete
* @return The list of records being saved.
[4786] Fix | Delete
*/
[4787] Fix | Delete
const __experimentalGetEntitiesBeingSaved = (0,external_wp_data_namespaceObject.createSelector)(state => {
[4788] Fix | Delete
const {
[4789] Fix | Delete
entities: {
[4790] Fix | Delete
records
[4791] Fix | Delete
}
[4792] Fix | Delete
} = state;
[4793] Fix | Delete
const recordsBeingSaved = [];
[4794] Fix | Delete
Object.keys(records).forEach(kind => {
[4795] Fix | Delete
Object.keys(records[kind]).forEach(name => {
[4796] Fix | Delete
const primaryKeys = Object.keys(records[kind][name].saving).filter(primaryKey => isSavingEntityRecord(state, kind, name, primaryKey));
[4797] Fix | Delete
if (primaryKeys.length) {
[4798] Fix | Delete
const entityConfig = getEntityConfig(state, kind, name);
[4799] Fix | Delete
primaryKeys.forEach(primaryKey => {
[4800] Fix | Delete
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
[4801] Fix | Delete
recordsBeingSaved.push({
[4802] Fix | Delete
// We avoid using primaryKey because it's transformed into a string
[4803] Fix | Delete
// when it's used as an object key.
[4804] Fix | Delete
key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined,
[4805] Fix | Delete
title: entityConfig?.getTitle?.(entityRecord) || '',
[4806] Fix | Delete
name,
[4807] Fix | Delete
kind
[4808] Fix | Delete
});
[4809] Fix | Delete
});
[4810] Fix | Delete
}
[4811] Fix | Delete
});
[4812] Fix | Delete
});
[4813] Fix | Delete
return recordsBeingSaved;
[4814] Fix | Delete
}, state => [state.entities.records]);
[4815] Fix | Delete
[4816] Fix | Delete
/**
[4817] Fix | Delete
* Returns the specified entity record's edits.
[4818] Fix | Delete
*
[4819] Fix | Delete
* @param state State tree.
[4820] Fix | Delete
* @param kind Entity kind.
[4821] Fix | Delete
* @param name Entity name.
[4822] Fix | Delete
* @param recordId Record ID.
[4823] Fix | Delete
*
[4824] Fix | Delete
* @return The entity record's edits.
[4825] Fix | Delete
*/
[4826] Fix | Delete
function getEntityRecordEdits(state, kind, name, recordId) {
[4827] Fix | Delete
return state.entities.records?.[kind]?.[name]?.edits?.[recordId];
[4828] Fix | Delete
}
[4829] Fix | Delete
[4830] Fix | Delete
/**
[4831] Fix | Delete
* Returns the specified entity record's non transient edits.
[4832] Fix | Delete
*
[4833] Fix | Delete
* Transient edits don't create an undo level, and
[4834] Fix | Delete
* are not considered for change detection.
[4835] Fix | Delete
* They are defined in the entity's config.
[4836] Fix | Delete
*
[4837] Fix | Delete
* @param state State tree.
[4838] Fix | Delete
* @param kind Entity kind.
[4839] Fix | Delete
* @param name Entity name.
[4840] Fix | Delete
* @param recordId Record ID.
[4841] Fix | Delete
*
[4842] Fix | Delete
* @return The entity record's non transient edits.
[4843] Fix | Delete
*/
[4844] Fix | Delete
const getEntityRecordNonTransientEdits = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => {
[4845] Fix | Delete
const {
[4846] Fix | Delete
transientEdits
[4847] Fix | Delete
} = getEntityConfig(state, kind, name) || {};
[4848] Fix | Delete
const edits = getEntityRecordEdits(state, kind, name, recordId) || {};
[4849] Fix | Delete
if (!transientEdits) {
[4850] Fix | Delete
return edits;
[4851] Fix | Delete
}
[4852] Fix | Delete
return Object.keys(edits).reduce((acc, key) => {
[4853] Fix | Delete
if (!transientEdits[key]) {
[4854] Fix | Delete
acc[key] = edits[key];
[4855] Fix | Delete
}
[4856] Fix | Delete
return acc;
[4857] Fix | Delete
}, {});
[4858] Fix | Delete
}, (state, kind, name, recordId) => [state.entities.config, state.entities.records?.[kind]?.[name]?.edits?.[recordId]]);
[4859] Fix | Delete
[4860] Fix | Delete
/**
[4861] Fix | Delete
* Returns true if the specified entity record has edits,
[4862] Fix | Delete
* and false otherwise.
[4863] Fix | Delete
*
[4864] Fix | Delete
* @param state State tree.
[4865] Fix | Delete
* @param kind Entity kind.
[4866] Fix | Delete
* @param name Entity name.
[4867] Fix | Delete
* @param recordId Record ID.
[4868] Fix | Delete
*
[4869] Fix | Delete
* @return Whether the entity record has edits or not.
[4870] Fix | Delete
*/
[4871] Fix | Delete
function hasEditsForEntityRecord(state, kind, name, recordId) {
[4872] Fix | Delete
return isSavingEntityRecord(state, kind, name, recordId) || Object.keys(getEntityRecordNonTransientEdits(state, kind, name, recordId)).length > 0;
[4873] Fix | Delete
}
[4874] Fix | Delete
[4875] Fix | Delete
/**
[4876] Fix | Delete
* Returns the specified entity record, merged with its edits.
[4877] Fix | Delete
*
[4878] Fix | Delete
* @param state State tree.
[4879] Fix | Delete
* @param kind Entity kind.
[4880] Fix | Delete
* @param name Entity name.
[4881] Fix | Delete
* @param recordId Record ID.
[4882] Fix | Delete
*
[4883] Fix | Delete
* @return The entity record, merged with its edits.
[4884] Fix | Delete
*/
[4885] Fix | Delete
const getEditedEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => {
[4886] Fix | Delete
const raw = getRawEntityRecord(state, kind, name, recordId);
[4887] Fix | Delete
const edited = getEntityRecordEdits(state, kind, name, recordId);
[4888] Fix | Delete
// Never return a non-falsy empty object. Unfortunately we can't return
[4889] Fix | Delete
// undefined or null because we were previously returning an empty
[4890] Fix | Delete
// object, so trying to read properties from the result would throw.
[4891] Fix | Delete
// Using false here is a workaround to avoid breaking changes.
[4892] Fix | Delete
if (!raw && !edited) {
[4893] Fix | Delete
return false;
[4894] Fix | Delete
}
[4895] Fix | Delete
return {
[4896] Fix | Delete
...raw,
[4897] Fix | Delete
...edited
[4898] Fix | Delete
};
[4899] Fix | Delete
}, (state, kind, name, recordId, query) => {
[4900] Fix | Delete
var _query$context4;
[4901] Fix | Delete
const context = (_query$context4 = query?.context) !== null && _query$context4 !== void 0 ? _query$context4 : 'default';
[4902] Fix | Delete
return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData.itemIsComplete[context]?.[recordId], state.entities.records?.[kind]?.[name]?.edits?.[recordId]];
[4903] Fix | Delete
});
[4904] Fix | Delete
[4905] Fix | Delete
/**
[4906] Fix | Delete
* Returns true if the specified entity record is autosaving, and false otherwise.
[4907] Fix | Delete
*
[4908] Fix | Delete
* @param state State tree.
[4909] Fix | Delete
* @param kind Entity kind.
[4910] Fix | Delete
* @param name Entity name.
[4911] Fix | Delete
* @param recordId Record ID.
[4912] Fix | Delete
*
[4913] Fix | Delete
* @return Whether the entity record is autosaving or not.
[4914] Fix | Delete
*/
[4915] Fix | Delete
function isAutosavingEntityRecord(state, kind, name, recordId) {
[4916] Fix | Delete
var _state$entities$recor;
[4917] Fix | Delete
const {
[4918] Fix | Delete
pending,
[4919] Fix | Delete
isAutosave
[4920] Fix | Delete
} = (_state$entities$recor = state.entities.records?.[kind]?.[name]?.saving?.[recordId]) !== null && _state$entities$recor !== void 0 ? _state$entities$recor : {};
[4921] Fix | Delete
return Boolean(pending && isAutosave);
[4922] Fix | Delete
}
[4923] Fix | Delete
[4924] Fix | Delete
/**
[4925] Fix | Delete
* Returns true if the specified entity record is saving, and false otherwise.
[4926] Fix | Delete
*
[4927] Fix | Delete
* @param state State tree.
[4928] Fix | Delete
* @param kind Entity kind.
[4929] Fix | Delete
* @param name Entity name.
[4930] Fix | Delete
* @param recordId Record ID.
[4931] Fix | Delete
*
[4932] Fix | Delete
* @return Whether the entity record is saving or not.
[4933] Fix | Delete
*/
[4934] Fix | Delete
function isSavingEntityRecord(state, kind, name, recordId) {
[4935] Fix | Delete
var _state$entities$recor2;
[4936] Fix | Delete
return (_state$entities$recor2 = state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.pending) !== null && _state$entities$recor2 !== void 0 ? _state$entities$recor2 : false;
[4937] Fix | Delete
}
[4938] Fix | Delete
[4939] Fix | Delete
/**
[4940] Fix | Delete
* Returns true if the specified entity record is deleting, and false otherwise.
[4941] Fix | Delete
*
[4942] Fix | Delete
* @param state State tree.
[4943] Fix | Delete
* @param kind Entity kind.
[4944] Fix | Delete
* @param name Entity name.
[4945] Fix | Delete
* @param recordId Record ID.
[4946] Fix | Delete
*
[4947] Fix | Delete
* @return Whether the entity record is deleting or not.
[4948] Fix | Delete
*/
[4949] Fix | Delete
function isDeletingEntityRecord(state, kind, name, recordId) {
[4950] Fix | Delete
var _state$entities$recor3;
[4951] Fix | Delete
return (_state$entities$recor3 = state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.pending) !== null && _state$entities$recor3 !== void 0 ? _state$entities$recor3 : false;
[4952] Fix | Delete
}
[4953] Fix | Delete
[4954] Fix | Delete
/**
[4955] Fix | Delete
* Returns the specified entity record's last save error.
[4956] Fix | Delete
*
[4957] Fix | Delete
* @param state State tree.
[4958] Fix | Delete
* @param kind Entity kind.
[4959] Fix | Delete
* @param name Entity name.
[4960] Fix | Delete
* @param recordId Record ID.
[4961] Fix | Delete
*
[4962] Fix | Delete
* @return The entity record's save error.
[4963] Fix | Delete
*/
[4964] Fix | Delete
function getLastEntitySaveError(state, kind, name, recordId) {
[4965] Fix | Delete
return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.error;
[4966] Fix | Delete
}
[4967] Fix | Delete
[4968] Fix | Delete
/**
[4969] Fix | Delete
* Returns the specified entity record's last delete error.
[4970] Fix | Delete
*
[4971] Fix | Delete
* @param state State tree.
[4972] Fix | Delete
* @param kind Entity kind.
[4973] Fix | Delete
* @param name Entity name.
[4974] Fix | Delete
* @param recordId Record ID.
[4975] Fix | Delete
*
[4976] Fix | Delete
* @return The entity record's save error.
[4977] Fix | Delete
*/
[4978] Fix | Delete
function getLastEntityDeleteError(state, kind, name, recordId) {
[4979] Fix | Delete
return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.error;
[4980] Fix | Delete
}
[4981] Fix | Delete
[4982] Fix | Delete
/**
[4983] Fix | Delete
* Returns the previous edit from the current undo offset
[4984] Fix | Delete
* for the entity records edits history, if any.
[4985] Fix | Delete
*
[4986] Fix | Delete
* @deprecated since 6.3
[4987] Fix | Delete
*
[4988] Fix | Delete
* @param state State tree.
[4989] Fix | Delete
*
[4990] Fix | Delete
* @return The edit.
[4991] Fix | Delete
*/
[4992] Fix | Delete
function getUndoEdit(state) {
[4993] Fix | Delete
external_wp_deprecated_default()("select( 'core' ).getUndoEdit()", {
[4994] Fix | Delete
since: '6.3'
[4995] Fix | Delete
});
[4996] Fix | Delete
return undefined;
[4997] Fix | Delete
}
[4998] Fix | Delete
[4999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function