@wordpress/core-commands 1.32.0 → 1.32.1-next.47f435fc9.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.
@@ -1,122 +1,142 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var site_editor_navigation_commands_exports = {};
19
+ __export(site_editor_navigation_commands_exports, {
20
+ useSiteEditorNavigationCommands: () => useSiteEditorNavigationCommands
5
21
  });
6
- exports.useSiteEditorNavigationCommands = useSiteEditorNavigationCommands;
7
- var _commands = require("@wordpress/commands");
8
- var _i18n = require("@wordpress/i18n");
9
- var _element = require("@wordpress/element");
10
- var _data = require("@wordpress/data");
11
- var _coreData = require("@wordpress/core-data");
12
- var _icons = require("@wordpress/icons");
13
- var _router = require("@wordpress/router");
14
- var _url = require("@wordpress/url");
15
- var _compose = require("@wordpress/compose");
16
- var _htmlEntities = require("@wordpress/html-entities");
17
- var _lockUnlock = require("./lock-unlock");
18
- var _orderEntityRecordsBySearch = require("./utils/order-entity-records-by-search");
19
- /**
20
- * WordPress dependencies
21
- */
22
-
23
- /**
24
- * Internal dependencies
25
- */
26
-
27
- const {
28
- useHistory
29
- } = (0, _lockUnlock.unlock)(_router.privateApis);
22
+ module.exports = __toCommonJS(site_editor_navigation_commands_exports);
23
+ var import_commands = require("@wordpress/commands");
24
+ var import_i18n = require("@wordpress/i18n");
25
+ var import_element = require("@wordpress/element");
26
+ var import_data = require("@wordpress/data");
27
+ var import_core_data = require("@wordpress/core-data");
28
+ var import_icons = require("@wordpress/icons");
29
+ var import_router = require("@wordpress/router");
30
+ var import_url = require("@wordpress/url");
31
+ var import_compose = require("@wordpress/compose");
32
+ var import_html_entities = require("@wordpress/html-entities");
33
+ var import_lock_unlock = require("./lock-unlock");
34
+ var import_order_entity_records_by_search = require("./utils/order-entity-records-by-search");
35
+ const { useHistory } = (0, import_lock_unlock.unlock)(import_router.privateApis);
30
36
  const icons = {
31
- post: _icons.post,
32
- page: _icons.page,
33
- wp_template: _icons.layout,
34
- wp_registered_template: _icons.layout,
35
- wp_template_part: _icons.symbolFilled
37
+ post: import_icons.post,
38
+ page: import_icons.page,
39
+ wp_template: import_icons.layout,
40
+ wp_registered_template: import_icons.layout,
41
+ wp_template_part: import_icons.symbolFilled
36
42
  };
37
43
  function useDebouncedValue(value) {
38
- const [debouncedValue, setDebouncedValue] = (0, _element.useState)('');
39
- const debounced = (0, _compose.useDebounce)(setDebouncedValue, 250);
40
- (0, _element.useEffect)(() => {
44
+ const [debouncedValue, setDebouncedValue] = (0, import_element.useState)("");
45
+ const debounced = (0, import_compose.useDebounce)(setDebouncedValue, 250);
46
+ (0, import_element.useEffect)(() => {
41
47
  debounced(value);
42
48
  return () => debounced.cancel();
43
49
  }, [debounced, value]);
44
50
  return debouncedValue;
45
51
  }
46
- const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader({
47
- search
48
- }) {
52
+ const getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
49
53
  const history = useHistory();
50
- const {
51
- isBlockBasedTheme,
52
- canCreateTemplate
53
- } = (0, _data.useSelect)(select => {
54
- return {
55
- isBlockBasedTheme: select(_coreData.store).getCurrentTheme()?.is_block_theme,
56
- canCreateTemplate: select(_coreData.store).canUser('create', {
57
- kind: 'postType',
58
- name: 'wp_template'
59
- })
60
- };
61
- }, []);
54
+ const { isBlockBasedTheme, canCreateTemplate } = (0, import_data.useSelect)(
55
+ (select) => {
56
+ return {
57
+ isBlockBasedTheme: select(import_core_data.store).getCurrentTheme()?.is_block_theme,
58
+ canCreateTemplate: select(import_core_data.store).canUser("create", {
59
+ kind: "postType",
60
+ name: "wp_template"
61
+ })
62
+ };
63
+ },
64
+ []
65
+ );
62
66
  const delayedSearch = useDebouncedValue(search);
63
- const {
64
- records,
65
- isLoading
66
- } = (0, _data.useSelect)(select => {
67
- if (!delayedSearch) {
67
+ const { records, isLoading } = (0, import_data.useSelect)(
68
+ (select) => {
69
+ if (!delayedSearch) {
70
+ return {
71
+ isLoading: false
72
+ };
73
+ }
74
+ const query = {
75
+ search: delayedSearch,
76
+ per_page: 10,
77
+ orderby: "relevance",
78
+ status: [
79
+ "publish",
80
+ "future",
81
+ "draft",
82
+ "pending",
83
+ "private"
84
+ ]
85
+ };
68
86
  return {
69
- isLoading: false
87
+ records: select(import_core_data.store).getEntityRecords(
88
+ "postType",
89
+ postType,
90
+ query
91
+ ),
92
+ isLoading: !select(import_core_data.store).hasFinishedResolution(
93
+ "getEntityRecords",
94
+ ["postType", postType, query]
95
+ )
70
96
  };
71
- }
72
- const query = {
73
- search: delayedSearch,
74
- per_page: 10,
75
- orderby: 'relevance',
76
- status: ['publish', 'future', 'draft', 'pending', 'private']
77
- };
78
- return {
79
- records: select(_coreData.store).getEntityRecords('postType', postType, query),
80
- isLoading: !select(_coreData.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query])
81
- };
82
- }, [delayedSearch]);
83
- const commands = (0, _element.useMemo)(() => {
84
- return (records !== null && records !== void 0 ? records : []).map(record => {
97
+ },
98
+ [delayedSearch]
99
+ );
100
+ const commands = (0, import_element.useMemo)(() => {
101
+ return (records ?? []).map((record) => {
85
102
  const command = {
86
- name: postType + '-' + record.id,
87
- searchLabel: record.title?.rendered + ' ' + record.id,
88
- label: record.title?.rendered ? (0, _htmlEntities.decodeEntities)(record.title?.rendered) : (0, _i18n.__)('(no title)'),
103
+ name: postType + "-" + record.id,
104
+ searchLabel: record.title?.rendered + " " + record.id,
105
+ label: record.title?.rendered ? (0, import_html_entities.decodeEntities)(record.title?.rendered) : (0, import_i18n.__)("(no title)"),
89
106
  icon: icons[postType]
90
107
  };
91
- if (!canCreateTemplate || postType === 'post' || postType === 'page' && !isBlockBasedTheme) {
108
+ if (!canCreateTemplate || postType === "post" || postType === "page" && !isBlockBasedTheme) {
92
109
  return {
93
110
  ...command,
94
- callback: ({
95
- close
96
- }) => {
111
+ callback: ({ close }) => {
97
112
  const args = {
98
113
  post: record.id,
99
- action: 'edit'
114
+ action: "edit"
100
115
  };
101
- const targetUrl = (0, _url.addQueryArgs)('post.php', args);
116
+ const targetUrl = (0, import_url.addQueryArgs)("post.php", args);
102
117
  document.location = targetUrl;
103
118
  close();
104
119
  }
105
120
  };
106
121
  }
107
- const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
122
+ const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
123
+ "site-editor.php"
124
+ );
108
125
  return {
109
126
  ...command,
110
- callback: ({
111
- close
112
- }) => {
127
+ callback: ({ close }) => {
113
128
  if (isSiteEditor) {
114
- history.navigate(`/${postType}/${record.id}?canvas=edit`);
129
+ history.navigate(
130
+ `/${postType}/${record.id}?canvas=edit`
131
+ );
115
132
  } else {
116
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
117
- p: `/${postType}/${record.id}`,
118
- canvas: 'edit'
119
- });
133
+ document.location = (0, import_url.addQueryArgs)(
134
+ "site-editor.php",
135
+ {
136
+ p: `/${postType}/${record.id}`,
137
+ canvas: "edit"
138
+ }
139
+ );
120
140
  }
121
141
  close();
122
142
  }
@@ -128,89 +148,87 @@ const getNavigationCommandLoaderPerPostType = postType => function useNavigation
128
148
  isLoading
129
149
  };
130
150
  };
131
- const getNavigationCommandLoaderPerTemplate = templateType => function useNavigationCommandLoader({
132
- search
133
- }) {
151
+ const getNavigationCommandLoaderPerTemplate = (templateType) => function useNavigationCommandLoader({ search }) {
134
152
  const history = useHistory();
135
- const {
136
- isBlockBasedTheme,
137
- canCreateTemplate
138
- } = (0, _data.useSelect)(select => {
139
- return {
140
- isBlockBasedTheme: select(_coreData.store).getCurrentTheme()?.is_block_theme,
141
- canCreateTemplate: select(_coreData.store).canUser('read', {
142
- kind: 'postType',
143
- name: templateType
144
- })
145
- };
146
- }, []);
147
- const {
148
- records,
149
- isLoading
150
- } = (0, _data.useSelect)(select => {
151
- const {
152
- getEntityRecords
153
- } = select(_coreData.store);
154
- const query = {
155
- per_page: -1
156
- };
153
+ const { isBlockBasedTheme, canCreateTemplate } = (0, import_data.useSelect)(
154
+ (select) => {
155
+ return {
156
+ isBlockBasedTheme: select(import_core_data.store).getCurrentTheme()?.is_block_theme,
157
+ canCreateTemplate: select(import_core_data.store).canUser("read", {
158
+ kind: "postType",
159
+ name: templateType
160
+ })
161
+ };
162
+ },
163
+ []
164
+ );
165
+ const { records, isLoading } = (0, import_data.useSelect)((select) => {
166
+ const { getEntityRecords } = select(import_core_data.store);
167
+ const query = { per_page: -1 };
157
168
  return {
158
- records: getEntityRecords('postType', templateType, query),
159
- isLoading: !select(_coreData.store).hasFinishedResolution('getEntityRecords', ['postType', templateType, query])
169
+ records: getEntityRecords("postType", templateType, query),
170
+ isLoading: !select(import_core_data.store).hasFinishedResolution(
171
+ "getEntityRecords",
172
+ ["postType", templateType, query]
173
+ )
160
174
  };
161
175
  }, []);
162
-
163
- /*
164
- * wp_template and wp_template_part endpoints do not support per_page or orderby parameters.
165
- * We need to sort the results based on the search query to avoid removing relevant
166
- * records below using .slice().
167
- */
168
- const orderedRecords = (0, _element.useMemo)(() => {
169
- return (0, _orderEntityRecordsBySearch.orderEntityRecordsBySearch)(records, search).slice(0, 10);
176
+ const orderedRecords = (0, import_element.useMemo)(() => {
177
+ return (0, import_order_entity_records_by_search.orderEntityRecordsBySearch)(records, search).slice(0, 10);
170
178
  }, [records, search]);
171
- const commands = (0, _element.useMemo)(() => {
172
- if (!canCreateTemplate || !isBlockBasedTheme && !templateType === 'wp_template_part') {
179
+ const commands = (0, import_element.useMemo)(() => {
180
+ if (!canCreateTemplate || !isBlockBasedTheme && !templateType === "wp_template_part") {
173
181
  return [];
174
182
  }
175
- const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
183
+ const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
184
+ "site-editor.php"
185
+ );
176
186
  const result = [];
177
- result.push(...orderedRecords.map(record => {
178
- return {
179
- name: templateType + '-' + record.id,
180
- searchLabel: record.title?.rendered + ' ' + record.id,
181
- label: record.title?.rendered ? record.title?.rendered : (0, _i18n.__)('(no title)'),
182
- icon: icons[templateType],
183
- callback: ({
184
- close
185
- }) => {
186
- if (isSiteEditor) {
187
- history.navigate(`/${templateType}/${record.id}?canvas=edit`);
188
- } else {
189
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
190
- p: `/${templateType}/${record.id}`,
191
- canvas: 'edit'
192
- });
187
+ result.push(
188
+ ...orderedRecords.map((record) => {
189
+ return {
190
+ name: templateType + "-" + record.id,
191
+ searchLabel: record.title?.rendered + " " + record.id,
192
+ label: record.title?.rendered ? record.title?.rendered : (0, import_i18n.__)("(no title)"),
193
+ icon: icons[templateType],
194
+ callback: ({ close }) => {
195
+ if (isSiteEditor) {
196
+ history.navigate(
197
+ `/${templateType}/${record.id}?canvas=edit`
198
+ );
199
+ } else {
200
+ document.location = (0, import_url.addQueryArgs)(
201
+ "site-editor.php",
202
+ {
203
+ p: `/${templateType}/${record.id}`,
204
+ canvas: "edit"
205
+ }
206
+ );
207
+ }
208
+ close();
193
209
  }
194
- close();
195
- }
196
- };
197
- }));
198
- if (orderedRecords?.length > 0 && templateType === 'wp_template_part') {
210
+ };
211
+ })
212
+ );
213
+ if (orderedRecords?.length > 0 && templateType === "wp_template_part") {
199
214
  result.push({
200
- name: 'core/edit-site/open-template-parts',
201
- label: (0, _i18n.__)('Go to: Template parts'),
202
- icon: _icons.symbolFilled,
203
- callback: ({
204
- close
205
- }) => {
215
+ name: "core/edit-site/open-template-parts",
216
+ label: (0, import_i18n.__)("Go to: Template parts"),
217
+ icon: import_icons.symbolFilled,
218
+ callback: ({ close }) => {
206
219
  if (isSiteEditor) {
207
- history.navigate('/pattern?postType=wp_template_part&categoryId=all-parts');
220
+ history.navigate(
221
+ "/pattern?postType=wp_template_part&categoryId=all-parts"
222
+ );
208
223
  } else {
209
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
210
- p: '/pattern',
211
- postType: 'wp_template_part',
212
- categoryId: 'all-parts'
213
- });
224
+ document.location = (0, import_url.addQueryArgs)(
225
+ "site-editor.php",
226
+ {
227
+ p: "/pattern",
228
+ postType: "wp_template_part",
229
+ categoryId: "all-parts"
230
+ }
231
+ );
214
232
  }
215
233
  close();
216
234
  }
@@ -225,75 +243,75 @@ const getNavigationCommandLoaderPerTemplate = templateType => function useNaviga
225
243
  };
226
244
  const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
227
245
  const history = useHistory();
228
- const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
229
- const {
230
- isBlockBasedTheme,
231
- canCreateTemplate,
232
- canCreatePatterns
233
- } = (0, _data.useSelect)(select => {
246
+ const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
247
+ "site-editor.php"
248
+ );
249
+ const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } = (0, import_data.useSelect)((select) => {
234
250
  return {
235
- isBlockBasedTheme: select(_coreData.store).getCurrentTheme()?.is_block_theme,
236
- canCreateTemplate: select(_coreData.store).canUser('create', {
237
- kind: 'postType',
238
- name: 'wp_template'
251
+ isBlockBasedTheme: select(import_core_data.store).getCurrentTheme()?.is_block_theme,
252
+ canCreateTemplate: select(import_core_data.store).canUser("create", {
253
+ kind: "postType",
254
+ name: "wp_template"
239
255
  }),
240
- canCreatePatterns: select(_coreData.store).canUser('create', {
241
- kind: 'postType',
242
- name: 'wp_block'
256
+ canCreatePatterns: select(import_core_data.store).canUser("create", {
257
+ kind: "postType",
258
+ name: "wp_block"
243
259
  })
244
260
  };
245
261
  }, []);
246
- const commands = (0, _element.useMemo)(() => {
262
+ const commands = (0, import_element.useMemo)(() => {
247
263
  const result = [];
248
264
  if (canCreateTemplate && isBlockBasedTheme) {
249
- // Go to Styles command
250
265
  result.push({
251
- name: 'core/edit-site/open-styles',
252
- label: (0, _i18n.__)('Go to: Styles'),
253
- icon: _icons.styles,
254
- callback: ({
255
- close
256
- }) => {
266
+ name: "core/edit-site/open-styles",
267
+ label: (0, import_i18n.__)("Go to: Styles"),
268
+ icon: import_icons.styles,
269
+ callback: ({ close }) => {
257
270
  if (isSiteEditor) {
258
- history.navigate('/styles');
271
+ history.navigate("/styles");
259
272
  } else {
260
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
261
- p: '/styles'
262
- });
273
+ document.location = (0, import_url.addQueryArgs)(
274
+ "site-editor.php",
275
+ {
276
+ p: "/styles"
277
+ }
278
+ );
263
279
  }
264
280
  close();
265
281
  }
266
282
  });
267
283
  result.push({
268
- name: 'core/edit-site/open-navigation',
269
- label: (0, _i18n.__)('Go to: Navigation'),
270
- icon: _icons.navigation,
271
- callback: ({
272
- close
273
- }) => {
284
+ name: "core/edit-site/open-navigation",
285
+ label: (0, import_i18n.__)("Go to: Navigation"),
286
+ icon: import_icons.navigation,
287
+ callback: ({ close }) => {
274
288
  if (isSiteEditor) {
275
- history.navigate('/navigation');
289
+ history.navigate("/navigation");
276
290
  } else {
277
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
278
- p: '/navigation'
279
- });
291
+ document.location = (0, import_url.addQueryArgs)(
292
+ "site-editor.php",
293
+ {
294
+ p: "/navigation"
295
+ }
296
+ );
280
297
  }
281
298
  close();
282
299
  }
283
300
  });
284
301
  result.push({
285
- name: 'core/edit-site/open-templates',
286
- label: (0, _i18n.__)('Go to: Templates'),
287
- icon: _icons.layout,
288
- callback: ({
289
- close
290
- }) => {
302
+ name: "core/edit-site/open-templates",
303
+ label: (0, import_i18n.__)("Go to: Templates"),
304
+ icon: import_icons.layout,
305
+ callback: ({ close }) => {
291
306
  if (isSiteEditor) {
292
- history.navigate('/template');
307
+ history.navigate("/template");
293
308
  } else {
294
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
295
- p: '/template'
296
- });
309
+ document.location = (0, import_url.addQueryArgs)(
310
+ "site-editor.php",
311
+ {
312
+ p: "/template"
313
+ }
314
+ );
297
315
  }
298
316
  close();
299
317
  }
@@ -301,30 +319,36 @@ const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNa
301
319
  }
302
320
  if (canCreatePatterns) {
303
321
  result.push({
304
- name: 'core/edit-site/open-patterns',
305
- label: (0, _i18n.__)('Go to: Patterns'),
306
- icon: _icons.symbol,
307
- callback: ({
308
- close
309
- }) => {
322
+ name: "core/edit-site/open-patterns",
323
+ label: (0, import_i18n.__)("Go to: Patterns"),
324
+ icon: import_icons.symbol,
325
+ callback: ({ close }) => {
310
326
  if (canCreateTemplate) {
311
327
  if (isSiteEditor) {
312
- history.navigate('/pattern');
328
+ history.navigate("/pattern");
313
329
  } else {
314
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
315
- p: '/pattern'
316
- });
330
+ document.location = (0, import_url.addQueryArgs)(
331
+ "site-editor.php",
332
+ {
333
+ p: "/pattern"
334
+ }
335
+ );
317
336
  }
318
337
  close();
319
338
  } else {
320
- // If a user cannot access the site editor.
321
- document.location.href = 'edit.php?post_type=wp_block';
339
+ document.location.href = "edit.php?post_type=wp_block";
322
340
  }
323
341
  }
324
342
  });
325
343
  }
326
344
  return result;
327
- }, [history, isSiteEditor, canCreateTemplate, canCreatePatterns, isBlockBasedTheme]);
345
+ }, [
346
+ history,
347
+ isSiteEditor,
348
+ canCreateTemplate,
349
+ canCreatePatterns,
350
+ isBlockBasedTheme
351
+ ]);
328
352
  return {
329
353
  commands,
330
354
  isLoading: false
@@ -332,42 +356,42 @@ const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNa
332
356
  };
333
357
  const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
334
358
  const history = useHistory();
335
- const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
336
- const {
337
- canEditCSS
338
- } = (0, _data.useSelect)(select => {
339
- const {
340
- getEntityRecord,
341
- __experimentalGetCurrentGlobalStylesId
342
- } = select(_coreData.store);
359
+ const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
360
+ "site-editor.php"
361
+ );
362
+ const { canEditCSS } = (0, import_data.useSelect)((select) => {
363
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(import_core_data.store);
343
364
  const globalStylesId = __experimentalGetCurrentGlobalStylesId();
344
- const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
365
+ const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
345
366
  return {
346
- canEditCSS: !!globalStyles?._links?.['wp:action-edit-css']
367
+ canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
347
368
  };
348
369
  }, []);
349
- const commands = (0, _element.useMemo)(() => {
370
+ const commands = (0, import_element.useMemo)(() => {
350
371
  if (!canEditCSS) {
351
372
  return [];
352
373
  }
353
- return [{
354
- name: 'core/open-styles-css',
355
- label: (0, _i18n.__)('Open custom CSS'),
356
- icon: _icons.brush,
357
- callback: ({
358
- close
359
- }) => {
360
- close();
361
- if (isSiteEditor) {
362
- history.navigate('/styles?section=/css');
363
- } else {
364
- document.location = (0, _url.addQueryArgs)('site-editor.php', {
365
- p: '/styles',
366
- section: '/css'
367
- });
374
+ return [
375
+ {
376
+ name: "core/open-styles-css",
377
+ label: (0, import_i18n.__)("Open custom CSS"),
378
+ icon: import_icons.brush,
379
+ callback: ({ close }) => {
380
+ close();
381
+ if (isSiteEditor) {
382
+ history.navigate("/styles?section=/css");
383
+ } else {
384
+ document.location = (0, import_url.addQueryArgs)(
385
+ "site-editor.php",
386
+ {
387
+ p: "/styles",
388
+ section: "/css"
389
+ }
390
+ );
391
+ }
368
392
  }
369
393
  }
370
- }];
394
+ ];
371
395
  }, [history, canEditCSS, isSiteEditor]);
372
396
  return {
373
397
  isLoading: false,
@@ -375,34 +399,38 @@ const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssComm
375
399
  };
376
400
  };
377
401
  function useSiteEditorNavigationCommands() {
378
- (0, _commands.useCommandLoader)({
379
- name: 'core/edit-site/navigate-pages',
380
- hook: getNavigationCommandLoaderPerPostType('page')
402
+ (0, import_commands.useCommandLoader)({
403
+ name: "core/edit-site/navigate-pages",
404
+ hook: getNavigationCommandLoaderPerPostType("page")
381
405
  });
382
- (0, _commands.useCommandLoader)({
383
- name: 'core/edit-site/navigate-posts',
384
- hook: getNavigationCommandLoaderPerPostType('post')
406
+ (0, import_commands.useCommandLoader)({
407
+ name: "core/edit-site/navigate-posts",
408
+ hook: getNavigationCommandLoaderPerPostType("post")
385
409
  });
386
- (0, _commands.useCommandLoader)({
387
- name: 'core/edit-site/navigate-templates',
388
- hook: getNavigationCommandLoaderPerTemplate('wp_template')
410
+ (0, import_commands.useCommandLoader)({
411
+ name: "core/edit-site/navigate-templates",
412
+ hook: getNavigationCommandLoaderPerTemplate("wp_template")
389
413
  });
390
- (0, _commands.useCommandLoader)({
391
- name: 'core/edit-site/navigate-templates',
392
- hook: getNavigationCommandLoaderPerTemplate('wp_registered_template')
414
+ (0, import_commands.useCommandLoader)({
415
+ name: "core/edit-site/navigate-templates",
416
+ hook: getNavigationCommandLoaderPerTemplate("wp_registered_template")
393
417
  });
394
- (0, _commands.useCommandLoader)({
395
- name: 'core/edit-site/navigate-template-parts',
396
- hook: getNavigationCommandLoaderPerTemplate('wp_template_part')
418
+ (0, import_commands.useCommandLoader)({
419
+ name: "core/edit-site/navigate-template-parts",
420
+ hook: getNavigationCommandLoaderPerTemplate("wp_template_part")
397
421
  });
398
- (0, _commands.useCommandLoader)({
399
- name: 'core/edit-site/basic-navigation',
422
+ (0, import_commands.useCommandLoader)({
423
+ name: "core/edit-site/basic-navigation",
400
424
  hook: getSiteEditorBasicNavigationCommands(),
401
- context: 'site-editor'
425
+ context: "site-editor"
402
426
  });
403
- (0, _commands.useCommandLoader)({
404
- name: 'core/edit-site/global-styles-css',
427
+ (0, import_commands.useCommandLoader)({
428
+ name: "core/edit-site/global-styles-css",
405
429
  hook: getGlobalStylesOpenCssCommands()
406
430
  });
407
431
  }
408
- //# sourceMappingURL=site-editor-navigation-commands.js.map
432
+ // Annotate the CommonJS export names for ESM import in node:
433
+ 0 && (module.exports = {
434
+ useSiteEditorNavigationCommands
435
+ });
436
+ //# sourceMappingURL=site-editor-navigation-commands.js.map