@wordpress/core-commands 0.25.0 → 0.26.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.26.0 (2024-05-02)
6
+
5
7
  ## 0.25.0 (2024-04-19)
6
8
 
7
9
  ## 0.24.0 (2024-04-03)
@@ -25,7 +25,6 @@ const {
25
25
  function useAdminNavigationCommands() {
26
26
  const history = useHistory();
27
27
  const isTemplatesAccessible = (0, _hooks.useIsTemplatesAccessible)();
28
- const isBlockBasedTheme = (0, _hooks.useIsBlockBasedTheme)();
29
28
  const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
30
29
  (0, _commands.useCommand)({
31
30
  name: 'core/add-new-post',
@@ -50,7 +49,11 @@ function useAdminNavigationCommands() {
50
49
  callback: ({
51
50
  close
52
51
  }) => {
53
- if (isTemplatesAccessible && isBlockBasedTheme) {
52
+ // The site editor and templates both check whether the user
53
+ // can read templates. We can leverage that here and this
54
+ // command links to the classic dashboard manage patterns page
55
+ // if the user can't access it.
56
+ if (isTemplatesAccessible) {
54
57
  const args = {
55
58
  path: '/patterns'
56
59
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_commands","require","_i18n","_icons","_url","_router","_hooks","_lockUnlock","useHistory","unlock","routerPrivateApis","useAdminNavigationCommands","history","isTemplatesAccessible","useIsTemplatesAccessible","isBlockBasedTheme","useIsBlockBasedTheme","isSiteEditor","getPath","window","location","href","includes","useCommand","name","label","__","icon","plus","callback","document","symbol","close","args","path","push","addQueryArgs"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus, symbol } from '@wordpress/icons';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useAdminNavigationCommands() {\n\tconst history = useHistory();\n\tconst isTemplatesAccessible = useIsTemplatesAccessible();\n\tconst isBlockBasedTheme = useIsBlockBasedTheme();\n\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add new post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/add-new-page',\n\t\tlabel: __( 'Add new page' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php?post_type=page';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/manage-reusable-blocks',\n\t\tlabel: __( 'Patterns' ),\n\t\ticon: symbol,\n\t\tcallback: ( { close } ) => {\n\t\t\tif ( isTemplatesAccessible && isBlockBasedTheme ) {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/patterns',\n\t\t\t\t};\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t\t}\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,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CAACuB,IAAI,CAAEF,IAAK,CAAC;QACrB,CAAC,MAAM;UACNH,QAAQ,CAACV,QAAQ,GAAG,IAAAgB,iBAAY,EAAE,iBAAiB,EAAEH,IAAK,CAAC;QAC5D;QACAD,KAAK,CAAC,CAAC;MACR,CAAC,MAAM;QACNF,QAAQ,CAACV,QAAQ,CAACC,IAAI,GAAG,6BAA6B;MACvD;IACD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_commands","require","_i18n","_icons","_url","_router","_hooks","_lockUnlock","useHistory","unlock","routerPrivateApis","useAdminNavigationCommands","history","isTemplatesAccessible","useIsTemplatesAccessible","isSiteEditor","getPath","window","location","href","includes","useCommand","name","label","__","icon","plus","callback","document","symbol","close","args","path","push","addQueryArgs"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus, symbol } from '@wordpress/icons';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useIsTemplatesAccessible } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useAdminNavigationCommands() {\n\tconst history = useHistory();\n\tconst isTemplatesAccessible = useIsTemplatesAccessible();\n\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add new post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/add-new-page',\n\t\tlabel: __( 'Add new page' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php?post_type=page';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/manage-reusable-blocks',\n\t\tlabel: __( 'Patterns' ),\n\t\ticon: symbol,\n\t\tcallback: ( { close } ) => {\n\t\t\t// The site editor and templates both check whether the user\n\t\t\t// can read templates. We can leverage that here and this\n\t\t\t// command links to the classic dashboard manage patterns page\n\t\t\t// if the user can't access it.\n\t\t\tif ( isTemplatesAccessible ) {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/patterns',\n\t\t\t\t};\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t\t}\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE3C,SAASC,0BAA0BA,CAAA,EAAG;EAC5C,MAAMC,OAAO,GAAGJ,UAAU,CAAC,CAAC;EAC5B,MAAMK,qBAAqB,GAAG,IAAAC,+BAAwB,EAAC,CAAC;EAExD,MAAMC,YAAY,GAAG,IAAAC,YAAO,EAAEC,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC,EAAEC,QAAQ,CAC7D,iBACD,CAAC;EAED,IAAAC,oBAAU,EAAE;IACXC,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;IAC3BC,IAAI,EAAEC,WAAI;IACVC,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACV,QAAQ,CAACC,IAAI,GAAG,cAAc;IACxC;EACD,CAAE,CAAC;EACH,IAAAE,oBAAU,EAAE;IACXC,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;IAC3BC,IAAI,EAAEC,WAAI;IACVC,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACV,QAAQ,CAACC,IAAI,GAAG,6BAA6B;IACvD;EACD,CAAE,CAAC;EACH,IAAAE,oBAAU,EAAE;IACXC,IAAI,EAAE,6BAA6B;IACnCC,KAAK,EAAE,IAAAC,QAAE,EAAE,UAAW,CAAC;IACvBC,IAAI,EAAEI,aAAM;IACZF,QAAQ,EAAEA,CAAE;MAAEG;IAAM,CAAC,KAAM;MAC1B;MACA;MACA;MACA;MACA,IAAKjB,qBAAqB,EAAG;QAC5B,MAAMkB,IAAI,GAAG;UACZC,IAAI,EAAE;QACP,CAAC;QACD,IAAKjB,YAAY,EAAG;UACnBH,OAAO,CAACqB,IAAI,CAAEF,IAAK,CAAC;QACrB,CAAC,MAAM;UACNH,QAAQ,CAACV,QAAQ,GAAG,IAAAgB,iBAAY,EAAE,iBAAiB,EAAEH,IAAK,CAAC;QAC5D;QACAD,KAAK,CAAC,CAAC;MACR,CAAC,MAAM;QACNF,QAAQ,CAACV,QAAQ,CAACC,IAAI,GAAG,6BAA6B;MACvD;IACD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -10,7 +10,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- import { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';
13
+ import { useIsTemplatesAccessible } from './hooks';
14
14
  import { unlock } from './lock-unlock';
15
15
  const {
16
16
  useHistory
@@ -18,7 +18,6 @@ const {
18
18
  export function useAdminNavigationCommands() {
19
19
  const history = useHistory();
20
20
  const isTemplatesAccessible = useIsTemplatesAccessible();
21
- const isBlockBasedTheme = useIsBlockBasedTheme();
22
21
  const isSiteEditor = getPath(window.location.href)?.includes('site-editor.php');
23
22
  useCommand({
24
23
  name: 'core/add-new-post',
@@ -43,7 +42,11 @@ export function useAdminNavigationCommands() {
43
42
  callback: ({
44
43
  close
45
44
  }) => {
46
- if (isTemplatesAccessible && isBlockBasedTheme) {
45
+ // The site editor and templates both check whether the user
46
+ // can read templates. We can leverage that here and this
47
+ // command links to the classic dashboard manage patterns page
48
+ // if the user can't access it.
49
+ if (isTemplatesAccessible) {
47
50
  const args = {
48
51
  path: '/patterns'
49
52
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useCommand","__","plus","symbol","addQueryArgs","getPath","privateApis","routerPrivateApis","useIsTemplatesAccessible","useIsBlockBasedTheme","unlock","useHistory","useAdminNavigationCommands","history","isTemplatesAccessible","isBlockBasedTheme","isSiteEditor","window","location","href","includes","name","label","icon","callback","document","close","args","path","push"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus, symbol } from '@wordpress/icons';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useAdminNavigationCommands() {\n\tconst history = useHistory();\n\tconst isTemplatesAccessible = useIsTemplatesAccessible();\n\tconst isBlockBasedTheme = useIsBlockBasedTheme();\n\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add new post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/add-new-page',\n\t\tlabel: __( 'Add new page' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php?post_type=page';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/manage-reusable-blocks',\n\t\tlabel: __( 'Patterns' ),\n\t\ticon: symbol,\n\t\tcallback: ( { close } ) => {\n\t\t\tif ( isTemplatesAccessible && isBlockBasedTheme ) {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/patterns',\n\t\t\t\t};\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t\t}\n\t\t},\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;AAC/C,SAASC,YAAY,EAAEC,OAAO,QAAQ,gBAAgB;AACtD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,wBAAwB,EAAEC,oBAAoB,QAAQ,SAAS;AACxE,SAASC,MAAM,QAAQ,eAAe;AAEtC,MAAM;EAAEC;AAAW,CAAC,GAAGD,MAAM,CAAEH,iBAAkB,CAAC;AAElD,OAAO,SAASK,0BAA0BA,CAAA,EAAG;EAC5C,MAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAC5B,MAAMG,qBAAqB,GAAGN,wBAAwB,CAAC,CAAC;EACxD,MAAMO,iBAAiB,GAAGN,oBAAoB,CAAC,CAAC;EAEhD,MAAMO,YAAY,GAAGX,OAAO,CAAEY,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC,EAAEC,QAAQ,CAC7D,iBACD,CAAC;EAEDpB,UAAU,CAAE;IACXqB,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAErB,EAAE,CAAE,cAAe,CAAC;IAC3BsB,IAAI,EAAErB,IAAI;IACVsB,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACP,QAAQ,CAACC,IAAI,GAAG,cAAc;IACxC;EACD,CAAE,CAAC;EACHnB,UAAU,CAAE;IACXqB,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAErB,EAAE,CAAE,cAAe,CAAC;IAC3BsB,IAAI,EAAErB,IAAI;IACVsB,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACP,QAAQ,CAACC,IAAI,GAAG,6BAA6B;IACvD;EACD,CAAE,CAAC;EACHnB,UAAU,CAAE;IACXqB,IAAI,EAAE,6BAA6B;IACnCC,KAAK,EAAErB,EAAE,CAAE,UAAW,CAAC;IACvBsB,IAAI,EAAEpB,MAAM;IACZqB,QAAQ,EAAEA,CAAE;MAAEE;IAAM,CAAC,KAAM;MAC1B,IAAKZ,qBAAqB,IAAIC,iBAAiB,EAAG;QACjD,MAAMY,IAAI,GAAG;UACZC,IAAI,EAAE;QACP,CAAC;QACD,IAAKZ,YAAY,EAAG;UACnBH,OAAO,CAACgB,IAAI,CAAEF,IAAK,CAAC;QACrB,CAAC,MAAM;UACNF,QAAQ,CAACP,QAAQ,GAAGd,YAAY,CAAE,iBAAiB,EAAEuB,IAAK,CAAC;QAC5D;QACAD,KAAK,CAAC,CAAC;MACR,CAAC,MAAM;QACND,QAAQ,CAACP,QAAQ,CAACC,IAAI,GAAG,6BAA6B;MACvD;IACD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["useCommand","__","plus","symbol","addQueryArgs","getPath","privateApis","routerPrivateApis","useIsTemplatesAccessible","unlock","useHistory","useAdminNavigationCommands","history","isTemplatesAccessible","isSiteEditor","window","location","href","includes","name","label","icon","callback","document","close","args","path","push"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus, symbol } from '@wordpress/icons';\nimport { addQueryArgs, getPath } from '@wordpress/url';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useIsTemplatesAccessible } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useAdminNavigationCommands() {\n\tconst history = useHistory();\n\tconst isTemplatesAccessible = useIsTemplatesAccessible();\n\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add new post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/add-new-page',\n\t\tlabel: __( 'Add new page' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'post-new.php?post_type=page';\n\t\t},\n\t} );\n\tuseCommand( {\n\t\tname: 'core/manage-reusable-blocks',\n\t\tlabel: __( 'Patterns' ),\n\t\ticon: symbol,\n\t\tcallback: ( { close } ) => {\n\t\t\t// The site editor and templates both check whether the user\n\t\t\t// can read templates. We can leverage that here and this\n\t\t\t// command links to the classic dashboard manage patterns page\n\t\t\t// if the user can't access it.\n\t\t\tif ( isTemplatesAccessible ) {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/patterns',\n\t\t\t\t};\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\tdocument.location.href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W,CAAC;IACvBoB,IAAI,EAAElB,MAAM;IACZmB,QAAQ,EAAEA,CAAE;MAAEE;IAAM,CAAC,KAAM;MAC1B;MACA;MACA;MACA;MACA,IAAKX,qBAAqB,EAAG;QAC5B,MAAMY,IAAI,GAAG;UACZC,IAAI,EAAE;QACP,CAAC;QACD,IAAKZ,YAAY,EAAG;UACnBF,OAAO,CAACe,IAAI,CAAEF,IAAK,CAAC;QACrB,CAAC,MAAM;UACNF,QAAQ,CAACP,QAAQ,GAAGZ,YAAY,CAAE,iBAAiB,EAAEqB,IAAK,CAAC;QAC5D;QACAD,KAAK,CAAC,CAAC;MACR,CAAC,MAAM;QACND,QAAQ,CAACP,QAAQ,CAACC,IAAI,GAAG,6BAA6B;MACvD;IACD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-commands",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "WordPress core reusable commands.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,17 +27,17 @@
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/block-editor": "^12.24.0",
31
- "@wordpress/commands": "^0.27.0",
32
- "@wordpress/compose": "^6.33.0",
33
- "@wordpress/core-data": "^6.33.0",
34
- "@wordpress/data": "^9.26.0",
35
- "@wordpress/element": "^5.33.0",
36
- "@wordpress/i18n": "^4.56.0",
37
- "@wordpress/icons": "^9.47.0",
38
- "@wordpress/private-apis": "^0.38.0",
39
- "@wordpress/router": "^0.25.0",
40
- "@wordpress/url": "^3.57.0"
30
+ "@wordpress/block-editor": "^12.25.0",
31
+ "@wordpress/commands": "^0.28.0",
32
+ "@wordpress/compose": "^6.34.0",
33
+ "@wordpress/core-data": "^6.34.0",
34
+ "@wordpress/data": "^9.27.0",
35
+ "@wordpress/element": "^5.34.0",
36
+ "@wordpress/i18n": "^4.57.0",
37
+ "@wordpress/icons": "^9.48.0",
38
+ "@wordpress/private-apis": "^0.39.0",
39
+ "@wordpress/router": "^0.26.0",
40
+ "@wordpress/url": "^3.58.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "^18.0.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
49
+ "gitHead": "581d8a5580dba8f600b7268d51eb554771ae482c"
50
50
  }
@@ -10,7 +10,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- import { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';
13
+ import { useIsTemplatesAccessible } from './hooks';
14
14
  import { unlock } from './lock-unlock';
15
15
 
16
16
  const { useHistory } = unlock( routerPrivateApis );
@@ -18,7 +18,6 @@ const { useHistory } = unlock( routerPrivateApis );
18
18
  export function useAdminNavigationCommands() {
19
19
  const history = useHistory();
20
20
  const isTemplatesAccessible = useIsTemplatesAccessible();
21
- const isBlockBasedTheme = useIsBlockBasedTheme();
22
21
 
23
22
  const isSiteEditor = getPath( window.location.href )?.includes(
24
23
  'site-editor.php'
@@ -45,7 +44,11 @@ export function useAdminNavigationCommands() {
45
44
  label: __( 'Patterns' ),
46
45
  icon: symbol,
47
46
  callback: ( { close } ) => {
48
- if ( isTemplatesAccessible && isBlockBasedTheme ) {
47
+ // The site editor and templates both check whether the user
48
+ // can read templates. We can leverage that here and this
49
+ // command links to the classic dashboard manage patterns page
50
+ // if the user can't access it.
51
+ if ( isTemplatesAccessible ) {
49
52
  const args = {
50
53
  path: '/patterns',
51
54
  };