Diff: STRATO-apps/wordpress_03/app/wp-includes/js/dist/core-commands.js
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
/******/ (() => { // webpackBootstrap
2
+
/******/ "use strict";
3
+
/******/ // The require scope
4
+
/******/ var __webpack_require__ = {};
5
+
/******/
6
+
/************************************************************************/
7
+
/******/ /* webpack/runtime/define property getters */
8
+
/******/ (() => {
9
+
/******/ // define getter functions for harmony exports
10
+
/******/ __webpack_require__.d = (exports, definition) => {
11
+
/******/ for(var key in definition) {
12
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14
+
/******/ }
15
+
/******/ }
16
+
/******/ };
17
+
/******/ })();
18
+
/******/
19
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
20
+
/******/ (() => {
21
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22
+
/******/ })();
23
+
/******/
24
+
/******/ /* webpack/runtime/make namespace object */
25
+
/******/ (() => {
26
+
/******/ // define __esModule on exports
27
+
/******/ __webpack_require__.r = (exports) => {
28
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30
+
/******/ }
31
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
32
+
/******/ };
33
+
/******/ })();
34
+
/******/
35
+
/************************************************************************/
36
+
var __webpack_exports__ = {};
37
+
// ESM COMPAT FLAG
38
+
__webpack_require__.r(__webpack_exports__);
39
+
40
+
// EXPORTS
41
+
__webpack_require__.d(__webpack_exports__, {
42
+
initializeCommandPalette: () => (/* binding */ initializeCommandPalette),
43
+
privateApis: () => (/* reexport */ privateApis)
44
+
});
45
+
46
+
;// external "ReactJSXRuntime"
47
+
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
48
+
;// external ["wp","element"]
49
+
const external_wp_element_namespaceObject = window["wp"]["element"];
50
+
;// external ["wp","router"]
51
+
const external_wp_router_namespaceObject = window["wp"]["router"];
52
+
;// external ["wp","commands"]
53
+
const external_wp_commands_namespaceObject = window["wp"]["commands"];
54
+
;// external ["wp","i18n"]
55
+
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
56
+
;// external ["wp","primitives"]
57
+
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
58
+
;// ./node_modules/@wordpress/icons/build-module/library/external.js
59
+
60
+
61
+
var external_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) });
62
+
63
+
64
+
;// external ["wp","coreData"]
65
+
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
66
+
;// external ["wp","data"]
67
+
const external_wp_data_namespaceObject = window["wp"]["data"];
68
+
;// ./node_modules/@wordpress/core-commands/build-module/admin-navigation-commands.js
69
+
70
+
71
+
72
+
73
+
74
+
75
+
const getViewSiteCommand = () => function useViewSiteCommand() {
76
+
const homeUrl = (0,external_wp_data_namespaceObject.useSelect)((select) => {
77
+
return select(external_wp_coreData_namespaceObject.store).getEntityRecord(
78
+
"root",
79
+
"__unstableBase"
80
+
)?.home;
81
+
}, []);
82
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
83
+
if (!homeUrl) {
84
+
return [];
85
+
}
86
+
return [
87
+
{
88
+
name: "core/view-site",
89
+
label: (0,external_wp_i18n_namespaceObject.__)("View site"),
90
+
icon: external_default,
91
+
callback: ({ close }) => {
92
+
close();
93
+
window.open(homeUrl, "_blank");
94
+
}
95
+
}
96
+
];
97
+
}, [homeUrl]);
98
+
return {
99
+
isLoading: false,
100
+
commands
101
+
};
102
+
};
103
+
function useAdminNavigationCommands(menuCommands) {
104
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
105
+
return (menuCommands ?? []).map((menuCommand) => {
106
+
const label = (0,external_wp_i18n_namespaceObject.sprintf)(
107
+
/* translators: %s: menu label */
108
+
(0,external_wp_i18n_namespaceObject.__)("Go to: %s"),
109
+
menuCommand.label
110
+
);
111
+
return {
112
+
name: menuCommand.name,
113
+
label,
114
+
searchLabel: label,
115
+
callback: ({ close }) => {
116
+
document.location = menuCommand.url;
117
+
close();
118
+
}
119
+
};
120
+
});
121
+
}, [menuCommands]);
122
+
(0,external_wp_commands_namespaceObject.useCommands)(commands);
123
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
124
+
name: "core/view-site",
125
+
hook: getViewSiteCommand()
126
+
});
127
+
}
128
+
129
+
130
+
;// ./node_modules/@wordpress/icons/build-module/library/post.js
131
+
132
+
133
+
var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) });
134
+
135
+
136
+
;// ./node_modules/@wordpress/icons/build-module/library/page.js
137
+
138
+
139
+
var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
140
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
141
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })
142
+
] });
143
+
144
+
145
+
;// ./node_modules/@wordpress/icons/build-module/library/layout.js
146
+
147
+
148
+
var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });
149
+
150
+
151
+
;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
152
+
153
+
154
+
var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });
155
+
156
+
157
+
;// ./node_modules/@wordpress/icons/build-module/library/styles.js
158
+
159
+
160
+
var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
161
+
external_wp_primitives_namespaceObject.Path,
162
+
{
163
+
fillRule: "evenodd",
164
+
clipRule: "evenodd",
165
+
d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"
166
+
}
167
+
) });
168
+
169
+
170
+
;// ./node_modules/@wordpress/icons/build-module/library/navigation.js
171
+
172
+
173
+
var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) });
174
+
175
+
176
+
;// ./node_modules/@wordpress/icons/build-module/library/symbol.js
177
+
178
+
179
+
var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });
180
+
181
+
182
+
;// ./node_modules/@wordpress/icons/build-module/library/brush.js
183
+
184
+
185
+
var brush_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" }) });
186
+
187
+
188
+
;// external ["wp","url"]
189
+
const external_wp_url_namespaceObject = window["wp"]["url"];
190
+
;// external ["wp","compose"]
191
+
const external_wp_compose_namespaceObject = window["wp"]["compose"];
192
+
;// external ["wp","htmlEntities"]
193
+
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
194
+
;// external ["wp","privateApis"]
195
+
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
196
+
;// ./node_modules/@wordpress/core-commands/build-module/lock-unlock.js
197
+
198
+
const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
199
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
200
+
"@wordpress/core-commands"
201
+
);
202
+
203
+
204
+
;// ./node_modules/@wordpress/core-commands/build-module/utils/order-entity-records-by-search.js
205
+
function orderEntityRecordsBySearch(records = [], search = "") {
206
+
if (!Array.isArray(records) || !records.length) {
207
+
return [];
208
+
}
209
+
if (!search) {
210
+
return records;
211
+
}
212
+
const priority = [];
213
+
const nonPriority = [];
214
+
for (let i = 0; i < records.length; i++) {
215
+
const record = records[i];
216
+
if (record?.title?.raw?.toLowerCase()?.includes(search?.toLowerCase())) {
217
+
priority.push(record);
218
+
} else {
219
+
nonPriority.push(record);
220
+
}
221
+
}
222
+
return priority.concat(nonPriority);
223
+
}
224
+
225
+
226
+
;// ./node_modules/@wordpress/core-commands/build-module/site-editor-navigation-commands.js
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
const { useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
240
+
const icons = {
241
+
post: post_default,
242
+
page: page_default,
243
+
wp_template: layout_default,
244
+
wp_template_part: symbol_filled_default
245
+
};
246
+
function useDebouncedValue(value) {
247
+
const [debouncedValue, setDebouncedValue] = (0,external_wp_element_namespaceObject.useState)("");
248
+
const debounced = (0,external_wp_compose_namespaceObject.useDebounce)(setDebouncedValue, 250);
249
+
(0,external_wp_element_namespaceObject.useEffect)(() => {
250
+
debounced(value);
251
+
return () => debounced.cancel();
252
+
}, [debounced, value]);
253
+
return debouncedValue;
254
+
}
255
+
const getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
256
+
const history = useHistory();
257
+
const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(
258
+
(select) => {
259
+
return {
260
+
isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
261
+
canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser("create", {
262
+
kind: "postType",
263
+
name: "wp_template"
264
+
})
265
+
};
266
+
},
267
+
[]
268
+
);
269
+
const delayedSearch = useDebouncedValue(search);
270
+
const { records, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(
271
+
(select) => {
272
+
if (!delayedSearch) {
273
+
return {
274
+
isLoading: false
275
+
};
276
+
}
277
+
const query = {
278
+
search: delayedSearch,
279
+
per_page: 10,
280
+
orderby: "relevance",
281
+
status: [
282
+
"publish",
283
+
"future",
284
+
"draft",
285
+
"pending",
286
+
"private"
287
+
]
288
+
};
289
+
return {
290
+
records: select(external_wp_coreData_namespaceObject.store).getEntityRecords(
291
+
"postType",
292
+
postType,
293
+
query
294
+
),
295
+
isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution(
296
+
"getEntityRecords",
297
+
["postType", postType, query]
298
+
)
299
+
};
300
+
},
301
+
[delayedSearch]
302
+
);
303
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
304
+
return (records ?? []).map((record) => {
305
+
const command = {
306
+
name: postType + "-" + record.id,
307
+
searchLabel: record.title?.rendered + " " + record.id,
308
+
label: record.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(record.title?.rendered) : (0,external_wp_i18n_namespaceObject.__)("(no title)"),
309
+
icon: icons[postType]
310
+
};
311
+
if (!canCreateTemplate || postType === "post" || postType === "page" && !isBlockBasedTheme) {
312
+
return {
313
+
...command,
314
+
callback: ({ close }) => {
315
+
const args = {
316
+
post: record.id,
317
+
action: "edit"
318
+
};
319
+
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)("post.php", args);
320
+
document.location = targetUrl;
321
+
close();
322
+
}
323
+
};
324
+
}
325
+
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
326
+
"site-editor.php"
327
+
);
328
+
return {
329
+
...command,
330
+
callback: ({ close }) => {
331
+
if (isSiteEditor) {
332
+
history.navigate(
333
+
`/${postType}/${record.id}?canvas=edit`
334
+
);
335
+
} else {
336
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
337
+
"site-editor.php",
338
+
{
339
+
p: `/${postType}/${record.id}`,
340
+
canvas: "edit"
341
+
}
342
+
);
343
+
}
344
+
close();
345
+
}
346
+
};
347
+
});
348
+
}, [canCreateTemplate, records, isBlockBasedTheme, history]);
349
+
return {
350
+
commands,
351
+
isLoading
352
+
};
353
+
};
354
+
const getNavigationCommandLoaderPerTemplate = (templateType) => function useNavigationCommandLoader({ search }) {
355
+
const history = useHistory();
356
+
const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(
357
+
(select) => {
358
+
return {
359
+
isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
360
+
canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser("create", {
361
+
kind: "postType",
362
+
name: templateType
363
+
})
364
+
};
365
+
},
366
+
[]
367
+
);
368
+
const { records, isLoading } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
369
+
const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store);
370
+
const query = { per_page: -1 };
371
+
return {
372
+
records: getEntityRecords("postType", templateType, query),
373
+
isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution(
374
+
"getEntityRecords",
375
+
["postType", templateType, query]
376
+
)
377
+
};
378
+
}, []);
379
+
const orderedRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
380
+
return orderEntityRecordsBySearch(records, search).slice(0, 10);
381
+
}, [records, search]);
382
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
383
+
if (!canCreateTemplate || !isBlockBasedTheme && !templateType === "wp_template_part") {
384
+
return [];
385
+
}
386
+
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
387
+
"site-editor.php"
388
+
);
389
+
const result = [];
390
+
result.push(
391
+
...orderedRecords.map((record) => {
392
+
return {
393
+
name: templateType + "-" + record.id,
394
+
searchLabel: record.title?.rendered + " " + record.id,
395
+
label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)("(no title)"),
396
+
icon: icons[templateType],
397
+
callback: ({ close }) => {
398
+
if (isSiteEditor) {
399
+
history.navigate(
400
+
`/${templateType}/${record.id}?canvas=edit`
401
+
);
402
+
} else {
403
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
404
+
"site-editor.php",
405
+
{
406
+
p: `/${templateType}/${record.id}`,
407
+
canvas: "edit"
408
+
}
409
+
);
410
+
}
411
+
close();
412
+
}
413
+
};
414
+
})
415
+
);
416
+
if (orderedRecords?.length > 0 && templateType === "wp_template_part") {
417
+
result.push({
418
+
name: "core/edit-site/open-template-parts",
419
+
label: (0,external_wp_i18n_namespaceObject.__)("Go to: Template parts"),
420
+
icon: symbol_filled_default,
421
+
callback: ({ close }) => {
422
+
if (isSiteEditor) {
423
+
history.navigate(
424
+
"/pattern?postType=wp_template_part&categoryId=all-parts"
425
+
);
426
+
} else {
427
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
428
+
"site-editor.php",
429
+
{
430
+
p: "/pattern",
431
+
postType: "wp_template_part",
432
+
categoryId: "all-parts"
433
+
}
434
+
);
435
+
}
436
+
close();
437
+
}
438
+
});
439
+
}
440
+
return result;
441
+
}, [canCreateTemplate, isBlockBasedTheme, orderedRecords, history]);
442
+
return {
443
+
commands,
444
+
isLoading
445
+
};
446
+
};
447
+
const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
448
+
const history = useHistory();
449
+
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
450
+
"site-editor.php"
451
+
);
452
+
const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
453
+
return {
454
+
isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
455
+
canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser("create", {
456
+
kind: "postType",
457
+
name: "wp_template"
458
+
}),
459
+
canCreatePatterns: select(external_wp_coreData_namespaceObject.store).canUser("create", {
460
+
kind: "postType",
461
+
name: "wp_block"
462
+
})
463
+
};
464
+
}, []);
465
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
466
+
const result = [];
467
+
if (canCreateTemplate && isBlockBasedTheme) {
468
+
result.push({
469
+
name: "core/edit-site/open-styles",
470
+
label: (0,external_wp_i18n_namespaceObject.__)("Go to: Styles"),
471
+
icon: styles_default,
472
+
callback: ({ close }) => {
473
+
if (isSiteEditor) {
474
+
history.navigate("/styles");
475
+
} else {
476
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
477
+
"site-editor.php",
478
+
{
479
+
p: "/styles"
480
+
}
481
+
);
482
+
}
483
+
close();
484
+
}
485
+
});
486
+
result.push({
487
+
name: "core/edit-site/open-navigation",
488
+
label: (0,external_wp_i18n_namespaceObject.__)("Go to: Navigation"),
489
+
icon: navigation_default,
490
+
callback: ({ close }) => {
491
+
if (isSiteEditor) {
492
+
history.navigate("/navigation");
493
+
} else {
494
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
495
+
"site-editor.php",
496
+
{
497
+
p: "/navigation"
498
+
}
499
+
);
500
+
}
501
+
close();
502
+
}
503
+
});
504
+
result.push({
505
+
name: "core/edit-site/open-templates",
506
+
label: (0,external_wp_i18n_namespaceObject.__)("Go to: Templates"),
507
+
icon: layout_default,
508
+
callback: ({ close }) => {
509
+
if (isSiteEditor) {
510
+
history.navigate("/template");
511
+
} else {
512
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
513
+
"site-editor.php",
514
+
{
515
+
p: "/template"
516
+
}
517
+
);
518
+
}
519
+
close();
520
+
}
521
+
});
522
+
}
523
+
if (canCreatePatterns) {
524
+
result.push({
525
+
name: "core/edit-site/open-patterns",
526
+
label: (0,external_wp_i18n_namespaceObject.__)("Go to: Patterns"),
527
+
icon: symbol_default,
528
+
callback: ({ close }) => {
529
+
if (canCreateTemplate) {
530
+
if (isSiteEditor) {
531
+
history.navigate("/pattern");
532
+
} else {
533
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
534
+
"site-editor.php",
535
+
{
536
+
p: "/pattern"
537
+
}
538
+
);
539
+
}
540
+
close();
541
+
} else {
542
+
document.location.href = "edit.php?post_type=wp_block";
543
+
}
544
+
}
545
+
});
546
+
}
547
+
return result;
548
+
}, [
549
+
history,
550
+
isSiteEditor,
551
+
canCreateTemplate,
552
+
canCreatePatterns,
553
+
isBlockBasedTheme
554
+
]);
555
+
return {
556
+
commands,
557
+
isLoading: false
558
+
};
559
+
};
560
+
const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
561
+
const history = useHistory();
562
+
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
563
+
"site-editor.php"
564
+
);
565
+
const { canEditCSS } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
566
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
567
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
568
+
const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
569
+
return {
570
+
canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
571
+
};
572
+
}, []);
573
+
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
574
+
if (!canEditCSS) {
575
+
return [];
576
+
}
577
+
return [
578
+
{
579
+
name: "core/open-styles-css",
580
+
label: (0,external_wp_i18n_namespaceObject.__)("Open custom CSS"),
581
+
icon: brush_default,
582
+
callback: ({ close }) => {
583
+
close();
584
+
if (isSiteEditor) {
585
+
history.navigate("/styles?section=/css");
586
+
} else {
587
+
document.location = (0,external_wp_url_namespaceObject.addQueryArgs)(
588
+
"site-editor.php",
589
+
{
590
+
p: "/styles",
591
+
section: "/css"
592
+
}
593
+
);
594
+
}
595
+
}
596
+
}
597
+
];
598
+
}, [history, canEditCSS, isSiteEditor]);
599
+
return {
600
+
isLoading: false,
601
+
commands
602
+
};
603
+
};
604
+
function useSiteEditorNavigationCommands(isNetworkAdmin) {
605
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
606
+
name: "core/edit-site/navigate-pages",
607
+
hook: getNavigationCommandLoaderPerPostType("page"),
608
+
disabled: isNetworkAdmin
609
+
});
610
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
611
+
name: "core/edit-site/navigate-posts",
612
+
hook: getNavigationCommandLoaderPerPostType("post"),
613
+
disabled: isNetworkAdmin
614
+
});
615
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
616
+
name: "core/edit-site/navigate-templates",
617
+
hook: getNavigationCommandLoaderPerTemplate("wp_template"),
618
+
disabled: isNetworkAdmin
619
+
});
620
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
621
+
name: "core/edit-site/navigate-template-parts",
622
+
hook: getNavigationCommandLoaderPerTemplate("wp_template_part"),
623
+
disabled: isNetworkAdmin
624
+
});
625
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
626
+
name: "core/edit-site/basic-navigation",
627
+
hook: getSiteEditorBasicNavigationCommands(),
628
+
context: "site-editor",
629
+
disabled: isNetworkAdmin
630
+
});
631
+
(0,external_wp_commands_namespaceObject.useCommandLoader)({
632
+
name: "core/edit-site/global-styles-css",
633
+
hook: getGlobalStylesOpenCssCommands(),
634
+
disabled: isNetworkAdmin
635
+
});
636
+
}
637
+
638
+
639
+
;// ./node_modules/@wordpress/core-commands/build-module/private-apis.js
640
+
641
+
642
+
643
+
function useCommands() {
644
+
useAdminNavigationCommands();
645
+
useSiteEditorNavigationCommands();
646
+
}
647
+
const privateApis = {};
648
+
lock(privateApis, {
649
+
useCommands
650
+
});
651
+
652
+
653
+
;// ./node_modules/@wordpress/core-commands/build-module/index.js
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
const { RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis);
663
+
function CommandPalette({ settings }) {
664
+
const { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } = settings;
665
+
useAdminNavigationCommands(menuCommands);
666
+
useSiteEditorNavigationCommands(isNetworkAdmin);
667
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RouterProvider, { pathArg: "p", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}) });
668
+
}
669
+
function initializeCommandPalette(settings) {
670
+
const root = document.createElement("div");
671
+
document.body.appendChild(root);
672
+
(0,external_wp_element_namespaceObject.createRoot)(root).render(
673
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CommandPalette, { settings }) })
674
+
);
675
+
}
676
+
677
+
678
+
(window.wp = window.wp || {}).coreCommands = __webpack_exports__;
679
+
/******/ })()
680
+
;