[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> core-commands.js (source)

   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  ;// CONCATENATED MODULE: external ["wp","commands"]
  46  const external_wp_commands_namespaceObject = window["wp"]["commands"];
  47  ;// CONCATENATED MODULE: external ["wp","i18n"]
  48  const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  49  ;// CONCATENATED MODULE: external "React"
  50  const external_React_namespaceObject = window["React"];
  51  ;// CONCATENATED MODULE: external ["wp","primitives"]
  52  const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  53  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  54  
  55  /**
  56   * WordPress dependencies
  57   */
  58  
  59  const plus = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  60    xmlns: "http://www.w3.org/2000/svg",
  61    viewBox: "0 0 24 24"
  62  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  63    d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
  64  }));
  65  /* harmony default export */ const library_plus = (plus);
  66  
  67  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
  68  
  69  /**
  70   * WordPress dependencies
  71   */
  72  
  73  const symbol = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  74    xmlns: "http://www.w3.org/2000/svg",
  75    viewBox: "0 0 24 24"
  76  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  77    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"
  78  }));
  79  /* harmony default export */ const library_symbol = (symbol);
  80  
  81  ;// CONCATENATED MODULE: external ["wp","url"]
  82  const external_wp_url_namespaceObject = window["wp"]["url"];
  83  ;// CONCATENATED MODULE: external ["wp","router"]
  84  const external_wp_router_namespaceObject = window["wp"]["router"];
  85  ;// CONCATENATED MODULE: external ["wp","coreData"]
  86  const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  87  ;// CONCATENATED MODULE: external ["wp","data"]
  88  const external_wp_data_namespaceObject = window["wp"]["data"];
  89  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/hooks.js
  90  /**
  91   * WordPress dependencies
  92   */
  93  
  94  
  95  function useIsTemplatesAccessible() {
  96    return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUser('read', 'templates'), []);
  97  }
  98  function useIsBlockBasedTheme() {
  99    return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []);
 100  }
 101  
 102  ;// CONCATENATED MODULE: external ["wp","privateApis"]
 103  const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
 104  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/lock-unlock.js
 105  /**
 106   * WordPress dependencies
 107   */
 108  
 109  const {
 110    lock,
 111    unlock
 112  } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/core-commands');
 113  
 114  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/admin-navigation-commands.js
 115  /**
 116   * WordPress dependencies
 117   */
 118  
 119  
 120  
 121  
 122  
 123  
 124  /**
 125   * Internal dependencies
 126   */
 127  
 128  
 129  const {
 130    useHistory
 131  } = unlock(external_wp_router_namespaceObject.privateApis);
 132  function useAdminNavigationCommands() {
 133    const history = useHistory();
 134    const isTemplatesAccessible = useIsTemplatesAccessible();
 135    const isBlockBasedTheme = useIsBlockBasedTheme();
 136    const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
 137    (0,external_wp_commands_namespaceObject.useCommand)({
 138      name: 'core/add-new-post',
 139      label: (0,external_wp_i18n_namespaceObject.__)('Add new post'),
 140      icon: library_plus,
 141      callback: () => {
 142        document.location.href = 'post-new.php';
 143      }
 144    });
 145    (0,external_wp_commands_namespaceObject.useCommand)({
 146      name: 'core/add-new-page',
 147      label: (0,external_wp_i18n_namespaceObject.__)('Add new page'),
 148      icon: library_plus,
 149      callback: () => {
 150        document.location.href = 'post-new.php?post_type=page';
 151      }
 152    });
 153    (0,external_wp_commands_namespaceObject.useCommand)({
 154      name: 'core/manage-reusable-blocks',
 155      label: (0,external_wp_i18n_namespaceObject.__)('Patterns'),
 156      icon: library_symbol,
 157      callback: ({
 158        close
 159      }) => {
 160        if (isTemplatesAccessible && isBlockBasedTheme) {
 161          const args = {
 162            path: '/patterns'
 163          };
 164          if (isSiteEditor) {
 165            history.push(args);
 166          } else {
 167            document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 168          }
 169          close();
 170        } else {
 171          document.location.href = 'edit.php?post_type=wp_block';
 172        }
 173      }
 174    });
 175  }
 176  
 177  ;// CONCATENATED MODULE: external ["wp","element"]
 178  const external_wp_element_namespaceObject = window["wp"]["element"];
 179  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
 180  
 181  /**
 182   * WordPress dependencies
 183   */
 184  
 185  const post = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 186    xmlns: "http://www.w3.org/2000/svg",
 187    viewBox: "0 0 24 24"
 188  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 189    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"
 190  }));
 191  /* harmony default export */ const library_post = (post);
 192  
 193  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
 194  
 195  /**
 196   * WordPress dependencies
 197   */
 198  
 199  const page = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 200    xmlns: "http://www.w3.org/2000/svg",
 201    viewBox: "0 0 24 24"
 202  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 203    d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
 204  }), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 205    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"
 206  }));
 207  /* harmony default export */ const library_page = (page);
 208  
 209  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
 210  
 211  /**
 212   * WordPress dependencies
 213   */
 214  
 215  const layout = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 216    xmlns: "http://www.w3.org/2000/svg",
 217    viewBox: "0 0 24 24"
 218  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 219    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"
 220  }));
 221  /* harmony default export */ const library_layout = (layout);
 222  
 223  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
 224  
 225  /**
 226   * WordPress dependencies
 227   */
 228  
 229  const symbolFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 230    xmlns: "http://www.w3.org/2000/svg",
 231    viewBox: "0 0 24 24"
 232  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 233    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"
 234  }));
 235  /* harmony default export */ const symbol_filled = (symbolFilled);
 236  
 237  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
 238  
 239  /**
 240   * WordPress dependencies
 241   */
 242  
 243  const navigation = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 244    viewBox: "0 0 24 24",
 245    xmlns: "http://www.w3.org/2000/svg"
 246  }, (0,external_React_namespaceObject.createElement)(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  /* harmony default export */ const library_navigation = (navigation);
 250  
 251  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
 252  
 253  /**
 254   * WordPress dependencies
 255   */
 256  
 257  const styles = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 258    viewBox: "0 0 24 24",
 259    xmlns: "http://www.w3.org/2000/svg"
 260  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 261    d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"
 262  }));
 263  /* harmony default export */ const library_styles = (styles);
 264  
 265  ;// CONCATENATED MODULE: external ["wp","compose"]
 266  const external_wp_compose_namespaceObject = window["wp"]["compose"];
 267  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/utils/order-entity-records-by-search.js
 268  function orderEntityRecordsBySearch(records = [], search = '') {
 269    if (!Array.isArray(records) || !records.length) {
 270      return [];
 271    }
 272    if (!search) {
 273      return records;
 274    }
 275    const priority = [];
 276    const nonPriority = [];
 277    for (let i = 0; i < records.length; i++) {
 278      const record = records[i];
 279      if (record?.title?.raw?.toLowerCase()?.includes(search?.toLowerCase())) {
 280        priority.push(record);
 281      } else {
 282        nonPriority.push(record);
 283      }
 284    }
 285    return priority.concat(nonPriority);
 286  }
 287  
 288  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/site-editor-navigation-commands.js
 289  /**
 290   * WordPress dependencies
 291   */
 292  
 293  
 294  
 295  
 296  
 297  
 298  
 299  
 300  
 301  
 302  /**
 303   * Internal dependencies
 304   */
 305  
 306  
 307  
 308  const {
 309    useHistory: site_editor_navigation_commands_useHistory,
 310    useLocation
 311  } = unlock(external_wp_router_namespaceObject.privateApis);
 312  const icons = {
 313    post: library_post,
 314    page: library_page,
 315    wp_template: library_layout,
 316    wp_template_part: symbol_filled
 317  };
 318  function useDebouncedValue(value) {
 319    const [debouncedValue, setDebouncedValue] = (0,external_wp_element_namespaceObject.useState)('');
 320    const debounced = (0,external_wp_compose_namespaceObject.useDebounce)(setDebouncedValue, 250);
 321    (0,external_wp_element_namespaceObject.useEffect)(() => {
 322      debounced(value);
 323      return () => debounced.cancel();
 324    }, [debounced, value]);
 325    return debouncedValue;
 326  }
 327  const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader({
 328    search
 329  }) {
 330    const history = site_editor_navigation_commands_useHistory();
 331    const isBlockBasedTheme = useIsBlockBasedTheme();
 332    const delayedSearch = useDebouncedValue(search);
 333    const {
 334      records,
 335      isLoading
 336    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
 337      if (!delayedSearch) {
 338        return {
 339          isLoading: false
 340        };
 341      }
 342      const query = {
 343        search: delayedSearch,
 344        per_page: 10,
 345        orderby: 'relevance',
 346        status: ['publish', 'future', 'draft', 'pending', 'private']
 347      };
 348      return {
 349        records: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, query),
 350        isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query])
 351      };
 352    }, [delayedSearch]);
 353    const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
 354      return (records !== null && records !== void 0 ? records : []).map(record => {
 355        const command = {
 356          name: postType + '-' + record.id,
 357          searchLabel: record.title?.rendered + ' ' + record.id,
 358          label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
 359          icon: icons[postType]
 360        };
 361        if (postType === 'post' || postType === 'page' && !isBlockBasedTheme) {
 362          return {
 363            ...command,
 364            callback: ({
 365              close
 366            }) => {
 367              const args = {
 368                post: record.id,
 369                action: 'edit'
 370              };
 371              const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', args);
 372              document.location = targetUrl;
 373              close();
 374            }
 375          };
 376        }
 377        const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
 378        const extraArgs = isSiteEditor ? {
 379          canvas: (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'canvas')
 380        } : {};
 381        return {
 382          ...command,
 383          callback: ({
 384            close
 385          }) => {
 386            const args = {
 387              postType,
 388              postId: record.id,
 389              ...extraArgs
 390            };
 391            const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 392            if (isSiteEditor) {
 393              history.push(args);
 394            } else {
 395              document.location = targetUrl;
 396            }
 397            close();
 398          }
 399        };
 400      });
 401    }, [records, isBlockBasedTheme, history]);
 402    return {
 403      commands,
 404      isLoading
 405    };
 406  };
 407  const getNavigationCommandLoaderPerTemplate = templateType => function useNavigationCommandLoader({
 408    search
 409  }) {
 410    const history = site_editor_navigation_commands_useHistory();
 411    const location = useLocation();
 412    const isPatternsPage = location?.params?.path === '/patterns' || location?.params?.postType === 'wp_block';
 413    const didAccessPatternsPage = !!location?.params?.didAccessPatternsPage;
 414    const isBlockBasedTheme = useIsBlockBasedTheme();
 415    const {
 416      records,
 417      isLoading
 418    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
 419      const {
 420        getEntityRecords
 421      } = select(external_wp_coreData_namespaceObject.store);
 422      const query = {
 423        per_page: -1
 424      };
 425      return {
 426        records: getEntityRecords('postType', templateType, query),
 427        isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', templateType, query])
 428      };
 429    }, []);
 430  
 431    /*
 432     * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.
 433     * We need to sort the results based on the search query to avoid removing relevant
 434     * records below using .slice().
 435     */
 436    const orderedRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
 437      return orderEntityRecordsBySearch(records, search).slice(0, 10);
 438    }, [records, search]);
 439    const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
 440      if (!isBlockBasedTheme && !templateType === 'wp_template_part') {
 441        return [];
 442      }
 443      return orderedRecords.map(record => {
 444        const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
 445        const extraArgs = isSiteEditor ? {
 446          canvas: (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'canvas')
 447        } : {};
 448        return {
 449          name: templateType + '-' + record.id,
 450          searchLabel: record.title?.rendered + ' ' + record.id,
 451          label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
 452          icon: icons[templateType],
 453          callback: ({
 454            close
 455          }) => {
 456            const args = {
 457              postType: templateType,
 458              postId: record.id,
 459              didAccessPatternsPage: !isBlockBasedTheme && (isPatternsPage || didAccessPatternsPage) ? 1 : undefined,
 460              ...extraArgs
 461            };
 462            const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 463            if (isSiteEditor) {
 464              history.push(args);
 465            } else {
 466              document.location = targetUrl;
 467            }
 468            close();
 469          }
 470        };
 471      });
 472    }, [isBlockBasedTheme, orderedRecords, history]);
 473    return {
 474      commands,
 475      isLoading
 476    };
 477  };
 478  const usePageNavigationCommandLoader = getNavigationCommandLoaderPerPostType('page');
 479  const usePostNavigationCommandLoader = getNavigationCommandLoaderPerPostType('post');
 480  const useTemplateNavigationCommandLoader = getNavigationCommandLoaderPerTemplate('wp_template');
 481  const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerTemplate('wp_template_part');
 482  function useSiteEditorBasicNavigationCommands() {
 483    const history = site_editor_navigation_commands_useHistory();
 484    const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
 485    const isTemplatesAccessible = useIsTemplatesAccessible();
 486    const isBlockBasedTheme = useIsBlockBasedTheme();
 487    const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
 488      const result = [];
 489      if (!isTemplatesAccessible || !isBlockBasedTheme) {
 490        return result;
 491      }
 492      result.push({
 493        name: 'core/edit-site/open-navigation',
 494        label: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
 495        icon: library_navigation,
 496        callback: ({
 497          close
 498        }) => {
 499          const args = {
 500            path: '/navigation'
 501          };
 502          const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 503          if (isSiteEditor) {
 504            history.push(args);
 505          } else {
 506            document.location = targetUrl;
 507          }
 508          close();
 509        }
 510      });
 511      result.push({
 512        name: 'core/edit-site/open-styles',
 513        label: (0,external_wp_i18n_namespaceObject.__)('Styles'),
 514        icon: library_styles,
 515        callback: ({
 516          close
 517        }) => {
 518          const args = {
 519            path: '/wp_global_styles'
 520          };
 521          const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 522          if (isSiteEditor) {
 523            history.push(args);
 524          } else {
 525            document.location = targetUrl;
 526          }
 527          close();
 528        }
 529      });
 530      result.push({
 531        name: 'core/edit-site/open-pages',
 532        label: (0,external_wp_i18n_namespaceObject.__)('Pages'),
 533        icon: library_page,
 534        callback: ({
 535          close
 536        }) => {
 537          const args = {
 538            path: '/page'
 539          };
 540          const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 541          if (isSiteEditor) {
 542            history.push(args);
 543          } else {
 544            document.location = targetUrl;
 545          }
 546          close();
 547        }
 548      });
 549      result.push({
 550        name: 'core/edit-site/open-templates',
 551        label: (0,external_wp_i18n_namespaceObject.__)('Templates'),
 552        icon: library_layout,
 553        callback: ({
 554          close
 555        }) => {
 556          const args = {
 557            path: '/wp_template'
 558          };
 559          const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
 560          if (isSiteEditor) {
 561            history.push(args);
 562          } else {
 563            document.location = targetUrl;
 564          }
 565          close();
 566        }
 567      });
 568      return result;
 569    }, [history, isSiteEditor, isTemplatesAccessible, isBlockBasedTheme]);
 570    return {
 571      commands,
 572      isLoading: false
 573    };
 574  }
 575  function useSiteEditorNavigationCommands() {
 576    (0,external_wp_commands_namespaceObject.useCommandLoader)({
 577      name: 'core/edit-site/navigate-pages',
 578      hook: usePageNavigationCommandLoader
 579    });
 580    (0,external_wp_commands_namespaceObject.useCommandLoader)({
 581      name: 'core/edit-site/navigate-posts',
 582      hook: usePostNavigationCommandLoader
 583    });
 584    (0,external_wp_commands_namespaceObject.useCommandLoader)({
 585      name: 'core/edit-site/navigate-templates',
 586      hook: useTemplateNavigationCommandLoader
 587    });
 588    (0,external_wp_commands_namespaceObject.useCommandLoader)({
 589      name: 'core/edit-site/navigate-template-parts',
 590      hook: useTemplatePartNavigationCommandLoader
 591    });
 592    (0,external_wp_commands_namespaceObject.useCommandLoader)({
 593      name: 'core/edit-site/basic-navigation',
 594      hook: useSiteEditorBasicNavigationCommands,
 595      context: 'site-editor'
 596    });
 597  }
 598  
 599  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/private-apis.js
 600  /**
 601   * Internal dependencies
 602   */
 603  
 604  
 605  
 606  function useCommands() {
 607    useAdminNavigationCommands();
 608    useSiteEditorNavigationCommands();
 609  }
 610  const privateApis = {};
 611  lock(privateApis, {
 612    useCommands
 613  });
 614  
 615  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/index.js
 616  
 617  
 618  (window.wp = window.wp || {}).coreCommands = __webpack_exports__;
 619  /******/ })()
 620  ;


Generated : Sun Apr 28 08:20:02 2024 Cross-referenced by PHPXref