@wordpress/core-commands 0.4.1 → 0.4.2

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useAddPostTypeCommands = useAddPostTypeCommands;
6
+ exports.useAdminNavigationCommands = useAdminNavigationCommands;
7
7
 
8
8
  var _commands = require("@wordpress/commands");
9
9
 
@@ -14,7 +14,7 @@ var _icons = require("@wordpress/icons");
14
14
  /**
15
15
  * WordPress dependencies
16
16
  */
17
- function useAddPostTypeCommands() {
17
+ function useAdminNavigationCommands() {
18
18
  (0, _commands.useCommand)({
19
19
  name: 'core/add-new-post',
20
20
  label: (0, _i18n.__)('Add new post'),
@@ -31,5 +31,13 @@ function useAddPostTypeCommands() {
31
31
  document.location.href = 'post-new.php?post_type=page';
32
32
  }
33
33
  });
34
+ (0, _commands.useCommand)({
35
+ name: 'core/manage-reusable-blocks',
36
+ label: (0, _i18n.__)('Manage all custom patterns'),
37
+ callback: () => {
38
+ document.location.href = 'edit.php?post_type=wp_block';
39
+ },
40
+ icon: _icons.external
41
+ });
34
42
  }
35
- //# sourceMappingURL=add-post-type-commands.js.map
43
+ //# sourceMappingURL=admin-navigation-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"names":["useAdminNavigationCommands","name","label","icon","plus","callback","document","location","href","external"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKO,SAASA,0BAAT,GAAsC;AAC5C,4BAAY;AACXC,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAE,cAAI,cAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEC,WAHK;AAIXC,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,cAAzB;AACA;AANU,GAAZ;AAQA,4BAAY;AACXP,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAE,cAAI,cAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEC,WAHK;AAIXC,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA;AANU,GAAZ;AAQA,4BAAY;AACXP,IAAAA,IAAI,EAAE,6BADK;AAEXC,IAAAA,KAAK,EAAE,cAAI,4BAAJ,CAFI;AAGXG,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA,KALU;AAMXL,IAAAA,IAAI,EAAEM;AANK,GAAZ;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { external, plus } from '@wordpress/icons';\n\nexport function useAdminNavigationCommands() {\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: __( 'Manage all custom patterns' ),\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t},\n\t\ticon: external,\n\t} );\n}\n"]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.privateApis = void 0;
7
7
 
8
- var _addPostTypeCommands = require("./add-post-type-commands");
8
+ var _adminNavigationCommands = require("./admin-navigation-commands");
9
9
 
10
10
  var _siteEditorNavigationCommands = require("./site-editor-navigation-commands");
11
11
 
@@ -15,7 +15,7 @@ var _lockUnlock = require("./lock-unlock");
15
15
  * Internal dependencies
16
16
  */
17
17
  function useCommands() {
18
- (0, _addPostTypeCommands.useAddPostTypeCommands)();
18
+ (0, _adminNavigationCommands.useAdminNavigationCommands)();
19
19
  (0, _siteEditorNavigationCommands.useSiteEditorNavigationCommands)();
20
20
  }
21
21
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-commands/src/private-apis.js"],"names":["useCommands","privateApis"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,SAASA,WAAT,GAAuB;AACtB;AACA;AACA;;AAEM,MAAMC,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB;AAClBD,EAAAA;AADkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useAddPostTypeCommands } from './add-post-type-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { lock } from './lock-unlock';\n\nfunction useCommands() {\n\tuseAddPostTypeCommands();\n\tuseSiteEditorNavigationCommands();\n}\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommands,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/core-commands/src/private-apis.js"],"names":["useCommands","privateApis"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,SAASA,WAAT,GAAuB;AACtB;AACA;AACA;;AAEM,MAAMC,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB;AAClBD,EAAAA;AADkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useAdminNavigationCommands } from './admin-navigation-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { lock } from './lock-unlock';\n\nfunction useCommands() {\n\tuseAdminNavigationCommands();\n\tuseSiteEditorNavigationCommands();\n}\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommands,\n} );\n"]}
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { useCommand } from '@wordpress/commands';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { plus } from '@wordpress/icons';
7
- export function useAddPostTypeCommands() {
6
+ import { external, plus } from '@wordpress/icons';
7
+ export function useAdminNavigationCommands() {
8
8
  useCommand({
9
9
  name: 'core/add-new-post',
10
10
  label: __('Add new post'),
@@ -21,5 +21,13 @@ export function useAddPostTypeCommands() {
21
21
  document.location.href = 'post-new.php?post_type=page';
22
22
  }
23
23
  });
24
+ useCommand({
25
+ name: 'core/manage-reusable-blocks',
26
+ label: __('Manage all custom patterns'),
27
+ callback: () => {
28
+ document.location.href = 'edit.php?post_type=wp_block';
29
+ },
30
+ icon: external
31
+ });
24
32
  }
25
- //# sourceMappingURL=add-post-type-commands.js.map
33
+ //# sourceMappingURL=admin-navigation-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"names":["useCommand","__","external","plus","useAdminNavigationCommands","name","label","icon","callback","document","location","href"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,qBAA3B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AAEA,OAAO,SAASC,0BAAT,GAAsC;AAC5CJ,EAAAA,UAAU,CAAE;AACXK,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAEL,EAAE,CAAE,cAAF,CAFE;AAGXM,IAAAA,IAAI,EAAEJ,IAHK;AAIXK,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,cAAzB;AACA;AANU,GAAF,CAAV;AAQAX,EAAAA,UAAU,CAAE;AACXK,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAEL,EAAE,CAAE,cAAF,CAFE;AAGXM,IAAAA,IAAI,EAAEJ,IAHK;AAIXK,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA;AANU,GAAF,CAAV;AAQAX,EAAAA,UAAU,CAAE;AACXK,IAAAA,IAAI,EAAE,6BADK;AAEXC,IAAAA,KAAK,EAAEL,EAAE,CAAE,4BAAF,CAFE;AAGXO,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA,KALU;AAMXJ,IAAAA,IAAI,EAAEL;AANK,GAAF,CAAV;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { external, plus } from '@wordpress/icons';\n\nexport function useAdminNavigationCommands() {\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: __( 'Manage all custom patterns' ),\n\t\tcallback: () => {\n\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t},\n\t\ticon: external,\n\t} );\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { useAddPostTypeCommands } from './add-post-type-commands';
4
+ import { useAdminNavigationCommands } from './admin-navigation-commands';
5
5
  import { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';
6
6
  import { lock } from './lock-unlock';
7
7
 
8
8
  function useCommands() {
9
- useAddPostTypeCommands();
9
+ useAdminNavigationCommands();
10
10
  useSiteEditorNavigationCommands();
11
11
  }
12
12
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-commands/src/private-apis.js"],"names":["useAddPostTypeCommands","useSiteEditorNavigationCommands","lock","useCommands","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAT,QAAuC,0BAAvC;AACA,SAASC,+BAAT,QAAgD,mCAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;;AAEA,SAASC,WAAT,GAAuB;AACtBH,EAAAA,sBAAsB;AACtBC,EAAAA,+BAA+B;AAC/B;;AAED,OAAO,MAAMG,WAAW,GAAG,EAApB;AACPF,IAAI,CAAEE,WAAF,EAAe;AAClBD,EAAAA;AADkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useAddPostTypeCommands } from './add-post-type-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { lock } from './lock-unlock';\n\nfunction useCommands() {\n\tuseAddPostTypeCommands();\n\tuseSiteEditorNavigationCommands();\n}\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommands,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/core-commands/src/private-apis.js"],"names":["useAdminNavigationCommands","useSiteEditorNavigationCommands","lock","useCommands","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,6BAA3C;AACA,SAASC,+BAAT,QAAgD,mCAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;;AAEA,SAASC,WAAT,GAAuB;AACtBH,EAAAA,0BAA0B;AAC1BC,EAAAA,+BAA+B;AAC/B;;AAED,OAAO,MAAMG,WAAW,GAAG,EAApB;AACPF,IAAI,CAAEE,WAAF,EAAe;AAClBD,EAAAA;AADkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useAdminNavigationCommands } from './admin-navigation-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { lock } from './lock-unlock';\n\nfunction useCommands() {\n\tuseAdminNavigationCommands();\n\tuseSiteEditorNavigationCommands();\n}\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommands,\n} );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-commands",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "WordPress core reusable commands.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,12 +27,12 @@
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/commands": "^0.6.1",
31
- "@wordpress/core-data": "^6.12.1",
30
+ "@wordpress/commands": "^0.6.2",
31
+ "@wordpress/core-data": "^6.12.2",
32
32
  "@wordpress/data": "^9.5.1",
33
33
  "@wordpress/element": "^5.12.1",
34
34
  "@wordpress/i18n": "^4.35.1",
35
- "@wordpress/icons": "^9.26.1",
35
+ "@wordpress/icons": "^9.26.2",
36
36
  "@wordpress/private-apis": "^0.17.1",
37
37
  "@wordpress/router": "^0.4.1",
38
38
  "@wordpress/url": "^3.36.1"
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
46
+ "gitHead": "a00463f06c90ae6705951861eb889e67a52bf448"
47
47
  }
@@ -3,9 +3,9 @@
3
3
  */
4
4
  import { useCommand } from '@wordpress/commands';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { plus } from '@wordpress/icons';
6
+ import { external, plus } from '@wordpress/icons';
7
7
 
8
- export function useAddPostTypeCommands() {
8
+ export function useAdminNavigationCommands() {
9
9
  useCommand( {
10
10
  name: 'core/add-new-post',
11
11
  label: __( 'Add new post' ),
@@ -22,4 +22,12 @@ export function useAddPostTypeCommands() {
22
22
  document.location.href = 'post-new.php?post_type=page';
23
23
  },
24
24
  } );
25
+ useCommand( {
26
+ name: 'core/manage-reusable-blocks',
27
+ label: __( 'Manage all custom patterns' ),
28
+ callback: () => {
29
+ document.location.href = 'edit.php?post_type=wp_block';
30
+ },
31
+ icon: external,
32
+ } );
25
33
  }
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { useAddPostTypeCommands } from './add-post-type-commands';
4
+ import { useAdminNavigationCommands } from './admin-navigation-commands';
5
5
  import { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';
6
6
  import { lock } from './lock-unlock';
7
7
 
8
8
  function useCommands() {
9
- useAddPostTypeCommands();
9
+ useAdminNavigationCommands();
10
10
  useSiteEditorNavigationCommands();
11
11
  }
12
12
 
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/core-commands/src/add-post-type-commands.js"],"names":["useAddPostTypeCommands","name","label","icon","plus","callback","document","location","href"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKO,SAASA,sBAAT,GAAkC;AACxC,4BAAY;AACXC,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAE,cAAI,cAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEC,WAHK;AAIXC,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,cAAzB;AACA;AANU,GAAZ;AAQA,4BAAY;AACXP,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAE,cAAI,cAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEC,WAHK;AAIXC,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA;AANU,GAAZ;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\nexport function useAddPostTypeCommands() {\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}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/core-commands/src/add-post-type-commands.js"],"names":["useCommand","__","plus","useAddPostTypeCommands","name","label","icon","callback","document","location","href"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,qBAA3B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA,OAAO,SAASC,sBAAT,GAAkC;AACxCH,EAAAA,UAAU,CAAE;AACXI,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAEJ,EAAE,CAAE,cAAF,CAFE;AAGXK,IAAAA,IAAI,EAAEJ,IAHK;AAIXK,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,cAAzB;AACA;AANU,GAAF,CAAV;AAQAV,EAAAA,UAAU,CAAE;AACXI,IAAAA,IAAI,EAAE,mBADK;AAEXC,IAAAA,KAAK,EAAEJ,EAAE,CAAE,cAAF,CAFE;AAGXK,IAAAA,IAAI,EAAEJ,IAHK;AAIXK,IAAAA,QAAQ,EAAE,MAAM;AACfC,MAAAA,QAAQ,CAACC,QAAT,CAAkBC,IAAlB,GAAyB,6BAAzB;AACA;AANU,GAAF,CAAV;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\nexport function useAddPostTypeCommands() {\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}\n"]}