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: editor.js
/**
[4000] Fix | Delete
* Returns the default template part areas.
[4001] Fix | Delete
*
[4002] Fix | Delete
* @param {Object} state Global application state.
[4003] Fix | Delete
*
[4004] Fix | Delete
* @return {Array} The template part areas.
[4005] Fix | Delete
*/
[4006] Fix | Delete
const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createSelector)(state => {
[4007] Fix | Delete
var _getEditorSettings$de;
[4008] Fix | Delete
const areas = (_getEditorSettings$de = getEditorSettings(state)?.defaultTemplatePartAreas) !== null && _getEditorSettings$de !== void 0 ? _getEditorSettings$de : [];
[4009] Fix | Delete
return areas.map(item => {
[4010] Fix | Delete
return {
[4011] Fix | Delete
...item,
[4012] Fix | Delete
icon: getTemplatePartIcon(item.icon)
[4013] Fix | Delete
};
[4014] Fix | Delete
});
[4015] Fix | Delete
}, state => [getEditorSettings(state)?.defaultTemplatePartAreas]);
[4016] Fix | Delete
[4017] Fix | Delete
/**
[4018] Fix | Delete
* Returns a default template type searched by slug.
[4019] Fix | Delete
*
[4020] Fix | Delete
* @param {Object} state Global application state.
[4021] Fix | Delete
* @param {string} slug The template type slug.
[4022] Fix | Delete
*
[4023] Fix | Delete
* @return {Object} The template type.
[4024] Fix | Delete
*/
[4025] Fix | Delete
const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createSelector)((state, slug) => {
[4026] Fix | Delete
var _Object$values$find;
[4027] Fix | Delete
const templateTypes = __experimentalGetDefaultTemplateTypes(state);
[4028] Fix | Delete
if (!templateTypes) {
[4029] Fix | Delete
return EMPTY_OBJECT;
[4030] Fix | Delete
}
[4031] Fix | Delete
return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
[4032] Fix | Delete
}, state => [__experimentalGetDefaultTemplateTypes(state)]);
[4033] Fix | Delete
[4034] Fix | Delete
/**
[4035] Fix | Delete
* Given a template entity, return information about it which is ready to be
[4036] Fix | Delete
* rendered, such as the title, description, and icon.
[4037] Fix | Delete
*
[4038] Fix | Delete
* @param {Object} state Global application state.
[4039] Fix | Delete
* @param {Object} template The template for which we need information.
[4040] Fix | Delete
* @return {Object} Information about the template, including title, description, and icon.
[4041] Fix | Delete
*/
[4042] Fix | Delete
const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createSelector)((state, template) => {
[4043] Fix | Delete
if (!template) {
[4044] Fix | Delete
return EMPTY_OBJECT;
[4045] Fix | Delete
}
[4046] Fix | Delete
const {
[4047] Fix | Delete
description,
[4048] Fix | Delete
slug,
[4049] Fix | Delete
title,
[4050] Fix | Delete
area
[4051] Fix | Delete
} = template;
[4052] Fix | Delete
const {
[4053] Fix | Delete
title: defaultTitle,
[4054] Fix | Delete
description: defaultDescription
[4055] Fix | Delete
} = __experimentalGetDefaultTemplateType(state, slug);
[4056] Fix | Delete
const templateTitle = typeof title === 'string' ? title : title?.rendered;
[4057] Fix | Delete
const templateDescription = typeof description === 'string' ? description : description?.raw;
[4058] Fix | Delete
const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || library_layout;
[4059] Fix | Delete
return {
[4060] Fix | Delete
title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
[4061] Fix | Delete
description: templateDescription || defaultDescription,
[4062] Fix | Delete
icon: templateIcon
[4063] Fix | Delete
};
[4064] Fix | Delete
}, state => [__experimentalGetDefaultTemplateTypes(state), __experimentalGetDefaultTemplatePartAreas(state)]);
[4065] Fix | Delete
[4066] Fix | Delete
/**
[4067] Fix | Delete
* Returns a post type label depending on the current post.
[4068] Fix | Delete
*
[4069] Fix | Delete
* @param {Object} state Global application state.
[4070] Fix | Delete
*
[4071] Fix | Delete
* @return {string|undefined} The post type label if available, otherwise undefined.
[4072] Fix | Delete
*/
[4073] Fix | Delete
const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
[4074] Fix | Delete
const currentPostType = getCurrentPostType(state);
[4075] Fix | Delete
const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType);
[4076] Fix | Delete
// Disable reason: Post type labels object is shaped like this.
[4077] Fix | Delete
// eslint-disable-next-line camelcase
[4078] Fix | Delete
return postType?.labels?.singular_name;
[4079] Fix | Delete
});
[4080] Fix | Delete
[4081] Fix | Delete
/**
[4082] Fix | Delete
* Returns true if the publish sidebar is opened.
[4083] Fix | Delete
*
[4084] Fix | Delete
* @param {Object} state Global application state
[4085] Fix | Delete
*
[4086] Fix | Delete
* @return {boolean} Whether the publish sidebar is open.
[4087] Fix | Delete
*/
[4088] Fix | Delete
function isPublishSidebarOpened(state) {
[4089] Fix | Delete
return state.publishSidebarActive;
[4090] Fix | Delete
}
[4091] Fix | Delete
[4092] Fix | Delete
;// CONCATENATED MODULE: external ["wp","a11y"]
[4093] Fix | Delete
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
[4094] Fix | Delete
;// CONCATENATED MODULE: external ["wp","apiFetch"]
[4095] Fix | Delete
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
[4096] Fix | Delete
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
[4097] Fix | Delete
;// CONCATENATED MODULE: external ["wp","notices"]
[4098] Fix | Delete
const external_wp_notices_namespaceObject = window["wp"]["notices"];
[4099] Fix | Delete
;// CONCATENATED MODULE: external ["wp","hooks"]
[4100] Fix | Delete
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
[4101] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js
[4102] Fix | Delete
/**
[4103] Fix | Delete
* Function returning a sessionStorage key to set or retrieve a given post's
[4104] Fix | Delete
* automatic session backup.
[4105] Fix | Delete
*
[4106] Fix | Delete
* Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
[4107] Fix | Delete
* `loggedout` handler can clear sessionStorage of any user-private content.
[4108] Fix | Delete
*
[4109] Fix | Delete
* @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
[4110] Fix | Delete
*
[4111] Fix | Delete
* @param {string} postId Post ID.
[4112] Fix | Delete
* @param {boolean} isPostNew Whether post new.
[4113] Fix | Delete
*
[4114] Fix | Delete
* @return {string} sessionStorage key
[4115] Fix | Delete
*/
[4116] Fix | Delete
function postKey(postId, isPostNew) {
[4117] Fix | Delete
return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
[4118] Fix | Delete
}
[4119] Fix | Delete
function localAutosaveGet(postId, isPostNew) {
[4120] Fix | Delete
return window.sessionStorage.getItem(postKey(postId, isPostNew));
[4121] Fix | Delete
}
[4122] Fix | Delete
function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
[4123] Fix | Delete
window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
[4124] Fix | Delete
post_title: title,
[4125] Fix | Delete
content,
[4126] Fix | Delete
excerpt
[4127] Fix | Delete
}));
[4128] Fix | Delete
}
[4129] Fix | Delete
function localAutosaveClear(postId, isPostNew) {
[4130] Fix | Delete
window.sessionStorage.removeItem(postKey(postId, isPostNew));
[4131] Fix | Delete
}
[4132] Fix | Delete
[4133] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
[4134] Fix | Delete
/**
[4135] Fix | Delete
* WordPress dependencies
[4136] Fix | Delete
*/
[4137] Fix | Delete
[4138] Fix | Delete
[4139] Fix | Delete
/**
[4140] Fix | Delete
* Internal dependencies
[4141] Fix | Delete
*/
[4142] Fix | Delete
[4143] Fix | Delete
[4144] Fix | Delete
/**
[4145] Fix | Delete
* Builds the arguments for a success notification dispatch.
[4146] Fix | Delete
*
[4147] Fix | Delete
* @param {Object} data Incoming data to build the arguments from.
[4148] Fix | Delete
*
[4149] Fix | Delete
* @return {Array} Arguments for dispatch. An empty array signals no
[4150] Fix | Delete
* notification should be sent.
[4151] Fix | Delete
*/
[4152] Fix | Delete
function getNotificationArgumentsForSaveSuccess(data) {
[4153] Fix | Delete
var _postType$viewable;
[4154] Fix | Delete
const {
[4155] Fix | Delete
previousPost,
[4156] Fix | Delete
post,
[4157] Fix | Delete
postType
[4158] Fix | Delete
} = data;
[4159] Fix | Delete
// Autosaves are neither shown a notice nor redirected.
[4160] Fix | Delete
if (data.options?.isAutosave) {
[4161] Fix | Delete
return [];
[4162] Fix | Delete
}
[4163] Fix | Delete
const publishStatus = ['publish', 'private', 'future'];
[4164] Fix | Delete
const isPublished = publishStatus.includes(previousPost.status);
[4165] Fix | Delete
const willPublish = publishStatus.includes(post.status);
[4166] Fix | Delete
const willTrash = post.status === 'trash' && previousPost.status !== 'trash';
[4167] Fix | Delete
let noticeMessage;
[4168] Fix | Delete
let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
[4169] Fix | Delete
let isDraft;
[4170] Fix | Delete
[4171] Fix | Delete
// Always should a notice, which will be spoken for accessibility.
[4172] Fix | Delete
if (willTrash) {
[4173] Fix | Delete
noticeMessage = postType.labels.item_trashed;
[4174] Fix | Delete
shouldShowLink = false;
[4175] Fix | Delete
} else if (!isPublished && !willPublish) {
[4176] Fix | Delete
// If saving a non-published post, don't show notice.
[4177] Fix | Delete
noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.');
[4178] Fix | Delete
isDraft = true;
[4179] Fix | Delete
} else if (isPublished && !willPublish) {
[4180] Fix | Delete
// If undoing publish status, show specific notice.
[4181] Fix | Delete
noticeMessage = postType.labels.item_reverted_to_draft;
[4182] Fix | Delete
shouldShowLink = false;
[4183] Fix | Delete
} else if (!isPublished && willPublish) {
[4184] Fix | Delete
// If publishing or scheduling a post, show the corresponding
[4185] Fix | Delete
// publish message.
[4186] Fix | Delete
noticeMessage = {
[4187] Fix | Delete
publish: postType.labels.item_published,
[4188] Fix | Delete
private: postType.labels.item_published_privately,
[4189] Fix | Delete
future: postType.labels.item_scheduled
[4190] Fix | Delete
}[post.status];
[4191] Fix | Delete
} else {
[4192] Fix | Delete
// Generic fallback notice.
[4193] Fix | Delete
noticeMessage = postType.labels.item_updated;
[4194] Fix | Delete
}
[4195] Fix | Delete
const actions = [];
[4196] Fix | Delete
if (shouldShowLink) {
[4197] Fix | Delete
actions.push({
[4198] Fix | Delete
label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item,
[4199] Fix | Delete
url: post.link
[4200] Fix | Delete
});
[4201] Fix | Delete
}
[4202] Fix | Delete
return [noticeMessage, {
[4203] Fix | Delete
id: SAVE_POST_NOTICE_ID,
[4204] Fix | Delete
type: 'snackbar',
[4205] Fix | Delete
actions
[4206] Fix | Delete
}];
[4207] Fix | Delete
}
[4208] Fix | Delete
[4209] Fix | Delete
/**
[4210] Fix | Delete
* Builds the fail notification arguments for dispatch.
[4211] Fix | Delete
*
[4212] Fix | Delete
* @param {Object} data Incoming data to build the arguments with.
[4213] Fix | Delete
*
[4214] Fix | Delete
* @return {Array} Arguments for dispatch. An empty array signals no
[4215] Fix | Delete
* notification should be sent.
[4216] Fix | Delete
*/
[4217] Fix | Delete
function getNotificationArgumentsForSaveFail(data) {
[4218] Fix | Delete
const {
[4219] Fix | Delete
post,
[4220] Fix | Delete
edits,
[4221] Fix | Delete
error
[4222] Fix | Delete
} = data;
[4223] Fix | Delete
if (error && 'rest_autosave_no_changes' === error.code) {
[4224] Fix | Delete
// Autosave requested a new autosave, but there were no changes. This shouldn't
[4225] Fix | Delete
// result in an error notice for the user.
[4226] Fix | Delete
return [];
[4227] Fix | Delete
}
[4228] Fix | Delete
const publishStatus = ['publish', 'private', 'future'];
[4229] Fix | Delete
const isPublished = publishStatus.indexOf(post.status) !== -1;
[4230] Fix | Delete
// If the post was being published, we show the corresponding publish error message
[4231] Fix | Delete
// Unless we publish an "updating failed" message.
[4232] Fix | Delete
const messages = {
[4233] Fix | Delete
publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
[4234] Fix | Delete
private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
[4235] Fix | Delete
future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.')
[4236] Fix | Delete
};
[4237] Fix | Delete
let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.');
[4238] Fix | Delete
[4239] Fix | Delete
// Check if message string contains HTML. Notice text is currently only
[4240] Fix | Delete
// supported as plaintext, and stripping the tags may muddle the meaning.
[4241] Fix | Delete
if (error.message && !/<\/?[^>]*>/.test(error.message)) {
[4242] Fix | Delete
noticeMessage = [noticeMessage, error.message].join(' ');
[4243] Fix | Delete
}
[4244] Fix | Delete
return [noticeMessage, {
[4245] Fix | Delete
id: SAVE_POST_NOTICE_ID
[4246] Fix | Delete
}];
[4247] Fix | Delete
}
[4248] Fix | Delete
[4249] Fix | Delete
/**
[4250] Fix | Delete
* Builds the trash fail notification arguments for dispatch.
[4251] Fix | Delete
*
[4252] Fix | Delete
* @param {Object} data
[4253] Fix | Delete
*
[4254] Fix | Delete
* @return {Array} Arguments for dispatch.
[4255] Fix | Delete
*/
[4256] Fix | Delete
function getNotificationArgumentsForTrashFail(data) {
[4257] Fix | Delete
return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), {
[4258] Fix | Delete
id: TRASH_POST_NOTICE_ID
[4259] Fix | Delete
}];
[4260] Fix | Delete
}
[4261] Fix | Delete
[4262] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
[4263] Fix | Delete
/**
[4264] Fix | Delete
* WordPress dependencies
[4265] Fix | Delete
*/
[4266] Fix | Delete
[4267] Fix | Delete
[4268] Fix | Delete
[4269] Fix | Delete
[4270] Fix | Delete
[4271] Fix | Delete
[4272] Fix | Delete
[4273] Fix | Delete
[4274] Fix | Delete
[4275] Fix | Delete
[4276] Fix | Delete
[4277] Fix | Delete
/**
[4278] Fix | Delete
* Internal dependencies
[4279] Fix | Delete
*/
[4280] Fix | Delete
[4281] Fix | Delete
[4282] Fix | Delete
[4283] Fix | Delete
[4284] Fix | Delete
/**
[4285] Fix | Delete
* Returns an action generator used in signalling that editor has initialized with
[4286] Fix | Delete
* the specified post object and editor settings.
[4287] Fix | Delete
*
[4288] Fix | Delete
* @param {Object} post Post object.
[4289] Fix | Delete
* @param {Object} edits Initial edited attributes object.
[4290] Fix | Delete
* @param {Array?} template Block Template.
[4291] Fix | Delete
*/
[4292] Fix | Delete
const setupEditor = (post, edits, template) => ({
[4293] Fix | Delete
dispatch
[4294] Fix | Delete
}) => {
[4295] Fix | Delete
dispatch.setEditedPost(post.type, post.id);
[4296] Fix | Delete
// Apply a template for new posts only, if exists.
[4297] Fix | Delete
const isNewPost = post.status === 'auto-draft';
[4298] Fix | Delete
if (isNewPost && template) {
[4299] Fix | Delete
// In order to ensure maximum of a single parse during setup, edits are
[4300] Fix | Delete
// included as part of editor setup action. Assume edited content as
[4301] Fix | Delete
// canonical if provided, falling back to post.
[4302] Fix | Delete
let content;
[4303] Fix | Delete
if ('content' in edits) {
[4304] Fix | Delete
content = edits.content;
[4305] Fix | Delete
} else {
[4306] Fix | Delete
content = post.content.raw;
[4307] Fix | Delete
}
[4308] Fix | Delete
let blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
[4309] Fix | Delete
blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
[4310] Fix | Delete
dispatch.resetEditorBlocks(blocks, {
[4311] Fix | Delete
__unstableShouldCreateUndoLevel: false
[4312] Fix | Delete
});
[4313] Fix | Delete
}
[4314] Fix | Delete
if (edits && Object.values(edits).some(([key, edit]) => {
[4315] Fix | Delete
var _post$key$raw;
[4316] Fix | Delete
return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
[4317] Fix | Delete
})) {
[4318] Fix | Delete
dispatch.editPost(edits);
[4319] Fix | Delete
}
[4320] Fix | Delete
};
[4321] Fix | Delete
[4322] Fix | Delete
/**
[4323] Fix | Delete
* Returns an action object signalling that the editor is being destroyed and
[4324] Fix | Delete
* that any necessary state or side-effect cleanup should occur.
[4325] Fix | Delete
*
[4326] Fix | Delete
* @deprecated
[4327] Fix | Delete
*
[4328] Fix | Delete
* @return {Object} Action object.
[4329] Fix | Delete
*/
[4330] Fix | Delete
function __experimentalTearDownEditor() {
[4331] Fix | Delete
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", {
[4332] Fix | Delete
since: '6.5'
[4333] Fix | Delete
});
[4334] Fix | Delete
return {
[4335] Fix | Delete
type: 'DO_NOTHING'
[4336] Fix | Delete
};
[4337] Fix | Delete
}
[4338] Fix | Delete
[4339] Fix | Delete
/**
[4340] Fix | Delete
* Returns an action object used in signalling that the latest version of the
[4341] Fix | Delete
* post has been received, either by initialization or save.
[4342] Fix | Delete
*
[4343] Fix | Delete
* @deprecated Since WordPress 6.0.
[4344] Fix | Delete
*/
[4345] Fix | Delete
function resetPost() {
[4346] Fix | Delete
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", {
[4347] Fix | Delete
since: '6.0',
[4348] Fix | Delete
version: '6.3',
[4349] Fix | Delete
alternative: 'Initialize the editor with the setupEditorState action'
[4350] Fix | Delete
});
[4351] Fix | Delete
return {
[4352] Fix | Delete
type: 'DO_NOTHING'
[4353] Fix | Delete
};
[4354] Fix | Delete
}
[4355] Fix | Delete
[4356] Fix | Delete
/**
[4357] Fix | Delete
* Returns an action object used in signalling that a patch of updates for the
[4358] Fix | Delete
* latest version of the post have been received.
[4359] Fix | Delete
*
[4360] Fix | Delete
* @return {Object} Action object.
[4361] Fix | Delete
* @deprecated since Gutenberg 9.7.0.
[4362] Fix | Delete
*/
[4363] Fix | Delete
function updatePost() {
[4364] Fix | Delete
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
[4365] Fix | Delete
since: '5.7',
[4366] Fix | Delete
alternative: 'Use the core entities store instead'
[4367] Fix | Delete
});
[4368] Fix | Delete
return {
[4369] Fix | Delete
type: 'DO_NOTHING'
[4370] Fix | Delete
};
[4371] Fix | Delete
}
[4372] Fix | Delete
[4373] Fix | Delete
/**
[4374] Fix | Delete
* Setup the editor state.
[4375] Fix | Delete
*
[4376] Fix | Delete
* @deprecated
[4377] Fix | Delete
*
[4378] Fix | Delete
* @param {Object} post Post object.
[4379] Fix | Delete
*/
[4380] Fix | Delete
function setupEditorState(post) {
[4381] Fix | Delete
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", {
[4382] Fix | Delete
since: '6.5',
[4383] Fix | Delete
alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost"
[4384] Fix | Delete
});
[4385] Fix | Delete
return setEditedPost(post.type, post.id);
[4386] Fix | Delete
}
[4387] Fix | Delete
[4388] Fix | Delete
/**
[4389] Fix | Delete
* Returns an action that sets the current post Type and post ID.
[4390] Fix | Delete
*
[4391] Fix | Delete
* @param {string} postType Post Type.
[4392] Fix | Delete
* @param {string} postId Post ID.
[4393] Fix | Delete
*
[4394] Fix | Delete
* @return {Object} Action object.
[4395] Fix | Delete
*/
[4396] Fix | Delete
function setEditedPost(postType, postId) {
[4397] Fix | Delete
return {
[4398] Fix | Delete
type: 'SET_EDITED_POST',
[4399] Fix | Delete
postType,
[4400] Fix | Delete
postId
[4401] Fix | Delete
};
[4402] Fix | Delete
}
[4403] Fix | Delete
[4404] Fix | Delete
/**
[4405] Fix | Delete
* Returns an action object used in signalling that attributes of the post have
[4406] Fix | Delete
* been edited.
[4407] Fix | Delete
*
[4408] Fix | Delete
* @param {Object} edits Post attributes to edit.
[4409] Fix | Delete
* @param {Object} options Options for the edit.
[4410] Fix | Delete
*/
[4411] Fix | Delete
const editPost = (edits, options) => ({
[4412] Fix | Delete
select,
[4413] Fix | Delete
registry
[4414] Fix | Delete
}) => {
[4415] Fix | Delete
const {
[4416] Fix | Delete
id,
[4417] Fix | Delete
type
[4418] Fix | Delete
} = select.getCurrentPost();
[4419] Fix | Delete
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options);
[4420] Fix | Delete
};
[4421] Fix | Delete
[4422] Fix | Delete
/**
[4423] Fix | Delete
* Action for saving the current post in the editor.
[4424] Fix | Delete
*
[4425] Fix | Delete
* @param {Object} options
[4426] Fix | Delete
*/
[4427] Fix | Delete
const savePost = (options = {}) => async ({
[4428] Fix | Delete
select,
[4429] Fix | Delete
dispatch,
[4430] Fix | Delete
registry
[4431] Fix | Delete
}) => {
[4432] Fix | Delete
if (!select.isEditedPostSaveable()) {
[4433] Fix | Delete
return;
[4434] Fix | Delete
}
[4435] Fix | Delete
const content = select.getEditedPostContent();
[4436] Fix | Delete
if (!options.isAutosave) {
[4437] Fix | Delete
dispatch.editPost({
[4438] Fix | Delete
content
[4439] Fix | Delete
}, {
[4440] Fix | Delete
undoIgnore: true
[4441] Fix | Delete
});
[4442] Fix | Delete
}
[4443] Fix | Delete
const previousRecord = select.getCurrentPost();
[4444] Fix | Delete
const edits = {
[4445] Fix | Delete
id: previousRecord.id,
[4446] Fix | Delete
...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
[4447] Fix | Delete
content
[4448] Fix | Delete
};
[4449] Fix | Delete
dispatch({
[4450] Fix | Delete
type: 'REQUEST_POST_UPDATE_START',
[4451] Fix | Delete
options
[4452] Fix | Delete
});
[4453] Fix | Delete
await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options);
[4454] Fix | Delete
let error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
[4455] Fix | Delete
if (!error) {
[4456] Fix | Delete
await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options).catch(err => {
[4457] Fix | Delete
error = err;
[4458] Fix | Delete
});
[4459] Fix | Delete
}
[4460] Fix | Delete
dispatch({
[4461] Fix | Delete
type: 'REQUEST_POST_UPDATE_FINISH',
[4462] Fix | Delete
options
[4463] Fix | Delete
});
[4464] Fix | Delete
if (error) {
[4465] Fix | Delete
const args = getNotificationArgumentsForSaveFail({
[4466] Fix | Delete
post: previousRecord,
[4467] Fix | Delete
edits,
[4468] Fix | Delete
error
[4469] Fix | Delete
});
[4470] Fix | Delete
if (args.length) {
[4471] Fix | Delete
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args);
[4472] Fix | Delete
}
[4473] Fix | Delete
} else {
[4474] Fix | Delete
const updatedRecord = select.getCurrentPost();
[4475] Fix | Delete
const args = getNotificationArgumentsForSaveSuccess({
[4476] Fix | Delete
previousPost: previousRecord,
[4477] Fix | Delete
post: updatedRecord,
[4478] Fix | Delete
postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type),
[4479] Fix | Delete
options
[4480] Fix | Delete
});
[4481] Fix | Delete
if (args.length) {
[4482] Fix | Delete
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args);
[4483] Fix | Delete
}
[4484] Fix | Delete
// Make sure that any edits after saving create an undo level and are
[4485] Fix | Delete
// considered for change detection.
[4486] Fix | Delete
if (!options.isAutosave) {
[4487] Fix | Delete
registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent();
[4488] Fix | Delete
}
[4489] Fix | Delete
}
[4490] Fix | Delete
};
[4491] Fix | Delete
[4492] Fix | Delete
/**
[4493] Fix | Delete
* Action for refreshing the current post.
[4494] Fix | Delete
*
[4495] Fix | Delete
* @deprecated Since WordPress 6.0.
[4496] Fix | Delete
*/
[4497] Fix | Delete
function refreshPost() {
[4498] Fix | Delete
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", {
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function