@elementor/editor-site-navigation 4.5.0-1207 → 4.5.0-1209
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/dist/index.js +308 -234
- package/dist/index.mjs +274 -200
- package/package.json +10 -10
- package/src/api/post.ts +16 -0
- package/src/components/panel/actions-menu/actions/duplicate.tsx +3 -5
- package/src/components/panel/content-panel-header-add.tsx +35 -27
- package/src/components/panel/posts-list/list-items/list-item-view.tsx +13 -4
- package/src/components/panel/section-add-button.tsx +4 -5
- package/src/components/panel/shell-panel-body-content.tsx +44 -0
- package/src/components/panel/shell.tsx +10 -15
- package/src/components/panel/user-load-error.tsx +16 -0
- package/src/env.ts +2 -0
- package/src/hooks/use-accessible-panel-post-types.ts +29 -0
- package/src/hooks/use-can-create.ts +9 -0
- package/src/init.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,11 +30,57 @@ import { isSidebarEnabled, sidebarTools } from "@elementor/editor-sidebar";
|
|
|
30
30
|
import { createPanel } from "@elementor/editor-panels";
|
|
31
31
|
|
|
32
32
|
// src/components/panel/shell.tsx
|
|
33
|
-
import * as
|
|
33
|
+
import * as React26 from "react";
|
|
34
34
|
import { useState as useState6 } from "react";
|
|
35
35
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
36
|
-
import { Divider as Divider4,
|
|
37
|
-
import { __ as
|
|
36
|
+
import { Divider as Divider4, Stack as Stack3 } from "@elementor/ui";
|
|
37
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
38
|
+
|
|
39
|
+
// src/contexts/content-panel-coordinator.tsx
|
|
40
|
+
import * as React from "react";
|
|
41
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
42
|
+
var ContentPanelCoordinatorContext = createContext(null);
|
|
43
|
+
function ContentPanelCoordinatorProvider({ children }) {
|
|
44
|
+
const sectionsRef = useRef(/* @__PURE__ */ new Map());
|
|
45
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
46
|
+
const registerSection = useCallback((type, handlers) => {
|
|
47
|
+
sectionsRef.current.set(type, handlers);
|
|
48
|
+
}, []);
|
|
49
|
+
const unregisterSection = useCallback((type) => {
|
|
50
|
+
sectionsRef.current.delete(type);
|
|
51
|
+
}, []);
|
|
52
|
+
const requestCreate = useCallback((type) => {
|
|
53
|
+
const handlers = sectionsRef.current.get(type);
|
|
54
|
+
if (!handlers) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
handlers.setExpanded(true);
|
|
58
|
+
handlers.startCreate();
|
|
59
|
+
}, []);
|
|
60
|
+
const value = useMemo(
|
|
61
|
+
() => ({
|
|
62
|
+
registerSection,
|
|
63
|
+
unregisterSection,
|
|
64
|
+
requestCreate,
|
|
65
|
+
searchQuery,
|
|
66
|
+
setSearchQuery
|
|
67
|
+
}),
|
|
68
|
+
[registerSection, unregisterSection, requestCreate, searchQuery]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
71
|
+
}
|
|
72
|
+
function useContentPanelCoordinator() {
|
|
73
|
+
const context = useContext(ContentPanelCoordinatorContext);
|
|
74
|
+
if (!context) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"The `useContentPanelCoordinator()` hook must be used within a `<ContentPanelCoordinatorProvider />`"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return context;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/hooks/use-accessible-panel-post-types.ts
|
|
83
|
+
import { useMemo as useMemo2 } from "react";
|
|
38
84
|
|
|
39
85
|
// src/api/post.ts
|
|
40
86
|
import apiFetch from "@wordpress/api-fetch";
|
|
@@ -61,6 +107,15 @@ var panelPostTypeSlugs = Object.keys(postTypesMap);
|
|
|
61
107
|
function getPostTypeCreateCapability(postTypeSlug) {
|
|
62
108
|
return postTypesMap[postTypeSlug].createCapability;
|
|
63
109
|
}
|
|
110
|
+
function getAccessiblePanelPostTypes(capabilities) {
|
|
111
|
+
return panelPostTypeSlugs.filter((slug) => capabilities[getPostTypeCreateCapability(slug)]);
|
|
112
|
+
}
|
|
113
|
+
function getCannotEditPanelItemMessage(postTypeSlug) {
|
|
114
|
+
if ("page" === postTypeSlug) {
|
|
115
|
+
return __("You cannot edit this page.", "elementor");
|
|
116
|
+
}
|
|
117
|
+
return __("You cannot edit this post.", "elementor");
|
|
118
|
+
}
|
|
64
119
|
var POST_PER_PAGE = 10;
|
|
65
120
|
var getRequest = async (postTypeSlug, page, search = "") => {
|
|
66
121
|
const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
@@ -124,89 +179,56 @@ var duplicateRequest = (originalPost) => {
|
|
|
124
179
|
});
|
|
125
180
|
};
|
|
126
181
|
|
|
127
|
-
// src/
|
|
128
|
-
import
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const sectionsRef = useRef(/* @__PURE__ */ new Map());
|
|
133
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
134
|
-
const registerSection = useCallback((type, handlers) => {
|
|
135
|
-
sectionsRef.current.set(type, handlers);
|
|
136
|
-
}, []);
|
|
137
|
-
const unregisterSection = useCallback((type) => {
|
|
138
|
-
sectionsRef.current.delete(type);
|
|
139
|
-
}, []);
|
|
140
|
-
const requestCreate = useCallback((type) => {
|
|
141
|
-
const handlers = sectionsRef.current.get(type);
|
|
142
|
-
if (!handlers) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
handlers.setExpanded(true);
|
|
146
|
-
handlers.startCreate();
|
|
147
|
-
}, []);
|
|
148
|
-
const value = useMemo(
|
|
149
|
-
() => ({
|
|
150
|
-
registerSection,
|
|
151
|
-
unregisterSection,
|
|
152
|
-
requestCreate,
|
|
153
|
-
searchQuery,
|
|
154
|
-
setSearchQuery
|
|
155
|
-
}),
|
|
156
|
-
[registerSection, unregisterSection, requestCreate, searchQuery]
|
|
157
|
-
);
|
|
158
|
-
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
159
|
-
}
|
|
160
|
-
function useContentPanelCoordinator() {
|
|
161
|
-
const context = useContext(ContentPanelCoordinatorContext);
|
|
162
|
-
if (!context) {
|
|
163
|
-
throw new Error(
|
|
164
|
-
"The `useContentPanelCoordinator()` hook must be used within a `<ContentPanelCoordinatorProvider />`"
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
return context;
|
|
168
|
-
}
|
|
182
|
+
// src/env.ts
|
|
183
|
+
import { parseEnv } from "@elementor/env";
|
|
184
|
+
var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
|
|
185
|
+
return envData;
|
|
186
|
+
});
|
|
169
187
|
|
|
170
|
-
// src/
|
|
171
|
-
import
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
188
|
+
// src/hooks/use-user.ts
|
|
189
|
+
import { useQuery } from "@elementor/query";
|
|
190
|
+
|
|
191
|
+
// src/api/user.ts
|
|
192
|
+
import apiFetch2 from "@wordpress/api-fetch";
|
|
193
|
+
var getUser = () => {
|
|
194
|
+
const baseUri = "/wp/v2/users/me";
|
|
195
|
+
const keys = ["capabilities"];
|
|
196
|
+
const queryParams = new URLSearchParams({
|
|
197
|
+
_fields: keys.join(","),
|
|
198
|
+
context: "edit"
|
|
199
|
+
});
|
|
200
|
+
const uri = baseUri + "?" + queryParams.toString();
|
|
201
|
+
return apiFetch2({ path: uri });
|
|
179
202
|
};
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
|
|
204
|
+
// src/hooks/use-user.ts
|
|
205
|
+
var userQueryKey = () => ["site-navigation", "user"];
|
|
206
|
+
function useUser() {
|
|
207
|
+
return useQuery({
|
|
208
|
+
queryKey: userQueryKey(),
|
|
209
|
+
queryFn: getUser,
|
|
210
|
+
staleTime: 30 * 60 * 1e3
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/hooks/use-accessible-panel-post-types.ts
|
|
215
|
+
function useAccessiblePanelPostTypes() {
|
|
216
|
+
const { data: user, isPending: isUserPending, isError: isUserError } = useUser();
|
|
217
|
+
const accessiblePostTypes = useMemo2(() => {
|
|
218
|
+
if (user?.capabilities) {
|
|
219
|
+
return getAccessiblePanelPostTypes(user.capabilities);
|
|
220
|
+
}
|
|
221
|
+
if (isUserError && env.can_access_site_content_panel) {
|
|
222
|
+
return panelPostTypeSlugs;
|
|
223
|
+
}
|
|
224
|
+
return [];
|
|
225
|
+
}, [user, isUserError]);
|
|
226
|
+
const showUserLoadError = isUserError && accessiblePostTypes.length === 0;
|
|
227
|
+
return {
|
|
228
|
+
accessiblePostTypes,
|
|
229
|
+
isUserPending,
|
|
230
|
+
showUserLoadError
|
|
189
231
|
};
|
|
190
|
-
return /* @__PURE__ */ React2.createElement(
|
|
191
|
-
PostListContext.Provider,
|
|
192
|
-
{
|
|
193
|
-
value: {
|
|
194
|
-
type,
|
|
195
|
-
editMode,
|
|
196
|
-
setEditMode,
|
|
197
|
-
resetEditMode,
|
|
198
|
-
setError
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
children
|
|
202
|
-
);
|
|
203
|
-
};
|
|
204
|
-
function usePostListContext() {
|
|
205
|
-
const context = useContext2(PostListContext);
|
|
206
|
-
if (!context) {
|
|
207
|
-
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
208
|
-
}
|
|
209
|
-
return context;
|
|
210
232
|
}
|
|
211
233
|
|
|
212
234
|
// src/components/panel/content-panel-chrome.ts
|
|
@@ -262,44 +284,25 @@ var contentPanelListItemButtonSx = {
|
|
|
262
284
|
};
|
|
263
285
|
|
|
264
286
|
// src/components/panel/content-panel-header-add.tsx
|
|
265
|
-
import * as
|
|
287
|
+
import * as React3 from "react";
|
|
266
288
|
import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
|
|
267
289
|
import { bindMenu, bindTrigger, ListItemIcon, ListItemText, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
268
290
|
import { __ as __2 } from "@wordpress/i18n";
|
|
269
291
|
|
|
270
|
-
// src/hooks/use-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
var getUser = () => {
|
|
276
|
-
const baseUri = "/wp/v2/users/me";
|
|
277
|
-
const keys = ["capabilities"];
|
|
278
|
-
const queryParams = new URLSearchParams({
|
|
279
|
-
_fields: keys.join(","),
|
|
280
|
-
context: "edit"
|
|
281
|
-
});
|
|
282
|
-
const uri = baseUri + "?" + queryParams.toString();
|
|
283
|
-
return apiFetch2({ path: uri });
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// src/hooks/use-user.ts
|
|
287
|
-
var userQueryKey = () => ["site-navigation", "user"];
|
|
288
|
-
function useUser() {
|
|
289
|
-
return useQuery({
|
|
290
|
-
queryKey: userQueryKey(),
|
|
291
|
-
queryFn: getUser,
|
|
292
|
-
staleTime: 30 * 60 * 1e3
|
|
293
|
-
});
|
|
292
|
+
// src/hooks/use-can-create.ts
|
|
293
|
+
function useCanCreate(postTypeSlug) {
|
|
294
|
+
const { data: user } = useUser();
|
|
295
|
+
const capability = getPostTypeCreateCapability(postTypeSlug);
|
|
296
|
+
return !!user?.capabilities?.[capability];
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
// src/components/panel/content-panel-add-icon-button.tsx
|
|
297
|
-
import * as
|
|
300
|
+
import * as React2 from "react";
|
|
298
301
|
import { PlusIcon } from "@elementor/icons";
|
|
299
302
|
import { IconButton } from "@elementor/ui";
|
|
300
303
|
var CONTENT_PANEL_ADD_ICON_SIZE = "tiny";
|
|
301
304
|
function ContentPanelAddIconButton(props) {
|
|
302
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ React2.createElement(IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React2.createElement(PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
// src/components/panel/content-panel-header-add.tsx
|
|
@@ -307,45 +310,46 @@ var typeIcons = {
|
|
|
307
310
|
page: PageTypeIcon2,
|
|
308
311
|
post: PostTypeIcon2
|
|
309
312
|
};
|
|
313
|
+
function HeaderAddMenuItem({ slug, onSelect }) {
|
|
314
|
+
const canCreate = useCanCreate(slug);
|
|
315
|
+
const Icon = typeIcons[slug];
|
|
316
|
+
const singularName = postTypesMap[slug].labels.singular_name;
|
|
317
|
+
return /* @__PURE__ */ React3.createElement(MenuItem, { disabled: !canCreate, onClick: () => onSelect(slug) }, /* @__PURE__ */ React3.createElement(ListItemIcon, null, /* @__PURE__ */ React3.createElement(Icon, { fontSize: "small" })), /* @__PURE__ */ React3.createElement(ListItemText, { primary: singularName, primaryTypographyProps: { variant: "body2" } }));
|
|
318
|
+
}
|
|
310
319
|
function ContentPanelHeaderAdd() {
|
|
311
320
|
const { requestCreate } = useContentPanelCoordinator();
|
|
312
|
-
const {
|
|
321
|
+
const { accessiblePostTypes: accessibleSlugs } = useAccessiblePanelPostTypes();
|
|
313
322
|
const popupState = usePopupState({
|
|
314
323
|
variant: "popover",
|
|
315
324
|
popupId: "elementor-content-panel-header-add"
|
|
316
325
|
});
|
|
326
|
+
const canAddAny = accessibleSlugs.length > 0;
|
|
317
327
|
const buttonProps = bindTrigger(popupState);
|
|
318
328
|
const menuProps = bindMenu(popupState);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
/* @__PURE__ */ React4.createElement(ListItemIcon, null, /* @__PURE__ */ React4.createElement(Icon, { fontSize: "small" })),
|
|
336
|
-
/* @__PURE__ */ React4.createElement(ListItemText, { primary: singularName, primaryTypographyProps: { variant: "body2" } })
|
|
337
|
-
);
|
|
338
|
-
})));
|
|
329
|
+
const handleSelectType = (slug) => {
|
|
330
|
+
popupState.close();
|
|
331
|
+
requestAnimationFrame(() => {
|
|
332
|
+
requestCreate(slug);
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
336
|
+
ContentPanelAddIconButton,
|
|
337
|
+
{
|
|
338
|
+
"aria-label": __2("Add new", "elementor"),
|
|
339
|
+
...buttonProps,
|
|
340
|
+
disabled: !canAddAny
|
|
341
|
+
}
|
|
342
|
+
), /* @__PURE__ */ React3.createElement(Menu, { ...menuProps }, accessibleSlugs.map((slug) => /* @__PURE__ */ React3.createElement(HeaderAddMenuItem, { key: slug, onSelect: handleSelectType, slug }))));
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
// src/components/panel/content-panel-search.tsx
|
|
342
|
-
import * as
|
|
346
|
+
import * as React4 from "react";
|
|
343
347
|
import { SearchIcon } from "@elementor/icons";
|
|
344
348
|
import { Box, InputAdornment, TextField } from "@elementor/ui";
|
|
345
349
|
import { __ as __3 } from "@wordpress/i18n";
|
|
346
350
|
function ContentPanelSearch() {
|
|
347
351
|
const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
|
|
348
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ React4.createElement(Box, { component: "search", sx: contentPanelSearchBoxSx, "aria-label": __3("Search site content", "elementor") }, /* @__PURE__ */ React4.createElement(
|
|
349
353
|
TextField,
|
|
350
354
|
{
|
|
351
355
|
fullWidth: true,
|
|
@@ -357,17 +361,17 @@ function ContentPanelSearch() {
|
|
|
357
361
|
"aria-label": __3("Search", "elementor")
|
|
358
362
|
},
|
|
359
363
|
InputProps: {
|
|
360
|
-
startAdornment: /* @__PURE__ */
|
|
364
|
+
startAdornment: /* @__PURE__ */ React4.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React4.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
361
365
|
}
|
|
362
366
|
}
|
|
363
367
|
));
|
|
364
368
|
}
|
|
365
369
|
|
|
366
370
|
// src/components/panel/error-snackbar.tsx
|
|
367
|
-
import * as
|
|
371
|
+
import * as React5 from "react";
|
|
368
372
|
import { Alert, Snackbar, Typography } from "@elementor/ui";
|
|
369
373
|
var ErrorSnackbar = ({ open, onClose }) => {
|
|
370
|
-
return /* @__PURE__ */
|
|
374
|
+
return /* @__PURE__ */ React5.createElement(
|
|
371
375
|
Snackbar,
|
|
372
376
|
{
|
|
373
377
|
open,
|
|
@@ -377,7 +381,7 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
377
381
|
horizontal: "left"
|
|
378
382
|
}
|
|
379
383
|
},
|
|
380
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ React5.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React5.createElement(
|
|
381
385
|
Typography,
|
|
382
386
|
{
|
|
383
387
|
component: "span",
|
|
@@ -391,9 +395,55 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
391
395
|
};
|
|
392
396
|
var error_snackbar_default = ErrorSnackbar;
|
|
393
397
|
|
|
398
|
+
// src/components/panel/shell-panel-body-content.tsx
|
|
399
|
+
import * as React25 from "react";
|
|
400
|
+
import { List as List2, Skeleton as Skeleton2, Stack as Stack2 } from "@elementor/ui";
|
|
401
|
+
|
|
402
|
+
// src/contexts/post-list-context.tsx
|
|
403
|
+
import * as React6 from "react";
|
|
404
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
|
|
405
|
+
var defaultValues = {
|
|
406
|
+
type: "page",
|
|
407
|
+
editMode: { mode: "none", details: {} },
|
|
408
|
+
setEditMode: () => null,
|
|
409
|
+
resetEditMode: () => null,
|
|
410
|
+
setError: () => null
|
|
411
|
+
};
|
|
412
|
+
var PostListContext = createContext2(defaultValues);
|
|
413
|
+
var PostListContextProvider = ({
|
|
414
|
+
type,
|
|
415
|
+
setError,
|
|
416
|
+
children
|
|
417
|
+
}) => {
|
|
418
|
+
const [editMode, setEditMode] = useState2(defaultValues.editMode);
|
|
419
|
+
const resetEditMode = () => {
|
|
420
|
+
setEditMode(defaultValues.editMode);
|
|
421
|
+
};
|
|
422
|
+
return /* @__PURE__ */ React6.createElement(
|
|
423
|
+
PostListContext.Provider,
|
|
424
|
+
{
|
|
425
|
+
value: {
|
|
426
|
+
type,
|
|
427
|
+
editMode,
|
|
428
|
+
setEditMode,
|
|
429
|
+
resetEditMode,
|
|
430
|
+
setError
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
children
|
|
434
|
+
);
|
|
435
|
+
};
|
|
436
|
+
function usePostListContext() {
|
|
437
|
+
const context = useContext2(PostListContext);
|
|
438
|
+
if (!context) {
|
|
439
|
+
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
440
|
+
}
|
|
441
|
+
return context;
|
|
442
|
+
}
|
|
443
|
+
|
|
394
444
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
395
445
|
import * as React23 from "react";
|
|
396
|
-
import { useEffect, useMemo as
|
|
446
|
+
import { useEffect, useMemo as useMemo4, useState as useState5 } from "react";
|
|
397
447
|
import { Box as Box6, Button as Button2, CircularProgress as CircularProgress4, Skeleton, Typography as Typography5 } from "@elementor/ui";
|
|
398
448
|
import { __ as __15 } from "@wordpress/i18n";
|
|
399
449
|
|
|
@@ -463,8 +513,7 @@ import * as React7 from "react";
|
|
|
463
513
|
import { __ as __4, sprintf } from "@wordpress/i18n";
|
|
464
514
|
function SectionAddButton({ onBeforeCreate }) {
|
|
465
515
|
const { type, setEditMode } = usePostListContext();
|
|
466
|
-
const
|
|
467
|
-
const createCapability = getPostTypeCreateCapability(type);
|
|
516
|
+
const canCreate = useCanCreate(type);
|
|
468
517
|
const singularName = postTypesMap[type].labels.singular_name;
|
|
469
518
|
const ariaLabel = sprintf(
|
|
470
519
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
@@ -475,7 +524,7 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
475
524
|
ContentPanelAddIconButton,
|
|
476
525
|
{
|
|
477
526
|
"aria-label": ariaLabel,
|
|
478
|
-
disabled: !
|
|
527
|
+
disabled: !canCreate,
|
|
479
528
|
onClick: (event) => {
|
|
480
529
|
event.stopPropagation();
|
|
481
530
|
onBeforeCreate?.();
|
|
@@ -944,7 +993,7 @@ import * as React14 from "react";
|
|
|
944
993
|
import { Box as Box5, Typography as Typography3 } from "@elementor/ui";
|
|
945
994
|
|
|
946
995
|
// src/hooks/use-reverse-html-entities.ts
|
|
947
|
-
import { useMemo as
|
|
996
|
+
import { useMemo as useMemo3 } from "react";
|
|
948
997
|
|
|
949
998
|
// src/utils/post-title-plain.ts
|
|
950
999
|
function getPostTitlePlain(renderedTitle) {
|
|
@@ -958,7 +1007,7 @@ function getPostTitlePlain(renderedTitle) {
|
|
|
958
1007
|
|
|
959
1008
|
// src/hooks/use-reverse-html-entities.ts
|
|
960
1009
|
function useReverseHtmlEntities(escapedHTML = "") {
|
|
961
|
-
return
|
|
1010
|
+
return useMemo3(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
|
|
962
1011
|
}
|
|
963
1012
|
|
|
964
1013
|
// src/components/shared/page-title-and-status.tsx
|
|
@@ -1105,8 +1154,7 @@ import { CopyIcon } from "@elementor/icons";
|
|
|
1105
1154
|
import { __ as __10 } from "@wordpress/i18n";
|
|
1106
1155
|
function Duplicate({ post, popupState }) {
|
|
1107
1156
|
const { setEditMode, type } = usePostListContext();
|
|
1108
|
-
const
|
|
1109
|
-
const createCapability = getPostTypeCreateCapability(type);
|
|
1157
|
+
const canCreate = useCanCreate(type);
|
|
1110
1158
|
const onClick = () => {
|
|
1111
1159
|
popupState.close();
|
|
1112
1160
|
setEditMode({
|
|
@@ -1117,7 +1165,7 @@ function Duplicate({ post, popupState }) {
|
|
|
1117
1165
|
}
|
|
1118
1166
|
});
|
|
1119
1167
|
};
|
|
1120
|
-
const isDisabled = !
|
|
1168
|
+
const isDisabled = !canCreate;
|
|
1121
1169
|
return /* @__PURE__ */ React17.createElement(
|
|
1122
1170
|
ActionMenuItem,
|
|
1123
1171
|
{
|
|
@@ -1233,9 +1281,13 @@ function View({ post }) {
|
|
|
1233
1281
|
}
|
|
1234
1282
|
|
|
1235
1283
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1236
|
-
var DisabledPostTooltip = ({
|
|
1284
|
+
var DisabledPostTooltip = ({
|
|
1285
|
+
children,
|
|
1286
|
+
isDisabled,
|
|
1287
|
+
postTypeSlug
|
|
1288
|
+
}) => {
|
|
1237
1289
|
if (isDisabled) {
|
|
1238
|
-
const title = /* @__PURE__ */ React21.createElement(Typography4, { variant: "caption" },
|
|
1290
|
+
const title = /* @__PURE__ */ React21.createElement(Typography4, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React21.createElement("br", null), __14("To edit it directly, contact the site owner", "elementor"));
|
|
1239
1291
|
return /* @__PURE__ */ React21.createElement(Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React21.createElement("span", null, children));
|
|
1240
1292
|
}
|
|
1241
1293
|
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
|
|
@@ -1254,7 +1306,7 @@ function ListItemView({ post }) {
|
|
|
1254
1306
|
const title = isActive ? activeDocument?.title : post.title.rendered;
|
|
1255
1307
|
const isDisabled = !post.user_can.edit;
|
|
1256
1308
|
const menuTriggerProps = bindTrigger2(popupState);
|
|
1257
|
-
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ React21.createElement(
|
|
1309
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DisabledPostTooltip, { isDisabled, postTypeSlug: type }, /* @__PURE__ */ React21.createElement(
|
|
1258
1310
|
ListItem2,
|
|
1259
1311
|
{
|
|
1260
1312
|
disablePadding: true,
|
|
@@ -1353,7 +1405,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1353
1405
|
});
|
|
1354
1406
|
return () => unregisterSection(type);
|
|
1355
1407
|
}, [registerSection, unregisterSection, type, setEditMode]);
|
|
1356
|
-
const filteredPosts =
|
|
1408
|
+
const filteredPosts = useMemo4(() => {
|
|
1357
1409
|
if (!posts) {
|
|
1358
1410
|
return [];
|
|
1359
1411
|
}
|
|
@@ -1410,11 +1462,39 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1410
1462
|
);
|
|
1411
1463
|
}
|
|
1412
1464
|
|
|
1465
|
+
// src/components/panel/user-load-error.tsx
|
|
1466
|
+
import * as React24 from "react";
|
|
1467
|
+
import { Box as Box7, Typography as Typography6 } from "@elementor/ui";
|
|
1468
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
1469
|
+
function UserLoadError() {
|
|
1470
|
+
return /* @__PURE__ */ React24.createElement(Box7, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React24.createElement(Typography6, { variant: "body2", color: "text.secondary" }, __16(
|
|
1471
|
+
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
1472
|
+
"elementor"
|
|
1473
|
+
)));
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
// src/components/panel/shell-panel-body-content.tsx
|
|
1477
|
+
function ShellPanelBodyContent({
|
|
1478
|
+
accessiblePostTypes,
|
|
1479
|
+
isUserPending,
|
|
1480
|
+
onListError,
|
|
1481
|
+
showUserLoadError
|
|
1482
|
+
}) {
|
|
1483
|
+
if (isUserPending) {
|
|
1484
|
+
return /* @__PURE__ */ React25.createElement(Stack2, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
1485
|
+
}
|
|
1486
|
+
if (showUserLoadError) {
|
|
1487
|
+
return /* @__PURE__ */ React25.createElement(UserLoadError, null);
|
|
1488
|
+
}
|
|
1489
|
+
return /* @__PURE__ */ React25.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React25.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React25.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1413
1492
|
// src/components/panel/shell.tsx
|
|
1414
1493
|
var Shell = () => {
|
|
1415
1494
|
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState6(false);
|
|
1416
|
-
|
|
1417
|
-
|
|
1495
|
+
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
1496
|
+
return /* @__PURE__ */ React26.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React26.createElement(Panel, null, /* @__PURE__ */ React26.createElement(PanelHeader, null, /* @__PURE__ */ React26.createElement(
|
|
1497
|
+
Stack3,
|
|
1418
1498
|
{
|
|
1419
1499
|
alignItems: "center",
|
|
1420
1500
|
direction: "row",
|
|
@@ -1423,17 +1503,17 @@ var Shell = () => {
|
|
|
1423
1503
|
...contentPanelHeaderStackSx
|
|
1424
1504
|
}
|
|
1425
1505
|
},
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
)), /* @__PURE__ */
|
|
1429
|
-
|
|
1506
|
+
/* @__PURE__ */ React26.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __17("Site content", "elementor")),
|
|
1507
|
+
/* @__PURE__ */ React26.createElement(ContentPanelHeaderAdd, null)
|
|
1508
|
+
)), /* @__PURE__ */ React26.createElement(Divider4, null), /* @__PURE__ */ React26.createElement(PanelBody, null, /* @__PURE__ */ React26.createElement(ContentPanelSearch, null), /* @__PURE__ */ React26.createElement(
|
|
1509
|
+
ShellPanelBodyContent,
|
|
1430
1510
|
{
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
)
|
|
1511
|
+
accessiblePostTypes,
|
|
1512
|
+
isUserPending,
|
|
1513
|
+
onListError: () => setIsErrorSnackbarOpen(true),
|
|
1514
|
+
showUserLoadError
|
|
1515
|
+
}
|
|
1516
|
+
), /* @__PURE__ */ React26.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
|
|
1437
1517
|
};
|
|
1438
1518
|
var shell_default = Shell;
|
|
1439
1519
|
|
|
@@ -1444,7 +1524,7 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
|
|
|
1444
1524
|
});
|
|
1445
1525
|
|
|
1446
1526
|
// src/components/top-bar/recently-edited.tsx
|
|
1447
|
-
import * as
|
|
1527
|
+
import * as React31 from "react";
|
|
1448
1528
|
import {
|
|
1449
1529
|
__useActiveDocument as useActiveDocument4,
|
|
1450
1530
|
__useHostDocument as useHostDocument
|
|
@@ -1461,15 +1541,15 @@ import {
|
|
|
1461
1541
|
MenuItem as MenuItem5,
|
|
1462
1542
|
usePopupState as usePopupState3
|
|
1463
1543
|
} from "@elementor/ui";
|
|
1464
|
-
import { __ as
|
|
1544
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1465
1545
|
|
|
1466
1546
|
// src/components/top-bar/create-post-list-item.tsx
|
|
1467
|
-
import * as
|
|
1547
|
+
import * as React27 from "react";
|
|
1468
1548
|
import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
|
|
1469
1549
|
import { useMixpanel } from "@elementor/events";
|
|
1470
1550
|
import { PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1471
1551
|
import { CircularProgress as CircularProgress5, ListItemIcon as ListItemIcon3, ListItemText as ListItemText6, MenuItem as MenuItem3 } from "@elementor/ui";
|
|
1472
|
-
import { __ as
|
|
1552
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
1473
1553
|
|
|
1474
1554
|
// src/hooks/use-create-page.ts
|
|
1475
1555
|
import { useState as useState7 } from "react";
|
|
@@ -1499,7 +1579,7 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1499
1579
|
const navigateToDocument = useNavigateToDocument4();
|
|
1500
1580
|
const { data: user } = useUser();
|
|
1501
1581
|
const { dispatchEvent, config } = useMixpanel();
|
|
1502
|
-
return /* @__PURE__ */
|
|
1582
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1503
1583
|
MenuItem3,
|
|
1504
1584
|
{
|
|
1505
1585
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
@@ -1523,25 +1603,25 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1523
1603
|
},
|
|
1524
1604
|
...props
|
|
1525
1605
|
},
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ React27.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React27.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React27.createElement(PlusIcon2, { fontSize: "small" })),
|
|
1607
|
+
/* @__PURE__ */ React27.createElement(
|
|
1528
1608
|
ListItemText6,
|
|
1529
1609
|
{
|
|
1530
1610
|
primaryTypographyProps: { variant: "body2" },
|
|
1531
|
-
primary:
|
|
1611
|
+
primary: __18("Add new page", "elementor")
|
|
1532
1612
|
}
|
|
1533
1613
|
)
|
|
1534
1614
|
);
|
|
1535
1615
|
}
|
|
1536
1616
|
|
|
1537
1617
|
// src/components/top-bar/indicator.tsx
|
|
1538
|
-
import * as
|
|
1539
|
-
import { Stack as
|
|
1618
|
+
import * as React28 from "react";
|
|
1619
|
+
import { Stack as Stack4, Tooltip as BaseTooltip, Typography as Typography7 } from "@elementor/ui";
|
|
1540
1620
|
function Indicator({ title, status }) {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1621
|
+
return /* @__PURE__ */ React28.createElement(Tooltip2, { title }, /* @__PURE__ */ React28.createElement(Stack4, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
1542
1622
|
}
|
|
1543
1623
|
function Tooltip2(props) {
|
|
1544
|
-
return /* @__PURE__ */
|
|
1624
|
+
return /* @__PURE__ */ React28.createElement(
|
|
1545
1625
|
BaseTooltip,
|
|
1546
1626
|
{
|
|
1547
1627
|
PopperProps: {
|
|
@@ -1557,20 +1637,20 @@ function Tooltip2(props) {
|
|
|
1557
1637
|
}
|
|
1558
1638
|
|
|
1559
1639
|
// src/components/top-bar/post-list-item.tsx
|
|
1560
|
-
import * as
|
|
1640
|
+
import * as React30 from "react";
|
|
1561
1641
|
import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
|
|
1562
1642
|
import { useMixpanel as useMixpanel2 } from "@elementor/events";
|
|
1563
1643
|
import { ListItemText as ListItemText7, MenuItem as MenuItem4 } from "@elementor/ui";
|
|
1564
1644
|
|
|
1565
1645
|
// src/components/top-bar/chip-doc-type.tsx
|
|
1566
|
-
import * as
|
|
1646
|
+
import * as React29 from "react";
|
|
1567
1647
|
import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
|
|
1568
1648
|
import { Chip as Chip2 } from "@elementor/ui";
|
|
1569
1649
|
var iconsMap2 = getIconsMap();
|
|
1570
1650
|
function DocTypeChip({ postType, docType, label }) {
|
|
1571
1651
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
1572
1652
|
const Icon = iconsMap2[docType] || PostTypeIcon3;
|
|
1573
|
-
return /* @__PURE__ */
|
|
1653
|
+
return /* @__PURE__ */ React29.createElement(
|
|
1574
1654
|
Chip2,
|
|
1575
1655
|
{
|
|
1576
1656
|
component: "span",
|
|
@@ -1579,7 +1659,7 @@ function DocTypeChip({ postType, docType, label }) {
|
|
|
1579
1659
|
label,
|
|
1580
1660
|
"data-value": docType,
|
|
1581
1661
|
color,
|
|
1582
|
-
icon: /* @__PURE__ */
|
|
1662
|
+
icon: /* @__PURE__ */ React29.createElement(Icon, null),
|
|
1583
1663
|
sx: { ml: 1, cursor: "inherit" }
|
|
1584
1664
|
}
|
|
1585
1665
|
);
|
|
@@ -1590,7 +1670,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1590
1670
|
const navigateToDocument = useNavigateToDocument5();
|
|
1591
1671
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
1592
1672
|
const { dispatchEvent, config } = useMixpanel2();
|
|
1593
|
-
return /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ React30.createElement(
|
|
1594
1674
|
MenuItem4,
|
|
1595
1675
|
{
|
|
1596
1676
|
disabled: !post.user_can.edit,
|
|
@@ -1613,7 +1693,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1613
1693
|
},
|
|
1614
1694
|
...props
|
|
1615
1695
|
},
|
|
1616
|
-
/* @__PURE__ */
|
|
1696
|
+
/* @__PURE__ */ React30.createElement(
|
|
1617
1697
|
ListItemText7,
|
|
1618
1698
|
{
|
|
1619
1699
|
sx: { flexGrow: 0 },
|
|
@@ -1621,7 +1701,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1621
1701
|
primary: postTitle
|
|
1622
1702
|
}
|
|
1623
1703
|
),
|
|
1624
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ React30.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
|
|
1625
1705
|
);
|
|
1626
1706
|
}
|
|
1627
1707
|
|
|
@@ -1647,12 +1727,12 @@ function RecentlyEdited() {
|
|
|
1647
1727
|
return null;
|
|
1648
1728
|
}
|
|
1649
1729
|
const buttonProps = bindTrigger3(popupState);
|
|
1650
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
|
|
1651
1731
|
Button3,
|
|
1652
1732
|
{
|
|
1653
1733
|
color: "inherit",
|
|
1654
1734
|
size: "small",
|
|
1655
|
-
endIcon: /* @__PURE__ */
|
|
1735
|
+
endIcon: /* @__PURE__ */ React31.createElement(ChevronDownIcon, { fontSize: "small" }),
|
|
1656
1736
|
...buttonProps,
|
|
1657
1737
|
onClick: (e) => {
|
|
1658
1738
|
const extendedWindow = window;
|
|
@@ -1671,46 +1751,40 @@ function RecentlyEdited() {
|
|
|
1671
1751
|
buttonProps.onClick(e);
|
|
1672
1752
|
}
|
|
1673
1753
|
},
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
), /* @__PURE__ */
|
|
1754
|
+
/* @__PURE__ */ React31.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
1755
|
+
), /* @__PURE__ */ React31.createElement(
|
|
1676
1756
|
Menu3,
|
|
1677
1757
|
{
|
|
1678
1758
|
MenuListProps: {
|
|
1679
|
-
subheader: /* @__PURE__ */
|
|
1759
|
+
subheader: /* @__PURE__ */ React31.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __19("Recent", "elementor"))
|
|
1680
1760
|
},
|
|
1681
1761
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
1682
1762
|
...bindMenu3(popupState)
|
|
1683
1763
|
},
|
|
1684
|
-
recentPosts.map((post) => /* @__PURE__ */
|
|
1685
|
-
recentPosts.length === 0 && /* @__PURE__ */
|
|
1764
|
+
recentPosts.map((post) => /* @__PURE__ */ React31.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
1765
|
+
recentPosts.length === 0 && /* @__PURE__ */ React31.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React31.createElement(
|
|
1686
1766
|
ListItemText8,
|
|
1687
1767
|
{
|
|
1688
1768
|
primaryTypographyProps: {
|
|
1689
1769
|
variant: "caption",
|
|
1690
1770
|
fontStyle: "italic"
|
|
1691
1771
|
},
|
|
1692
|
-
primary:
|
|
1772
|
+
primary: __19("There are no other pages or templates on this site yet.", "elementor")
|
|
1693
1773
|
}
|
|
1694
1774
|
)),
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ React31.createElement(Divider5, { disabled: recentPosts.length === 0 }),
|
|
1776
|
+
/* @__PURE__ */ React31.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
1697
1777
|
));
|
|
1698
1778
|
}
|
|
1699
1779
|
|
|
1700
|
-
// src/env.ts
|
|
1701
|
-
import { parseEnv } from "@elementor/env";
|
|
1702
|
-
var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
|
|
1703
|
-
return envData;
|
|
1704
|
-
});
|
|
1705
|
-
|
|
1706
1780
|
// src/hooks/use-toggle-button-props.ts
|
|
1707
1781
|
import { PagesIcon } from "@elementor/icons";
|
|
1708
|
-
import { __ as
|
|
1782
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1709
1783
|
function useToggleButtonProps() {
|
|
1710
1784
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1711
1785
|
const { open, close } = usePanelActions();
|
|
1712
1786
|
return {
|
|
1713
|
-
title:
|
|
1787
|
+
title: __20("Site content", "elementor"),
|
|
1714
1788
|
icon: PagesIcon,
|
|
1715
1789
|
onClick: () => {
|
|
1716
1790
|
const extendedWindow = window;
|
|
@@ -1733,7 +1807,7 @@ function useToggleButtonProps() {
|
|
|
1733
1807
|
// src/init.ts
|
|
1734
1808
|
function init() {
|
|
1735
1809
|
registerTopBarMenuItems();
|
|
1736
|
-
if (env.is_pages_panel_active) {
|
|
1810
|
+
if (env.is_pages_panel_active && env.can_access_site_content_panel) {
|
|
1737
1811
|
registerPanel(panel);
|
|
1738
1812
|
registerButton();
|
|
1739
1813
|
}
|