@wordpress/core-commands 0.4.2 → 0.5.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 +2 -0
- package/build/{admin-navigation-commands.js → add-post-type-commands.js} +3 -11
- package/build/add-post-type-commands.js.map +1 -0
- package/build/private-apis.js +2 -2
- package/build/private-apis.js.map +1 -1
- package/build-module/{admin-navigation-commands.js → add-post-type-commands.js} +3 -11
- package/build-module/add-post-type-commands.js.map +1 -0
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/package.json +11 -11
- package/src/{admin-navigation-commands.js → add-post-type-commands.js} +2 -10
- package/src/private-apis.js +2 -2
- package/build/admin-navigation-commands.js.map +0 -1
- package/build-module/admin-navigation-commands.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useAddPostTypeCommands = useAddPostTypeCommands;
|
|
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
|
|
17
|
+
function useAddPostTypeCommands() {
|
|
18
18
|
(0, _commands.useCommand)({
|
|
19
19
|
name: 'core/add-new-post',
|
|
20
20
|
label: (0, _i18n.__)('Add new post'),
|
|
@@ -31,13 +31,5 @@ function useAdminNavigationCommands() {
|
|
|
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
|
-
});
|
|
42
34
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=add-post-type-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
package/build/private-apis.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.privateApis = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _addPostTypeCommands = require("./add-post-type-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,
|
|
18
|
+
(0, _addPostTypeCommands.useAddPostTypeCommands)();
|
|
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 {
|
|
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"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useCommand } from '@wordpress/commands';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
7
|
-
export function
|
|
6
|
+
import { plus } from '@wordpress/icons';
|
|
7
|
+
export function useAddPostTypeCommands() {
|
|
8
8
|
useCommand({
|
|
9
9
|
name: 'core/add-new-post',
|
|
10
10
|
label: __('Add new post'),
|
|
@@ -21,13 +21,5 @@ export function useAdminNavigationCommands() {
|
|
|
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
|
-
});
|
|
32
24
|
}
|
|
33
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=add-post-type-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useAddPostTypeCommands } from './add-post-type-commands';
|
|
5
5
|
import { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
|
|
8
8
|
function useCommands() {
|
|
9
|
-
|
|
9
|
+
useAddPostTypeCommands();
|
|
10
10
|
useSiteEditorNavigationCommands();
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-commands/src/private-apis.js"],"names":["
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-commands",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "WordPress core reusable commands.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/commands": "^0.
|
|
31
|
-
"@wordpress/core-data": "^6.
|
|
32
|
-
"@wordpress/data": "^9.
|
|
33
|
-
"@wordpress/element": "^5.
|
|
34
|
-
"@wordpress/i18n": "^4.
|
|
35
|
-
"@wordpress/icons": "^9.
|
|
36
|
-
"@wordpress/private-apis": "^0.
|
|
37
|
-
"@wordpress/router": "^0.
|
|
38
|
-
"@wordpress/url": "^3.
|
|
30
|
+
"@wordpress/commands": "^0.7.0",
|
|
31
|
+
"@wordpress/core-data": "^6.13.0",
|
|
32
|
+
"@wordpress/data": "^9.6.0",
|
|
33
|
+
"@wordpress/element": "^5.13.0",
|
|
34
|
+
"@wordpress/i18n": "^4.36.0",
|
|
35
|
+
"@wordpress/icons": "^9.27.0",
|
|
36
|
+
"@wordpress/private-apis": "^0.18.0",
|
|
37
|
+
"@wordpress/router": "^0.5.0",
|
|
38
|
+
"@wordpress/url": "^3.37.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^18.0.0"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "d47d8069e1aae05d4a16dc287902eb90edcbff50"
|
|
47
47
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useCommand } from '@wordpress/commands';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { plus } from '@wordpress/icons';
|
|
7
7
|
|
|
8
|
-
export function
|
|
8
|
+
export function useAddPostTypeCommands() {
|
|
9
9
|
useCommand( {
|
|
10
10
|
name: 'core/add-new-post',
|
|
11
11
|
label: __( 'Add new post' ),
|
|
@@ -22,12 +22,4 @@ export function useAdminNavigationCommands() {
|
|
|
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
|
-
} );
|
|
33
25
|
}
|
package/src/private-apis.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useAddPostTypeCommands } from './add-post-type-commands';
|
|
5
5
|
import { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
|
|
8
8
|
function useCommands() {
|
|
9
|
-
|
|
9
|
+
useAddPostTypeCommands();
|
|
10
10
|
useSiteEditorNavigationCommands();
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|