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
isPreviewMode: editorSettings.__unstableIsPreviewMode,
[25000] Fix | Delete
previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/editor/previous-region'),
[25001] Fix | Delete
nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/editor/next-region'),
[25002] Fix | Delete
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
[25003] Fix | Delete
// translators: Default label for the Document in the Block Breadcrumb.
[25004] Fix | Delete
documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
[25005] Fix | Delete
blockEditorMode: select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode()
[25006] Fix | Delete
};
[25007] Fix | Delete
}, []);
[25008] Fix | Delete
const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
[25009] Fix | Delete
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
[25010] Fix | Delete
const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
[25011] Fix | Delete
[25012] Fix | Delete
// Local state for save panel.
[25013] Fix | Delete
// Note 'truthy' callback implies an open panel.
[25014] Fix | Delete
const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
[25015] Fix | Delete
const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
[25016] Fix | Delete
if (typeof entitiesSavedStatesCallback === 'function') {
[25017] Fix | Delete
entitiesSavedStatesCallback(arg);
[25018] Fix | Delete
}
[25019] Fix | Delete
setEntitiesSavedStatesCallback(false);
[25020] Fix | Delete
}, [entitiesSavedStatesCallback]);
[25021] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, {
[25022] Fix | Delete
enableRegionNavigation: enableRegionNavigation,
[25023] Fix | Delete
isDistractionFree: isDistractionFree && isWideViewport,
[25024] Fix | Delete
className: dist_clsx('editor-editor-interface', className, {
[25025] Fix | Delete
'is-entity-save-view-open': !!entitiesSavedStatesCallback,
[25026] Fix | Delete
'is-distraction-free': isDistractionFree && isWideViewport && !isPreviewMode
[25027] Fix | Delete
}),
[25028] Fix | Delete
labels: {
[25029] Fix | Delete
...interfaceLabels,
[25030] Fix | Delete
secondarySidebar: secondarySidebarLabel
[25031] Fix | Delete
},
[25032] Fix | Delete
header: !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_header, {
[25033] Fix | Delete
forceIsDirty: forceIsDirty,
[25034] Fix | Delete
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback,
[25035] Fix | Delete
customSaveButton: customSaveButton,
[25036] Fix | Delete
forceDisableBlockTools: forceDisableBlockTools,
[25037] Fix | Delete
title: title
[25038] Fix | Delete
}),
[25039] Fix | Delete
editorNotices: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}),
[25040] Fix | Delete
secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})),
[25041] Fix | Delete
sidebar: !isPreviewMode && !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, {
[25042] Fix | Delete
scope: "core"
[25043] Fix | Delete
}),
[25044] Fix | Delete
content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[25045] Fix | Delete
children: [!isDistractionFree && !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill.Slot, {
[25046] Fix | Delete
children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[25047] Fix | Delete
children: [!isPreviewMode && (mode === 'text' || !isRichEditingEnabled) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextEditor
[25048] Fix | Delete
// We should auto-focus the canvas (title) on load.
[25049] Fix | Delete
// eslint-disable-next-line jsx-a11y/no-autofocus
[25050] Fix | Delete
, {
[25051] Fix | Delete
autoFocus: autoFocus
[25052] Fix | Delete
}), !isPreviewMode && !isLargeViewport && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
[25053] Fix | Delete
hideDragHandle: true
[25054] Fix | Delete
}), (isPreviewMode || isRichEditingEnabled && mode === 'visual') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visual_editor, {
[25055] Fix | Delete
styles: styles,
[25056] Fix | Delete
contentRef: contentRef,
[25057] Fix | Delete
disableIframe: disableIframe
[25058] Fix | Delete
// We should auto-focus the canvas (title) on load.
[25059] Fix | Delete
// eslint-disable-next-line jsx-a11y/no-autofocus
[25060] Fix | Delete
,
[25061] Fix | Delete
autoFocus: autoFocus,
[25062] Fix | Delete
iframeProps: iframeProps
[25063] Fix | Delete
}), children]
[25064] Fix | Delete
})
[25065] Fix | Delete
})]
[25066] Fix | Delete
}),
[25067] Fix | Delete
footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && isRichEditingEnabled && blockEditorMode !== 'zoom-out' && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
[25068] Fix | Delete
rootLabelText: documentLabel
[25069] Fix | Delete
}),
[25070] Fix | Delete
actions: !isPreviewMode ? customSavePanel || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePublishPanels, {
[25071] Fix | Delete
closeEntitiesSavedStates: closeEntitiesSavedStates,
[25072] Fix | Delete
isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
[25073] Fix | Delete
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback,
[25074] Fix | Delete
forceIsDirtyPublishPanel: forceIsDirty
[25075] Fix | Delete
}) : undefined,
[25076] Fix | Delete
shortcuts: {
[25077] Fix | Delete
previous: previousShortcut,
[25078] Fix | Delete
next: nextShortcut
[25079] Fix | Delete
}
[25080] Fix | Delete
});
[25081] Fix | Delete
}
[25082] Fix | Delete
[25083] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js
[25084] Fix | Delete
/**
[25085] Fix | Delete
* WordPress dependencies
[25086] Fix | Delete
*/
[25087] Fix | Delete
[25088] Fix | Delete
[25089] Fix | Delete
[25090] Fix | Delete
/**
[25091] Fix | Delete
* Internal dependencies
[25092] Fix | Delete
*/
[25093] Fix | Delete
[25094] Fix | Delete
[25095] Fix | Delete
[25096] Fix | Delete
const {
[25097] Fix | Delete
OverridesPanel
[25098] Fix | Delete
} = unlock(external_wp_patterns_namespaceObject.privateApis);
[25099] Fix | Delete
function PatternOverridesPanel() {
[25100] Fix | Delete
const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === 'wp_block', []);
[25101] Fix | Delete
if (!supportsPatternOverridesPanel) {
[25102] Fix | Delete
return null;
[25103] Fix | Delete
}
[25104] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {});
[25105] Fix | Delete
}
[25106] Fix | Delete
[25107] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
[25108] Fix | Delete
/**
[25109] Fix | Delete
* WordPress dependencies
[25110] Fix | Delete
*/
[25111] Fix | Delete
[25112] Fix | Delete
[25113] Fix | Delete
const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[25114] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[25115] Fix | Delete
viewBox: "0 0 24 24",
[25116] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[25117] Fix | Delete
fillRule: "evenodd",
[25118] Fix | Delete
clipRule: "evenodd",
[25119] Fix | Delete
d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
[25120] Fix | Delete
})
[25121] Fix | Delete
});
[25122] Fix | Delete
/* harmony default export */ const library_trash = (trash);
[25123] Fix | Delete
[25124] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/client-zip/index.js
[25125] Fix | Delete
"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),client_zip_r=e=>Math.min(65535,Number(e));function f(e,i){if(void 0===i||i instanceof Date||(i=new Date(i)),e instanceof File)return{isFile:1,t:i||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:i};if("string"==typeof e)return{isFile:1,t:i,i:t(e)};if(e instanceof Blob)return{isFile:1,t:i,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:i,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:i,i:n(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:i,i:o(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function o(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[f,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{o:d(f||t(e.name)),u:BigInt(e.size),l:o};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?=["']?(.*?)["']?$/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{o:d(f||t(s)),u:BigInt(u),l:o}}return f=d(f,void 0!==e||void 0!==r),"string"==typeof e?{o:f,u:BigInt(t(e).length),l:o}:e instanceof Blob?{o:f,u:BigInt(e.size),l:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:f,u:BigInt(e.byteLength),l:o}:{o:f,u:u(e,r),l:o}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n^=-1;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return(-1^n)>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({o:e,l:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.o.length,1),n(r)}async function*g(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=y(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.m=y(n,e.m),e.u+=BigInt(n.length),yield n}}}function I(t,r){const f=e(16+(r?8:0));return f.setUint32(0,1347094280),f.setUint32(4,t.isFile?t.m:0,1),r?(f.setBigUint64(8,t.u,1),f.setBigUint64(16,t.u,1)):(f.setUint32(8,i(t.u),1),f.setUint32(12,i(t.u),1)),n(f)}function v(t,r,f=0,o=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|f),w(t.t,a,12),a.setUint32(16,t.isFile?t.m:0,1),a.setUint32(20,i(t.u),1),a.setUint32(24,i(t.u),1),a.setUint16(28,t.o.length,1),a.setUint16(30,o,1),a.setUint16(40,t.isFile?33204:16893,1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const f=e(r);return f.setUint16(0,1,1),f.setUint16(2,r-4,1),16&r&&(f.setBigUint64(4,t.u,1),f.setBigUint64(12,t.u,1)),f.setBigUint64(r-8,i,1),n(f)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.o)throw new Error("Every file must have a non-empty name.");if(void 0===r.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.o)}".`);const e=r.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+r.o.length+(e&&8))+r.u,n+=BigInt(r.o.length+46+(12*f|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(f(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return o(async function*(t,f){const o=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,f.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.o),e.isFile&&(yield*g(e));const t=e.u>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),o.push(v(e,a,n,i)),o.push(e.o),i&&o.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.o.length)+e.u,u||(u=t)}let d=0n;for(const e of o)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,client_zip_r(s),1),l.setUint16(10,client_zip_r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)}
[25126] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-actions/export-pattern-action.js
[25127] Fix | Delete
/**
[25128] Fix | Delete
* External dependencies
[25129] Fix | Delete
*/
[25130] Fix | Delete
[25131] Fix | Delete
[25132] Fix | Delete
[25133] Fix | Delete
/**
[25134] Fix | Delete
* WordPress dependencies
[25135] Fix | Delete
*/
[25136] Fix | Delete
[25137] Fix | Delete
[25138] Fix | Delete
[25139] Fix | Delete
[25140] Fix | Delete
/**
[25141] Fix | Delete
* Internal dependencies
[25142] Fix | Delete
*/
[25143] Fix | Delete
[25144] Fix | Delete
[25145] Fix | Delete
// Patterns.
[25146] Fix | Delete
const {
[25147] Fix | Delete
PATTERN_TYPES: export_pattern_action_PATTERN_TYPES
[25148] Fix | Delete
} = unlock(external_wp_patterns_namespaceObject.privateApis);
[25149] Fix | Delete
function getJsonFromItem(item) {
[25150] Fix | Delete
return JSON.stringify({
[25151] Fix | Delete
__file: item.type,
[25152] Fix | Delete
title: item.title || item.name,
[25153] Fix | Delete
content: item?.patternPost?.content?.raw || item.content,
[25154] Fix | Delete
syncStatus: item?.patternPost?.wp_pattern_sync_status || item.wp_pattern_sync_status
[25155] Fix | Delete
}, null, 2);
[25156] Fix | Delete
}
[25157] Fix | Delete
const exportPatternAsJSONAction = {
[25158] Fix | Delete
id: 'export-pattern',
[25159] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'),
[25160] Fix | Delete
supportsBulk: true,
[25161] Fix | Delete
isEligible: item => {
[25162] Fix | Delete
if (!item.type) {
[25163] Fix | Delete
return false;
[25164] Fix | Delete
}
[25165] Fix | Delete
return item.type === export_pattern_action_PATTERN_TYPES.user;
[25166] Fix | Delete
},
[25167] Fix | Delete
callback: async items => {
[25168] Fix | Delete
if (items.length === 1) {
[25169] Fix | Delete
return (0,external_wp_blob_namespaceObject.downloadBlob)(`${paramCase(items[0].title || items[0].name)}.json`, getJsonFromItem(items[0]), 'application/json');
[25170] Fix | Delete
}
[25171] Fix | Delete
const nameCount = {};
[25172] Fix | Delete
const filesToZip = items.map(item => {
[25173] Fix | Delete
const name = paramCase(item.title || item.name);
[25174] Fix | Delete
nameCount[name] = (nameCount[name] || 0) + 1;
[25175] Fix | Delete
return {
[25176] Fix | Delete
name: `${name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`,
[25177] Fix | Delete
lastModified: new Date(),
[25178] Fix | Delete
input: getJsonFromItem(item)
[25179] Fix | Delete
};
[25180] Fix | Delete
});
[25181] Fix | Delete
return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip');
[25182] Fix | Delete
}
[25183] Fix | Delete
};
[25184] Fix | Delete
[25185] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js
[25186] Fix | Delete
/**
[25187] Fix | Delete
* WordPress dependencies
[25188] Fix | Delete
*/
[25189] Fix | Delete
[25190] Fix | Delete
[25191] Fix | Delete
[25192] Fix | Delete
[25193] Fix | Delete
[25194] Fix | Delete
[25195] Fix | Delete
[25196] Fix | Delete
[25197] Fix | Delete
[25198] Fix | Delete
[25199] Fix | Delete
[25200] Fix | Delete
/**
[25201] Fix | Delete
* Internal dependencies
[25202] Fix | Delete
*/
[25203] Fix | Delete
[25204] Fix | Delete
[25205] Fix | Delete
[25206] Fix | Delete
[25207] Fix | Delete
[25208] Fix | Delete
[25209] Fix | Delete
[25210] Fix | Delete
// Patterns.
[25211] Fix | Delete
[25212] Fix | Delete
[25213] Fix | Delete
const {
[25214] Fix | Delete
PATTERN_TYPES: actions_PATTERN_TYPES,
[25215] Fix | Delete
CreatePatternModalContents,
[25216] Fix | Delete
useDuplicatePatternProps
[25217] Fix | Delete
} = unlock(external_wp_patterns_namespaceObject.privateApis);
[25218] Fix | Delete
[25219] Fix | Delete
/**
[25220] Fix | Delete
* Check if a template is removable.
[25221] Fix | Delete
*
[25222] Fix | Delete
* @param {Object} template The template entity to check.
[25223] Fix | Delete
* @return {boolean} Whether the template is removable.
[25224] Fix | Delete
*/
[25225] Fix | Delete
function isTemplateRemovable(template) {
[25226] Fix | Delete
if (!template) {
[25227] Fix | Delete
return false;
[25228] Fix | Delete
}
[25229] Fix | Delete
// In patterns list page we map the templates parts to a different object
[25230] Fix | Delete
// than the one returned from the endpoint. This is why we need to check for
[25231] Fix | Delete
// two props whether is custom or has a theme file.
[25232] Fix | Delete
return [template.source, template.templatePart?.source].includes(TEMPLATE_ORIGINS.custom) && !template.has_theme_file && !template.templatePart?.has_theme_file;
[25233] Fix | Delete
}
[25234] Fix | Delete
function getItemTitle(item) {
[25235] Fix | Delete
if (typeof item.title === 'string') {
[25236] Fix | Delete
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title);
[25237] Fix | Delete
}
[25238] Fix | Delete
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered || '');
[25239] Fix | Delete
}
[25240] Fix | Delete
[25241] Fix | Delete
// This action is used for templates, patterns and template parts.
[25242] Fix | Delete
// Every other post type uses the similar `trashPostAction` which
[25243] Fix | Delete
// moves the post to trash.
[25244] Fix | Delete
const deletePostAction = {
[25245] Fix | Delete
id: 'delete-post',
[25246] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
[25247] Fix | Delete
isPrimary: true,
[25248] Fix | Delete
icon: library_trash,
[25249] Fix | Delete
isEligible(post) {
[25250] Fix | Delete
if ([TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(post.type)) {
[25251] Fix | Delete
return isTemplateRemovable(post);
[25252] Fix | Delete
}
[25253] Fix | Delete
// We can only remove user patterns.
[25254] Fix | Delete
return post.type === actions_PATTERN_TYPES.user;
[25255] Fix | Delete
},
[25256] Fix | Delete
supportsBulk: true,
[25257] Fix | Delete
hideModalHeader: true,
[25258] Fix | Delete
RenderModal: ({
[25259] Fix | Delete
items,
[25260] Fix | Delete
closeModal,
[25261] Fix | Delete
onActionStart,
[25262] Fix | Delete
onActionPerformed
[25263] Fix | Delete
}) => {
[25264] Fix | Delete
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
[25265] Fix | Delete
const {
[25266] Fix | Delete
removeTemplates
[25267] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
[25268] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
[25269] Fix | Delete
spacing: "5",
[25270] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
[25271] Fix | Delete
children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
[25272] Fix | Delete
// translators: %d: number of items to delete.
[25273] Fix | Delete
(0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)(
[25274] Fix | Delete
// translators: %s: The template or template part's titles
[25275] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Delete "%s"?'), getItemTitle(items[0]))
[25276] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[25277] Fix | Delete
justify: "right",
[25278] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[25279] Fix | Delete
variant: "tertiary",
[25280] Fix | Delete
onClick: closeModal,
[25281] Fix | Delete
disabled: isBusy,
[25282] Fix | Delete
__experimentalIsFocusable: true,
[25283] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
[25284] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[25285] Fix | Delete
variant: "primary",
[25286] Fix | Delete
onClick: async () => {
[25287] Fix | Delete
setIsBusy(true);
[25288] Fix | Delete
if (onActionStart) {
[25289] Fix | Delete
onActionStart(items);
[25290] Fix | Delete
}
[25291] Fix | Delete
await removeTemplates(items, {
[25292] Fix | Delete
allowUndo: false
[25293] Fix | Delete
});
[25294] Fix | Delete
onActionPerformed?.(items);
[25295] Fix | Delete
setIsBusy(false);
[25296] Fix | Delete
closeModal();
[25297] Fix | Delete
},
[25298] Fix | Delete
isBusy: isBusy,
[25299] Fix | Delete
disabled: isBusy,
[25300] Fix | Delete
__experimentalIsFocusable: true,
[25301] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Delete')
[25302] Fix | Delete
})]
[25303] Fix | Delete
})]
[25304] Fix | Delete
});
[25305] Fix | Delete
}
[25306] Fix | Delete
};
[25307] Fix | Delete
function useCanUserEligibilityCheckPostType(capability, resource, action) {
[25308] Fix | Delete
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
[25309] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => ({
[25310] Fix | Delete
...action,
[25311] Fix | Delete
isEligible(item) {
[25312] Fix | Delete
return action.isEligible(item) && registry.select(external_wp_coreData_namespaceObject.store).canUser(capability, resource, item.id);
[25313] Fix | Delete
}
[25314] Fix | Delete
}), [action, registry, capability, resource]);
[25315] Fix | Delete
}
[25316] Fix | Delete
const trashPostAction = {
[25317] Fix | Delete
id: 'move-to-trash',
[25318] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Move to Trash'),
[25319] Fix | Delete
isPrimary: true,
[25320] Fix | Delete
icon: library_trash,
[25321] Fix | Delete
isEligible(item) {
[25322] Fix | Delete
return !['auto-draft', 'trash'].includes(item.status);
[25323] Fix | Delete
},
[25324] Fix | Delete
supportsBulk: true,
[25325] Fix | Delete
hideModalHeader: true,
[25326] Fix | Delete
RenderModal: ({
[25327] Fix | Delete
items,
[25328] Fix | Delete
closeModal,
[25329] Fix | Delete
onActionStart,
[25330] Fix | Delete
onActionPerformed
[25331] Fix | Delete
}) => {
[25332] Fix | Delete
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
[25333] Fix | Delete
const {
[25334] Fix | Delete
createSuccessNotice,
[25335] Fix | Delete
createErrorNotice
[25336] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[25337] Fix | Delete
const {
[25338] Fix | Delete
deleteEntityRecord
[25339] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
[25340] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
[25341] Fix | Delete
spacing: "5",
[25342] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
[25343] Fix | Delete
children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
[25344] Fix | Delete
// translators: %s: The item's title.
[25345] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move to trash "%s"?'), getItemTitle(items[0])) : (0,external_wp_i18n_namespaceObject.sprintf)(
[25346] Fix | Delete
// translators: %d: The number of items (2 or more).
[25347] Fix | Delete
(0,external_wp_i18n_namespaceObject._n)('Are you sure you want to move to trash %d item?', 'Are you sure you want to move to trash %d items?', items.length), items.length)
[25348] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[25349] Fix | Delete
justify: "right",
[25350] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[25351] Fix | Delete
variant: "tertiary",
[25352] Fix | Delete
onClick: closeModal,
[25353] Fix | Delete
disabled: isBusy,
[25354] Fix | Delete
__experimentalIsFocusable: true,
[25355] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
[25356] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[25357] Fix | Delete
variant: "primary",
[25358] Fix | Delete
onClick: async () => {
[25359] Fix | Delete
setIsBusy(true);
[25360] Fix | Delete
if (onActionStart) {
[25361] Fix | Delete
onActionStart(items);
[25362] Fix | Delete
}
[25363] Fix | Delete
const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id, {}, {
[25364] Fix | Delete
throwOnError: true
[25365] Fix | Delete
})));
[25366] Fix | Delete
// If all the promises were fulfilled with success.
[25367] Fix | Delete
if (promiseResult.every(({
[25368] Fix | Delete
status
[25369] Fix | Delete
}) => status === 'fulfilled')) {
[25370] Fix | Delete
let successMessage;
[25371] Fix | Delete
if (promiseResult.length === 1) {
[25372] Fix | Delete
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The item's title. */
[25373] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('"%s" moved to trash.'), getItemTitle(items[0]));
[25374] Fix | Delete
} else {
[25375] Fix | Delete
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
[25376] Fix | Delete
(0,external_wp_i18n_namespaceObject._n)('%s item moved to trash.', '%s items moved to trash.', items.length), items.length);
[25377] Fix | Delete
}
[25378] Fix | Delete
createSuccessNotice(successMessage, {
[25379] Fix | Delete
type: 'snackbar',
[25380] Fix | Delete
id: 'move-to-trash-action'
[25381] Fix | Delete
});
[25382] Fix | Delete
} else {
[25383] Fix | Delete
// If there was at least one failure.
[25384] Fix | Delete
let errorMessage;
[25385] Fix | Delete
// If we were trying to delete a single item.
[25386] Fix | Delete
if (promiseResult.length === 1) {
[25387] Fix | Delete
if (promiseResult[0].reason?.message) {
[25388] Fix | Delete
errorMessage = promiseResult[0].reason.message;
[25389] Fix | Delete
} else {
[25390] Fix | Delete
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the item.');
[25391] Fix | Delete
}
[25392] Fix | Delete
// If we were trying to delete multiple items.
[25393] Fix | Delete
} else {
[25394] Fix | Delete
const errorMessages = new Set();
[25395] Fix | Delete
const failedPromises = promiseResult.filter(({
[25396] Fix | Delete
status
[25397] Fix | Delete
}) => status === 'rejected');
[25398] Fix | Delete
for (const failedPromise of failedPromises) {
[25399] Fix | Delete
if (failedPromise.reason?.message) {
[25400] Fix | Delete
errorMessages.add(failedPromise.reason.message);
[25401] Fix | Delete
}
[25402] Fix | Delete
}
[25403] Fix | Delete
if (errorMessages.size === 0) {
[25404] Fix | Delete
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the items.');
[25405] Fix | Delete
} else if (errorMessages.size === 1) {
[25406] Fix | Delete
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
[25407] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the item: %s'), [...errorMessages][0]);
[25408] Fix | Delete
} else {
[25409] Fix | Delete
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
[25410] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving to trash the items: %s'), [...errorMessages].join(','));
[25411] Fix | Delete
}
[25412] Fix | Delete
}
[25413] Fix | Delete
createErrorNotice(errorMessage, {
[25414] Fix | Delete
type: 'snackbar'
[25415] Fix | Delete
});
[25416] Fix | Delete
}
[25417] Fix | Delete
if (onActionPerformed) {
[25418] Fix | Delete
onActionPerformed(items);
[25419] Fix | Delete
}
[25420] Fix | Delete
setIsBusy(false);
[25421] Fix | Delete
closeModal();
[25422] Fix | Delete
},
[25423] Fix | Delete
isBusy: isBusy,
[25424] Fix | Delete
disabled: isBusy,
[25425] Fix | Delete
__experimentalIsFocusable: true,
[25426] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Trash')
[25427] Fix | Delete
})]
[25428] Fix | Delete
})]
[25429] Fix | Delete
});
[25430] Fix | Delete
}
[25431] Fix | Delete
};
[25432] Fix | Delete
function useTrashPostAction(resource) {
[25433] Fix | Delete
return useCanUserEligibilityCheckPostType('delete', resource, trashPostAction);
[25434] Fix | Delete
}
[25435] Fix | Delete
function usePermanentlyDeletePostAction(resource) {
[25436] Fix | Delete
const {
[25437] Fix | Delete
createSuccessNotice,
[25438] Fix | Delete
createErrorNotice
[25439] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[25440] Fix | Delete
const {
[25441] Fix | Delete
deleteEntityRecord
[25442] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
[25443] Fix | Delete
const permanentlyDeletePostAction = (0,external_wp_element_namespaceObject.useMemo)(() => ({
[25444] Fix | Delete
id: 'permanently-delete',
[25445] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'),
[25446] Fix | Delete
supportsBulk: true,
[25447] Fix | Delete
isEligible({
[25448] Fix | Delete
status
[25449] Fix | Delete
}) {
[25450] Fix | Delete
return status === 'trash';
[25451] Fix | Delete
},
[25452] Fix | Delete
async callback(posts, onActionPerformed) {
[25453] Fix | Delete
const promiseResult = await Promise.allSettled(posts.map(post => {
[25454] Fix | Delete
return deleteEntityRecord('postType', post.type, post.id, {
[25455] Fix | Delete
force: true
[25456] Fix | Delete
}, {
[25457] Fix | Delete
throwOnError: true
[25458] Fix | Delete
});
[25459] Fix | Delete
}));
[25460] Fix | Delete
// If all the promises were fulfilled with success.
[25461] Fix | Delete
if (promiseResult.every(({
[25462] Fix | Delete
status
[25463] Fix | Delete
}) => status === 'fulfilled')) {
[25464] Fix | Delete
let successMessage;
[25465] Fix | Delete
if (promiseResult.length === 1) {
[25466] Fix | Delete
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
[25467] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), getItemTitle(posts[0]));
[25468] Fix | Delete
} else {
[25469] Fix | Delete
successMessage = (0,external_wp_i18n_namespaceObject.__)('The posts were permanently deleted.');
[25470] Fix | Delete
}
[25471] Fix | Delete
createSuccessNotice(successMessage, {
[25472] Fix | Delete
type: 'snackbar',
[25473] Fix | Delete
id: 'permanently-delete-post-action'
[25474] Fix | Delete
});
[25475] Fix | Delete
if (onActionPerformed) {
[25476] Fix | Delete
onActionPerformed(posts);
[25477] Fix | Delete
}
[25478] Fix | Delete
} else {
[25479] Fix | Delete
// If there was at lease one failure.
[25480] Fix | Delete
let errorMessage;
[25481] Fix | Delete
// If we were trying to permanently delete a single post.
[25482] Fix | Delete
if (promiseResult.length === 1) {
[25483] Fix | Delete
if (promiseResult[0].reason?.message) {
[25484] Fix | Delete
errorMessage = promiseResult[0].reason.message;
[25485] Fix | Delete
} else {
[25486] Fix | Delete
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the post.');
[25487] Fix | Delete
}
[25488] Fix | Delete
// If we were trying to permanently delete multiple posts
[25489] Fix | Delete
} else {
[25490] Fix | Delete
const errorMessages = new Set();
[25491] Fix | Delete
const failedPromises = promiseResult.filter(({
[25492] Fix | Delete
status
[25493] Fix | Delete
}) => status === 'rejected');
[25494] Fix | Delete
for (const failedPromise of failedPromises) {
[25495] Fix | Delete
if (failedPromise.reason?.message) {
[25496] Fix | Delete
errorMessages.add(failedPromise.reason.message);
[25497] Fix | Delete
}
[25498] Fix | Delete
}
[25499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function