@wordpress/core-commands 1.34.0 → 1.35.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 +3 -1
- package/build/admin-navigation-commands.js.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/site-editor-navigation-commands.js +8 -6
- package/build/site-editor-navigation-commands.js.map +1 -1
- package/build/utils/order-entity-records-by-search.js +2 -0
- package/build/utils/order-entity-records-by-search.js.map +1 -1
- package/build-module/admin-navigation-commands.js +2 -1
- package/build-module/admin-navigation-commands.js.map +1 -1
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +2 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/site-editor-navigation-commands.js +7 -6
- package/build-module/site-editor-navigation-commands.js.map +1 -1
- package/build-module/utils/order-entity-records-by-search.js +1 -0
- package/build-module/utils/order-entity-records-by-search.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/admin-navigation-commands.js
|
|
18
20
|
var admin_navigation_commands_exports = {};
|
|
19
21
|
__export(admin_navigation_commands_exports, {
|
|
20
22
|
useAdminNavigationCommands: () => useAdminNavigationCommands
|
|
@@ -26,7 +28,7 @@ var import_icons = require("@wordpress/icons");
|
|
|
26
28
|
var import_element = require("@wordpress/element");
|
|
27
29
|
var import_core_data = require("@wordpress/core-data");
|
|
28
30
|
var import_data = require("@wordpress/data");
|
|
29
|
-
|
|
31
|
+
var getViewSiteCommand = () => function useViewSiteCommand() {
|
|
30
32
|
const homeUrl = (0, import_data.useSelect)((select) => {
|
|
31
33
|
return select(import_core_data.store).getEntityRecord(
|
|
32
34
|
"root",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/admin-navigation-commands.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader, useCommands } from '@wordpress/commands';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst getViewSiteCommand = () =>\n\tfunction useViewSiteCommand() {\n\t\tconst homeUrl = useSelect( ( select ) => {\n\t\t\t// Site index.\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t)?.home;\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! homeUrl ) {\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/view-site',\n\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\ticon: external,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t\twindow.open( homeUrl, '_blank' );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ homeUrl ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useAdminNavigationCommands( menuCommands ) {\n\tconst commands = useMemo( () => {\n\t\treturn ( menuCommands ?? [] ).map( ( menuCommand ) => {\n\t\t\tconst label = sprintf(\n\t\t\t\t/* translators: %s: menu label */\n\t\t\t\t__( 'Go to: %s' ),\n\t\t\t\tmenuCommand.label\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tname: menuCommand.name,\n\t\t\t\tlabel,\n\t\t\t\tsearchLabel: label,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tdocument.location = menuCommand.url;\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t};\n\t\t} );\n\t}, [ menuCommands ] );\n\tuseCommands( commands );\n\n\tuseCommandLoader( {\n\t\tname: 'core/view-site',\n\t\thook: getViewSiteCommand(),\n\t} );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAA8C;AAC9C,kBAA4B;AAC5B,mBAAyB;AACzB,qBAAwB;AACxB,uBAAmC;AACnC,kBAA0B;AAE1B,IAAM,qBAAqB,MAC1B,SAAS,qBAAqB;AAC7B,QAAM,cAAU,uBAAW,CAAE,WAAY;AAExC,WAAO,OAAQ,iBAAAA,KAAU,EAAE;AAAA,MAC1B;AAAA,MACA;AAAA,IACD,GAAG;AAAA,EACJ,GAAG,CAAC,CAAE;AAEN,QAAM,eAAW,wBAAS,MAAM;AAC/B,QAAK,CAAE,SAAU;AAChB,aAAO,CAAC;AAAA,IACT;AAEA,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,WAAO,gBAAI,WAAY;AAAA,QACvB,MAAM;AAAA,QACN,UAAU,CAAE,EAAE,MAAM,MAAO;AAC1B,gBAAM;AACN,iBAAO,KAAM,SAAS,QAAS;AAAA,QAChC;AAAA,MACD;AAAA,IACD;AAAA,EACD,GAAG,CAAE,OAAQ,CAAE;AAEf,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,EACD;AACD;AAEM,SAAS,2BAA4B,cAAe;AAC1D,QAAM,eAAW,wBAAS,MAAM;AAC/B,YAAS,gBAAgB,CAAC,GAAI,IAAK,CAAE,gBAAiB;AACrD,YAAM,YAAQ;AAAA;AAAA,YAEb,gBAAI,WAAY;AAAA,QAChB,YAAY;AAAA,MACb;AACA,aAAO;AAAA,QACN,MAAM,YAAY;AAAA,QAClB;AAAA,QACA,aAAa;AAAA,QACb,UAAU,CAAE,EAAE,MAAM,MAAO;AAC1B,mBAAS,WAAW,YAAY;AAChC,gBAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,YAAa,CAAE;AACpB,mCAAa,QAAS;AAEtB,wCAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,mBAAmB;AAAA,EAC1B,CAAE;AACH;",
|
|
6
6
|
"names": ["coreStore"]
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -15,13 +15,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/index.js
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
__export(index_exports, {
|
|
20
22
|
initializeCommandPalette: () => initializeCommandPalette,
|
|
21
23
|
privateApis: () => import_private_apis.privateApis
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(index_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_element = require("@wordpress/element");
|
|
26
27
|
var import_router = require("@wordpress/router");
|
|
27
28
|
var import_commands = require("@wordpress/commands");
|
|
@@ -29,7 +30,8 @@ var import_admin_navigation_commands = require("./admin-navigation-commands");
|
|
|
29
30
|
var import_site_editor_navigation_commands = require("./site-editor-navigation-commands");
|
|
30
31
|
var import_lock_unlock = require("./lock-unlock");
|
|
31
32
|
var import_private_apis = require("./private-apis");
|
|
32
|
-
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var { RouterProvider } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
33
35
|
function CommandPalette({ settings }) {
|
|
34
36
|
const { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } = settings;
|
|
35
37
|
(0, import_admin_navigation_commands.useAdminNavigationCommands)(menuCommands);
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport { useAdminNavigationCommands } from './admin-navigation-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { unlock } from './lock-unlock';\nexport { privateApis } from './private-apis';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\n// Register core commands and render the Command Palette.\nfunction CommandPalette( { settings } ) {\n\tconst { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } =\n\t\tsettings;\n\tuseAdminNavigationCommands( menuCommands );\n\tuseSiteEditorNavigationCommands( isNetworkAdmin );\n\treturn (\n\t\t<RouterProvider pathArg=\"p\">\n\t\t\t<CommandMenu />\n\t\t</RouterProvider>\n\t);\n}\n\n/**\n * Initializes the Command Palette.\n *\n * @param {Object} settings Command palette settings.\n */\nexport function initializeCommandPalette( settings ) {\n\tconst root = document.createElement( 'div' );\n\tdocument.body.appendChild( root );\n\tcreateRoot( root ).render(\n\t\t<StrictMode>\n\t\t\t<CommandPalette settings={ settings } />\n\t\t</StrictMode>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAuC;AACvC,oBAAiD;AACjD,sBAA4B;AAK5B,uCAA2C;AAC3C,6CAAgD;AAChD,yBAAuB;AACvB,0BAA4B;AAYzB;AAVH,IAAM,EAAE,eAAe,QAAI,2BAAQ,cAAAA,WAAkB;AAGrD,SAAS,eAAgB,EAAE,SAAS,GAAI;AACvC,QAAM,EAAE,eAAe,cAAc,kBAAkB,eAAe,IACrE;AACD,mEAA4B,YAAa;AACzC,8EAAiC,cAAe;AAChD,SACC,4CAAC,kBAAe,SAAQ,KACvB,sDAAC,+BAAY,GACd;AAEF;AAOO,SAAS,yBAA0B,UAAW;AACpD,QAAM,OAAO,SAAS,cAAe,KAAM;AAC3C,WAAS,KAAK,YAAa,IAAK;AAChC,iCAAY,IAAK,EAAE;AAAA,IAClB,4CAAC,6BACA,sDAAC,kBAAe,UAAsB,GACvC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": ["routerPrivateApis"]
|
|
7
7
|
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/lock-unlock.js
|
|
18
20
|
var lock_unlock_exports = {};
|
|
19
21
|
__export(lock_unlock_exports, {
|
|
20
22
|
lock: () => lock,
|
|
@@ -22,7 +24,7 @@ __export(lock_unlock_exports, {
|
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(lock_unlock_exports);
|
|
24
26
|
var import_private_apis = require("@wordpress/private-apis");
|
|
25
|
-
|
|
27
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
26
28
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
27
29
|
"@wordpress/core-commands"
|
|
28
30
|
);
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-commands'\n\t);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/private-apis.js
CHANGED
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/private-apis.js
|
|
18
20
|
var private_apis_exports = {};
|
|
19
21
|
__export(private_apis_exports, {
|
|
20
22
|
privateApis: () => privateApis
|
|
@@ -27,7 +29,7 @@ function useCommands() {
|
|
|
27
29
|
(0, import_admin_navigation_commands.useAdminNavigationCommands)();
|
|
28
30
|
(0, import_site_editor_navigation_commands.useSiteEditorNavigationCommands)();
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
var privateApis = {};
|
|
31
33
|
(0, import_lock_unlock.lock)(privateApis, {
|
|
32
34
|
useCommands
|
|
33
35
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.js"],
|
|
4
4
|
"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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uCAA2C;AAC3C,6CAAgD;AAChD,yBAAqB;AAErB,SAAS,cAAc;AACtB,mEAA2B;AAC3B,8EAAgC;AACjC;AAEO,IAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/site-editor-navigation-commands.js
|
|
18
20
|
var site_editor_navigation_commands_exports = {};
|
|
19
21
|
__export(site_editor_navigation_commands_exports, {
|
|
20
22
|
useSiteEditorNavigationCommands: () => useSiteEditorNavigationCommands
|
|
@@ -32,8 +34,8 @@ var import_compose = require("@wordpress/compose");
|
|
|
32
34
|
var import_html_entities = require("@wordpress/html-entities");
|
|
33
35
|
var import_lock_unlock = require("./lock-unlock");
|
|
34
36
|
var import_order_entity_records_by_search = require("./utils/order-entity-records-by-search");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
var { useHistory } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
38
|
+
var icons = {
|
|
37
39
|
post: import_icons.post,
|
|
38
40
|
page: import_icons.page,
|
|
39
41
|
wp_template: import_icons.layout,
|
|
@@ -48,7 +50,7 @@ function useDebouncedValue(value) {
|
|
|
48
50
|
}, [debounced, value]);
|
|
49
51
|
return debouncedValue;
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
var getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
|
|
52
54
|
const history = useHistory();
|
|
53
55
|
const { isBlockBasedTheme, canCreateTemplate } = (0, import_data.useSelect)(
|
|
54
56
|
(select) => {
|
|
@@ -147,7 +149,7 @@ const getNavigationCommandLoaderPerPostType = (postType) => function useNavigati
|
|
|
147
149
|
isLoading
|
|
148
150
|
};
|
|
149
151
|
};
|
|
150
|
-
|
|
152
|
+
var getNavigationCommandLoaderPerTemplate = (templateType) => function useNavigationCommandLoader({ search }) {
|
|
151
153
|
const history = useHistory();
|
|
152
154
|
const { isBlockBasedTheme, canCreateTemplate } = (0, import_data.useSelect)(
|
|
153
155
|
(select) => {
|
|
@@ -240,7 +242,7 @@ const getNavigationCommandLoaderPerTemplate = (templateType) => function useNavi
|
|
|
240
242
|
isLoading
|
|
241
243
|
};
|
|
242
244
|
};
|
|
243
|
-
|
|
245
|
+
var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
|
|
244
246
|
const history = useHistory();
|
|
245
247
|
const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
|
|
246
248
|
"site-editor.php"
|
|
@@ -353,7 +355,7 @@ const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNa
|
|
|
353
355
|
isLoading: false
|
|
354
356
|
};
|
|
355
357
|
};
|
|
356
|
-
|
|
358
|
+
var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
|
|
357
359
|
const history = useHistory();
|
|
358
360
|
const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
|
|
359
361
|
"site-editor.php"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/site-editor-navigation-commands.js"],
|
|
4
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": "
|
|
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;AAC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UAAU;AAAA,EACX,CAAE;AACH;",
|
|
6
6
|
"names": ["routerPrivateApis", "coreStore"]
|
|
7
7
|
}
|
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/core-commands/src/utils/order-entity-records-by-search.js
|
|
18
20
|
var order_entity_records_by_search_exports = {};
|
|
19
21
|
__export(order_entity_records_by_search_exports, {
|
|
20
22
|
orderEntityRecordsBySearch: () => orderEntityRecordsBySearch
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/order-entity-records-by-search.js"],
|
|
4
4
|
"sourcesContent": ["export function orderEntityRecordsBySearch( records = [], search = '' ) {\n\tif ( ! Array.isArray( records ) || ! records.length ) {\n\t\treturn [];\n\t}\n\n\tif ( ! search ) {\n\t\treturn records;\n\t}\n\n\tconst priority = [];\n\tconst nonPriority = [];\n\n\tfor ( let i = 0; i < records.length; i++ ) {\n\t\tconst record = records[ i ];\n\t\tif (\n\t\t\trecord?.title?.raw?.toLowerCase()?.includes( search?.toLowerCase() )\n\t\t) {\n\t\t\tpriority.push( record );\n\t\t} else {\n\t\t\tnonPriority.push( record );\n\t\t}\n\t}\n\n\treturn priority.concat( nonPriority );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,2BAA4B,UAAU,CAAC,GAAG,SAAS,IAAK;AACvE,MAAK,CAAE,MAAM,QAAS,OAAQ,KAAK,CAAE,QAAQ,QAAS;AACrD,WAAO,CAAC;AAAA,EACT;AAEA,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,CAAC;AAClB,QAAM,cAAc,CAAC;AAErB,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,UAAM,SAAS,QAAS,CAAE;AAC1B,QACC,QAAQ,OAAO,KAAK,YAAY,GAAG,SAAU,QAAQ,YAAY,CAAE,GAClE;AACD,eAAS,KAAM,MAAO;AAAA,IACvB,OAAO;AACN,kBAAY,KAAM,MAAO;AAAA,IAC1B;AAAA,EACD;AAEA,SAAO,SAAS,OAAQ,WAAY;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// packages/core-commands/src/admin-navigation-commands.js
|
|
1
2
|
import { useCommandLoader, useCommands } from "@wordpress/commands";
|
|
2
3
|
import { __, sprintf } from "@wordpress/i18n";
|
|
3
4
|
import { external } from "@wordpress/icons";
|
|
4
5
|
import { useMemo } from "@wordpress/element";
|
|
5
6
|
import { store as coreStore } from "@wordpress/core-data";
|
|
6
7
|
import { useSelect } from "@wordpress/data";
|
|
7
|
-
|
|
8
|
+
var getViewSiteCommand = () => function useViewSiteCommand() {
|
|
8
9
|
const homeUrl = useSelect((select) => {
|
|
9
10
|
return select(coreStore).getEntityRecord(
|
|
10
11
|
"root",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/admin-navigation-commands.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCommandLoader, useCommands } from '@wordpress/commands';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst getViewSiteCommand = () =>\n\tfunction useViewSiteCommand() {\n\t\tconst homeUrl = useSelect( ( select ) => {\n\t\t\t// Site index.\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t)?.home;\n\t\t}, [] );\n\n\t\tconst commands = useMemo( () => {\n\t\t\tif ( ! homeUrl ) {\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/view-site',\n\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\ticon: external,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t\twindow.open( homeUrl, '_blank' );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t}, [ homeUrl ] );\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport function useAdminNavigationCommands( menuCommands ) {\n\tconst commands = useMemo( () => {\n\t\treturn ( menuCommands ?? [] ).map( ( menuCommand ) => {\n\t\t\tconst label = sprintf(\n\t\t\t\t/* translators: %s: menu label */\n\t\t\t\t__( 'Go to: %s' ),\n\t\t\t\tmenuCommand.label\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tname: menuCommand.name,\n\t\t\t\tlabel,\n\t\t\t\tsearchLabel: label,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tdocument.location = menuCommand.url;\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t};\n\t\t} );\n\t}, [ menuCommands ] );\n\tuseCommands( commands );\n\n\tuseCommandLoader( {\n\t\tname: 'core/view-site',\n\t\thook: getViewSiteCommand(),\n\t} );\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,kBAAkB,mBAAmB;AAC9C,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAE1B,
|
|
5
|
+
"mappings": ";AAGA,SAAS,kBAAkB,mBAAmB;AAC9C,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAE1B,IAAM,qBAAqB,MAC1B,SAAS,qBAAqB;AAC7B,QAAM,UAAU,UAAW,CAAE,WAAY;AAExC,WAAO,OAAQ,SAAU,EAAE;AAAA,MAC1B;AAAA,MACA;AAAA,IACD,GAAG;AAAA,EACJ,GAAG,CAAC,CAAE;AAEN,QAAM,WAAW,QAAS,MAAM;AAC/B,QAAK,CAAE,SAAU;AAChB,aAAO,CAAC;AAAA,IACT;AAEA,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,OAAO,GAAI,WAAY;AAAA,QACvB,MAAM;AAAA,QACN,UAAU,CAAE,EAAE,MAAM,MAAO;AAC1B,gBAAM;AACN,iBAAO,KAAM,SAAS,QAAS;AAAA,QAChC;AAAA,MACD;AAAA,IACD;AAAA,EACD,GAAG,CAAE,OAAQ,CAAE;AAEf,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,EACD;AACD;AAEM,SAAS,2BAA4B,cAAe;AAC1D,QAAM,WAAW,QAAS,MAAM;AAC/B,YAAS,gBAAgB,CAAC,GAAI,IAAK,CAAE,gBAAiB;AACrD,YAAM,QAAQ;AAAA;AAAA,QAEb,GAAI,WAAY;AAAA,QAChB,YAAY;AAAA,MACb;AACA,aAAO;AAAA,QACN,MAAM,YAAY;AAAA,QAClB;AAAA,QACA,aAAa;AAAA,QACb,UAAU,CAAE,EAAE,MAAM,MAAO;AAC1B,mBAAS,WAAW,YAAY;AAChC,gBAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,YAAa,CAAE;AACpB,cAAa,QAAS;AAEtB,mBAAkB;AAAA,IACjB,MAAM;AAAA,IACN,MAAM,mBAAmB;AAAA,EAC1B,CAAE;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/core-commands/src/index.js
|
|
2
2
|
import { createRoot, StrictMode } from "@wordpress/element";
|
|
3
3
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
4
4
|
import { CommandMenu } from "@wordpress/commands";
|
|
@@ -6,7 +6,8 @@ import { useAdminNavigationCommands } from "./admin-navigation-commands";
|
|
|
6
6
|
import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands";
|
|
7
7
|
import { unlock } from "./lock-unlock";
|
|
8
8
|
import { privateApis } from "./private-apis";
|
|
9
|
-
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var { RouterProvider } = unlock(routerPrivateApis);
|
|
10
11
|
function CommandPalette({ settings }) {
|
|
11
12
|
const { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } = settings;
|
|
12
13
|
useAdminNavigationCommands(menuCommands);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport { useAdminNavigationCommands } from './admin-navigation-commands';\nimport { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';\nimport { unlock } from './lock-unlock';\nexport { privateApis } from './private-apis';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\n// Register core commands and render the Command Palette.\nfunction CommandPalette( { settings } ) {\n\tconst { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } =\n\t\tsettings;\n\tuseAdminNavigationCommands( menuCommands );\n\tuseSiteEditorNavigationCommands( isNetworkAdmin );\n\treturn (\n\t\t<RouterProvider pathArg=\"p\">\n\t\t\t<CommandMenu />\n\t\t</RouterProvider>\n\t);\n}\n\n/**\n * Initializes the Command Palette.\n *\n * @param {Object} settings Command palette settings.\n */\nexport function initializeCommandPalette( settings ) {\n\tconst root = document.createElement( 'div' );\n\tdocument.body.appendChild( root );\n\tcreateRoot( root ).render(\n\t\t<StrictMode>\n\t\t\t<CommandPalette settings={ settings } />\n\t\t</StrictMode>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY,kBAAkB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,mBAAmB;AAK5B,SAAS,kCAAkC;AAC3C,SAAS,uCAAuC;AAChD,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAYzB;AAVH,IAAM,EAAE,eAAe,IAAI,OAAQ,iBAAkB;AAGrD,SAAS,eAAgB,EAAE,SAAS,GAAI;AACvC,QAAM,EAAE,eAAe,cAAc,kBAAkB,eAAe,IACrE;AACD,6BAA4B,YAAa;AACzC,kCAAiC,cAAe;AAChD,SACC,oBAAC,kBAAe,SAAQ,KACvB,8BAAC,eAAY,GACd;AAEF;AAOO,SAAS,yBAA0B,UAAW;AACpD,QAAM,OAAO,SAAS,cAAe,KAAM;AAC3C,WAAS,KAAK,YAAa,IAAK;AAChC,aAAY,IAAK,EAAE;AAAA,IAClB,oBAAC,cACA,8BAAC,kBAAe,UAAsB,GACvC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// packages/core-commands/src/lock-unlock.js
|
|
1
2
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
|
|
2
|
-
|
|
3
|
+
var { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
3
4
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
4
5
|
"@wordpress/core-commands"
|
|
5
6
|
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-commands'\n\t);\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,wDAAwD;AAE1D,
|
|
5
|
+
"mappings": ";AAGA,SAAS,wDAAwD;AAE1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/core-commands/src/private-apis.js
|
|
1
2
|
import { useAdminNavigationCommands } from "./admin-navigation-commands";
|
|
2
3
|
import { useSiteEditorNavigationCommands } from "./site-editor-navigation-commands";
|
|
3
4
|
import { lock } from "./lock-unlock";
|
|
@@ -5,7 +6,7 @@ function useCommands() {
|
|
|
5
6
|
useAdminNavigationCommands();
|
|
6
7
|
useSiteEditorNavigationCommands();
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
var privateApis = {};
|
|
9
10
|
lock(privateApis, {
|
|
10
11
|
useCommands
|
|
11
12
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.js"],
|
|
4
4
|
"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"],
|
|
5
|
-
"mappings": "AAGA,SAAS,kCAAkC;AAC3C,SAAS,uCAAuC;AAChD,SAAS,YAAY;AAErB,SAAS,cAAc;AACtB,6BAA2B;AAC3B,kCAAgC;AACjC;AAEO,
|
|
5
|
+
"mappings": ";AAGA,SAAS,kCAAkC;AAC3C,SAAS,uCAAuC;AAChD,SAAS,YAAY;AAErB,SAAS,cAAc;AACtB,6BAA2B;AAC3B,kCAAgC;AACjC;AAEO,IAAM,cAAc,CAAC;AAC5B,KAAM,aAAa;AAAA,EAClB;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/core-commands/src/site-editor-navigation-commands.js
|
|
1
2
|
import { useCommandLoader } from "@wordpress/commands";
|
|
2
3
|
import { __ } from "@wordpress/i18n";
|
|
3
4
|
import { useMemo, useEffect, useState } from "@wordpress/element";
|
|
@@ -19,8 +20,8 @@ import { useDebounce } from "@wordpress/compose";
|
|
|
19
20
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
20
21
|
import { unlock } from "./lock-unlock";
|
|
21
22
|
import { orderEntityRecordsBySearch } from "./utils/order-entity-records-by-search";
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
var { useHistory } = unlock(routerPrivateApis);
|
|
24
|
+
var icons = {
|
|
24
25
|
post,
|
|
25
26
|
page,
|
|
26
27
|
wp_template: layout,
|
|
@@ -35,7 +36,7 @@ function useDebouncedValue(value) {
|
|
|
35
36
|
}, [debounced, value]);
|
|
36
37
|
return debouncedValue;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
var getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
|
|
39
40
|
const history = useHistory();
|
|
40
41
|
const { isBlockBasedTheme, canCreateTemplate } = useSelect(
|
|
41
42
|
(select) => {
|
|
@@ -134,7 +135,7 @@ const getNavigationCommandLoaderPerPostType = (postType) => function useNavigati
|
|
|
134
135
|
isLoading
|
|
135
136
|
};
|
|
136
137
|
};
|
|
137
|
-
|
|
138
|
+
var getNavigationCommandLoaderPerTemplate = (templateType) => function useNavigationCommandLoader({ search }) {
|
|
138
139
|
const history = useHistory();
|
|
139
140
|
const { isBlockBasedTheme, canCreateTemplate } = useSelect(
|
|
140
141
|
(select) => {
|
|
@@ -227,7 +228,7 @@ const getNavigationCommandLoaderPerTemplate = (templateType) => function useNavi
|
|
|
227
228
|
isLoading
|
|
228
229
|
};
|
|
229
230
|
};
|
|
230
|
-
|
|
231
|
+
var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
|
|
231
232
|
const history = useHistory();
|
|
232
233
|
const isSiteEditor = getPath(window.location.href)?.includes(
|
|
233
234
|
"site-editor.php"
|
|
@@ -340,7 +341,7 @@ const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNa
|
|
|
340
341
|
isLoading: false
|
|
341
342
|
};
|
|
342
343
|
};
|
|
343
|
-
|
|
344
|
+
var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
|
|
344
345
|
const history = useHistory();
|
|
345
346
|
const isSiteEditor = getPath(window.location.href)?.includes(
|
|
346
347
|
"site-editor.php"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/site-editor-navigation-commands.js"],
|
|
4
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,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,
|
|
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;A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
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/order-entity-records-by-search.js"],
|
|
4
4
|
"sourcesContent": ["export function orderEntityRecordsBySearch( records = [], search = '' ) {\n\tif ( ! Array.isArray( records ) || ! records.length ) {\n\t\treturn [];\n\t}\n\n\tif ( ! search ) {\n\t\treturn records;\n\t}\n\n\tconst priority = [];\n\tconst nonPriority = [];\n\n\tfor ( let i = 0; i < records.length; i++ ) {\n\t\tconst record = records[ i ];\n\t\tif (\n\t\t\trecord?.title?.raw?.toLowerCase()?.includes( search?.toLowerCase() )\n\t\t) {\n\t\t\tpriority.push( record );\n\t\t} else {\n\t\t\tnonPriority.push( record );\n\t\t}\n\t}\n\n\treturn priority.concat( nonPriority );\n}\n"],
|
|
5
|
-
"mappings": "AAAO,SAAS,2BAA4B,UAAU,CAAC,GAAG,SAAS,IAAK;AACvE,MAAK,CAAE,MAAM,QAAS,OAAQ,KAAK,CAAE,QAAQ,QAAS;AACrD,WAAO,CAAC;AAAA,EACT;AAEA,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,CAAC;AAClB,QAAM,cAAc,CAAC;AAErB,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,UAAM,SAAS,QAAS,CAAE;AAC1B,QACC,QAAQ,OAAO,KAAK,YAAY,GAAG,SAAU,QAAQ,YAAY,CAAE,GAClE;AACD,eAAS,KAAM,MAAO;AAAA,IACvB,OAAO;AACN,kBAAY,KAAM,MAAO;AAAA,IAC1B;AAAA,EACD;AAEA,SAAO,SAAS,OAAQ,WAAY;AACrC;",
|
|
5
|
+
"mappings": ";AAAO,SAAS,2BAA4B,UAAU,CAAC,GAAG,SAAS,IAAK;AACvE,MAAK,CAAE,MAAM,QAAS,OAAQ,KAAK,CAAE,QAAQ,QAAS;AACrD,WAAO,CAAC;AAAA,EACT;AAEA,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,CAAC;AAClB,QAAM,cAAc,CAAC;AAErB,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,UAAM,SAAS,QAAS,CAAE;AAC1B,QACC,QAAQ,OAAO,KAAK,YAAY,GAAG,SAAU,QAAQ,YAAY,CAAE,GAClE;AACD,eAAS,KAAM,MAAO;AAAA,IACvB,OAAO;AACN,kBAAY,KAAM,MAAO;AAAA,IAC1B;AAAA,EACD;AAEA,SAAO,SAAS,OAAQ,WAAY;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-commands",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "WordPress core reusable commands.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
"wpScript": true,
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@wordpress/block-editor": "^15.
|
|
39
|
-
"@wordpress/commands": "^1.
|
|
40
|
-
"@wordpress/compose": "^7.
|
|
41
|
-
"@wordpress/core-data": "^7.
|
|
42
|
-
"@wordpress/data": "^10.
|
|
43
|
-
"@wordpress/element": "^6.
|
|
44
|
-
"@wordpress/html-entities": "^4.
|
|
45
|
-
"@wordpress/i18n": "^6.
|
|
46
|
-
"@wordpress/icons": "^11.
|
|
47
|
-
"@wordpress/notices": "^5.
|
|
48
|
-
"@wordpress/private-apis": "^1.
|
|
49
|
-
"@wordpress/router": "^1.
|
|
50
|
-
"@wordpress/url": "^4.
|
|
38
|
+
"@wordpress/block-editor": "^15.8.0",
|
|
39
|
+
"@wordpress/commands": "^1.35.0",
|
|
40
|
+
"@wordpress/compose": "^7.35.0",
|
|
41
|
+
"@wordpress/core-data": "^7.35.0",
|
|
42
|
+
"@wordpress/data": "^10.35.0",
|
|
43
|
+
"@wordpress/element": "^6.35.0",
|
|
44
|
+
"@wordpress/html-entities": "^4.35.0",
|
|
45
|
+
"@wordpress/i18n": "^6.8.0",
|
|
46
|
+
"@wordpress/icons": "^11.2.0",
|
|
47
|
+
"@wordpress/notices": "^5.35.0",
|
|
48
|
+
"@wordpress/private-apis": "^1.35.0",
|
|
49
|
+
"@wordpress/router": "^1.35.0",
|
|
50
|
+
"@wordpress/url": "^4.35.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": "^18.0.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
|
|
60
60
|
}
|