[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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 privateApis: () => (/* reexport */ privateApis) 43 }); 44 45 ;// external ["wp","commands"] 46 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 47 ;// external ["wp","i18n"] 48 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 49 ;// external ["wp","primitives"] 50 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 51 ;// external "ReactJSXRuntime" 52 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 53 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 54 /** 55 * WordPress dependencies 56 */ 57 58 59 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 60 xmlns: "http://www.w3.org/2000/svg", 61 viewBox: "0 0 24 24", 62 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 63 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 64 }) 65 }); 66 /* harmony default export */ const library_plus = (plus); 67 68 ;// external ["wp","url"] 69 const external_wp_url_namespaceObject = window["wp"]["url"]; 70 ;// external ["wp","coreData"] 71 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 72 ;// external ["wp","data"] 73 const external_wp_data_namespaceObject = window["wp"]["data"]; 74 ;// external ["wp","element"] 75 const external_wp_element_namespaceObject = window["wp"]["element"]; 76 ;// external ["wp","notices"] 77 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 78 ;// external ["wp","router"] 79 const external_wp_router_namespaceObject = window["wp"]["router"]; 80 ;// external ["wp","privateApis"] 81 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 82 ;// ./node_modules/@wordpress/core-commands/build-module/lock-unlock.js 83 /** 84 * WordPress dependencies 85 */ 86 87 const { 88 lock, 89 unlock 90 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/core-commands'); 91 92 ;// ./node_modules/@wordpress/core-commands/build-module/admin-navigation-commands.js 93 /** 94 * WordPress dependencies 95 */ 96 97 98 99 100 101 102 103 104 105 106 /** 107 * Internal dependencies 108 */ 109 110 const { 111 useHistory 112 } = unlock(external_wp_router_namespaceObject.privateApis); 113 const getAddNewPageCommand = () => function useAddNewPageCommand() { 114 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 115 const history = useHistory(); 116 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 117 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme; 118 }, []); 119 const { 120 saveEntityRecord 121 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 122 const { 123 createErrorNotice 124 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 125 const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(async ({ 126 close 127 }) => { 128 try { 129 const page = await saveEntityRecord('postType', 'page', { 130 status: 'draft' 131 }, { 132 throwOnError: true 133 }); 134 if (page?.id) { 135 history.navigate(`/page/$page.id}?canvas=edit`); 136 } 137 } catch (error) { 138 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); 139 createErrorNotice(errorMessage, { 140 type: 'snackbar' 141 }); 142 } finally { 143 close(); 144 } 145 }, [createErrorNotice, history, saveEntityRecord]); 146 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 147 const addNewPage = isSiteEditor && isBlockBasedTheme ? createPageEntity : () => document.location.href = 'post-new.php?post_type=page'; 148 return [{ 149 name: 'core/add-new-page', 150 label: (0,external_wp_i18n_namespaceObject.__)('Add new page'), 151 icon: library_plus, 152 callback: addNewPage 153 }]; 154 }, [createPageEntity, isSiteEditor, isBlockBasedTheme]); 155 return { 156 isLoading: false, 157 commands 158 }; 159 }; 160 function useAdminNavigationCommands() { 161 (0,external_wp_commands_namespaceObject.useCommand)({ 162 name: 'core/add-new-post', 163 label: (0,external_wp_i18n_namespaceObject.__)('Add new post'), 164 icon: library_plus, 165 callback: () => { 166 document.location.assign('post-new.php'); 167 } 168 }); 169 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 170 name: 'core/add-new-page', 171 hook: getAddNewPageCommand() 172 }); 173 } 174 175 ;// ./node_modules/@wordpress/icons/build-module/library/post.js 176 /** 177 * WordPress dependencies 178 */ 179 180 181 const post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 182 xmlns: "http://www.w3.org/2000/svg", 183 viewBox: "0 0 24 24", 184 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 185 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" 186 }) 187 }); 188 /* harmony default export */ const library_post = (post); 189 190 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 191 /** 192 * WordPress dependencies 193 */ 194 195 196 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 197 xmlns: "http://www.w3.org/2000/svg", 198 viewBox: "0 0 24 24", 199 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 200 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 201 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 202 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" 203 })] 204 }); 205 /* harmony default export */ const library_page = (page); 206 207 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 208 /** 209 * WordPress dependencies 210 */ 211 212 213 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 214 xmlns: "http://www.w3.org/2000/svg", 215 viewBox: "0 0 24 24", 216 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 217 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" 218 }) 219 }); 220 /* harmony default export */ const library_layout = (layout); 221 222 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 223 /** 224 * WordPress dependencies 225 */ 226 227 228 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 229 xmlns: "http://www.w3.org/2000/svg", 230 viewBox: "0 0 24 24", 231 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 232 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" 233 }) 234 }); 235 /* harmony default export */ const symbol_filled = (symbolFilled); 236 237 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 238 /** 239 * WordPress dependencies 240 */ 241 242 243 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 244 viewBox: "0 0 24 24", 245 xmlns: "http://www.w3.org/2000/svg", 246 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 247 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" 248 }) 249 }); 250 /* harmony default export */ const library_navigation = (navigation); 251 252 ;// ./node_modules/@wordpress/icons/build-module/library/styles.js 253 /** 254 * WordPress dependencies 255 */ 256 257 258 const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 259 viewBox: "0 0 24 24", 260 xmlns: "http://www.w3.org/2000/svg", 261 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 262 fillRule: "evenodd", 263 clipRule: "evenodd", 264 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" 265 }) 266 }); 267 /* harmony default export */ const library_styles = (styles); 268 269 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 270 /** 271 * WordPress dependencies 272 */ 273 274 275 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 276 xmlns: "http://www.w3.org/2000/svg", 277 viewBox: "0 0 24 24", 278 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 279 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" 280 }) 281 }); 282 /* harmony default export */ const library_symbol = (symbol); 283 284 ;// external ["wp","compose"] 285 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 286 ;// external ["wp","htmlEntities"] 287 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 288 ;// ./node_modules/@wordpress/core-commands/build-module/utils/order-entity-records-by-search.js 289 function orderEntityRecordsBySearch(records = [], search = '') { 290 if (!Array.isArray(records) || !records.length) { 291 return []; 292 } 293 if (!search) { 294 return records; 295 } 296 const priority = []; 297 const nonPriority = []; 298 for (let i = 0; i < records.length; i++) { 299 const record = records[i]; 300 if (record?.title?.raw?.toLowerCase()?.includes(search?.toLowerCase())) { 301 priority.push(record); 302 } else { 303 nonPriority.push(record); 304 } 305 } 306 return priority.concat(nonPriority); 307 } 308 309 ;// ./node_modules/@wordpress/core-commands/build-module/site-editor-navigation-commands.js 310 /* wp:polyfill */ 311 /** 312 * WordPress dependencies 313 */ 314 315 316 317 318 319 320 321 322 323 324 325 /** 326 * Internal dependencies 327 */ 328 329 330 const { 331 useHistory: site_editor_navigation_commands_useHistory 332 } = unlock(external_wp_router_namespaceObject.privateApis); 333 const icons = { 334 post: library_post, 335 page: library_page, 336 wp_template: library_layout, 337 wp_template_part: symbol_filled 338 }; 339 function useDebouncedValue(value) { 340 const [debouncedValue, setDebouncedValue] = (0,external_wp_element_namespaceObject.useState)(''); 341 const debounced = (0,external_wp_compose_namespaceObject.useDebounce)(setDebouncedValue, 250); 342 (0,external_wp_element_namespaceObject.useEffect)(() => { 343 debounced(value); 344 return () => debounced.cancel(); 345 }, [debounced, value]); 346 return debouncedValue; 347 } 348 const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader({ 349 search 350 }) { 351 const history = site_editor_navigation_commands_useHistory(); 352 const { 353 isBlockBasedTheme, 354 canCreateTemplate 355 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 356 return { 357 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 358 canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { 359 kind: 'postType', 360 name: 'wp_template' 361 }) 362 }; 363 }, []); 364 const delayedSearch = useDebouncedValue(search); 365 const { 366 records, 367 isLoading 368 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 369 if (!delayedSearch) { 370 return { 371 isLoading: false 372 }; 373 } 374 const query = { 375 search: delayedSearch, 376 per_page: 10, 377 orderby: 'relevance', 378 status: ['publish', 'future', 'draft', 'pending', 'private'] 379 }; 380 return { 381 records: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, query), 382 isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query]) 383 }; 384 }, [delayedSearch]); 385 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 386 return (records !== null && records !== void 0 ? records : []).map(record => { 387 const command = { 388 name: postType + '-' + record.id, 389 searchLabel: record.title?.rendered + ' ' + record.id, 390 label: record.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(record.title?.rendered) : (0,external_wp_i18n_namespaceObject.__)('(no title)'), 391 icon: icons[postType] 392 }; 393 if (!canCreateTemplate || postType === 'post' || postType === 'page' && !isBlockBasedTheme) { 394 return { 395 ...command, 396 callback: ({ 397 close 398 }) => { 399 const args = { 400 post: record.id, 401 action: 'edit' 402 }; 403 const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', args); 404 document.location = targetUrl; 405 close(); 406 } 407 }; 408 } 409 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 410 return { 411 ...command, 412 callback: ({ 413 close 414 }) => { 415 if (isSiteEditor) { 416 history.navigate(`/$postType}/$record.id}?canvas=edit`); 417 } else { 418 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 419 p: `/$postType}/$record.id}`, 420 canvas: 'edit' 421 }); 422 } 423 close(); 424 } 425 }; 426 }); 427 }, [canCreateTemplate, records, isBlockBasedTheme, history]); 428 return { 429 commands, 430 isLoading 431 }; 432 }; 433 const getNavigationCommandLoaderPerTemplate = templateType => function useNavigationCommandLoader({ 434 search 435 }) { 436 const history = site_editor_navigation_commands_useHistory(); 437 const { 438 isBlockBasedTheme, 439 canCreateTemplate 440 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 441 return { 442 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 443 canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { 444 kind: 'postType', 445 name: templateType 446 }) 447 }; 448 }, []); 449 const { 450 records, 451 isLoading 452 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 453 const { 454 getEntityRecords 455 } = select(external_wp_coreData_namespaceObject.store); 456 const query = { 457 per_page: -1 458 }; 459 return { 460 records: getEntityRecords('postType', templateType, query), 461 isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', templateType, query]) 462 }; 463 }, []); 464 465 /* 466 * wp_template and wp_template_part endpoints do not support per_page or orderby parameters. 467 * We need to sort the results based on the search query to avoid removing relevant 468 * records below using .slice(). 469 */ 470 const orderedRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { 471 return orderEntityRecordsBySearch(records, search).slice(0, 10); 472 }, [records, search]); 473 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 474 if (!canCreateTemplate || !isBlockBasedTheme && !templateType === 'wp_template_part') { 475 return []; 476 } 477 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 478 const result = []; 479 result.push(...orderedRecords.map(record => { 480 return { 481 name: templateType + '-' + record.id, 482 searchLabel: record.title?.rendered + ' ' + record.id, 483 label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'), 484 icon: icons[templateType], 485 callback: ({ 486 close 487 }) => { 488 if (isSiteEditor) { 489 history.navigate(`/$templateType}/$record.id}?canvas=edit`); 490 } else { 491 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 492 p: `/$templateType}/$record.id}`, 493 canvas: 'edit' 494 }); 495 } 496 close(); 497 } 498 }; 499 })); 500 if (orderedRecords?.length > 0 && templateType === 'wp_template_part') { 501 result.push({ 502 name: 'core/edit-site/open-template-parts', 503 label: (0,external_wp_i18n_namespaceObject.__)('Template parts'), 504 icon: symbol_filled, 505 callback: ({ 506 close 507 }) => { 508 if (isSiteEditor) { 509 history.navigate('/pattern?postType=wp_template_part&categoryId=all-parts'); 510 } else { 511 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 512 p: '/pattern', 513 postType: 'wp_template_part', 514 categoryId: 'all-parts' 515 }); 516 } 517 close(); 518 } 519 }); 520 } 521 return result; 522 }, [canCreateTemplate, isBlockBasedTheme, orderedRecords, history]); 523 return { 524 commands, 525 isLoading 526 }; 527 }; 528 const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() { 529 const history = site_editor_navigation_commands_useHistory(); 530 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 531 const { 532 isBlockBasedTheme, 533 canCreateTemplate 534 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 535 return { 536 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 537 canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { 538 kind: 'postType', 539 name: 'wp_template' 540 }) 541 }; 542 }, []); 543 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 544 const result = []; 545 if (canCreateTemplate && isBlockBasedTheme) { 546 result.push({ 547 name: 'core/edit-site/open-navigation', 548 label: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 549 icon: library_navigation, 550 callback: ({ 551 close 552 }) => { 553 if (isSiteEditor) { 554 history.navigate('/navigation'); 555 } else { 556 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 557 p: '/navigation' 558 }); 559 } 560 close(); 561 } 562 }); 563 result.push({ 564 name: 'core/edit-site/open-styles', 565 label: (0,external_wp_i18n_namespaceObject.__)('Styles'), 566 icon: library_styles, 567 callback: ({ 568 close 569 }) => { 570 if (isSiteEditor) { 571 history.navigate('/styles'); 572 } else { 573 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 574 p: '/styles' 575 }); 576 } 577 close(); 578 } 579 }); 580 result.push({ 581 name: 'core/edit-site/open-pages', 582 label: (0,external_wp_i18n_namespaceObject.__)('Pages'), 583 icon: library_page, 584 callback: ({ 585 close 586 }) => { 587 if (isSiteEditor) { 588 history.navigate('/page'); 589 } else { 590 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 591 p: '/page' 592 }); 593 } 594 close(); 595 } 596 }); 597 result.push({ 598 name: 'core/edit-site/open-templates', 599 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 600 icon: library_layout, 601 callback: ({ 602 close 603 }) => { 604 if (isSiteEditor) { 605 history.navigate('/template'); 606 } else { 607 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 608 p: '/template' 609 }); 610 } 611 close(); 612 } 613 }); 614 } 615 result.push({ 616 name: 'core/edit-site/open-patterns', 617 label: (0,external_wp_i18n_namespaceObject.__)('Patterns'), 618 icon: library_symbol, 619 callback: ({ 620 close 621 }) => { 622 if (canCreateTemplate) { 623 if (isSiteEditor) { 624 history.navigate('/pattern'); 625 } else { 626 document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 627 p: '/pattern' 628 }); 629 } 630 close(); 631 } else { 632 // If a user cannot access the site editor 633 document.location.href = 'edit.php?post_type=wp_block'; 634 } 635 } 636 }); 637 return result; 638 }, [history, isSiteEditor, canCreateTemplate, isBlockBasedTheme]); 639 return { 640 commands, 641 isLoading: false 642 }; 643 }; 644 function useSiteEditorNavigationCommands() { 645 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 646 name: 'core/edit-site/navigate-pages', 647 hook: getNavigationCommandLoaderPerPostType('page') 648 }); 649 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 650 name: 'core/edit-site/navigate-posts', 651 hook: getNavigationCommandLoaderPerPostType('post') 652 }); 653 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 654 name: 'core/edit-site/navigate-templates', 655 hook: getNavigationCommandLoaderPerTemplate('wp_template') 656 }); 657 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 658 name: 'core/edit-site/navigate-template-parts', 659 hook: getNavigationCommandLoaderPerTemplate('wp_template_part') 660 }); 661 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 662 name: 'core/edit-site/basic-navigation', 663 hook: getSiteEditorBasicNavigationCommands(), 664 context: 'site-editor' 665 }); 666 } 667 668 ;// ./node_modules/@wordpress/core-commands/build-module/private-apis.js 669 /** 670 * Internal dependencies 671 */ 672 673 674 675 function useCommands() { 676 useAdminNavigationCommands(); 677 useSiteEditorNavigationCommands(); 678 } 679 const privateApis = {}; 680 lock(privateApis, { 681 useCommands 682 }); 683 684 ;// ./node_modules/@wordpress/core-commands/build-module/index.js 685 686 687 (window.wp = window.wp || {}).coreCommands = __webpack_exports__; 688 /******/ })() 689 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Feb 21 08:20:01 2025 | Cross-referenced by PHPXref |