@wordpress/core-commands 1.37.0 → 1.37.1-next.ba3aee3a2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +0 -2
  2. package/LICENSE.md +1 -1
  3. package/build/{admin-navigation-commands.js → admin-navigation-commands.cjs} +1 -1
  4. package/build/{index.js → index.cjs} +5 -5
  5. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  6. package/build/{private-apis.js → private-apis.cjs} +4 -4
  7. package/build/{site-editor-navigation-commands.js → site-editor-navigation-commands.cjs} +47 -26
  8. package/build/site-editor-navigation-commands.cjs.map +7 -0
  9. package/build/utils/{order-entity-records-by-search.js → order-entity-records-by-search.cjs} +1 -1
  10. package/build-module/{admin-navigation-commands.js → admin-navigation-commands.mjs} +1 -1
  11. package/build-module/{index.js → index.mjs} +5 -5
  12. package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
  13. package/build-module/{private-apis.js → private-apis.mjs} +4 -4
  14. package/build-module/{site-editor-navigation-commands.js → site-editor-navigation-commands.mjs} +47 -26
  15. package/build-module/site-editor-navigation-commands.mjs.map +7 -0
  16. package/build-module/utils/{order-entity-records-by-search.js → order-entity-records-by-search.mjs} +1 -1
  17. package/package.json +26 -19
  18. package/src/site-editor-navigation-commands.js +62 -23
  19. package/build/site-editor-navigation-commands.js.map +0 -7
  20. package/build-module/site-editor-navigation-commands.js.map +0 -7
  21. /package/build/{admin-navigation-commands.js.map → admin-navigation-commands.cjs.map} +0 -0
  22. /package/build/{index.js.map → index.cjs.map} +0 -0
  23. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  24. /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
  25. /package/build/utils/{order-entity-records-by-search.js.map → order-entity-records-by-search.cjs.map} +0 -0
  26. /package/build-module/{admin-navigation-commands.js.map → admin-navigation-commands.mjs.map} +0 -0
  27. /package/build-module/{index.js.map → index.mjs.map} +0 -0
  28. /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
  29. /package/build-module/{private-apis.js.map → private-apis.mjs.map} +0 -0
  30. /package/build-module/utils/{order-entity-records-by-search.js.map → order-entity-records-by-search.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 1.37.0 (2025-12-23)
6
-
7
5
  ## 1.36.0 (2025-11-26)
8
6
 
9
7
  ## 1.35.0 (2025-11-12)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2025 by the contributors
3
+ Copyright 2016-2026 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
@@ -85,4 +85,4 @@ function useAdminNavigationCommands(menuCommands) {
85
85
  0 && (module.exports = {
86
86
  useAdminNavigationCommands
87
87
  });
88
- //# sourceMappingURL=admin-navigation-commands.js.map
88
+ //# sourceMappingURL=admin-navigation-commands.cjs.map
@@ -26,10 +26,10 @@ module.exports = __toCommonJS(index_exports);
26
26
  var import_element = require("@wordpress/element");
27
27
  var import_router = require("@wordpress/router");
28
28
  var import_commands = require("@wordpress/commands");
29
- var import_admin_navigation_commands = require("./admin-navigation-commands");
30
- var import_site_editor_navigation_commands = require("./site-editor-navigation-commands");
31
- var import_lock_unlock = require("./lock-unlock");
32
- var import_private_apis = require("./private-apis");
29
+ var import_admin_navigation_commands = require("./admin-navigation-commands.cjs");
30
+ var import_site_editor_navigation_commands = require("./site-editor-navigation-commands.cjs");
31
+ var import_lock_unlock = require("./lock-unlock.cjs");
32
+ var import_private_apis = require("./private-apis.cjs");
33
33
  var import_jsx_runtime = require("react/jsx-runtime");
34
34
  var { RouterProvider } = (0, import_lock_unlock.unlock)(import_router.privateApis);
35
35
  function CommandPalette({ settings }) {
@@ -50,4 +50,4 @@ function initializeCommandPalette(settings) {
50
50
  initializeCommandPalette,
51
51
  privateApis
52
52
  });
53
- //# sourceMappingURL=index.js.map
53
+ //# sourceMappingURL=index.cjs.map
@@ -33,4 +33,4 @@ var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnl
33
33
  lock,
34
34
  unlock
35
35
  });
36
- //# sourceMappingURL=lock-unlock.js.map
36
+ //# sourceMappingURL=lock-unlock.cjs.map
@@ -22,9 +22,9 @@ __export(private_apis_exports, {
22
22
  privateApis: () => privateApis
23
23
  });
24
24
  module.exports = __toCommonJS(private_apis_exports);
25
- var import_admin_navigation_commands = require("./admin-navigation-commands");
26
- var import_site_editor_navigation_commands = require("./site-editor-navigation-commands");
27
- var import_lock_unlock = require("./lock-unlock");
25
+ var import_admin_navigation_commands = require("./admin-navigation-commands.cjs");
26
+ var import_site_editor_navigation_commands = require("./site-editor-navigation-commands.cjs");
27
+ var import_lock_unlock = require("./lock-unlock.cjs");
28
28
  function useCommands() {
29
29
  (0, import_admin_navigation_commands.useAdminNavigationCommands)();
30
30
  (0, import_site_editor_navigation_commands.useSiteEditorNavigationCommands)();
@@ -37,4 +37,4 @@ var privateApis = {};
37
37
  0 && (module.exports = {
38
38
  privateApis
39
39
  });
40
- //# sourceMappingURL=private-apis.js.map
40
+ //# sourceMappingURL=private-apis.cjs.map
@@ -32,8 +32,8 @@ var import_router = require("@wordpress/router");
32
32
  var import_url = require("@wordpress/url");
33
33
  var import_compose = require("@wordpress/compose");
34
34
  var import_html_entities = require("@wordpress/html-entities");
35
- var import_lock_unlock = require("./lock-unlock");
36
- var import_order_entity_records_by_search = require("./utils/order-entity-records-by-search");
35
+ var import_lock_unlock = require("./lock-unlock.cjs");
36
+ var import_order_entity_records_by_search = require("./utils/order-entity-records-by-search.cjs");
37
37
  var { useHistory } = (0, import_lock_unlock.unlock)(import_router.privateApis);
38
38
  var icons = {
39
39
  post: import_icons.post,
@@ -50,6 +50,31 @@ function useDebouncedValue(value) {
50
50
  }, [debounced, value]);
51
51
  return debouncedValue;
52
52
  }
53
+ var ROUTE_MAPPING = {
54
+ "/template": "/templates",
55
+ "/pattern": "/patterns"
56
+ };
57
+ function getSiteEditorPage() {
58
+ return window.__experimentalExtensibleSiteEditor ? "admin.php?page=site-editor-v2" : "site-editor.php";
59
+ }
60
+ function mapRoute(path) {
61
+ if (!window.__experimentalExtensibleSiteEditor) {
62
+ return path;
63
+ }
64
+ for (const [oldPath, newPath] of Object.entries(ROUTE_MAPPING)) {
65
+ if (path === oldPath || path.startsWith(oldPath + "?")) {
66
+ if (path.includes("postType=wp_template_part")) {
67
+ return "/template-parts";
68
+ }
69
+ return path.replace(oldPath, newPath);
70
+ }
71
+ }
72
+ return path;
73
+ }
74
+ function isInSiteEditor() {
75
+ const path = (0, import_url.getPath)(window.location.href);
76
+ return path?.includes("site-editor.php") || path?.includes("page=site-editor-v2");
77
+ }
53
78
  var getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
54
79
  const history = useHistory();
55
80
  const { isBlockBasedTheme, canCreateTemplate } = (0, import_data.useSelect)(
@@ -120,9 +145,7 @@ var getNavigationCommandLoaderPerPostType = (postType) => function useNavigation
120
145
  }
121
146
  };
122
147
  }
123
- const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
124
- "site-editor.php"
125
- );
148
+ const isSiteEditor = isInSiteEditor();
126
149
  return {
127
150
  ...command,
128
151
  callback: ({ close }) => {
@@ -132,7 +155,7 @@ var getNavigationCommandLoaderPerPostType = (postType) => function useNavigation
132
155
  );
133
156
  } else {
134
157
  document.location = (0, import_url.addQueryArgs)(
135
- "site-editor.php",
158
+ getSiteEditorPage(),
136
159
  {
137
160
  p: `/${postType}/${record.id}`,
138
161
  canvas: "edit"
@@ -199,7 +222,7 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
199
222
  );
200
223
  } else {
201
224
  document.location = (0, import_url.addQueryArgs)(
202
- "site-editor.php",
225
+ getSiteEditorPage(),
203
226
  {
204
227
  p: `/${templateType}/${record.id}`,
205
228
  canvas: "edit"
@@ -219,13 +242,15 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
219
242
  callback: ({ close }) => {
220
243
  if (isSiteEditor) {
221
244
  history.navigate(
222
- "/pattern?postType=wp_template_part&categoryId=all-parts"
245
+ mapRoute(
246
+ "/pattern?postType=wp_template_part&categoryId=all-parts"
247
+ )
223
248
  );
224
249
  } else {
225
250
  document.location = (0, import_url.addQueryArgs)(
226
- "site-editor.php",
251
+ getSiteEditorPage(),
227
252
  {
228
- p: "/pattern",
253
+ p: mapRoute("/pattern"),
229
254
  postType: "wp_template_part",
230
255
  categoryId: "all-parts"
231
256
  }
@@ -244,9 +269,7 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
244
269
  };
245
270
  var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
246
271
  const history = useHistory();
247
- const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
248
- "site-editor.php"
249
- );
272
+ const isSiteEditor = isInSiteEditor();
250
273
  const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } = (0, import_data.useSelect)((select) => {
251
274
  return {
252
275
  isBlockBasedTheme: select(import_core_data.store).getCurrentTheme()?.is_block_theme,
@@ -272,7 +295,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
272
295
  history.navigate("/styles");
273
296
  } else {
274
297
  document.location = (0, import_url.addQueryArgs)(
275
- "site-editor.php",
298
+ getSiteEditorPage(),
276
299
  {
277
300
  p: "/styles"
278
301
  }
@@ -290,7 +313,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
290
313
  history.navigate("/navigation");
291
314
  } else {
292
315
  document.location = (0, import_url.addQueryArgs)(
293
- "site-editor.php",
316
+ getSiteEditorPage(),
294
317
  {
295
318
  p: "/navigation"
296
319
  }
@@ -305,12 +328,12 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
305
328
  icon: import_icons.layout,
306
329
  callback: ({ close }) => {
307
330
  if (isSiteEditor) {
308
- history.navigate("/template");
331
+ history.navigate(mapRoute("/template"));
309
332
  } else {
310
333
  document.location = (0, import_url.addQueryArgs)(
311
- "site-editor.php",
334
+ getSiteEditorPage(),
312
335
  {
313
- p: "/template"
336
+ p: mapRoute("/template")
314
337
  }
315
338
  );
316
339
  }
@@ -326,12 +349,12 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
326
349
  callback: ({ close }) => {
327
350
  if (canCreateTemplate) {
328
351
  if (isSiteEditor) {
329
- history.navigate("/pattern");
352
+ history.navigate(mapRoute("/pattern"));
330
353
  } else {
331
354
  document.location = (0, import_url.addQueryArgs)(
332
- "site-editor.php",
355
+ getSiteEditorPage(),
333
356
  {
334
- p: "/pattern"
357
+ p: mapRoute("/pattern")
335
358
  }
336
359
  );
337
360
  }
@@ -357,9 +380,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
357
380
  };
358
381
  var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
359
382
  const history = useHistory();
360
- const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
361
- "site-editor.php"
362
- );
383
+ const isSiteEditor = isInSiteEditor();
363
384
  const { canEditCSS } = (0, import_data.useSelect)((select) => {
364
385
  const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(import_core_data.store);
365
386
  const globalStylesId = __experimentalGetCurrentGlobalStylesId();
@@ -383,7 +404,7 @@ var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssComman
383
404
  history.navigate("/styles?section=/css");
384
405
  } else {
385
406
  document.location = (0, import_url.addQueryArgs)(
386
- "site-editor.php",
407
+ getSiteEditorPage(),
387
408
  {
388
409
  p: "/styles",
389
410
  section: "/css"
@@ -436,4 +457,4 @@ function useSiteEditorNavigationCommands(isNetworkAdmin) {
436
457
  0 && (module.exports = {
437
458
  useSiteEditorNavigationCommands
438
459
  });
439
- //# sourceMappingURL=site-editor-navigation-commands.js.map
460
+ //# sourceMappingURL=site-editor-navigation-commands.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/site-editor-navigation-commands.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tpost,\n\tpage,\n\tlayout,\n\tsymbol,\n\tsymbolFilled,\n\tstyles,\n\tnavigation,\n\tbrush,\n} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nfunction useDebouncedValue( value ) {\n\tconst [ debouncedValue, setDebouncedValue ] = useState( '' );\n\tconst debounced = useDebounce( setDebouncedValue, 250 );\n\n\tuseEffect( () => {\n\t\tdebounced( value );\n\t\treturn () => debounced.cancel();\n\t}, [ debounced, value ] );\n\n\treturn debouncedValue;\n}\n\n// Route mapping for experimental site editor\nconst ROUTE_MAPPING = {\n\t'/template': '/templates',\n\t'/pattern': '/patterns',\n};\n\n// Helper to determine the site editor page URL\nfunction getSiteEditorPage() {\n\treturn window.__experimentalExtensibleSiteEditor\n\t\t? 'admin.php?page=site-editor-v2'\n\t\t: 'site-editor.php';\n}\n\n// Helper to map routes for experimental site editor\nfunction mapRoute( path ) {\n\tif ( ! window.__experimentalExtensibleSiteEditor ) {\n\t\treturn path;\n\t}\n\n\t// Check if path needs mapping\n\tfor ( const [ oldPath, newPath ] of Object.entries( ROUTE_MAPPING ) ) {\n\t\tif ( path === oldPath || path.startsWith( oldPath + '?' ) ) {\n\t\t\t// Handle template parts special case\n\t\t\tif ( path.includes( 'postType=wp_template_part' ) ) {\n\t\t\t\treturn '/template-parts';\n\t\t\t}\n\t\t\t// Replace the base path\n\t\t\treturn path.replace( oldPath, newPath );\n\t\t}\n\t}\n\n\treturn path;\n}\n\n// Helper to check if currently in site editor\nfunction isInSiteEditor() {\n\tconst path = getPath( window.location.href );\n\treturn (\n\t\tpath?.includes( 'site-editor.php' ) ||\n\t\tpath?.includes( 'page=site-editor-v2' )\n\t);\n}\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst delayedSearch = useDebouncedValue( search );\n\t\tconst { records, isLoading } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif ( ! delayedSearch ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst query = {\n\t\t\t\t\tsearch: delayedSearch,\n\t\t\t\t\tper_page: 10,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\tstatus: [\n\t\t\t\t\t\t'publish',\n\t\t\t\t\t\t'future',\n\t\t\t\t\t\t'draft',\n\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t'private',\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\trecords: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tquery\n\t\t\t\t\t),\n\t\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ delayedSearch ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).map( ( record ) => {\n\t\t\t\tconst command = {\n\t\t\t\t\tname: postType + '-' + record.id,\n\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? decodeEntities( record.title?.rendered )\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t};\n\n\t\t\t\tif (\n\t\t\t\t\t! canCreateTemplate ||\n\t\t\t\t\tpostType === 'post' ||\n\t\t\t\t\t( postType === 'page' && ! isBlockBasedTheme )\n\t\t\t\t) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...command,\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\t\tpost: record.id,\n\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst targetUrl = addQueryArgs( 'post.php', args );\n\t\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst isSiteEditor = isInSiteEditor();\n\n\t\t\t\treturn {\n\t\t\t\t\t...command,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t`/${ postType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: `/${ postType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ canCreateTemplate, records, isBlockBasedTheme, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getNavigationCommandLoaderPerTemplate = ( templateType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: templateType,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst { records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', templateType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', templateType, query ]\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t\t/*\n\t\t * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.\n\t\t * We need to sort the results based on the search query to avoid removing relevant\n\t\t * records below using .slice().\n\t\t */\n\t\tconst orderedRecords = useMemo( () => {\n\t\t\treturn orderEntityRecordsBySearch( records, search ).slice( 0, 10 );\n\t\t}, [ records, search ] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif (\n\t\t\t\t! canCreateTemplate ||\n\t\t\t\t( ! isBlockBasedTheme && ! templateType === 'wp_template_part' )\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tconst result = [];\n\t\t\tresult.push(\n\t\t\t\t...orderedRecords.map( ( record ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: templateType + '-' + record.id,\n\t\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\t\ticon: icons[ templateType ],\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t`/${ templateType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: `/${ templateType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\torderedRecords?.length > 0 &&\n\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-template-parts',\n\t\t\t\t\tlabel: __( 'Go to: Template parts' ),\n\t\t\t\t\ticon: symbolFilled,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\tmapRoute(\n\t\t\t\t\t\t\t\t\t'/pattern?postType=wp_template_part&categoryId=all-parts'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: mapRoute( '/pattern' ),\n\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\tcategoryId: 'all-parts',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn result;\n\t\t}, [ canCreateTemplate, isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getSiteEditorBasicNavigationCommands = () =>\n\tfunction useSiteEditorBasicNavigationCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = isInSiteEditor();\n\t\tconst { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t\tcanCreatePatterns: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst commands = useMemo( () => {\n\t\t\tconst result = [];\n\n\t\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\t\t// Go to Styles command\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-styles',\n\t\t\t\t\tlabel: __( 'Go to: Styles' ),\n\t\t\t\t\ticon: styles,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\t\t\tlabel: __( 'Go to: Navigation' ),\n\t\t\t\t\ticon: navigation,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/navigation' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/navigation',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-templates',\n\t\t\t\t\tlabel: __( 'Go to: Templates' ),\n\t\t\t\t\ticon: layout,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( mapRoute( '/template' ) );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: mapRoute( '/template' ),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( canCreatePatterns ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-patterns',\n\t\t\t\t\tlabel: __( 'Go to: Patterns' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( canCreateTemplate ) {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate( mapRoute( '/pattern' ) );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: mapRoute( '/pattern' ),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If a user cannot access the site editor.\n\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t'edit.php?post_type=wp_block';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, [\n\t\t\thistory,\n\t\t\tisSiteEditor,\n\t\t\tcanCreateTemplate,\n\t\t\tcanCreatePatterns,\n\t\t\tisBlockBasedTheme,\n\t\t] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getGlobalStylesOpenCssCommands = () =>\n\tfunction useGlobalStylesOpenCssCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = isInSiteEditor();\n\t\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! canEditCSS ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/open-styles-css',\n\t\t\t\t\tlabel: __( 'Open custom CSS' ),\n\t\t\t\t\ticon: brush,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles?section=/css' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ history, canEditCSS, isSiteEditor ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useSiteEditorNavigationCommands( isNetworkAdmin ) {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: getNavigationCommandLoaderPerPostType( 'page' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: getNavigationCommandLoaderPerPostType( 'post' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template_part' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: getSiteEditorBasicNavigationCommands(),\n\t\tcontext: 'site-editor',\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/global-styles-css',\n\t\thook: getGlobalStylesOpenCssCommands(),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAiC;AACjC,kBAAmB;AACnB,qBAA6C;AAC7C,kBAA0B;AAC1B,uBAAmC;AACnC,mBASO;AACP,oBAAiD;AACjD,iBAAsC;AACtC,qBAA4B;AAC5B,2BAA+B;AAK/B,yBAAuB;AACvB,4CAA2C;AAE3C,IAAM,EAAE,WAAW,QAAI,2BAAQ,cAAAA,WAAkB;AAEjD,IAAM,QAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,kBAAkB;AAC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AuC,MAAO;AAAA,IACpD,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,aAAc;AAAA,IAC3D,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,kBAAmB;AAAA,IAChE,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,qCAAqC;AAAA,IAC3C,SAAS;AAAA,IACT,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,+BAA+B;AAAA,IACrC,UAAU;AAAA,EACX,CAAE;AACH;",
6
+ "names": ["routerPrivateApis", "coreStore"]
7
+ }
@@ -45,4 +45,4 @@ function orderEntityRecordsBySearch(records = [], search = "") {
45
45
  0 && (module.exports = {
46
46
  orderEntityRecordsBySearch
47
47
  });
48
- //# sourceMappingURL=order-entity-records-by-search.js.map
48
+ //# sourceMappingURL=order-entity-records-by-search.cjs.map
@@ -61,4 +61,4 @@ function useAdminNavigationCommands(menuCommands) {
61
61
  export {
62
62
  useAdminNavigationCommands
63
63
  };
64
- //# sourceMappingURL=admin-navigation-commands.js.map
64
+ //# sourceMappingURL=admin-navigation-commands.mjs.map
@@ -2,10 +2,10 @@
2
2
  import { createRoot, StrictMode } from "@wordpress/element";
3
3
  import { privateApis as routerPrivateApis } from "@wordpress/router";
4
4
  import { CommandMenu } from "@wordpress/commands";
5
- import { useAdminNavigationCommands } from "./admin-navigation-commands";
6
- import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands";
7
- import { unlock } from "./lock-unlock";
8
- import { privateApis } from "./private-apis";
5
+ import { useAdminNavigationCommands } from "./admin-navigation-commands.mjs";
6
+ import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands.mjs";
7
+ import { unlock } from "./lock-unlock.mjs";
8
+ import { privateApis } from "./private-apis.mjs";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  var { RouterProvider } = unlock(routerPrivateApis);
11
11
  function CommandPalette({ settings }) {
@@ -25,4 +25,4 @@ export {
25
25
  initializeCommandPalette,
26
26
  privateApis
27
27
  };
28
- //# sourceMappingURL=index.js.map
28
+ //# sourceMappingURL=index.mjs.map
@@ -8,4 +8,4 @@ export {
8
8
  lock,
9
9
  unlock
10
10
  };
11
- //# sourceMappingURL=lock-unlock.js.map
11
+ //# sourceMappingURL=lock-unlock.mjs.map
@@ -1,7 +1,7 @@
1
1
  // packages/core-commands/src/private-apis.js
2
- import { useAdminNavigationCommands } from "./admin-navigation-commands";
3
- import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands";
4
- import { lock } from "./lock-unlock";
2
+ import { useAdminNavigationCommands } from "./admin-navigation-commands.mjs";
3
+ import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands.mjs";
4
+ import { lock } from "./lock-unlock.mjs";
5
5
  function useCommands() {
6
6
  useAdminNavigationCommands();
7
7
  useSiteEditorNavigationCommands();
@@ -13,4 +13,4 @@ lock(privateApis, {
13
13
  export {
14
14
  privateApis
15
15
  };
16
- //# sourceMappingURL=private-apis.js.map
16
+ //# sourceMappingURL=private-apis.mjs.map
@@ -18,8 +18,8 @@ import { privateApis as routerPrivateApis } from "@wordpress/router";
18
18
  import { addQueryArgs, getPath } from "@wordpress/url";
19
19
  import { useDebounce } from "@wordpress/compose";
20
20
  import { decodeEntities } from "@wordpress/html-entities";
21
- import { unlock } from "./lock-unlock";
22
- import { orderEntityRecordsBySearch } from "./utils/order-entity-records-by-search";
21
+ import { unlock } from "./lock-unlock.mjs";
22
+ import { orderEntityRecordsBySearch } from "./utils/order-entity-records-by-search.mjs";
23
23
  var { useHistory } = unlock(routerPrivateApis);
24
24
  var icons = {
25
25
  post,
@@ -36,6 +36,31 @@ function useDebouncedValue(value) {
36
36
  }, [debounced, value]);
37
37
  return debouncedValue;
38
38
  }
39
+ var ROUTE_MAPPING = {
40
+ "/template": "/templates",
41
+ "/pattern": "/patterns"
42
+ };
43
+ function getSiteEditorPage() {
44
+ return window.__experimentalExtensibleSiteEditor ? "admin.php?page=site-editor-v2" : "site-editor.php";
45
+ }
46
+ function mapRoute(path) {
47
+ if (!window.__experimentalExtensibleSiteEditor) {
48
+ return path;
49
+ }
50
+ for (const [oldPath, newPath] of Object.entries(ROUTE_MAPPING)) {
51
+ if (path === oldPath || path.startsWith(oldPath + "?")) {
52
+ if (path.includes("postType=wp_template_part")) {
53
+ return "/template-parts";
54
+ }
55
+ return path.replace(oldPath, newPath);
56
+ }
57
+ }
58
+ return path;
59
+ }
60
+ function isInSiteEditor() {
61
+ const path = getPath(window.location.href);
62
+ return path?.includes("site-editor.php") || path?.includes("page=site-editor-v2");
63
+ }
39
64
  var getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
40
65
  const history = useHistory();
41
66
  const { isBlockBasedTheme, canCreateTemplate } = useSelect(
@@ -106,9 +131,7 @@ var getNavigationCommandLoaderPerPostType = (postType) => function useNavigation
106
131
  }
107
132
  };
108
133
  }
109
- const isSiteEditor = getPath(window.location.href)?.includes(
110
- "site-editor.php"
111
- );
134
+ const isSiteEditor = isInSiteEditor();
112
135
  return {
113
136
  ...command,
114
137
  callback: ({ close }) => {
@@ -118,7 +141,7 @@ var getNavigationCommandLoaderPerPostType = (postType) => function useNavigation
118
141
  );
119
142
  } else {
120
143
  document.location = addQueryArgs(
121
- "site-editor.php",
144
+ getSiteEditorPage(),
122
145
  {
123
146
  p: `/${postType}/${record.id}`,
124
147
  canvas: "edit"
@@ -185,7 +208,7 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
185
208
  );
186
209
  } else {
187
210
  document.location = addQueryArgs(
188
- "site-editor.php",
211
+ getSiteEditorPage(),
189
212
  {
190
213
  p: `/${templateType}/${record.id}`,
191
214
  canvas: "edit"
@@ -205,13 +228,15 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
205
228
  callback: ({ close }) => {
206
229
  if (isSiteEditor) {
207
230
  history.navigate(
208
- "/pattern?postType=wp_template_part&categoryId=all-parts"
231
+ mapRoute(
232
+ "/pattern?postType=wp_template_part&categoryId=all-parts"
233
+ )
209
234
  );
210
235
  } else {
211
236
  document.location = addQueryArgs(
212
- "site-editor.php",
237
+ getSiteEditorPage(),
213
238
  {
214
- p: "/pattern",
239
+ p: mapRoute("/pattern"),
215
240
  postType: "wp_template_part",
216
241
  categoryId: "all-parts"
217
242
  }
@@ -230,9 +255,7 @@ var getNavigationCommandLoaderPerTemplate = (templateType) => function useNaviga
230
255
  };
231
256
  var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
232
257
  const history = useHistory();
233
- const isSiteEditor = getPath(window.location.href)?.includes(
234
- "site-editor.php"
235
- );
258
+ const isSiteEditor = isInSiteEditor();
236
259
  const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } = useSelect((select) => {
237
260
  return {
238
261
  isBlockBasedTheme: select(coreStore).getCurrentTheme()?.is_block_theme,
@@ -258,7 +281,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
258
281
  history.navigate("/styles");
259
282
  } else {
260
283
  document.location = addQueryArgs(
261
- "site-editor.php",
284
+ getSiteEditorPage(),
262
285
  {
263
286
  p: "/styles"
264
287
  }
@@ -276,7 +299,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
276
299
  history.navigate("/navigation");
277
300
  } else {
278
301
  document.location = addQueryArgs(
279
- "site-editor.php",
302
+ getSiteEditorPage(),
280
303
  {
281
304
  p: "/navigation"
282
305
  }
@@ -291,12 +314,12 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
291
314
  icon: layout,
292
315
  callback: ({ close }) => {
293
316
  if (isSiteEditor) {
294
- history.navigate("/template");
317
+ history.navigate(mapRoute("/template"));
295
318
  } else {
296
319
  document.location = addQueryArgs(
297
- "site-editor.php",
320
+ getSiteEditorPage(),
298
321
  {
299
- p: "/template"
322
+ p: mapRoute("/template")
300
323
  }
301
324
  );
302
325
  }
@@ -312,12 +335,12 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
312
335
  callback: ({ close }) => {
313
336
  if (canCreateTemplate) {
314
337
  if (isSiteEditor) {
315
- history.navigate("/pattern");
338
+ history.navigate(mapRoute("/pattern"));
316
339
  } else {
317
340
  document.location = addQueryArgs(
318
- "site-editor.php",
341
+ getSiteEditorPage(),
319
342
  {
320
- p: "/pattern"
343
+ p: mapRoute("/pattern")
321
344
  }
322
345
  );
323
346
  }
@@ -343,9 +366,7 @@ var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavi
343
366
  };
344
367
  var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
345
368
  const history = useHistory();
346
- const isSiteEditor = getPath(window.location.href)?.includes(
347
- "site-editor.php"
348
- );
369
+ const isSiteEditor = isInSiteEditor();
349
370
  const { canEditCSS } = useSelect((select) => {
350
371
  const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(coreStore);
351
372
  const globalStylesId = __experimentalGetCurrentGlobalStylesId();
@@ -369,7 +390,7 @@ var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssComman
369
390
  history.navigate("/styles?section=/css");
370
391
  } else {
371
392
  document.location = addQueryArgs(
372
- "site-editor.php",
393
+ getSiteEditorPage(),
373
394
  {
374
395
  p: "/styles",
375
396
  section: "/css"
@@ -421,4 +442,4 @@ function useSiteEditorNavigationCommands(isNetworkAdmin) {
421
442
  export {
422
443
  useSiteEditorNavigationCommands
423
444
  };
424
- //# sourceMappingURL=site-editor-navigation-commands.js.map
445
+ //# sourceMappingURL=site-editor-navigation-commands.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/site-editor-navigation-commands.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tpost,\n\tpage,\n\tlayout,\n\tsymbol,\n\tsymbolFilled,\n\tstyles,\n\tnavigation,\n\tbrush,\n} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nfunction useDebouncedValue( value ) {\n\tconst [ debouncedValue, setDebouncedValue ] = useState( '' );\n\tconst debounced = useDebounce( setDebouncedValue, 250 );\n\n\tuseEffect( () => {\n\t\tdebounced( value );\n\t\treturn () => debounced.cancel();\n\t}, [ debounced, value ] );\n\n\treturn debouncedValue;\n}\n\n// Route mapping for experimental site editor\nconst ROUTE_MAPPING = {\n\t'/template': '/templates',\n\t'/pattern': '/patterns',\n};\n\n// Helper to determine the site editor page URL\nfunction getSiteEditorPage() {\n\treturn window.__experimentalExtensibleSiteEditor\n\t\t? 'admin.php?page=site-editor-v2'\n\t\t: 'site-editor.php';\n}\n\n// Helper to map routes for experimental site editor\nfunction mapRoute( path ) {\n\tif ( ! window.__experimentalExtensibleSiteEditor ) {\n\t\treturn path;\n\t}\n\n\t// Check if path needs mapping\n\tfor ( const [ oldPath, newPath ] of Object.entries( ROUTE_MAPPING ) ) {\n\t\tif ( path === oldPath || path.startsWith( oldPath + '?' ) ) {\n\t\t\t// Handle template parts special case\n\t\t\tif ( path.includes( 'postType=wp_template_part' ) ) {\n\t\t\t\treturn '/template-parts';\n\t\t\t}\n\t\t\t// Replace the base path\n\t\t\treturn path.replace( oldPath, newPath );\n\t\t}\n\t}\n\n\treturn path;\n}\n\n// Helper to check if currently in site editor\nfunction isInSiteEditor() {\n\tconst path = getPath( window.location.href );\n\treturn (\n\t\tpath?.includes( 'site-editor.php' ) ||\n\t\tpath?.includes( 'page=site-editor-v2' )\n\t);\n}\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst delayedSearch = useDebouncedValue( search );\n\t\tconst { records, isLoading } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif ( ! delayedSearch ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst query = {\n\t\t\t\t\tsearch: delayedSearch,\n\t\t\t\t\tper_page: 10,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\tstatus: [\n\t\t\t\t\t\t'publish',\n\t\t\t\t\t\t'future',\n\t\t\t\t\t\t'draft',\n\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t'private',\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\trecords: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tquery\n\t\t\t\t\t),\n\t\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ delayedSearch ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).map( ( record ) => {\n\t\t\t\tconst command = {\n\t\t\t\t\tname: postType + '-' + record.id,\n\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? decodeEntities( record.title?.rendered )\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t};\n\n\t\t\t\tif (\n\t\t\t\t\t! canCreateTemplate ||\n\t\t\t\t\tpostType === 'post' ||\n\t\t\t\t\t( postType === 'page' && ! isBlockBasedTheme )\n\t\t\t\t) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...command,\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\t\tpost: record.id,\n\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst targetUrl = addQueryArgs( 'post.php', args );\n\t\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst isSiteEditor = isInSiteEditor();\n\n\t\t\t\treturn {\n\t\t\t\t\t...command,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t`/${ postType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: `/${ postType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ canCreateTemplate, records, isBlockBasedTheme, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getNavigationCommandLoaderPerTemplate = ( templateType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: templateType,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst { records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', templateType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', templateType, query ]\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t\t/*\n\t\t * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.\n\t\t * We need to sort the results based on the search query to avoid removing relevant\n\t\t * records below using .slice().\n\t\t */\n\t\tconst orderedRecords = useMemo( () => {\n\t\t\treturn orderEntityRecordsBySearch( records, search ).slice( 0, 10 );\n\t\t}, [ records, search ] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif (\n\t\t\t\t! canCreateTemplate ||\n\t\t\t\t( ! isBlockBasedTheme && ! templateType === 'wp_template_part' )\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tconst result = [];\n\t\t\tresult.push(\n\t\t\t\t...orderedRecords.map( ( record ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: templateType + '-' + record.id,\n\t\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\t\ticon: icons[ templateType ],\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t`/${ templateType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: `/${ templateType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\torderedRecords?.length > 0 &&\n\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-template-parts',\n\t\t\t\t\tlabel: __( 'Go to: Template parts' ),\n\t\t\t\t\ticon: symbolFilled,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\tmapRoute(\n\t\t\t\t\t\t\t\t\t'/pattern?postType=wp_template_part&categoryId=all-parts'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: mapRoute( '/pattern' ),\n\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\tcategoryId: 'all-parts',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn result;\n\t\t}, [ canCreateTemplate, isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getSiteEditorBasicNavigationCommands = () =>\n\tfunction useSiteEditorBasicNavigationCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = isInSiteEditor();\n\t\tconst { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t\tcanCreatePatterns: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst commands = useMemo( () => {\n\t\t\tconst result = [];\n\n\t\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\t\t// Go to Styles command\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-styles',\n\t\t\t\t\tlabel: __( 'Go to: Styles' ),\n\t\t\t\t\ticon: styles,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\t\t\tlabel: __( 'Go to: Navigation' ),\n\t\t\t\t\ticon: navigation,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/navigation' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/navigation',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-templates',\n\t\t\t\t\tlabel: __( 'Go to: Templates' ),\n\t\t\t\t\ticon: layout,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( mapRoute( '/template' ) );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: mapRoute( '/template' ),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( canCreatePatterns ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-patterns',\n\t\t\t\t\tlabel: __( 'Go to: Patterns' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( canCreateTemplate ) {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate( mapRoute( '/pattern' ) );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: mapRoute( '/pattern' ),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If a user cannot access the site editor.\n\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t'edit.php?post_type=wp_block';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, [\n\t\t\thistory,\n\t\t\tisSiteEditor,\n\t\t\tcanCreateTemplate,\n\t\t\tcanCreatePatterns,\n\t\t\tisBlockBasedTheme,\n\t\t] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getGlobalStylesOpenCssCommands = () =>\n\tfunction useGlobalStylesOpenCssCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = isInSiteEditor();\n\t\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! canEditCSS ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/open-styles-css',\n\t\t\t\t\tlabel: __( 'Open custom CSS' ),\n\t\t\t\t\ticon: brush,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles?section=/css' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\tgetSiteEditorPage(),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ history, canEditCSS, isSiteEditor ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useSiteEditorNavigationCommands( isNetworkAdmin ) {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: getNavigationCommandLoaderPerPostType( 'page' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: getNavigationCommandLoaderPerPostType( 'post' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template_part' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: getSiteEditorBasicNavigationCommands(),\n\t\tcontext: 'site-editor',\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/global-styles-css',\n\t\thook: getGlobalStylesOpenCssCommands(),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n}\n"],
5
+ "mappings": ";AAGA,SAAS,wBAAwB;AACjC,SAAS,UAAU;AACnB,SAAS,SAAS,WAAW,gBAAgB;AAC7C,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,eAAe,yBAAyB;AACjD,SAAS,cAAc,eAAe;AACtC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAK/B,SAAS,cAAc;AACvB,SAAS,kCAAkC;AAE3C,IAAM,EAAE,WAAW,IAAI,OAAQ,iBAAkB;AAEjD,IAAM,QAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,kBAAkB;AACnB;AAEA,SAAS,kBAAmB,OAAQ;AACnC,QAAM,CAAE,gBAAgB,iBAAkB,IAAI,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AmB;AAAA,IAChE,UAAU;AAAA,EACX,CAAE;AACF,mBAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,qCAAqC;AAAA,IAC3C,SAAS;AAAA,IACT,UAAU;AAAA,EACX,CAAE;AACF,mBAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,+BAA+B;AAAA,IACrC,UAAU;AAAA,EACX,CAAE;AACH;",
6
+ "names": []
7
+ }
@@ -21,4 +21,4 @@ function orderEntityRecordsBySearch(records = [], search = "") {
21
21
  export {
22
22
  orderEntityRecordsBySearch
23
23
  };
24
- //# sourceMappingURL=order-entity-records-by-search.js.map
24
+ //# sourceMappingURL=order-entity-records-by-search.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-commands",
3
- "version": "1.37.0",
3
+ "version": "1.37.1-next.ba3aee3a2.0",
4
4
  "description": "WordPress core reusable commands.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -22,12 +22,19 @@
22
22
  "node": ">=18.12.0",
23
23
  "npm": ">=8.19.2"
24
24
  },
25
- "main": "build/index.js",
26
- "module": "build-module/index.js",
25
+ "files": [
26
+ "src",
27
+ "build",
28
+ "build-module",
29
+ "build-types",
30
+ "*.md"
31
+ ],
32
+ "main": "build/index.cjs",
33
+ "module": "build-module/index.mjs",
27
34
  "exports": {
28
35
  ".": {
29
- "import": "./build-module/index.js",
30
- "require": "./build/index.js"
36
+ "import": "./build-module/index.mjs",
37
+ "require": "./build/index.cjs"
31
38
  },
32
39
  "./package.json": "./package.json"
33
40
  },
@@ -35,19 +42,19 @@
35
42
  "wpScript": true,
36
43
  "sideEffects": false,
37
44
  "dependencies": {
38
- "@wordpress/block-editor": "^15.10.0",
39
- "@wordpress/commands": "^1.37.0",
40
- "@wordpress/compose": "^7.37.0",
41
- "@wordpress/core-data": "^7.37.0",
42
- "@wordpress/data": "^10.37.0",
43
- "@wordpress/element": "^6.37.0",
44
- "@wordpress/html-entities": "^4.37.0",
45
- "@wordpress/i18n": "^6.10.0",
46
- "@wordpress/icons": "^11.4.0",
47
- "@wordpress/notices": "^5.37.0",
48
- "@wordpress/private-apis": "^1.37.0",
49
- "@wordpress/router": "^1.37.0",
50
- "@wordpress/url": "^4.37.0"
45
+ "@wordpress/block-editor": "^15.10.1-next.ba3aee3a2.0",
46
+ "@wordpress/commands": "^1.37.1-next.ba3aee3a2.0",
47
+ "@wordpress/compose": "^7.37.1-next.ba3aee3a2.0",
48
+ "@wordpress/core-data": "^7.37.1-next.ba3aee3a2.0",
49
+ "@wordpress/data": "^10.37.1-next.ba3aee3a2.0",
50
+ "@wordpress/element": "^6.37.1-next.ba3aee3a2.0",
51
+ "@wordpress/html-entities": "^4.37.1-next.ba3aee3a2.0",
52
+ "@wordpress/i18n": "^6.10.1-next.ba3aee3a2.0",
53
+ "@wordpress/icons": "^11.4.1-next.ba3aee3a2.0",
54
+ "@wordpress/notices": "^5.37.1-next.ba3aee3a2.0",
55
+ "@wordpress/private-apis": "^1.37.1-next.ba3aee3a2.0",
56
+ "@wordpress/router": "^1.37.1-next.ba3aee3a2.0",
57
+ "@wordpress/url": "^4.37.1-next.ba3aee3a2.0"
51
58
  },
52
59
  "peerDependencies": {
53
60
  "react": "^18.0.0",
@@ -56,5 +63,5 @@
56
63
  "publishConfig": {
57
64
  "access": "public"
58
65
  },
59
- "gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950"
66
+ "gitHead": "67d2e486fcd40c753591cf911ca0659132f519ca"
60
67
  }
@@ -48,6 +48,49 @@ function useDebouncedValue( value ) {
48
48
  return debouncedValue;
49
49
  }
50
50
 
51
+ // Route mapping for experimental site editor
52
+ const ROUTE_MAPPING = {
53
+ '/template': '/templates',
54
+ '/pattern': '/patterns',
55
+ };
56
+
57
+ // Helper to determine the site editor page URL
58
+ function getSiteEditorPage() {
59
+ return window.__experimentalExtensibleSiteEditor
60
+ ? 'admin.php?page=site-editor-v2'
61
+ : 'site-editor.php';
62
+ }
63
+
64
+ // Helper to map routes for experimental site editor
65
+ function mapRoute( path ) {
66
+ if ( ! window.__experimentalExtensibleSiteEditor ) {
67
+ return path;
68
+ }
69
+
70
+ // Check if path needs mapping
71
+ for ( const [ oldPath, newPath ] of Object.entries( ROUTE_MAPPING ) ) {
72
+ if ( path === oldPath || path.startsWith( oldPath + '?' ) ) {
73
+ // Handle template parts special case
74
+ if ( path.includes( 'postType=wp_template_part' ) ) {
75
+ return '/template-parts';
76
+ }
77
+ // Replace the base path
78
+ return path.replace( oldPath, newPath );
79
+ }
80
+ }
81
+
82
+ return path;
83
+ }
84
+
85
+ // Helper to check if currently in site editor
86
+ function isInSiteEditor() {
87
+ const path = getPath( window.location.href );
88
+ return (
89
+ path?.includes( 'site-editor.php' ) ||
90
+ path?.includes( 'page=site-editor-v2' )
91
+ );
92
+ }
93
+
51
94
  const getNavigationCommandLoaderPerPostType = ( postType ) =>
52
95
  function useNavigationCommandLoader( { search } ) {
53
96
  const history = useHistory();
@@ -130,9 +173,7 @@ const getNavigationCommandLoaderPerPostType = ( postType ) =>
130
173
  };
131
174
  }
132
175
 
133
- const isSiteEditor = getPath( window.location.href )?.includes(
134
- 'site-editor.php'
135
- );
176
+ const isSiteEditor = isInSiteEditor();
136
177
 
137
178
  return {
138
179
  ...command,
@@ -143,7 +184,7 @@ const getNavigationCommandLoaderPerPostType = ( postType ) =>
143
184
  );
144
185
  } else {
145
186
  document.location = addQueryArgs(
146
- 'site-editor.php',
187
+ getSiteEditorPage(),
147
188
  {
148
189
  p: `/${ postType }/${ record.id }`,
149
190
  canvas: 'edit',
@@ -226,7 +267,7 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
226
267
  );
227
268
  } else {
228
269
  document.location = addQueryArgs(
229
- 'site-editor.php',
270
+ getSiteEditorPage(),
230
271
  {
231
272
  p: `/${ templateType }/${ record.id }`,
232
273
  canvas: 'edit',
@@ -250,13 +291,15 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
250
291
  callback: ( { close } ) => {
251
292
  if ( isSiteEditor ) {
252
293
  history.navigate(
253
- '/pattern?postType=wp_template_part&categoryId=all-parts'
294
+ mapRoute(
295
+ '/pattern?postType=wp_template_part&categoryId=all-parts'
296
+ )
254
297
  );
255
298
  } else {
256
299
  document.location = addQueryArgs(
257
- 'site-editor.php',
300
+ getSiteEditorPage(),
258
301
  {
259
- p: '/pattern',
302
+ p: mapRoute( '/pattern' ),
260
303
  postType: 'wp_template_part',
261
304
  categoryId: 'all-parts',
262
305
  }
@@ -278,9 +321,7 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
278
321
  const getSiteEditorBasicNavigationCommands = () =>
279
322
  function useSiteEditorBasicNavigationCommands() {
280
323
  const history = useHistory();
281
- const isSiteEditor = getPath( window.location.href )?.includes(
282
- 'site-editor.php'
283
- );
324
+ const isSiteEditor = isInSiteEditor();
284
325
  const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } =
285
326
  useSelect( ( select ) => {
286
327
  return {
@@ -310,7 +351,7 @@ const getSiteEditorBasicNavigationCommands = () =>
310
351
  history.navigate( '/styles' );
311
352
  } else {
312
353
  document.location = addQueryArgs(
313
- 'site-editor.php',
354
+ getSiteEditorPage(),
314
355
  {
315
356
  p: '/styles',
316
357
  }
@@ -329,7 +370,7 @@ const getSiteEditorBasicNavigationCommands = () =>
329
370
  history.navigate( '/navigation' );
330
371
  } else {
331
372
  document.location = addQueryArgs(
332
- 'site-editor.php',
373
+ getSiteEditorPage(),
333
374
  {
334
375
  p: '/navigation',
335
376
  }
@@ -345,12 +386,12 @@ const getSiteEditorBasicNavigationCommands = () =>
345
386
  icon: layout,
346
387
  callback: ( { close } ) => {
347
388
  if ( isSiteEditor ) {
348
- history.navigate( '/template' );
389
+ history.navigate( mapRoute( '/template' ) );
349
390
  } else {
350
391
  document.location = addQueryArgs(
351
- 'site-editor.php',
392
+ getSiteEditorPage(),
352
393
  {
353
- p: '/template',
394
+ p: mapRoute( '/template' ),
354
395
  }
355
396
  );
356
397
  }
@@ -367,12 +408,12 @@ const getSiteEditorBasicNavigationCommands = () =>
367
408
  callback: ( { close } ) => {
368
409
  if ( canCreateTemplate ) {
369
410
  if ( isSiteEditor ) {
370
- history.navigate( '/pattern' );
411
+ history.navigate( mapRoute( '/pattern' ) );
371
412
  } else {
372
413
  document.location = addQueryArgs(
373
- 'site-editor.php',
414
+ getSiteEditorPage(),
374
415
  {
375
- p: '/pattern',
416
+ p: mapRoute( '/pattern' ),
376
417
  }
377
418
  );
378
419
  }
@@ -404,9 +445,7 @@ const getSiteEditorBasicNavigationCommands = () =>
404
445
  const getGlobalStylesOpenCssCommands = () =>
405
446
  function useGlobalStylesOpenCssCommands() {
406
447
  const history = useHistory();
407
- const isSiteEditor = getPath( window.location.href )?.includes(
408
- 'site-editor.php'
409
- );
448
+ const isSiteEditor = isInSiteEditor();
410
449
  const { canEditCSS } = useSelect( ( select ) => {
411
450
  const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
412
451
  select( coreStore );
@@ -438,7 +477,7 @@ const getGlobalStylesOpenCssCommands = () =>
438
477
  history.navigate( '/styles?section=/css' );
439
478
  } else {
440
479
  document.location = addQueryArgs(
441
- 'site-editor.php',
480
+ getSiteEditorPage(),
442
481
  {
443
482
  p: '/styles',
444
483
  section: '/css',
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/site-editor-navigation-commands.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tpost,\n\tpage,\n\tlayout,\n\tsymbol,\n\tsymbolFilled,\n\tstyles,\n\tnavigation,\n\tbrush,\n} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nfunction useDebouncedValue( value ) {\n\tconst [ debouncedValue, setDebouncedValue ] = useState( '' );\n\tconst debounced = useDebounce( setDebouncedValue, 250 );\n\n\tuseEffect( () => {\n\t\tdebounced( value );\n\t\treturn () => debounced.cancel();\n\t}, [ debounced, value ] );\n\n\treturn debouncedValue;\n}\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst delayedSearch = useDebouncedValue( search );\n\t\tconst { records, isLoading } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif ( ! delayedSearch ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst query = {\n\t\t\t\t\tsearch: delayedSearch,\n\t\t\t\t\tper_page: 10,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\tstatus: [\n\t\t\t\t\t\t'publish',\n\t\t\t\t\t\t'future',\n\t\t\t\t\t\t'draft',\n\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t'private',\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\trecords: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tquery\n\t\t\t\t\t),\n\t\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ delayedSearch ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).map( ( record ) => {\n\t\t\t\tconst command = {\n\t\t\t\t\tname: postType + '-' + record.id,\n\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? decodeEntities( record.title?.rendered )\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t};\n\n\t\t\t\tif (\n\t\t\t\t\t! canCreateTemplate ||\n\t\t\t\t\tpostType === 'post' ||\n\t\t\t\t\t( postType === 'page' && ! isBlockBasedTheme )\n\t\t\t\t) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...command,\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\t\tpost: record.id,\n\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst targetUrl = addQueryArgs( 'post.php', args );\n\t\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t\t'site-editor.php'\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...command,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t`/${ postType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: `/${ postType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ canCreateTemplate, records, isBlockBasedTheme, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getNavigationCommandLoaderPerTemplate = ( templateType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: templateType,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst { records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', templateType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', templateType, query ]\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t\t/*\n\t\t * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.\n\t\t * We need to sort the results based on the search query to avoid removing relevant\n\t\t * records below using .slice().\n\t\t */\n\t\tconst orderedRecords = useMemo( () => {\n\t\t\treturn orderEntityRecordsBySearch( records, search ).slice( 0, 10 );\n\t\t}, [ records, search ] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif (\n\t\t\t\t! canCreateTemplate ||\n\t\t\t\t( ! isBlockBasedTheme && ! templateType === 'wp_template_part' )\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tconst result = [];\n\t\t\tresult.push(\n\t\t\t\t...orderedRecords.map( ( record ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: templateType + '-' + record.id,\n\t\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\t\ticon: icons[ templateType ],\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t`/${ templateType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: `/${ templateType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\torderedRecords?.length > 0 &&\n\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-template-parts',\n\t\t\t\t\tlabel: __( 'Go to: Template parts' ),\n\t\t\t\t\ticon: symbolFilled,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t'/pattern?postType=wp_template_part&categoryId=all-parts'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\tcategoryId: 'all-parts',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn result;\n\t\t}, [ canCreateTemplate, isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getSiteEditorBasicNavigationCommands = () =>\n\tfunction useSiteEditorBasicNavigationCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t\tcanCreatePatterns: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst commands = useMemo( () => {\n\t\t\tconst result = [];\n\n\t\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\t\t// Go to Styles command\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-styles',\n\t\t\t\t\tlabel: __( 'Go to: Styles' ),\n\t\t\t\t\ticon: styles,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\t\t\tlabel: __( 'Go to: Navigation' ),\n\t\t\t\t\ticon: navigation,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/navigation' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/navigation',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-templates',\n\t\t\t\t\tlabel: __( 'Go to: Templates' ),\n\t\t\t\t\ticon: layout,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/template' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/template',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( canCreatePatterns ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-patterns',\n\t\t\t\t\tlabel: __( 'Go to: Patterns' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( canCreateTemplate ) {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate( '/pattern' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If a user cannot access the site editor.\n\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t'edit.php?post_type=wp_block';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, [\n\t\t\thistory,\n\t\t\tisSiteEditor,\n\t\t\tcanCreateTemplate,\n\t\t\tcanCreatePatterns,\n\t\t\tisBlockBasedTheme,\n\t\t] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getGlobalStylesOpenCssCommands = () =>\n\tfunction useGlobalStylesOpenCssCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! canEditCSS ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/open-styles-css',\n\t\t\t\t\tlabel: __( 'Open custom CSS' ),\n\t\t\t\t\ticon: brush,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles?section=/css' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ history, canEditCSS, isSiteEditor ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useSiteEditorNavigationCommands( isNetworkAdmin ) {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: getNavigationCommandLoaderPerPostType( 'page' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: getNavigationCommandLoaderPerPostType( 'post' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template_part' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: getSiteEditorBasicNavigationCommands(),\n\t\tcontext: 'site-editor',\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/global-styles-css',\n\t\thook: getGlobalStylesOpenCssCommands(),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAiC;AACjC,kBAAmB;AACnB,qBAA6C;AAC7C,kBAA0B;AAC1B,uBAAmC;AACnC,mBASO;AACP,oBAAiD;AACjD,iBAAsC;AACtC,qBAA4B;AAC5B,2BAA+B;AAK/B,yBAAuB;AACvB,4CAA2C;AAE3C,IAAM,EAAE,WAAW,QAAI,2BAAQ,cAAAA,WAAkB;AAEjD,IAAM,QAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA,aAAa;AAAA,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AAAA,IACT;AAEA,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,WAAO,gBAAI,iBAAkB;AAAA,QAC7B,MAAM;AAAA,QACN,UAAU,CAAE,EAAE,MAAM,MAAO;AAC1B,gBAAM;AAEN,cAAK,cAAe;AACnB,oBAAQ,SAAU,sBAAuB;AAAA,UAC1C,OAAO;AACN,qBAAS,eAAW;AAAA,cACnB;AAAA,cACA;AAAA,gBACC,GAAG;AAAA,gBACH,SAAS;AAAA,cACV;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD,GAAG,CAAE,SAAS,YAAY,YAAa,CAAE;AAEzC,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,EACD;AACD;AAEM,SAAS,gCAAiC,gBAAiB;AACjE,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,MAAO;AAAA,IACpD,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,MAAO;AAAA,IACpD,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,aAAc;AAAA,IAC3D,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,sCAAuC,kBAAmB;AAAA,IAChE,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,qCAAqC;AAAA,IAC3C,SAAS;AAAA,IACT,UAAU;AAAA,EACX,CAAE;AACF,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,+BAA+B;AAAA,IACrC,UAAU;AAAA,EACX,CAAE;AACH;",
6
- "names": ["routerPrivateApis", "coreStore"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/site-editor-navigation-commands.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tpost,\n\tpage,\n\tlayout,\n\tsymbol,\n\tsymbolFilled,\n\tstyles,\n\tnavigation,\n\tbrush,\n} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nfunction useDebouncedValue( value ) {\n\tconst [ debouncedValue, setDebouncedValue ] = useState( '' );\n\tconst debounced = useDebounce( setDebouncedValue, 250 );\n\n\tuseEffect( () => {\n\t\tdebounced( value );\n\t\treturn () => debounced.cancel();\n\t}, [ debounced, value ] );\n\n\treturn debouncedValue;\n}\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst delayedSearch = useDebouncedValue( search );\n\t\tconst { records, isLoading } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif ( ! delayedSearch ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst query = {\n\t\t\t\t\tsearch: delayedSearch,\n\t\t\t\t\tper_page: 10,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\tstatus: [\n\t\t\t\t\t\t'publish',\n\t\t\t\t\t\t'future',\n\t\t\t\t\t\t'draft',\n\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t'private',\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\trecords: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tquery\n\t\t\t\t\t),\n\t\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ delayedSearch ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).map( ( record ) => {\n\t\t\t\tconst command = {\n\t\t\t\t\tname: postType + '-' + record.id,\n\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? decodeEntities( record.title?.rendered )\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t};\n\n\t\t\t\tif (\n\t\t\t\t\t! canCreateTemplate ||\n\t\t\t\t\tpostType === 'post' ||\n\t\t\t\t\t( postType === 'page' && ! isBlockBasedTheme )\n\t\t\t\t) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...command,\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\t\tpost: record.id,\n\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst targetUrl = addQueryArgs( 'post.php', args );\n\t\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t\t'site-editor.php'\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...command,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t`/${ postType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: `/${ postType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ canCreateTemplate, records, isBlockBasedTheme, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getNavigationCommandLoaderPerTemplate = ( templateType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst history = useHistory();\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: templateType,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst { records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', templateType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', templateType, query ]\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t\t/*\n\t\t * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.\n\t\t * We need to sort the results based on the search query to avoid removing relevant\n\t\t * records below using .slice().\n\t\t */\n\t\tconst orderedRecords = useMemo( () => {\n\t\t\treturn orderEntityRecordsBySearch( records, search ).slice( 0, 10 );\n\t\t}, [ records, search ] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif (\n\t\t\t\t! canCreateTemplate ||\n\t\t\t\t( ! isBlockBasedTheme && ! templateType === 'wp_template_part' )\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tconst result = [];\n\t\t\tresult.push(\n\t\t\t\t...orderedRecords.map( ( record ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: templateType + '-' + record.id,\n\t\t\t\t\t\tsearchLabel: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\t\ticon: icons[ templateType ],\n\t\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t`/${ templateType }/${ record.id }?canvas=edit`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: `/${ templateType }/${ record.id }`,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\torderedRecords?.length > 0 &&\n\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-template-parts',\n\t\t\t\t\tlabel: __( 'Go to: Template parts' ),\n\t\t\t\t\ticon: symbolFilled,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t'/pattern?postType=wp_template_part&categoryId=all-parts'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\tcategoryId: 'all-parts',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn result;\n\t\t}, [ canCreateTemplate, isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst getSiteEditorBasicNavigationCommands = () =>\n\tfunction useSiteEditorBasicNavigationCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t\tcanCreatePatterns: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst commands = useMemo( () => {\n\t\t\tconst result = [];\n\n\t\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\t\t// Go to Styles command\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-styles',\n\t\t\t\t\tlabel: __( 'Go to: Styles' ),\n\t\t\t\t\ticon: styles,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\t\t\tlabel: __( 'Go to: Navigation' ),\n\t\t\t\t\ticon: navigation,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/navigation' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/navigation',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-templates',\n\t\t\t\t\tlabel: __( 'Go to: Templates' ),\n\t\t\t\t\ticon: layout,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/template' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/template',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( canCreatePatterns ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\tname: 'core/edit-site/open-patterns',\n\t\t\t\t\tlabel: __( 'Go to: Patterns' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tif ( canCreateTemplate ) {\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.navigate( '/pattern' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If a user cannot access the site editor.\n\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t'edit.php?post_type=wp_block';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, [\n\t\t\thistory,\n\t\t\tisSiteEditor,\n\t\t\tcanCreateTemplate,\n\t\t\tcanCreatePatterns,\n\t\t\tisBlockBasedTheme,\n\t\t] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getGlobalStylesOpenCssCommands = () =>\n\tfunction useGlobalStylesOpenCssCommands() {\n\t\tconst history = useHistory();\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! canEditCSS ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/open-styles-css',\n\t\t\t\t\tlabel: __( 'Open custom CSS' ),\n\t\t\t\t\ticon: brush,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.navigate( '/styles?section=/css' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tp: '/styles',\n\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ history, canEditCSS, isSiteEditor ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useSiteEditorNavigationCommands( isNetworkAdmin ) {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: getNavigationCommandLoaderPerPostType( 'page' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: getNavigationCommandLoaderPerPostType( 'post' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: getNavigationCommandLoaderPerTemplate( 'wp_template_part' ),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: getSiteEditorBasicNavigationCommands(),\n\t\tcontext: 'site-editor',\n\t\tdisabled: isNetworkAdmin,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/global-styles-css',\n\t\thook: getGlobalStylesOpenCssCommands(),\n\t\tdisabled: isNetworkAdmin,\n\t} );\n}\n"],
5
- "mappings": ";AAGA,SAAS,wBAAwB;AACjC,SAAS,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