@wordpress/core-commands 0.26.0 → 0.27.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 +0 -40
- package/build/admin-navigation-commands.js.map +1 -1
- package/build/hooks.js +0 -4
- package/build/hooks.js.map +1 -1
- package/build/site-editor-navigation-commands.js +123 -73
- package/build/site-editor-navigation-commands.js.map +1 -1
- package/build-module/admin-navigation-commands.js +1 -41
- package/build-module/admin-navigation-commands.js.map +1 -1
- package/build-module/hooks.js +0 -3
- package/build-module/hooks.js.map +1 -1
- package/build-module/site-editor-navigation-commands.js +125 -75
- package/build-module/site-editor-navigation-commands.js.map +1 -1
- package/package.json +13 -13
- package/src/admin-navigation-commands.js +1 -42
- package/src/hooks.js +0 -7
- package/src/site-editor-navigation-commands.js +153 -92
package/CHANGELOG.md
CHANGED
|
@@ -7,25 +7,11 @@ exports.useAdminNavigationCommands = useAdminNavigationCommands;
|
|
|
7
7
|
var _commands = require("@wordpress/commands");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _icons = require("@wordpress/icons");
|
|
10
|
-
var _url = require("@wordpress/url");
|
|
11
|
-
var _router = require("@wordpress/router");
|
|
12
|
-
var _hooks = require("./hooks");
|
|
13
|
-
var _lockUnlock = require("./lock-unlock");
|
|
14
10
|
/**
|
|
15
11
|
* WordPress dependencies
|
|
16
12
|
*/
|
|
17
13
|
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
useHistory
|
|
24
|
-
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
25
14
|
function useAdminNavigationCommands() {
|
|
26
|
-
const history = useHistory();
|
|
27
|
-
const isTemplatesAccessible = (0, _hooks.useIsTemplatesAccessible)();
|
|
28
|
-
const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
|
|
29
15
|
(0, _commands.useCommand)({
|
|
30
16
|
name: 'core/add-new-post',
|
|
31
17
|
label: (0, _i18n.__)('Add new post'),
|
|
@@ -42,31 +28,5 @@ function useAdminNavigationCommands() {
|
|
|
42
28
|
document.location.href = 'post-new.php?post_type=page';
|
|
43
29
|
}
|
|
44
30
|
});
|
|
45
|
-
(0, _commands.useCommand)({
|
|
46
|
-
name: 'core/manage-reusable-blocks',
|
|
47
|
-
label: (0, _i18n.__)('Patterns'),
|
|
48
|
-
icon: _icons.symbol,
|
|
49
|
-
callback: ({
|
|
50
|
-
close
|
|
51
|
-
}) => {
|
|
52
|
-
// The site editor and templates both check whether the user
|
|
53
|
-
// can read templates. We can leverage that here and this
|
|
54
|
-
// command links to the classic dashboard manage patterns page
|
|
55
|
-
// if the user can't access it.
|
|
56
|
-
if (isTemplatesAccessible) {
|
|
57
|
-
const args = {
|
|
58
|
-
path: '/patterns'
|
|
59
|
-
};
|
|
60
|
-
if (isSiteEditor) {
|
|
61
|
-
history.push(args);
|
|
62
|
-
} else {
|
|
63
|
-
document.location = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
64
|
-
}
|
|
65
|
-
close();
|
|
66
|
-
} else {
|
|
67
|
-
document.location.href = 'edit.php?post_type=wp_block';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
31
|
}
|
|
72
32
|
//# sourceMappingURL=admin-navigation-commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_commands","require","_i18n","_icons","
|
|
1
|
+
{"version":3,"names":["_commands","require","_i18n","_icons","useAdminNavigationCommands","useCommand","name","label","__","icon","plus","callback","document","location","href"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } 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}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKO,SAASG,0BAA0BA,CAAA,EAAG;EAC5C,IAAAC,oBAAU,EAAE;IACXC,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;IAC3BC,IAAI,EAAEC,WAAI;IACVC,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAG,cAAc;IACxC;EACD,CAAE,CAAC;EACH,IAAAT,oBAAU,EAAE;IACXC,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;IAC3BC,IAAI,EAAEC,WAAI;IACVC,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAG,6BAA6B;IACvD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
package/build/hooks.js
CHANGED
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useIsBlockBasedTheme = useIsBlockBasedTheme;
|
|
7
|
-
exports.useIsTemplatesAccessible = useIsTemplatesAccessible;
|
|
8
7
|
var _coreData = require("@wordpress/core-data");
|
|
9
8
|
var _data = require("@wordpress/data");
|
|
10
9
|
/**
|
|
11
10
|
* WordPress dependencies
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
|
-
function useIsTemplatesAccessible() {
|
|
15
|
-
return (0, _data.useSelect)(select => select(_coreData.store).canUser('read', 'templates'), []);
|
|
16
|
-
}
|
|
17
13
|
function useIsBlockBasedTheme() {
|
|
18
14
|
return (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme()?.is_block_theme, []);
|
|
19
15
|
}
|
package/build/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","useIsBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme"],"sources":["@wordpress/core-commands/src/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nexport function useIsBlockBasedTheme() {\n\treturn useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIO,SAASE,oBAAoBA,CAAA,EAAG;EACtC,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,EAAEC,cAAc,EACnE,EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -159,8 +159,9 @@ const getNavigationCommandLoaderPerTemplate = templateType => function useNaviga
|
|
|
159
159
|
if (!isBlockBasedTheme && !templateType === 'wp_template_part') {
|
|
160
160
|
return [];
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
|
|
163
|
+
const result = [];
|
|
164
|
+
result.push(...orderedRecords.map(record => {
|
|
164
165
|
const extraArgs = isSiteEditor ? {
|
|
165
166
|
canvas: (0, _url.getQueryArg)(window.location.href, 'canvas')
|
|
166
167
|
} : {};
|
|
@@ -187,7 +188,31 @@ const getNavigationCommandLoaderPerTemplate = templateType => function useNaviga
|
|
|
187
188
|
close();
|
|
188
189
|
}
|
|
189
190
|
};
|
|
190
|
-
});
|
|
191
|
+
}));
|
|
192
|
+
if (orderedRecords?.length > 0 && templateType === 'wp_template_part') {
|
|
193
|
+
result.push({
|
|
194
|
+
name: 'core/edit-site/open-template-parts',
|
|
195
|
+
label: (0, _i18n.__)('Template parts'),
|
|
196
|
+
icon: _icons.symbolFilled,
|
|
197
|
+
callback: ({
|
|
198
|
+
close
|
|
199
|
+
}) => {
|
|
200
|
+
const args = {
|
|
201
|
+
path: '/patterns',
|
|
202
|
+
categoryType: 'wp_template_part',
|
|
203
|
+
categoryId: 'all-parts'
|
|
204
|
+
};
|
|
205
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
206
|
+
if (isSiteEditor) {
|
|
207
|
+
history.push(args);
|
|
208
|
+
} else {
|
|
209
|
+
document.location = targetUrl;
|
|
210
|
+
}
|
|
211
|
+
close();
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
191
216
|
}, [isBlockBasedTheme, orderedRecords, history]);
|
|
192
217
|
return {
|
|
193
218
|
commands,
|
|
@@ -201,91 +226,116 @@ const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerTemp
|
|
|
201
226
|
function useSiteEditorBasicNavigationCommands() {
|
|
202
227
|
const history = useHistory();
|
|
203
228
|
const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
|
|
204
|
-
const
|
|
229
|
+
const canCreateTemplate = (0, _data.useSelect)(select => {
|
|
230
|
+
return select(_coreData.store).canUser('create', 'templates');
|
|
231
|
+
}, []);
|
|
205
232
|
const isBlockBasedTheme = (0, _hooks.useIsBlockBasedTheme)();
|
|
206
233
|
const commands = (0, _element.useMemo)(() => {
|
|
207
234
|
const result = [];
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
235
|
+
if (canCreateTemplate && isBlockBasedTheme) {
|
|
236
|
+
result.push({
|
|
237
|
+
name: 'core/edit-site/open-navigation',
|
|
238
|
+
label: (0, _i18n.__)('Navigation'),
|
|
239
|
+
icon: _icons.navigation,
|
|
240
|
+
callback: ({
|
|
241
|
+
close
|
|
242
|
+
}) => {
|
|
243
|
+
const args = {
|
|
244
|
+
path: '/navigation'
|
|
245
|
+
};
|
|
246
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
247
|
+
if (isSiteEditor) {
|
|
248
|
+
history.push(args);
|
|
249
|
+
} else {
|
|
250
|
+
document.location = targetUrl;
|
|
251
|
+
}
|
|
252
|
+
close();
|
|
226
253
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
254
|
+
});
|
|
255
|
+
result.push({
|
|
256
|
+
name: 'core/edit-site/open-styles',
|
|
257
|
+
label: (0, _i18n.__)('Styles'),
|
|
258
|
+
icon: _icons.styles,
|
|
259
|
+
callback: ({
|
|
260
|
+
close
|
|
261
|
+
}) => {
|
|
262
|
+
const args = {
|
|
263
|
+
path: '/wp_global_styles'
|
|
264
|
+
};
|
|
265
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
266
|
+
if (isSiteEditor) {
|
|
267
|
+
history.push(args);
|
|
268
|
+
} else {
|
|
269
|
+
document.location = targetUrl;
|
|
270
|
+
}
|
|
271
|
+
close();
|
|
245
272
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
273
|
+
});
|
|
274
|
+
result.push({
|
|
275
|
+
name: 'core/edit-site/open-pages',
|
|
276
|
+
label: (0, _i18n.__)('Pages'),
|
|
277
|
+
icon: _icons.page,
|
|
278
|
+
callback: ({
|
|
279
|
+
close
|
|
280
|
+
}) => {
|
|
281
|
+
const args = {
|
|
282
|
+
path: '/page'
|
|
283
|
+
};
|
|
284
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
285
|
+
if (isSiteEditor) {
|
|
286
|
+
history.push(args);
|
|
287
|
+
} else {
|
|
288
|
+
document.location = targetUrl;
|
|
289
|
+
}
|
|
290
|
+
close();
|
|
264
291
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
292
|
+
});
|
|
293
|
+
result.push({
|
|
294
|
+
name: 'core/edit-site/open-templates',
|
|
295
|
+
label: (0, _i18n.__)('Templates'),
|
|
296
|
+
icon: _icons.layout,
|
|
297
|
+
callback: ({
|
|
298
|
+
close
|
|
299
|
+
}) => {
|
|
300
|
+
const args = {
|
|
301
|
+
path: '/wp_template'
|
|
302
|
+
};
|
|
303
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
304
|
+
if (isSiteEditor) {
|
|
305
|
+
history.push(args);
|
|
306
|
+
} else {
|
|
307
|
+
document.location = targetUrl;
|
|
308
|
+
}
|
|
309
|
+
close();
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
268
313
|
result.push({
|
|
269
|
-
name: 'core/edit-site/open-
|
|
270
|
-
label: (0, _i18n.__)('
|
|
271
|
-
icon: _icons.
|
|
314
|
+
name: 'core/edit-site/open-patterns',
|
|
315
|
+
label: (0, _i18n.__)('Patterns'),
|
|
316
|
+
icon: _icons.symbol,
|
|
272
317
|
callback: ({
|
|
273
318
|
close
|
|
274
319
|
}) => {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
320
|
+
if (canCreateTemplate) {
|
|
321
|
+
const args = {
|
|
322
|
+
path: '/patterns'
|
|
323
|
+
};
|
|
324
|
+
const targetUrl = (0, _url.addQueryArgs)('site-editor.php', args);
|
|
325
|
+
if (isSiteEditor) {
|
|
326
|
+
history.push(args);
|
|
327
|
+
} else {
|
|
328
|
+
document.location = targetUrl;
|
|
329
|
+
}
|
|
330
|
+
close();
|
|
281
331
|
} else {
|
|
282
|
-
|
|
332
|
+
// If a user cannot access the site editor
|
|
333
|
+
document.location.href = 'edit.php?post_type=wp_block';
|
|
283
334
|
}
|
|
284
|
-
close();
|
|
285
335
|
}
|
|
286
336
|
});
|
|
287
337
|
return result;
|
|
288
|
-
}, [history, isSiteEditor,
|
|
338
|
+
}, [history, isSiteEditor, canCreateTemplate, isBlockBasedTheme]);
|
|
289
339
|
return {
|
|
290
340
|
commands,
|
|
291
341
|
isLoading: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_commands","require","_i18n","_element","_data","_coreData","_icons","_router","_url","_compose","_hooks","_lockUnlock","_orderEntityRecordsBySearch","useHistory","useLocation","unlock","routerPrivateApis","icons","post","page","wp_template","layout","wp_template_part","symbolFilled","useDebouncedValue","value","debouncedValue","setDebouncedValue","useState","debounced","useDebounce","useEffect","cancel","getNavigationCommandLoaderPerPostType","postType","useNavigationCommandLoader","search","history","isBlockBasedTheme","useIsBlockBasedTheme","delayedSearch","records","isLoading","useSelect","select","query","per_page","orderby","status","coreStore","getEntityRecords","hasFinishedResolution","commands","useMemo","map","record","command","name","id","searchLabel","title","rendered","label","__","icon","callback","close","args","action","targetUrl","addQueryArgs","document","location","isSiteEditor","getPath","window","href","includes","extraArgs","canvas","getQueryArg","postId","push","getNavigationCommandLoaderPerTemplate","templateType","isPatternsPage","params","path","didAccessPatternsPage","orderedRecords","orderEntityRecordsBySearch","slice","undefined","usePageNavigationCommandLoader","usePostNavigationCommandLoader","useTemplateNavigationCommandLoader","useTemplatePartNavigationCommandLoader","useSiteEditorBasicNavigationCommands","isTemplatesAccessible","useIsTemplatesAccessible","result","navigation","styles","useSiteEditorNavigationCommands","useCommandLoader","hook","context"],"sources":["@wordpress/core-commands/src/site-editor-navigation-commands.js"],"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\tsymbolFilled,\n\tstyles,\n\tnavigation,\n} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { getQueryArg, addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory, useLocation } = 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 = useIsBlockBasedTheme();\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? 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\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\t\t\t\tconst extraArgs = isSiteEditor\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcanvas: getQueryArg(\n\t\t\t\t\t\t\t\twindow.location.href,\n\t\t\t\t\t\t\t\t'canvas'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t }\n\t\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\tconst args = {\n\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\t...extraArgs,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst targetUrl = addQueryArgs(\n\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = targetUrl;\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}, [ 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 location = useLocation();\n\n\t\tconst isPatternsPage =\n\t\t\tlocation?.params?.path === '/patterns' ||\n\t\t\tlocation?.params?.postType === 'wp_block';\n\t\tconst didAccessPatternsPage =\n\t\t\t!! location?.params?.didAccessPatternsPage;\n\n\t\tconst isBlockBasedTheme = useIsBlockBasedTheme();\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! isBlockBasedTheme &&\n\t\t\t\t! templateType === 'wp_template_part'\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn orderedRecords.map( ( record ) => {\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\t\t\t\tconst extraArgs = isSiteEditor\n\t\t\t\t\t? { canvas: getQueryArg( window.location.href, 'canvas' ) }\n\t\t\t\t\t: {};\n\n\t\t\t\treturn {\n\t\t\t\t\tname: templateType + '-' + 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? record.title?.rendered\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ templateType ],\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\tpostType: templateType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\tdidAccessPatternsPage:\n\t\t\t\t\t\t\t\t! isBlockBasedTheme &&\n\t\t\t\t\t\t\t\t( isPatternsPage || didAccessPatternsPage )\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t...extraArgs,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst targetUrl = addQueryArgs(\n\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = targetUrl;\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}, [ isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst usePageNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'page' );\nconst usePostNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'post' );\nconst useTemplateNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerTemplate( 'wp_template' );\nconst useTemplatePartNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerTemplate( 'wp_template_part' );\n\nfunction useSiteEditorBasicNavigationCommands() {\n\tconst history = useHistory();\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\tconst isTemplatesAccessible = useIsTemplatesAccessible();\n\tconst isBlockBasedTheme = useIsBlockBasedTheme();\n\tconst commands = useMemo( () => {\n\t\tconst result = [];\n\n\t\tif ( ! isTemplatesAccessible || ! isBlockBasedTheme ) {\n\t\t\treturn result;\n\t\t}\n\n\t\tresult.push( {\n\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\tlabel: __( 'Navigation' ),\n\t\t\ticon: navigation,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/navigation',\n\t\t\t\t};\n\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tresult.push( {\n\t\t\tname: 'core/edit-site/open-styles',\n\t\t\tlabel: __( 'Styles' ),\n\t\t\ticon: styles,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\t};\n\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tresult.push( {\n\t\t\tname: 'core/edit-site/open-pages',\n\t\t\tlabel: __( 'Pages' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/page',\n\t\t\t\t};\n\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tresult.push( {\n\t\t\tname: 'core/edit-site/open-templates',\n\t\t\tlabel: __( 'Templates' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst args = {\n\t\t\t\t\tpath: '/wp_template',\n\t\t\t\t};\n\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\thistory.push( args );\n\t\t\t\t} else {\n\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t}\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\treturn result;\n\t}, [ history, isSiteEditor, isTemplatesAccessible, isBlockBasedTheme ] );\n\n\treturn {\n\t\tcommands,\n\t\tisLoading: false,\n\t};\n}\n\nexport function useSiteEditorNavigationCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: usePageNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: usePostNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: useTemplateNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: useTemplatePartNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: useSiteEditorBasicNavigationCommands,\n\t\tcontext: 'site-editor',\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAQA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,2BAAA,GAAAX,OAAA;AAzBA;AACA;AACA;;AAkBA;AACA;AACA;;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QAAQ,CAACC,QAAQ,GAAGH,SAAS;QAC9B;QACAH,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;IAEH,OAAOkC,MAAM;EACd,CAAC,EAAE,CAAE/D,OAAO,EAAEoC,YAAY,EAAEyB,qBAAqB,EAAE5D,iBAAiB,CAAG,CAAC;EAExE,OAAO;IACNc,QAAQ;IACRV,SAAS,EAAE;EACZ,CAAC;AACF;AAEO,SAAS6D,+BAA+BA,CAAA,EAAG;EACjD,IAAAC,0BAAgB,EAAE;IACjB/C,IAAI,EAAE,+BAA+B;IACrCgD,IAAI,EAAEZ;EACP,CAAE,CAAC;EACH,IAAAW,0BAAgB,EAAE;IACjB/C,IAAI,EAAE,+BAA+B;IACrCgD,IAAI,EAAEX;EACP,CAAE,CAAC;EACH,IAAAU,0BAAgB,EAAE;IACjB/C,IAAI,EAAE,mCAAmC;IACzCgD,IAAI,EAAEV;EACP,CAAE,CAAC;EACH,IAAAS,0BAAgB,EAAE;IACjB/C,IAAI,EAAE,wCAAwC;IAC9CgD,IAAI,EAAET;EACP,CAAE,CAAC;EACH,IAAAQ,0BAAgB,EAAE;IACjB/C,IAAI,EAAE,iCAAiC;IACvCgD,IAAI,EAAER,oCAAoC;IAC1CS,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_commands","require","_i18n","_element","_data","_coreData","_icons","_router","_url","_compose","_hooks","_lockUnlock","_orderEntityRecordsBySearch","useHistory","useLocation","unlock","routerPrivateApis","icons","post","page","wp_template","layout","wp_template_part","symbolFilled","useDebouncedValue","value","debouncedValue","setDebouncedValue","useState","debounced","useDebounce","useEffect","cancel","getNavigationCommandLoaderPerPostType","postType","useNavigationCommandLoader","search","history","isBlockBasedTheme","useIsBlockBasedTheme","delayedSearch","records","isLoading","useSelect","select","query","per_page","orderby","status","coreStore","getEntityRecords","hasFinishedResolution","commands","useMemo","map","record","command","name","id","searchLabel","title","rendered","label","__","icon","callback","close","args","action","targetUrl","addQueryArgs","document","location","isSiteEditor","getPath","window","href","includes","extraArgs","canvas","getQueryArg","postId","push","getNavigationCommandLoaderPerTemplate","templateType","isPatternsPage","params","path","didAccessPatternsPage","orderedRecords","orderEntityRecordsBySearch","slice","result","undefined","length","categoryType","categoryId","usePageNavigationCommandLoader","usePostNavigationCommandLoader","useTemplateNavigationCommandLoader","useTemplatePartNavigationCommandLoader","useSiteEditorBasicNavigationCommands","canCreateTemplate","canUser","navigation","styles","symbol","useSiteEditorNavigationCommands","useCommandLoader","hook","context"],"sources":["@wordpress/core-commands/src/site-editor-navigation-commands.js"],"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} from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { getQueryArg, addQueryArgs, getPath } from '@wordpress/url';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useIsBlockBasedTheme } from './hooks';\nimport { unlock } from './lock-unlock';\nimport { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';\n\nconst { useHistory, useLocation } = 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 = useIsBlockBasedTheme();\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? 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\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\t\t\t\tconst extraArgs = isSiteEditor\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcanvas: getQueryArg(\n\t\t\t\t\t\t\t\twindow.location.href,\n\t\t\t\t\t\t\t\t'canvas'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t }\n\t\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\tconst args = {\n\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\t...extraArgs,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst targetUrl = addQueryArgs(\n\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = targetUrl;\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}, [ 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 location = useLocation();\n\n\t\tconst isPatternsPage =\n\t\t\tlocation?.params?.path === '/patterns' ||\n\t\t\tlocation?.params?.postType === 'wp_block';\n\t\tconst didAccessPatternsPage =\n\t\t\t!! location?.params?.didAccessPatternsPage;\n\n\t\tconst isBlockBasedTheme = useIsBlockBasedTheme();\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! isBlockBasedTheme &&\n\t\t\t\t! 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\tconst extraArgs = isSiteEditor\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tcanvas: getQueryArg(\n\t\t\t\t\t\t\t\t\twindow.location.href,\n\t\t\t\t\t\t\t\t\t'canvas'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {};\n\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\tconst args = {\n\t\t\t\t\t\t\t\tpostType: templateType,\n\t\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\t\tdidAccessPatternsPage:\n\t\t\t\t\t\t\t\t\t! isBlockBasedTheme &&\n\t\t\t\t\t\t\t\t\t( isPatternsPage || didAccessPatternsPage )\n\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t...extraArgs,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst targetUrl = addQueryArgs(\n\t\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\t\targs\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdocument.location = targetUrl;\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: __( 'Template parts' ),\n\t\t\t\t\ticon: symbolFilled,\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\tpath: '/patterns',\n\t\t\t\t\t\t\tcategoryType: 'wp_template_part',\n\t\t\t\t\t\t\tcategoryId: 'all-parts',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst targetUrl = addQueryArgs(\n\t\t\t\t\t\t\t'site-editor.php',\n\t\t\t\t\t\t\targs\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.location = targetUrl;\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}, [ isBlockBasedTheme, orderedRecords, history ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst usePageNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'page' );\nconst usePostNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'post' );\nconst useTemplateNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerTemplate( 'wp_template' );\nconst useTemplatePartNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerTemplate( 'wp_template_part' );\n\nfunction useSiteEditorBasicNavigationCommands() {\n\tconst history = useHistory();\n\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t'site-editor.php'\n\t);\n\tconst canCreateTemplate = useSelect( ( select ) => {\n\t\treturn select( coreStore ).canUser( 'create', 'templates' );\n\t}, [] );\n\tconst isBlockBasedTheme = useIsBlockBasedTheme();\n\tconst commands = useMemo( () => {\n\t\tconst result = [];\n\n\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\tresult.push( {\n\t\t\t\tname: 'core/edit-site/open-navigation',\n\t\t\t\tlabel: __( 'Navigation' ),\n\t\t\t\ticon: navigation,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tconst args = {\n\t\t\t\t\t\tpath: '/navigation',\n\t\t\t\t\t};\n\t\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tresult.push( {\n\t\t\t\tname: 'core/edit-site/open-styles',\n\t\t\t\tlabel: __( 'Styles' ),\n\t\t\t\ticon: styles,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tconst args = {\n\t\t\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\t\t};\n\t\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tresult.push( {\n\t\t\t\tname: 'core/edit-site/open-pages',\n\t\t\t\tlabel: __( 'Pages' ),\n\t\t\t\ticon: page,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tconst args = {\n\t\t\t\t\t\tpath: '/page',\n\t\t\t\t\t};\n\t\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\tresult.push( {\n\t\t\t\tname: 'core/edit-site/open-templates',\n\t\t\t\tlabel: __( 'Templates' ),\n\t\t\t\ticon: layout,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tconst args = {\n\t\t\t\t\t\tpath: '/wp_template',\n\t\t\t\t\t};\n\t\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tresult.push( {\n\t\t\tname: 'core/edit-site/open-patterns',\n\t\t\tlabel: __( 'Patterns' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tif ( canCreateTemplate ) {\n\t\t\t\t\tconst args = {\n\t\t\t\t\t\tpath: '/patterns',\n\t\t\t\t\t};\n\t\t\t\t\tconst targetUrl = addQueryArgs( 'site-editor.php', args );\n\t\t\t\t\tif ( isSiteEditor ) {\n\t\t\t\t\t\thistory.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.location = targetUrl;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t} else {\n\t\t\t\t\t// If a user cannot access the site editor\n\t\t\t\t\tdocument.location.href = 'edit.php?post_type=wp_block';\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\treturn result;\n\t}, [ history, isSiteEditor, canCreateTemplate, isBlockBasedTheme ] );\n\n\treturn {\n\t\tcommands,\n\t\tisLoading: false,\n\t};\n}\n\nexport function useSiteEditorNavigationCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\thook: usePageNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\thook: usePostNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\thook: useTemplateNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\thook: useTemplatePartNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/basic-navigation',\n\t\thook: useSiteEditorBasicNavigationCommands,\n\t\tcontext: 'site-editor',\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OA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,0BAAgB,EAAE;IACjBnD,IAAI,EAAE,iCAAiC;IACvCoD,IAAI,EAAER,oCAAoC;IAC1CS,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -3,22 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useCommand } from '@wordpress/commands';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { plus
|
|
7
|
-
import { addQueryArgs, getPath } from '@wordpress/url';
|
|
8
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { useIsTemplatesAccessible } from './hooks';
|
|
14
|
-
import { unlock } from './lock-unlock';
|
|
15
|
-
const {
|
|
16
|
-
useHistory
|
|
17
|
-
} = unlock(routerPrivateApis);
|
|
6
|
+
import { plus } from '@wordpress/icons';
|
|
18
7
|
export function useAdminNavigationCommands() {
|
|
19
|
-
const history = useHistory();
|
|
20
|
-
const isTemplatesAccessible = useIsTemplatesAccessible();
|
|
21
|
-
const isSiteEditor = getPath(window.location.href)?.includes('site-editor.php');
|
|
22
8
|
useCommand({
|
|
23
9
|
name: 'core/add-new-post',
|
|
24
10
|
label: __('Add new post'),
|
|
@@ -35,31 +21,5 @@ export function useAdminNavigationCommands() {
|
|
|
35
21
|
document.location.href = 'post-new.php?post_type=page';
|
|
36
22
|
}
|
|
37
23
|
});
|
|
38
|
-
useCommand({
|
|
39
|
-
name: 'core/manage-reusable-blocks',
|
|
40
|
-
label: __('Patterns'),
|
|
41
|
-
icon: symbol,
|
|
42
|
-
callback: ({
|
|
43
|
-
close
|
|
44
|
-
}) => {
|
|
45
|
-
// The site editor and templates both check whether the user
|
|
46
|
-
// can read templates. We can leverage that here and this
|
|
47
|
-
// command links to the classic dashboard manage patterns page
|
|
48
|
-
// if the user can't access it.
|
|
49
|
-
if (isTemplatesAccessible) {
|
|
50
|
-
const args = {
|
|
51
|
-
path: '/patterns'
|
|
52
|
-
};
|
|
53
|
-
if (isSiteEditor) {
|
|
54
|
-
history.push(args);
|
|
55
|
-
} else {
|
|
56
|
-
document.location = addQueryArgs('site-editor.php', args);
|
|
57
|
-
}
|
|
58
|
-
close();
|
|
59
|
-
} else {
|
|
60
|
-
document.location.href = 'edit.php?post_type=wp_block';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
24
|
}
|
|
65
25
|
//# sourceMappingURL=admin-navigation-commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCommand","__","plus","
|
|
1
|
+
{"version":3,"names":["useCommand","__","plus","useAdminNavigationCommands","name","label","icon","callback","document","location","href"],"sources":["@wordpress/core-commands/src/admin-navigation-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCommand } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { plus } 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}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,OAAO,SAASC,0BAA0BA,CAAA,EAAG;EAC5CH,UAAU,CAAE;IACXI,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAEJ,EAAE,CAAE,cAAe,CAAC;IAC3BK,IAAI,EAAEJ,IAAI;IACVK,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAG,cAAc;IACxC;EACD,CAAE,CAAC;EACHV,UAAU,CAAE;IACXI,IAAI,EAAE,mBAAmB;IACzBC,KAAK,EAAEJ,EAAE,CAAE,cAAe,CAAC;IAC3BK,IAAI,EAAEJ,IAAI;IACVK,QAAQ,EAAEA,CAAA,KAAM;MACfC,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAG,6BAA6B;IACvD;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
package/build-module/hooks.js
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
export function useIsTemplatesAccessible() {
|
|
7
|
-
return useSelect(select => select(coreStore).canUser('read', 'templates'), []);
|
|
8
|
-
}
|
|
9
6
|
export function useIsBlockBasedTheme() {
|
|
10
7
|
return useSelect(select => select(coreStore).getCurrentTheme()?.is_block_theme, []);
|
|
11
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","useSelect","
|
|
1
|
+
{"version":3,"names":["store","coreStore","useSelect","useIsBlockBasedTheme","select","getCurrentTheme","is_block_theme"],"sources":["@wordpress/core-commands/src/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nexport function useIsBlockBasedTheme() {\n\treturn useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,OAAOD,SAAS,CACbE,MAAM,IAAMA,MAAM,CAAEH,SAAU,CAAC,CAACI,eAAe,CAAC,CAAC,EAAEC,cAAc,EACnE,EACD,CAAC;AACF","ignoreList":[]}
|