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
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
[13000] Fix | Delete
/**
[13001] Fix | Delete
* WordPress dependencies
[13002] Fix | Delete
*/
[13003] Fix | Delete
[13004] Fix | Delete
[13005] Fix | Delete
/**
[13006] Fix | Delete
* Internal dependencies
[13007] Fix | Delete
*/
[13008] Fix | Delete
[13009] Fix | Delete
[13010] Fix | Delete
[13011] Fix | Delete
function PostFormatCheck({
[13012] Fix | Delete
children
[13013] Fix | Delete
}) {
[13014] Fix | Delete
const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().disablePostFormats, []);
[13015] Fix | Delete
if (disablePostFormats) {
[13016] Fix | Delete
return null;
[13017] Fix | Delete
}
[13018] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
[13019] Fix | Delete
supportKeys: "post-formats",
[13020] Fix | Delete
children: children
[13021] Fix | Delete
});
[13022] Fix | Delete
}
[13023] Fix | Delete
[13024] Fix | Delete
/**
[13025] Fix | Delete
* Component check if there are any post formats.
[13026] Fix | Delete
*
[13027] Fix | Delete
* @param {Object} props The component props.
[13028] Fix | Delete
* @param {Element} props.children The child elements to render.
[13029] Fix | Delete
*
[13030] Fix | Delete
* @return {Component|null} The rendered component or null if post formats are disabled.
[13031] Fix | Delete
*/
[13032] Fix | Delete
/* harmony default export */ const post_format_check = (PostFormatCheck);
[13033] Fix | Delete
[13034] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
[13035] Fix | Delete
/**
[13036] Fix | Delete
* WordPress dependencies
[13037] Fix | Delete
*/
[13038] Fix | Delete
[13039] Fix | Delete
[13040] Fix | Delete
[13041] Fix | Delete
[13042] Fix | Delete
[13043] Fix | Delete
[13044] Fix | Delete
/**
[13045] Fix | Delete
* Internal dependencies
[13046] Fix | Delete
*/
[13047] Fix | Delete
[13048] Fix | Delete
[13049] Fix | Delete
[13050] Fix | Delete
// All WP post formats, sorted alphabetically by translated name.
[13051] Fix | Delete
[13052] Fix | Delete
[13053] Fix | Delete
const POST_FORMATS = [{
[13054] Fix | Delete
id: 'aside',
[13055] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Aside')
[13056] Fix | Delete
}, {
[13057] Fix | Delete
id: 'audio',
[13058] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Audio')
[13059] Fix | Delete
}, {
[13060] Fix | Delete
id: 'chat',
[13061] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Chat')
[13062] Fix | Delete
}, {
[13063] Fix | Delete
id: 'gallery',
[13064] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Gallery')
[13065] Fix | Delete
}, {
[13066] Fix | Delete
id: 'image',
[13067] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Image')
[13068] Fix | Delete
}, {
[13069] Fix | Delete
id: 'link',
[13070] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Link')
[13071] Fix | Delete
}, {
[13072] Fix | Delete
id: 'quote',
[13073] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Quote')
[13074] Fix | Delete
}, {
[13075] Fix | Delete
id: 'standard',
[13076] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Standard')
[13077] Fix | Delete
}, {
[13078] Fix | Delete
id: 'status',
[13079] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Status')
[13080] Fix | Delete
}, {
[13081] Fix | Delete
id: 'video',
[13082] Fix | Delete
caption: (0,external_wp_i18n_namespaceObject.__)('Video')
[13083] Fix | Delete
}].sort((a, b) => {
[13084] Fix | Delete
const normalizedA = a.caption.toUpperCase();
[13085] Fix | Delete
const normalizedB = b.caption.toUpperCase();
[13086] Fix | Delete
if (normalizedA < normalizedB) {
[13087] Fix | Delete
return -1;
[13088] Fix | Delete
}
[13089] Fix | Delete
if (normalizedA > normalizedB) {
[13090] Fix | Delete
return 1;
[13091] Fix | Delete
}
[13092] Fix | Delete
return 0;
[13093] Fix | Delete
});
[13094] Fix | Delete
[13095] Fix | Delete
/**
[13096] Fix | Delete
* `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.
[13097] Fix | Delete
*
[13098] Fix | Delete
* @example
[13099] Fix | Delete
* ```jsx
[13100] Fix | Delete
* <PostFormat />
[13101] Fix | Delete
* ```
[13102] Fix | Delete
*
[13103] Fix | Delete
* @return {JSX.Element} The rendered PostFormat component.
[13104] Fix | Delete
*/
[13105] Fix | Delete
function PostFormat() {
[13106] Fix | Delete
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat);
[13107] Fix | Delete
const postFormatSelectorId = `post-format-selector-${instanceId}`;
[13108] Fix | Delete
const {
[13109] Fix | Delete
postFormat,
[13110] Fix | Delete
suggestedFormat,
[13111] Fix | Delete
supportedFormats
[13112] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[13113] Fix | Delete
const {
[13114] Fix | Delete
getEditedPostAttribute,
[13115] Fix | Delete
getSuggestedPostFormat
[13116] Fix | Delete
} = select(store_store);
[13117] Fix | Delete
const _postFormat = getEditedPostAttribute('format');
[13118] Fix | Delete
const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
[13119] Fix | Delete
return {
[13120] Fix | Delete
postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
[13121] Fix | Delete
suggestedFormat: getSuggestedPostFormat(),
[13122] Fix | Delete
supportedFormats: themeSupports.formats
[13123] Fix | Delete
};
[13124] Fix | Delete
}, []);
[13125] Fix | Delete
const formats = POST_FORMATS.filter(format => {
[13126] Fix | Delete
// Ensure current format is always in the set.
[13127] Fix | Delete
// The current format may not be a format supported by the theme.
[13128] Fix | Delete
return supportedFormats?.includes(format.id) || postFormat === format.id;
[13129] Fix | Delete
});
[13130] Fix | Delete
const suggestion = formats.find(format => format.id === suggestedFormat);
[13131] Fix | Delete
const {
[13132] Fix | Delete
editPost
[13133] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[13134] Fix | Delete
const onUpdatePostFormat = format => editPost({
[13135] Fix | Delete
format
[13136] Fix | Delete
});
[13137] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_check, {
[13138] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[13139] Fix | Delete
className: "editor-post-format",
[13140] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
[13141] Fix | Delete
className: "editor-post-format__options",
[13142] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Post Format'),
[13143] Fix | Delete
selected: postFormat,
[13144] Fix | Delete
onChange: format => onUpdatePostFormat(format),
[13145] Fix | Delete
id: postFormatSelectorId,
[13146] Fix | Delete
options: formats.map(format => ({
[13147] Fix | Delete
label: format.caption,
[13148] Fix | Delete
value: format.id
[13149] Fix | Delete
})),
[13150] Fix | Delete
hideLabelFromVision: true
[13151] Fix | Delete
}), suggestion && suggestion.id !== postFormat && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[13152] Fix | Delete
className: "editor-post-format__suggestion",
[13153] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[13154] Fix | Delete
variant: "link",
[13155] Fix | Delete
onClick: () => onUpdatePostFormat(suggestion.id),
[13156] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
[13157] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption)
[13158] Fix | Delete
})
[13159] Fix | Delete
})]
[13160] Fix | Delete
})
[13161] Fix | Delete
});
[13162] Fix | Delete
}
[13163] Fix | Delete
[13164] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
[13165] Fix | Delete
/**
[13166] Fix | Delete
* WordPress dependencies
[13167] Fix | Delete
*/
[13168] Fix | Delete
[13169] Fix | Delete
[13170] Fix | Delete
const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[13171] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[13172] Fix | Delete
viewBox: "0 0 24 24",
[13173] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[13174] Fix | Delete
d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
[13175] Fix | Delete
})
[13176] Fix | Delete
});
[13177] Fix | Delete
/* harmony default export */ const library_backup = (backup);
[13178] Fix | Delete
[13179] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
[13180] Fix | Delete
/**
[13181] Fix | Delete
* WordPress dependencies
[13182] Fix | Delete
*/
[13183] Fix | Delete
[13184] Fix | Delete
[13185] Fix | Delete
/**
[13186] Fix | Delete
* Internal dependencies
[13187] Fix | Delete
*/
[13188] Fix | Delete
[13189] Fix | Delete
[13190] Fix | Delete
[13191] Fix | Delete
/**
[13192] Fix | Delete
* Wrapper component that renders its children if the post has more than one revision.
[13193] Fix | Delete
*
[13194] Fix | Delete
* @param {Object} props Props.
[13195] Fix | Delete
* @param {Element} props.children Children to be rendered.
[13196] Fix | Delete
*
[13197] Fix | Delete
* @return {Component|null} Rendered child components if post has more than one revision, otherwise null.
[13198] Fix | Delete
*/
[13199] Fix | Delete
[13200] Fix | Delete
function PostLastRevisionCheck({
[13201] Fix | Delete
children
[13202] Fix | Delete
}) {
[13203] Fix | Delete
const {
[13204] Fix | Delete
lastRevisionId,
[13205] Fix | Delete
revisionsCount
[13206] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[13207] Fix | Delete
const {
[13208] Fix | Delete
getCurrentPostLastRevisionId,
[13209] Fix | Delete
getCurrentPostRevisionsCount
[13210] Fix | Delete
} = select(store_store);
[13211] Fix | Delete
return {
[13212] Fix | Delete
lastRevisionId: getCurrentPostLastRevisionId(),
[13213] Fix | Delete
revisionsCount: getCurrentPostRevisionsCount()
[13214] Fix | Delete
};
[13215] Fix | Delete
}, []);
[13216] Fix | Delete
if (!lastRevisionId || revisionsCount < 2) {
[13217] Fix | Delete
return null;
[13218] Fix | Delete
}
[13219] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
[13220] Fix | Delete
supportKeys: "revisions",
[13221] Fix | Delete
children: children
[13222] Fix | Delete
});
[13223] Fix | Delete
}
[13224] Fix | Delete
/* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck);
[13225] Fix | Delete
[13226] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
[13227] Fix | Delete
/**
[13228] Fix | Delete
* WordPress dependencies
[13229] Fix | Delete
*/
[13230] Fix | Delete
[13231] Fix | Delete
[13232] Fix | Delete
[13233] Fix | Delete
[13234] Fix | Delete
[13235] Fix | Delete
[13236] Fix | Delete
/**
[13237] Fix | Delete
* Internal dependencies
[13238] Fix | Delete
*/
[13239] Fix | Delete
[13240] Fix | Delete
[13241] Fix | Delete
[13242] Fix | Delete
[13243] Fix | Delete
function usePostLastRevisionInfo() {
[13244] Fix | Delete
return (0,external_wp_data_namespaceObject.useSelect)(select => {
[13245] Fix | Delete
const {
[13246] Fix | Delete
getCurrentPostLastRevisionId,
[13247] Fix | Delete
getCurrentPostRevisionsCount
[13248] Fix | Delete
} = select(store_store);
[13249] Fix | Delete
return {
[13250] Fix | Delete
lastRevisionId: getCurrentPostLastRevisionId(),
[13251] Fix | Delete
revisionsCount: getCurrentPostRevisionsCount()
[13252] Fix | Delete
};
[13253] Fix | Delete
}, []);
[13254] Fix | Delete
}
[13255] Fix | Delete
[13256] Fix | Delete
/**
[13257] Fix | Delete
* Renders the component for displaying the last revision of a post.
[13258] Fix | Delete
*
[13259] Fix | Delete
* @return {Component} The component to be rendered.
[13260] Fix | Delete
*/
[13261] Fix | Delete
function PostLastRevision() {
[13262] Fix | Delete
const {
[13263] Fix | Delete
lastRevisionId,
[13264] Fix | Delete
revisionsCount
[13265] Fix | Delete
} = usePostLastRevisionInfo();
[13266] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
[13267] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[13268] Fix | Delete
href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
[13269] Fix | Delete
revision: lastRevisionId
[13270] Fix | Delete
}),
[13271] Fix | Delete
className: "editor-post-last-revision__title",
[13272] Fix | Delete
icon: library_backup,
[13273] Fix | Delete
iconPosition: "right",
[13274] Fix | Delete
text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions */
[13275] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount)
[13276] Fix | Delete
})
[13277] Fix | Delete
});
[13278] Fix | Delete
}
[13279] Fix | Delete
function PrivatePostLastRevision() {
[13280] Fix | Delete
const {
[13281] Fix | Delete
lastRevisionId,
[13282] Fix | Delete
revisionsCount
[13283] Fix | Delete
} = usePostLastRevisionInfo();
[13284] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
[13285] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
[13286] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Revisions'),
[13287] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[13288] Fix | Delete
href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
[13289] Fix | Delete
revision: lastRevisionId
[13290] Fix | Delete
}),
[13291] Fix | Delete
className: "editor-private-post-last-revision__button",
[13292] Fix | Delete
text: revisionsCount,
[13293] Fix | Delete
variant: "tertiary"
[13294] Fix | Delete
})
[13295] Fix | Delete
})
[13296] Fix | Delete
});
[13297] Fix | Delete
}
[13298] Fix | Delete
/* harmony default export */ const post_last_revision = (PostLastRevision);
[13299] Fix | Delete
[13300] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js
[13301] Fix | Delete
/**
[13302] Fix | Delete
* WordPress dependencies
[13303] Fix | Delete
*/
[13304] Fix | Delete
[13305] Fix | Delete
[13306] Fix | Delete
/**
[13307] Fix | Delete
* Internal dependencies
[13308] Fix | Delete
*/
[13309] Fix | Delete
[13310] Fix | Delete
[13311] Fix | Delete
[13312] Fix | Delete
/**
[13313] Fix | Delete
* Renders the panel for displaying the last revision of a post.
[13314] Fix | Delete
*
[13315] Fix | Delete
* @return {Component} The component to be rendered.
[13316] Fix | Delete
*/
[13317] Fix | Delete
[13318] Fix | Delete
function PostLastRevisionPanel() {
[13319] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
[13320] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
[13321] Fix | Delete
className: "editor-post-last-revision__panel",
[13322] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision, {})
[13323] Fix | Delete
})
[13324] Fix | Delete
});
[13325] Fix | Delete
}
[13326] Fix | Delete
/* harmony default export */ const post_last_revision_panel = (PostLastRevisionPanel);
[13327] Fix | Delete
[13328] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
[13329] Fix | Delete
/**
[13330] Fix | Delete
* WordPress dependencies
[13331] Fix | Delete
*/
[13332] Fix | Delete
[13333] Fix | Delete
[13334] Fix | Delete
[13335] Fix | Delete
[13336] Fix | Delete
[13337] Fix | Delete
[13338] Fix | Delete
[13339] Fix | Delete
[13340] Fix | Delete
[13341] Fix | Delete
/**
[13342] Fix | Delete
* Internal dependencies
[13343] Fix | Delete
*/
[13344] Fix | Delete
[13345] Fix | Delete
[13346] Fix | Delete
/**
[13347] Fix | Delete
* A modal component that is displayed when a post is locked for editing by another user.
[13348] Fix | Delete
* The modal provides information about the lock status and options to take over or exit the editor.
[13349] Fix | Delete
*
[13350] Fix | Delete
* @return {JSX.Element|null} The rendered PostLockedModal component.
[13351] Fix | Delete
*/
[13352] Fix | Delete
[13353] Fix | Delete
[13354] Fix | Delete
[13355] Fix | Delete
function PostLockedModal() {
[13356] Fix | Delete
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal);
[13357] Fix | Delete
const hookName = 'core/editor/post-locked-modal-' + instanceId;
[13358] Fix | Delete
const {
[13359] Fix | Delete
autosave,
[13360] Fix | Delete
updatePostLock
[13361] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[13362] Fix | Delete
const {
[13363] Fix | Delete
isLocked,
[13364] Fix | Delete
isTakeover,
[13365] Fix | Delete
user,
[13366] Fix | Delete
postId,
[13367] Fix | Delete
postLockUtils,
[13368] Fix | Delete
activePostLock,
[13369] Fix | Delete
postType,
[13370] Fix | Delete
previewLink
[13371] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[13372] Fix | Delete
const {
[13373] Fix | Delete
isPostLocked,
[13374] Fix | Delete
isPostLockTakeover,
[13375] Fix | Delete
getPostLockUser,
[13376] Fix | Delete
getCurrentPostId,
[13377] Fix | Delete
getActivePostLock,
[13378] Fix | Delete
getEditedPostAttribute,
[13379] Fix | Delete
getEditedPostPreviewLink,
[13380] Fix | Delete
getEditorSettings
[13381] Fix | Delete
} = select(store_store);
[13382] Fix | Delete
const {
[13383] Fix | Delete
getPostType
[13384] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[13385] Fix | Delete
return {
[13386] Fix | Delete
isLocked: isPostLocked(),
[13387] Fix | Delete
isTakeover: isPostLockTakeover(),
[13388] Fix | Delete
user: getPostLockUser(),
[13389] Fix | Delete
postId: getCurrentPostId(),
[13390] Fix | Delete
postLockUtils: getEditorSettings().postLockUtils,
[13391] Fix | Delete
activePostLock: getActivePostLock(),
[13392] Fix | Delete
postType: getPostType(getEditedPostAttribute('type')),
[13393] Fix | Delete
previewLink: getEditedPostPreviewLink()
[13394] Fix | Delete
};
[13395] Fix | Delete
}, []);
[13396] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[13397] Fix | Delete
/**
[13398] Fix | Delete
* Keep the lock refreshed.
[13399] Fix | Delete
*
[13400] Fix | Delete
* When the user does not send a heartbeat in a heartbeat-tick
[13401] Fix | Delete
* the user is no longer editing and another user can start editing.
[13402] Fix | Delete
*
[13403] Fix | Delete
* @param {Object} data Data to send in the heartbeat request.
[13404] Fix | Delete
*/
[13405] Fix | Delete
function sendPostLock(data) {
[13406] Fix | Delete
if (isLocked) {
[13407] Fix | Delete
return;
[13408] Fix | Delete
}
[13409] Fix | Delete
data['wp-refresh-post-lock'] = {
[13410] Fix | Delete
lock: activePostLock,
[13411] Fix | Delete
post_id: postId
[13412] Fix | Delete
};
[13413] Fix | Delete
}
[13414] Fix | Delete
[13415] Fix | Delete
/**
[13416] Fix | Delete
* Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
[13417] Fix | Delete
*
[13418] Fix | Delete
* @param {Object} data Data received in the heartbeat request
[13419] Fix | Delete
*/
[13420] Fix | Delete
function receivePostLock(data) {
[13421] Fix | Delete
if (!data['wp-refresh-post-lock']) {
[13422] Fix | Delete
return;
[13423] Fix | Delete
}
[13424] Fix | Delete
const received = data['wp-refresh-post-lock'];
[13425] Fix | Delete
if (received.lock_error) {
[13426] Fix | Delete
// Auto save and display the takeover modal.
[13427] Fix | Delete
autosave();
[13428] Fix | Delete
updatePostLock({
[13429] Fix | Delete
isLocked: true,
[13430] Fix | Delete
isTakeover: true,
[13431] Fix | Delete
user: {
[13432] Fix | Delete
name: received.lock_error.name,
[13433] Fix | Delete
avatar: received.lock_error.avatar_src_2x
[13434] Fix | Delete
}
[13435] Fix | Delete
});
[13436] Fix | Delete
} else if (received.new_lock) {
[13437] Fix | Delete
updatePostLock({
[13438] Fix | Delete
isLocked: false,
[13439] Fix | Delete
activePostLock: received.new_lock
[13440] Fix | Delete
});
[13441] Fix | Delete
}
[13442] Fix | Delete
}
[13443] Fix | Delete
[13444] Fix | Delete
/**
[13445] Fix | Delete
* Unlock the post before the window is exited.
[13446] Fix | Delete
*/
[13447] Fix | Delete
function releasePostLock() {
[13448] Fix | Delete
if (isLocked || !activePostLock) {
[13449] Fix | Delete
return;
[13450] Fix | Delete
}
[13451] Fix | Delete
const data = new window.FormData();
[13452] Fix | Delete
data.append('action', 'wp-remove-post-lock');
[13453] Fix | Delete
data.append('_wpnonce', postLockUtils.unlockNonce);
[13454] Fix | Delete
data.append('post_ID', postId);
[13455] Fix | Delete
data.append('active_post_lock', activePostLock);
[13456] Fix | Delete
if (window.navigator.sendBeacon) {
[13457] Fix | Delete
window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
[13458] Fix | Delete
} else {
[13459] Fix | Delete
const xhr = new window.XMLHttpRequest();
[13460] Fix | Delete
xhr.open('POST', postLockUtils.ajaxUrl, false);
[13461] Fix | Delete
xhr.send(data);
[13462] Fix | Delete
}
[13463] Fix | Delete
}
[13464] Fix | Delete
[13465] Fix | Delete
// Details on these events on the Heartbeat API docs
[13466] Fix | Delete
// https://developer.wordpress.org/plugins/javascript/heartbeat-api/
[13467] Fix | Delete
(0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock);
[13468] Fix | Delete
(0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock);
[13469] Fix | Delete
window.addEventListener('beforeunload', releasePostLock);
[13470] Fix | Delete
return () => {
[13471] Fix | Delete
(0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName);
[13472] Fix | Delete
(0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName);
[13473] Fix | Delete
window.removeEventListener('beforeunload', releasePostLock);
[13474] Fix | Delete
};
[13475] Fix | Delete
}, []);
[13476] Fix | Delete
if (!isLocked) {
[13477] Fix | Delete
return null;
[13478] Fix | Delete
}
[13479] Fix | Delete
const userDisplayName = user.name;
[13480] Fix | Delete
const userAvatar = user.avatar;
[13481] Fix | Delete
const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
[13482] Fix | Delete
'get-post-lock': '1',
[13483] Fix | Delete
lockKey: true,
[13484] Fix | Delete
post: postId,
[13485] Fix | Delete
action: 'edit',
[13486] Fix | Delete
_wpnonce: postLockUtils.nonce
[13487] Fix | Delete
});
[13488] Fix | Delete
const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
[13489] Fix | Delete
post_type: postType?.slug
[13490] Fix | Delete
});
[13491] Fix | Delete
const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor');
[13492] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
[13493] Fix | Delete
title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'),
[13494] Fix | Delete
focusOnMount: true,
[13495] Fix | Delete
shouldCloseOnClickOutside: false,
[13496] Fix | Delete
shouldCloseOnEsc: false,
[13497] Fix | Delete
isDismissible: false,
[13498] Fix | Delete
size: "medium",
[13499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function