@wordpress/core-commands 1.27.0 → 1.28.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 +2 -2
- package/build/admin-navigation-commands.js.map +1 -1
- package/build-module/admin-navigation-commands.js +2 -2
- package/build-module/admin-navigation-commands.js.map +1 -1
- package/package.json +15 -15
- package/src/admin-navigation-commands.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -62,7 +62,7 @@ const getAddNewPageCommand = () => function useAddNewPageCommand() {
|
|
|
62
62
|
const addNewPage = isSiteEditor && isBlockBasedTheme ? createPageEntity : () => document.location.href = 'post-new.php?post_type=page';
|
|
63
63
|
return [{
|
|
64
64
|
name: 'core/add-new-page',
|
|
65
|
-
label: (0, _i18n.__)('Add
|
|
65
|
+
label: (0, _i18n.__)('Add Page'),
|
|
66
66
|
icon: _icons.plus,
|
|
67
67
|
callback: addNewPage
|
|
68
68
|
}];
|
|
@@ -75,7 +75,7 @@ const getAddNewPageCommand = () => function useAddNewPageCommand() {
|
|
|
75
75
|
function useAdminNavigationCommands() {
|
|
76
76
|
(0, _commands.useCommand)({
|
|
77
77
|
name: 'core/add-new-post',
|
|
78
|
-
label: (0, _i18n.__)('Add
|
|
78
|
+
label: (0, _i18n.__)('Add Post'),
|
|
79
79
|
icon: _icons.plus,
|
|
80
80
|
callback: () => {
|
|
81
81
|
document.location.assign('post-new.php');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_commands","require","_i18n","_icons","_url","_coreData","_data","_element","_notices","_router","_lockUnlock","useHistory","unlock","routerPrivateApis","getAddNewPageCommand","useAddNewPageCommand","isSiteEditor","getPath","window","location","href","includes","history","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","saveEntityRecord","useDispatch","createErrorNotice","noticesStore","createPageEntity","useCallback","close","page","status","throwOnError","id","navigate","error","errorMessage","message","code","__","type","commands","useMemo","addNewPage","document","name","label","icon","plus","callback","isLoading","useAdminNavigationCommands","useCommand","assign","useCommandLoader","hook"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand, useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { getPath } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst getAddNewPageCommand = () =>\n\tfunction useAddNewPageCommand() {\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst history = useHistory();\n\t\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t\t}, [] );\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\t\tconst createPageEntity = useCallback(\n\t\t\tasync ( { close } ) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await saveEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( page?.id ) {\n\t\t\t\t\t\thistory.navigate( `/page/${ page.id }?canvas=edit` );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while creating the item.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t} finally {\n\t\t\t\t\tclose();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ createErrorNotice, history, saveEntityRecord ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\tconst addNewPage =\n\t\t\t\tisSiteEditor && isBlockBasedTheme\n\t\t\t\t\t? createPageEntity\n\t\t\t\t\t: () =>\n\t\t\t\t\t\t\t( document.location.href =\n\t\t\t\t\t\t\t\t'post-new.php?post_type=page' );\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/add-new-page',\n\t\t\t\t\tlabel: __( 'Add
|
|
1
|
+
{"version":3,"names":["_commands","require","_i18n","_icons","_url","_coreData","_data","_element","_notices","_router","_lockUnlock","useHistory","unlock","routerPrivateApis","getAddNewPageCommand","useAddNewPageCommand","isSiteEditor","getPath","window","location","href","includes","history","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","saveEntityRecord","useDispatch","createErrorNotice","noticesStore","createPageEntity","useCallback","close","page","status","throwOnError","id","navigate","error","errorMessage","message","code","__","type","commands","useMemo","addNewPage","document","name","label","icon","plus","callback","isLoading","useAdminNavigationCommands","useCommand","assign","useCommandLoader","hook"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand, useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { getPath } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst getAddNewPageCommand = () =>\n\tfunction useAddNewPageCommand() {\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst history = useHistory();\n\t\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t\t}, [] );\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\t\tconst createPageEntity = useCallback(\n\t\t\tasync ( { close } ) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await saveEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( page?.id ) {\n\t\t\t\t\t\thistory.navigate( `/page/${ page.id }?canvas=edit` );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while creating the item.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t} finally {\n\t\t\t\t\tclose();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ createErrorNotice, history, saveEntityRecord ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\tconst addNewPage =\n\t\t\t\tisSiteEditor && isBlockBasedTheme\n\t\t\t\t\t? createPageEntity\n\t\t\t\t\t: () =>\n\t\t\t\t\t\t\t( document.location.href =\n\t\t\t\t\t\t\t\t'post-new.php?post_type=page' );\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/add-new-page',\n\t\t\t\t\tlabel: __( 'Add Page' ),\n\t\t\t\t\ticon: plus,\n\t\t\t\t\tcallback: addNewPage,\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ createPageEntity, isSiteEditor, isBlockBasedTheme ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useAdminNavigationCommands() {\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add Post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.assign( 'post-new.php' );\n\t\t},\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/add-new-page',\n\t\thook: getAddNewPageCommand(),\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,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AAhBA;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAM;EAAEU;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElD,MAAMC,oBAAoB,GAAGA,CAAA,KAC5B,SAASC,oBAAoBA,CAAA,EAAG;EAC/B,MAAMC,YAAY,GAAG,IAAAC,YAAO,EAAEC,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC,EAAEC,QAAQ,CAC7D,i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AAQ,CAACC,IAAI,GACvB,6BAA+B;IACpC,OAAO,CACN;MACC+B,IAAI,EAAE,mBAAmB;MACzBC,KAAK,EAAE,IAAAP,QAAE,EAAE,UAAW,CAAC;MACvBQ,IAAI,EAAEC,WAAI;MACVC,QAAQ,EAAEN;IACX,CAAC,CACD;EACF,CAAC,EAAE,CAAEhB,gBAAgB,EAAEjB,YAAY,EAAEO,iBAAiB,CAAG,CAAC;EAE1D,OAAO;IACNiC,SAAS,EAAE,KAAK;IAChBT;EACD,CAAC;AACF,CAAC;AAEK,SAASU,0BAA0BA,CAAA,EAAG;EAC5C,IAAAC,oBAAU,EAAE;IACXP,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,IAAAP,QAAE,EAAE,UAAW,CAAC;IACvBQ,IAAI,EAAEC,WAAI;IACVC,QAAQ,EAAEA,CAAA,KAAM;MACfL,QAAQ,CAAC/B,QAAQ,CAACwC,MAAM,CAAE,cAAe,CAAC;IAC3C;EACD,CAAE,CAAC;EAEH,IAAAC,0BAAgB,EAAE;IACjBT,IAAI,EAAE,mBAAmB;IACzBU,IAAI,EAAE/C,oBAAoB,CAAC;EAC5B,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -55,7 +55,7 @@ const getAddNewPageCommand = () => function useAddNewPageCommand() {
|
|
|
55
55
|
const addNewPage = isSiteEditor && isBlockBasedTheme ? createPageEntity : () => document.location.href = 'post-new.php?post_type=page';
|
|
56
56
|
return [{
|
|
57
57
|
name: 'core/add-new-page',
|
|
58
|
-
label: __('Add
|
|
58
|
+
label: __('Add Page'),
|
|
59
59
|
icon: plus,
|
|
60
60
|
callback: addNewPage
|
|
61
61
|
}];
|
|
@@ -68,7 +68,7 @@ const getAddNewPageCommand = () => function useAddNewPageCommand() {
|
|
|
68
68
|
export function useAdminNavigationCommands() {
|
|
69
69
|
useCommand({
|
|
70
70
|
name: 'core/add-new-post',
|
|
71
|
-
label: __('Add
|
|
71
|
+
label: __('Add Post'),
|
|
72
72
|
icon: plus,
|
|
73
73
|
callback: () => {
|
|
74
74
|
document.location.assign('post-new.php');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCommand","useCommandLoader","__","plus","getPath","store","coreStore","useSelect","useDispatch","useCallback","useMemo","noticesStore","privateApis","routerPrivateApis","unlock","useHistory","getAddNewPageCommand","useAddNewPageCommand","isSiteEditor","window","location","href","includes","history","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","saveEntityRecord","createErrorNotice","createPageEntity","close","page","status","throwOnError","id","navigate","error","errorMessage","message","code","type","commands","addNewPage","document","name","label","icon","callback","isLoading","useAdminNavigationCommands","assign","hook"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand, useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { getPath } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst getAddNewPageCommand = () =>\n\tfunction useAddNewPageCommand() {\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst history = useHistory();\n\t\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t\t}, [] );\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\t\tconst createPageEntity = useCallback(\n\t\t\tasync ( { close } ) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await saveEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( page?.id ) {\n\t\t\t\t\t\thistory.navigate( `/page/${ page.id }?canvas=edit` );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while creating the item.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t} finally {\n\t\t\t\t\tclose();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ createErrorNotice, history, saveEntityRecord ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\tconst addNewPage =\n\t\t\t\tisSiteEditor && isBlockBasedTheme\n\t\t\t\t\t? createPageEntity\n\t\t\t\t\t: () =>\n\t\t\t\t\t\t\t( document.location.href =\n\t\t\t\t\t\t\t\t'post-new.php?post_type=page' );\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/add-new-page',\n\t\t\t\t\tlabel: __( 'Add
|
|
1
|
+
{"version":3,"names":["useCommand","useCommandLoader","__","plus","getPath","store","coreStore","useSelect","useDispatch","useCallback","useMemo","noticesStore","privateApis","routerPrivateApis","unlock","useHistory","getAddNewPageCommand","useAddNewPageCommand","isSiteEditor","window","location","href","includes","history","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","saveEntityRecord","createErrorNotice","createPageEntity","close","page","status","throwOnError","id","navigate","error","errorMessage","message","code","type","commands","addNewPage","document","name","label","icon","callback","isLoading","useAdminNavigationCommands","assign","hook"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand, useCommandLoader } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { getPath } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst getAddNewPageCommand = () =>\n\tfunction useAddNewPageCommand() {\n\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t'site-editor.php'\n\t\t);\n\t\tconst history = useHistory();\n\t\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t\t}, [] );\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\t\tconst createPageEntity = useCallback(\n\t\t\tasync ( { close } ) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await saveEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tif ( page?.id ) {\n\t\t\t\t\t\thistory.navigate( `/page/${ page.id }?canvas=edit` );\n\t\t\t\t\t}\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while creating the item.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t} finally {\n\t\t\t\t\tclose();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ createErrorNotice, history, saveEntityRecord ]\n\t\t);\n\n\t\tconst commands = useMemo( () => {\n\t\t\tconst addNewPage =\n\t\t\t\tisSiteEditor && isBlockBasedTheme\n\t\t\t\t\t? createPageEntity\n\t\t\t\t\t: () =>\n\t\t\t\t\t\t\t( document.location.href =\n\t\t\t\t\t\t\t\t'post-new.php?post_type=page' );\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/add-new-page',\n\t\t\t\t\tlabel: __( 'Add Page' ),\n\t\t\t\t\ticon: plus,\n\t\t\t\t\tcallback: addNewPage,\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ createPageEntity, isSiteEditor, isBlockBasedTheme ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useAdminNavigationCommands() {\n\tuseCommand( {\n\t\tname: 'core/add-new-post',\n\t\tlabel: __( 'Add Post' ),\n\t\ticon: plus,\n\t\tcallback: () => {\n\t\t\tdocument.location.assign( 'post-new.php' );\n\t\t},\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/add-new-page',\n\t\thook: getAddNewPageCommand(),\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,gBAAgB,QAAQ,qBAAqB;AAClE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASL,KAAK,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C;MAEL2B,iBAAiB,CAAES,YAAY,EAAE;QAChCG,IAAI,EAAE;MACP,CAAE,CAAC;IACJ,CAAC,SAAS;MACTV,KAAK,CAAC,CAAC;IACR;EACD,CAAC,EACD,CAAEF,iBAAiB,EAAEN,OAAO,EAAEK,gBAAgB,CAC/C,CAAC;EAED,MAAMc,QAAQ,GAAGhC,OAAO,CAAE,MAAM;IAC/B,MAAMiC,UAAU,GACfzB,YAAY,IAAIM,iBAAiB,GAC9BM,gBAAgB,GAChB,MACEc,QAAQ,CAACxB,QAAQ,CAACC,IAAI,GACvB,6BAA+B;IACpC,OAAO,CACN;MACCwB,IAAI,EAAE,mBAAmB;MACzBC,KAAK,EAAE5C,EAAE,CAAE,UAAW,CAAC;MACvB6C,IAAI,EAAE5C,IAAI;MACV6C,QAAQ,EAAEL;IACX,CAAC,CACD;EACF,CAAC,EAAE,CAAEb,gBAAgB,EAAEZ,YAAY,EAAEM,iBAAiB,CAAG,CAAC;EAE1D,OAAO;IACNyB,SAAS,EAAE,KAAK;IAChBP;EACD,CAAC;AACF,CAAC;AAEF,OAAO,SAASQ,0BAA0BA,CAAA,EAAG;EAC5ClD,UAAU,CAAE;IACX6C,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE5C,EAAE,CAAE,UAAW,CAAC;IACvB6C,IAAI,EAAE5C,IAAI;IACV6C,QAAQ,EAAEA,CAAA,KAAM;MACfJ,QAAQ,CAACxB,QAAQ,CAAC+B,MAAM,CAAE,cAAe,CAAC;IAC3C;EACD,CAAE,CAAC;EAEHlD,gBAAgB,CAAE;IACjB4C,IAAI,EAAE,mBAAmB;IACzBO,IAAI,EAAEpC,oBAAoB,CAAC;EAC5B,CAAE,CAAC;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-commands",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "WordPress core reusable commands.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "7.25.7",
|
|
32
|
-
"@wordpress/block-editor": "^15.
|
|
33
|
-
"@wordpress/commands": "^1.
|
|
34
|
-
"@wordpress/compose": "^7.
|
|
35
|
-
"@wordpress/core-data": "^7.
|
|
36
|
-
"@wordpress/data": "^10.
|
|
37
|
-
"@wordpress/element": "^6.
|
|
38
|
-
"@wordpress/html-entities": "^4.
|
|
39
|
-
"@wordpress/i18n": "^6.
|
|
40
|
-
"@wordpress/icons": "^10.
|
|
41
|
-
"@wordpress/notices": "^5.
|
|
42
|
-
"@wordpress/private-apis": "^1.
|
|
43
|
-
"@wordpress/router": "^1.
|
|
44
|
-
"@wordpress/url": "^4.
|
|
32
|
+
"@wordpress/block-editor": "^15.1.0",
|
|
33
|
+
"@wordpress/commands": "^1.28.0",
|
|
34
|
+
"@wordpress/compose": "^7.28.0",
|
|
35
|
+
"@wordpress/core-data": "^7.28.0",
|
|
36
|
+
"@wordpress/data": "^10.28.0",
|
|
37
|
+
"@wordpress/element": "^6.28.0",
|
|
38
|
+
"@wordpress/html-entities": "^4.28.0",
|
|
39
|
+
"@wordpress/i18n": "^6.1.0",
|
|
40
|
+
"@wordpress/icons": "^10.28.0",
|
|
41
|
+
"@wordpress/notices": "^5.28.0",
|
|
42
|
+
"@wordpress/private-apis": "^1.28.0",
|
|
43
|
+
"@wordpress/router": "^1.28.0",
|
|
44
|
+
"@wordpress/url": "^4.28.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "28cc2098f5ee28f89096b638533796538f495f72"
|
|
54
54
|
}
|
|
@@ -74,7 +74,7 @@ const getAddNewPageCommand = () =>
|
|
|
74
74
|
return [
|
|
75
75
|
{
|
|
76
76
|
name: 'core/add-new-page',
|
|
77
|
-
label: __( 'Add
|
|
77
|
+
label: __( 'Add Page' ),
|
|
78
78
|
icon: plus,
|
|
79
79
|
callback: addNewPage,
|
|
80
80
|
},
|
|
@@ -90,7 +90,7 @@ const getAddNewPageCommand = () =>
|
|
|
90
90
|
export function useAdminNavigationCommands() {
|
|
91
91
|
useCommand( {
|
|
92
92
|
name: 'core/add-new-post',
|
|
93
|
-
label: __( 'Add
|
|
93
|
+
label: __( 'Add Post' ),
|
|
94
94
|
icon: plus,
|
|
95
95
|
callback: () => {
|
|
96
96
|
document.location.assign( 'post-new.php' );
|