@elementor/editor-site-navigation 4.5.0-1205 → 4.5.0-1207
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 +784 -425
- package/dist/index.mjs +776 -426
- package/package.json +10 -9
- package/src/api/post.ts +22 -1
- package/src/components/panel/actions-menu/actions/delete.tsx +12 -6
- package/src/components/panel/actions-menu/actions/duplicate.tsx +4 -2
- package/src/components/panel/content-panel-add-icon-button.tsx +15 -0
- package/src/components/panel/content-panel-chrome.ts +65 -0
- package/src/components/panel/content-panel-header-add.tsx +57 -0
- package/src/components/panel/content-panel-search.tsx +33 -0
- package/src/components/panel/posts-list/collapsible-list.tsx +87 -65
- package/src/components/panel/posts-list/list-items/edit-mode-template.tsx +83 -20
- package/src/components/panel/posts-list/list-items/list-item-create.tsx +9 -2
- package/src/components/panel/posts-list/list-items/list-item-view.tsx +28 -8
- package/src/components/panel/posts-list/posts-collapsible-list.tsx +99 -65
- package/src/components/panel/section-add-button.tsx +35 -0
- package/src/components/panel/shell.tsx +41 -11
- package/src/components/shared/page-title-and-status.tsx +3 -0
- package/src/contexts/content-panel-coordinator.tsx +70 -0
- package/src/hooks/use-posts-actions.ts +6 -6
- package/src/hooks/use-posts.ts +18 -5
- package/src/hooks/use-reverse-html-entities.ts +3 -10
- package/src/hooks/use-toggle-button-props.ts +1 -1
- package/src/utils/post-title-plain.ts +36 -0
- package/src/components/panel/add-new-button.tsx +0 -28
package/dist/index.mjs
CHANGED
|
@@ -30,85 +30,11 @@ 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
|
|
34
|
-
import { useState as
|
|
33
|
+
import * as React24 from "react";
|
|
34
|
+
import { useState as useState6 } from "react";
|
|
35
35
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
// src/contexts/post-list-context.tsx
|
|
39
|
-
import * as React from "react";
|
|
40
|
-
import { createContext, useContext, useState } from "react";
|
|
41
|
-
var defaultValues = {
|
|
42
|
-
type: "page",
|
|
43
|
-
editMode: { mode: "none", details: {} },
|
|
44
|
-
setEditMode: () => null,
|
|
45
|
-
resetEditMode: () => null,
|
|
46
|
-
setError: () => null
|
|
47
|
-
};
|
|
48
|
-
var PostListContext = createContext(defaultValues);
|
|
49
|
-
var PostListContextProvider = ({
|
|
50
|
-
type,
|
|
51
|
-
setError,
|
|
52
|
-
children
|
|
53
|
-
}) => {
|
|
54
|
-
const [editMode, setEditMode] = useState(defaultValues.editMode);
|
|
55
|
-
const resetEditMode = () => {
|
|
56
|
-
setEditMode(defaultValues.editMode);
|
|
57
|
-
};
|
|
58
|
-
return /* @__PURE__ */ React.createElement(
|
|
59
|
-
PostListContext.Provider,
|
|
60
|
-
{
|
|
61
|
-
value: {
|
|
62
|
-
type,
|
|
63
|
-
editMode,
|
|
64
|
-
setEditMode,
|
|
65
|
-
resetEditMode,
|
|
66
|
-
setError
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
children
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
function usePostListContext() {
|
|
73
|
-
const context = useContext(PostListContext);
|
|
74
|
-
if (!context) {
|
|
75
|
-
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
76
|
-
}
|
|
77
|
-
return context;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/components/panel/error-snackbar.tsx
|
|
81
|
-
import * as React2 from "react";
|
|
82
|
-
import { Alert, Snackbar, Typography } from "@elementor/ui";
|
|
83
|
-
var ErrorSnackbar = ({ open, onClose }) => {
|
|
84
|
-
return /* @__PURE__ */ React2.createElement(
|
|
85
|
-
Snackbar,
|
|
86
|
-
{
|
|
87
|
-
open,
|
|
88
|
-
onClose,
|
|
89
|
-
anchorOrigin: {
|
|
90
|
-
vertical: "bottom",
|
|
91
|
-
horizontal: "left"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
/* @__PURE__ */ React2.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React2.createElement(
|
|
95
|
-
Typography,
|
|
96
|
-
{
|
|
97
|
-
component: "span",
|
|
98
|
-
sx: {
|
|
99
|
-
fontWeight: "bold"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"We couldn\u2019t complete the action."
|
|
103
|
-
), " ", "Please try again")
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
var error_snackbar_default = ErrorSnackbar;
|
|
107
|
-
|
|
108
|
-
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
109
|
-
import * as React19 from "react";
|
|
110
|
-
import { PageTypeIcon as PageTypeIcon2 } from "@elementor/icons";
|
|
111
|
-
import { Box as Box4, Button as Button3, CircularProgress as CircularProgress4, List as List2, Skeleton } from "@elementor/ui";
|
|
36
|
+
import { Divider as Divider4, List as List2, Stack as Stack2 } from "@elementor/ui";
|
|
37
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
112
38
|
|
|
113
39
|
// src/api/post.ts
|
|
114
40
|
import apiFetch from "@wordpress/api-fetch";
|
|
@@ -119,11 +45,24 @@ var postTypesMap = {
|
|
|
119
45
|
singular_name: __("Page", "elementor"),
|
|
120
46
|
plural_name: __("Pages", "elementor")
|
|
121
47
|
},
|
|
122
|
-
rest_base: "pages"
|
|
48
|
+
rest_base: "pages",
|
|
49
|
+
createCapability: "edit_pages"
|
|
50
|
+
},
|
|
51
|
+
post: {
|
|
52
|
+
labels: {
|
|
53
|
+
singular_name: __("Post", "elementor"),
|
|
54
|
+
plural_name: __("Posts", "elementor")
|
|
55
|
+
},
|
|
56
|
+
rest_base: "posts",
|
|
57
|
+
createCapability: "edit_posts"
|
|
123
58
|
}
|
|
124
59
|
};
|
|
60
|
+
var panelPostTypeSlugs = Object.keys(postTypesMap);
|
|
61
|
+
function getPostTypeCreateCapability(postTypeSlug) {
|
|
62
|
+
return postTypesMap[postTypeSlug].createCapability;
|
|
63
|
+
}
|
|
125
64
|
var POST_PER_PAGE = 10;
|
|
126
|
-
var getRequest = async (postTypeSlug, page) => {
|
|
65
|
+
var getRequest = async (postTypeSlug, page, search = "") => {
|
|
127
66
|
const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
128
67
|
const keys = ["id", "type", "title", "link", "status", "user_can"];
|
|
129
68
|
const queryParams = new URLSearchParams({
|
|
@@ -133,6 +72,10 @@ var getRequest = async (postTypeSlug, page) => {
|
|
|
133
72
|
per_page: POST_PER_PAGE.toString(),
|
|
134
73
|
_fields: keys.join(",")
|
|
135
74
|
});
|
|
75
|
+
const trimmedSearch = search.trim();
|
|
76
|
+
if (trimmedSearch) {
|
|
77
|
+
queryParams.set("search", trimmedSearch);
|
|
78
|
+
}
|
|
136
79
|
const uri = baseUri + "?" + queryParams.toString();
|
|
137
80
|
const result = await apiFetch({ path: uri, parse: false });
|
|
138
81
|
const data = await result.json();
|
|
@@ -181,18 +124,291 @@ var duplicateRequest = (originalPost) => {
|
|
|
181
124
|
});
|
|
182
125
|
};
|
|
183
126
|
|
|
184
|
-
// src/
|
|
127
|
+
// src/contexts/content-panel-coordinator.tsx
|
|
128
|
+
import * as React from "react";
|
|
129
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
130
|
+
var ContentPanelCoordinatorContext = createContext(null);
|
|
131
|
+
function ContentPanelCoordinatorProvider({ children }) {
|
|
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
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/contexts/post-list-context.tsx
|
|
171
|
+
import * as React2 from "react";
|
|
172
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
|
|
173
|
+
var defaultValues = {
|
|
174
|
+
type: "page",
|
|
175
|
+
editMode: { mode: "none", details: {} },
|
|
176
|
+
setEditMode: () => null,
|
|
177
|
+
resetEditMode: () => null,
|
|
178
|
+
setError: () => null
|
|
179
|
+
};
|
|
180
|
+
var PostListContext = createContext2(defaultValues);
|
|
181
|
+
var PostListContextProvider = ({
|
|
182
|
+
type,
|
|
183
|
+
setError,
|
|
184
|
+
children
|
|
185
|
+
}) => {
|
|
186
|
+
const [editMode, setEditMode] = useState2(defaultValues.editMode);
|
|
187
|
+
const resetEditMode = () => {
|
|
188
|
+
setEditMode(defaultValues.editMode);
|
|
189
|
+
};
|
|
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
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/components/panel/content-panel-chrome.ts
|
|
213
|
+
var CONTENT_PANEL_INSET_SPACING = 2;
|
|
214
|
+
var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
|
|
215
|
+
var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
|
|
216
|
+
var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
|
|
217
|
+
var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
|
|
218
|
+
var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
|
|
219
|
+
var CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP = 0.75;
|
|
220
|
+
var CONTENT_PANEL_SEARCH_PADDING_BLOCK = 1.5;
|
|
221
|
+
var contentPanelInsetPaddingSx = {
|
|
222
|
+
paddingInline: CONTENT_PANEL_INSET_SPACING
|
|
223
|
+
};
|
|
224
|
+
var contentPanelListRowPaddingSx = {
|
|
225
|
+
...contentPanelInsetPaddingSx
|
|
226
|
+
};
|
|
227
|
+
var contentPanelHeaderStackSx = {
|
|
228
|
+
width: "100%"
|
|
229
|
+
};
|
|
230
|
+
var contentPanelSearchBoxSx = {
|
|
231
|
+
...contentPanelInsetPaddingSx,
|
|
232
|
+
py: CONTENT_PANEL_SEARCH_PADDING_BLOCK
|
|
233
|
+
};
|
|
234
|
+
var contentPanelSectionHeaderSx = {
|
|
235
|
+
...contentPanelInsetPaddingSx,
|
|
236
|
+
py: CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK
|
|
237
|
+
};
|
|
238
|
+
var contentPanelSectionHeaderTrailingGap = CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP;
|
|
239
|
+
var contentPanelListRowTitleSx = {
|
|
240
|
+
fontSize: CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE
|
|
241
|
+
};
|
|
242
|
+
var contentPanelListSectionListSx = {
|
|
243
|
+
display: "flex",
|
|
244
|
+
flexDirection: "column",
|
|
245
|
+
gap: CONTENT_PANEL_LIST_ROW_GAP,
|
|
246
|
+
paddingBlockEnd: CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING
|
|
247
|
+
};
|
|
248
|
+
var contentPanelListItemButtonSx = {
|
|
249
|
+
justifyContent: "flex-start",
|
|
250
|
+
paddingInline: CONTENT_PANEL_LIST_ROW_INSET_INLINE,
|
|
251
|
+
textAlign: "start",
|
|
252
|
+
width: "100%",
|
|
253
|
+
"&.Mui-selected": {
|
|
254
|
+
backgroundColor: "action.selected"
|
|
255
|
+
},
|
|
256
|
+
"&.Mui-selected:hover": {
|
|
257
|
+
backgroundColor: "action.selected"
|
|
258
|
+
},
|
|
259
|
+
"&:hover:not(.Mui-disabled)": {
|
|
260
|
+
backgroundColor: "action.hover"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/components/panel/content-panel-header-add.tsx
|
|
265
|
+
import * as React4 from "react";
|
|
266
|
+
import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
|
|
267
|
+
import { bindMenu, bindTrigger, ListItemIcon, ListItemText, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
268
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
269
|
+
|
|
270
|
+
// src/hooks/use-user.ts
|
|
185
271
|
import { useQuery } from "@elementor/query";
|
|
186
272
|
|
|
187
|
-
// src/api/
|
|
273
|
+
// src/api/user.ts
|
|
188
274
|
import apiFetch2 from "@wordpress/api-fetch";
|
|
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
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/components/panel/content-panel-add-icon-button.tsx
|
|
297
|
+
import * as React3 from "react";
|
|
298
|
+
import { PlusIcon } from "@elementor/icons";
|
|
299
|
+
import { IconButton } from "@elementor/ui";
|
|
300
|
+
var CONTENT_PANEL_ADD_ICON_SIZE = "tiny";
|
|
301
|
+
function ContentPanelAddIconButton(props) {
|
|
302
|
+
return /* @__PURE__ */ React3.createElement(IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React3.createElement(PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/components/panel/content-panel-header-add.tsx
|
|
306
|
+
var typeIcons = {
|
|
307
|
+
page: PageTypeIcon2,
|
|
308
|
+
post: PostTypeIcon2
|
|
309
|
+
};
|
|
310
|
+
function ContentPanelHeaderAdd() {
|
|
311
|
+
const { requestCreate } = useContentPanelCoordinator();
|
|
312
|
+
const { data: user } = useUser();
|
|
313
|
+
const popupState = usePopupState({
|
|
314
|
+
variant: "popover",
|
|
315
|
+
popupId: "elementor-content-panel-header-add"
|
|
316
|
+
});
|
|
317
|
+
const buttonProps = bindTrigger(popupState);
|
|
318
|
+
const menuProps = bindMenu(popupState);
|
|
319
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ContentPanelAddIconButton, { "aria-label": __2("Add new", "elementor"), ...buttonProps }), /* @__PURE__ */ React4.createElement(Menu, { ...menuProps }, panelPostTypeSlugs.map((slug) => {
|
|
320
|
+
const Icon = typeIcons[slug];
|
|
321
|
+
const createCapability = getPostTypeCreateCapability(slug);
|
|
322
|
+
const singularName = postTypesMap[slug].labels.singular_name;
|
|
323
|
+
return /* @__PURE__ */ React4.createElement(
|
|
324
|
+
MenuItem,
|
|
325
|
+
{
|
|
326
|
+
key: slug,
|
|
327
|
+
disabled: !user?.capabilities?.[createCapability],
|
|
328
|
+
onClick: () => {
|
|
329
|
+
popupState.close();
|
|
330
|
+
requestAnimationFrame(() => {
|
|
331
|
+
requestCreate(slug);
|
|
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
|
+
})));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// src/components/panel/content-panel-search.tsx
|
|
342
|
+
import * as React5 from "react";
|
|
343
|
+
import { SearchIcon } from "@elementor/icons";
|
|
344
|
+
import { Box, InputAdornment, TextField } from "@elementor/ui";
|
|
345
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
346
|
+
function ContentPanelSearch() {
|
|
347
|
+
const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
|
|
348
|
+
return /* @__PURE__ */ React5.createElement(Box, { component: "search", sx: contentPanelSearchBoxSx, "aria-label": __3("Search site content", "elementor") }, /* @__PURE__ */ React5.createElement(
|
|
349
|
+
TextField,
|
|
350
|
+
{
|
|
351
|
+
fullWidth: true,
|
|
352
|
+
size: "tiny",
|
|
353
|
+
value: searchQuery,
|
|
354
|
+
placeholder: __3("Search", "elementor"),
|
|
355
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
356
|
+
inputProps: {
|
|
357
|
+
"aria-label": __3("Search", "elementor")
|
|
358
|
+
},
|
|
359
|
+
InputProps: {
|
|
360
|
+
startAdornment: /* @__PURE__ */ React5.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React5.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/components/panel/error-snackbar.tsx
|
|
367
|
+
import * as React6 from "react";
|
|
368
|
+
import { Alert, Snackbar, Typography } from "@elementor/ui";
|
|
369
|
+
var ErrorSnackbar = ({ open, onClose }) => {
|
|
370
|
+
return /* @__PURE__ */ React6.createElement(
|
|
371
|
+
Snackbar,
|
|
372
|
+
{
|
|
373
|
+
open,
|
|
374
|
+
onClose,
|
|
375
|
+
anchorOrigin: {
|
|
376
|
+
vertical: "bottom",
|
|
377
|
+
horizontal: "left"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
/* @__PURE__ */ React6.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React6.createElement(
|
|
381
|
+
Typography,
|
|
382
|
+
{
|
|
383
|
+
component: "span",
|
|
384
|
+
sx: {
|
|
385
|
+
fontWeight: "bold"
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"We couldn\u2019t complete the action."
|
|
389
|
+
), " ", "Please try again")
|
|
390
|
+
);
|
|
391
|
+
};
|
|
392
|
+
var error_snackbar_default = ErrorSnackbar;
|
|
393
|
+
|
|
394
|
+
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
395
|
+
import * as React23 from "react";
|
|
396
|
+
import { useEffect, useMemo as useMemo3, useState as useState5 } from "react";
|
|
397
|
+
import { Box as Box6, Button as Button2, CircularProgress as CircularProgress4, Skeleton, Typography as Typography5 } from "@elementor/ui";
|
|
398
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
399
|
+
|
|
400
|
+
// src/hooks/use-homepage.ts
|
|
401
|
+
import { useQuery as useQuery2 } from "@elementor/query";
|
|
402
|
+
|
|
403
|
+
// src/api/settings.ts
|
|
404
|
+
import apiFetch3 from "@wordpress/api-fetch";
|
|
189
405
|
var getSettings = () => {
|
|
190
406
|
const baseUri = "/elementor/v1/site-navigation/homepage";
|
|
191
407
|
const uri = baseUri;
|
|
192
|
-
return
|
|
408
|
+
return apiFetch3({ path: uri });
|
|
193
409
|
};
|
|
194
410
|
var updateSettings = (settings) => {
|
|
195
|
-
return
|
|
411
|
+
return apiFetch3({
|
|
196
412
|
path: "/wp/v2/settings",
|
|
197
413
|
method: "POST",
|
|
198
414
|
data: settings
|
|
@@ -202,15 +418,22 @@ var updateSettings = (settings) => {
|
|
|
202
418
|
// src/hooks/use-homepage.ts
|
|
203
419
|
var settingsQueryKey = () => ["site-navigation", "homepage"];
|
|
204
420
|
function useHomepage() {
|
|
205
|
-
return
|
|
421
|
+
return useQuery2({
|
|
206
422
|
queryKey: settingsQueryKey(),
|
|
207
423
|
queryFn: () => getSettings()
|
|
208
424
|
});
|
|
209
425
|
}
|
|
210
426
|
|
|
211
427
|
// src/hooks/use-posts.ts
|
|
212
|
-
import { useInfiniteQuery } from "@elementor/query";
|
|
213
|
-
var
|
|
428
|
+
import { keepPreviousData, useInfiniteQuery } from "@elementor/query";
|
|
429
|
+
var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
|
|
430
|
+
var postsQueryKey = (postTypeSlug, search = "") => {
|
|
431
|
+
const trimmedSearch = search.trim();
|
|
432
|
+
if (!trimmedSearch) {
|
|
433
|
+
return postsQueryKeyBase(postTypeSlug);
|
|
434
|
+
}
|
|
435
|
+
return [...postsQueryKeyBase(postTypeSlug), trimmedSearch];
|
|
436
|
+
};
|
|
214
437
|
var flattenData = (data) => {
|
|
215
438
|
if (!data) {
|
|
216
439
|
return data;
|
|
@@ -221,147 +444,136 @@ var flattenData = (data) => {
|
|
|
221
444
|
});
|
|
222
445
|
return flattened;
|
|
223
446
|
};
|
|
224
|
-
function usePosts(postTypeSlug) {
|
|
447
|
+
function usePosts(postTypeSlug, search = "") {
|
|
448
|
+
const trimmedSearch = search.trim();
|
|
225
449
|
const query = useInfiniteQuery({
|
|
226
|
-
queryKey: postsQueryKey(postTypeSlug),
|
|
227
|
-
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam),
|
|
450
|
+
queryKey: postsQueryKey(postTypeSlug, trimmedSearch),
|
|
451
|
+
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch),
|
|
228
452
|
initialPageParam: 1,
|
|
229
453
|
getNextPageParam: (lastPage) => {
|
|
230
454
|
return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
|
|
231
|
-
}
|
|
455
|
+
},
|
|
456
|
+
placeholderData: keepPreviousData
|
|
232
457
|
});
|
|
233
458
|
return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
|
|
234
459
|
}
|
|
235
460
|
|
|
236
|
-
// src/components/panel/add-
|
|
237
|
-
import * as
|
|
238
|
-
import {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// src/hooks/use-user.ts
|
|
243
|
-
import { useQuery as useQuery2 } from "@elementor/query";
|
|
244
|
-
|
|
245
|
-
// src/api/user.ts
|
|
246
|
-
import apiFetch3 from "@wordpress/api-fetch";
|
|
247
|
-
var getUser = () => {
|
|
248
|
-
const baseUri = "/wp/v2/users/me";
|
|
249
|
-
const keys = ["capabilities"];
|
|
250
|
-
const queryParams = new URLSearchParams({
|
|
251
|
-
_fields: keys.join(","),
|
|
252
|
-
context: "edit"
|
|
253
|
-
});
|
|
254
|
-
const uri = baseUri + "?" + queryParams.toString();
|
|
255
|
-
return apiFetch3({ path: uri });
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/hooks/use-user.ts
|
|
259
|
-
var userQueryKey = () => ["site-navigation", "user"];
|
|
260
|
-
function useUser() {
|
|
261
|
-
return useQuery2({
|
|
262
|
-
queryKey: userQueryKey(),
|
|
263
|
-
queryFn: getUser,
|
|
264
|
-
staleTime: 30 * 60 * 1e3
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/components/panel/add-new-button.tsx
|
|
269
|
-
function AddNewButton() {
|
|
270
|
-
const { setEditMode } = usePostListContext();
|
|
461
|
+
// src/components/panel/section-add-button.tsx
|
|
462
|
+
import * as React7 from "react";
|
|
463
|
+
import { __ as __4, sprintf } from "@wordpress/i18n";
|
|
464
|
+
function SectionAddButton({ onBeforeCreate }) {
|
|
465
|
+
const { type, setEditMode } = usePostListContext();
|
|
271
466
|
const { data: user } = useUser();
|
|
272
|
-
|
|
273
|
-
|
|
467
|
+
const createCapability = getPostTypeCreateCapability(type);
|
|
468
|
+
const singularName = postTypesMap[type].labels.singular_name;
|
|
469
|
+
const ariaLabel = sprintf(
|
|
470
|
+
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
471
|
+
__4("New %s", "elementor"),
|
|
472
|
+
singularName
|
|
473
|
+
);
|
|
474
|
+
return /* @__PURE__ */ React7.createElement(
|
|
475
|
+
ContentPanelAddIconButton,
|
|
274
476
|
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
477
|
+
"aria-label": ariaLabel,
|
|
478
|
+
disabled: !user?.capabilities?.[createCapability],
|
|
479
|
+
onClick: (event) => {
|
|
480
|
+
event.stopPropagation();
|
|
481
|
+
onBeforeCreate?.();
|
|
279
482
|
setEditMode({ mode: "create", details: {} });
|
|
280
|
-
},
|
|
281
|
-
sx: {
|
|
282
|
-
px: 1.5
|
|
283
483
|
}
|
|
284
|
-
}
|
|
285
|
-
__2("Add New", "elementor")
|
|
484
|
+
}
|
|
286
485
|
);
|
|
287
486
|
}
|
|
288
487
|
|
|
289
488
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
290
|
-
import * as
|
|
291
|
-
import {
|
|
292
|
-
import {
|
|
293
|
-
import {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
transform: isOpen ? "rotate(0deg)" : "rotate(-90deg)",
|
|
307
|
-
transition: theme.transitions.create("transform", {
|
|
308
|
-
duration: theme.transitions.duration.standard
|
|
309
|
-
})
|
|
310
|
-
}));
|
|
311
|
-
var StyledListItemIcon = styled(ListItemIcon)(({ theme }) => ({
|
|
312
|
-
minWidth: theme.spacing(4)
|
|
313
|
-
}));
|
|
489
|
+
import * as React8 from "react";
|
|
490
|
+
import { useId } from "react";
|
|
491
|
+
import { CollapseIcon } from "@elementor/editor-ui";
|
|
492
|
+
import { Box as Box2, Chip, Collapse, Divider, List, ListItemButton, ListItemText as ListItemText2, Stack } from "@elementor/ui";
|
|
493
|
+
var sectionHeaderListItemButtonSx = {
|
|
494
|
+
flexGrow: 1,
|
|
495
|
+
justifyContent: "flex-start",
|
|
496
|
+
minWidth: 0,
|
|
497
|
+
textAlign: "start",
|
|
498
|
+
"&:focus": { backgroundColor: "transparent" },
|
|
499
|
+
"&:hover": { backgroundColor: "transparent" },
|
|
500
|
+
"&.Mui-focusVisible": { backgroundColor: "transparent" }
|
|
501
|
+
};
|
|
502
|
+
function getSectionHeaderAriaLabel(title, count) {
|
|
503
|
+
return `${title} (${count.toString()})`;
|
|
504
|
+
}
|
|
314
505
|
function CollapsibleList({
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
506
|
+
count,
|
|
507
|
+
isOpen,
|
|
508
|
+
onOpenChange,
|
|
509
|
+
title,
|
|
510
|
+
trailingActions,
|
|
318
511
|
children
|
|
319
512
|
}) {
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
513
|
+
const id = useId();
|
|
514
|
+
const labelId = `label-${id}`;
|
|
515
|
+
const contentId = `content-${id}`;
|
|
516
|
+
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, count);
|
|
517
|
+
const handleClick = () => onOpenChange(!isOpen);
|
|
518
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
519
|
+
Box2,
|
|
323
520
|
{
|
|
324
521
|
sx: {
|
|
325
|
-
|
|
522
|
+
...contentPanelSectionHeaderSx,
|
|
523
|
+
alignItems: "center",
|
|
524
|
+
display: "flex",
|
|
525
|
+
flexDirection: "row",
|
|
526
|
+
width: "100%"
|
|
326
527
|
}
|
|
327
528
|
},
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
|
|
529
|
+
/* @__PURE__ */ React8.createElement(
|
|
530
|
+
ListItemButton,
|
|
330
531
|
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
532
|
+
id: labelId,
|
|
533
|
+
"aria-controls": contentId,
|
|
534
|
+
"aria-expanded": isOpen,
|
|
535
|
+
"aria-label": sectionHeaderAriaLabel,
|
|
536
|
+
dense: true,
|
|
537
|
+
disableGutters: true,
|
|
538
|
+
disableRipple: true,
|
|
539
|
+
onClick: handleClick,
|
|
540
|
+
sx: sectionHeaderListItemButtonSx
|
|
541
|
+
},
|
|
542
|
+
/* @__PURE__ */ React8.createElement(Stack, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React8.createElement(Stack, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React8.createElement(
|
|
543
|
+
ListItemText2,
|
|
544
|
+
{
|
|
545
|
+
secondary: title,
|
|
546
|
+
secondaryTypographyProps: {
|
|
547
|
+
color: "text.primary",
|
|
548
|
+
fontWeight: "bold",
|
|
549
|
+
variant: "caption"
|
|
550
|
+
},
|
|
551
|
+
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
335
552
|
}
|
|
553
|
+
), /* @__PURE__ */ React8.createElement(Chip, { label: count, size: "tiny" })), /* @__PURE__ */ React8.createElement(CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
|
|
554
|
+
),
|
|
555
|
+
trailingActions && /* @__PURE__ */ React8.createElement(
|
|
556
|
+
Stack,
|
|
557
|
+
{
|
|
558
|
+
alignItems: "center",
|
|
559
|
+
direction: "row",
|
|
560
|
+
flexShrink: 0,
|
|
561
|
+
gap: contentPanelSectionHeaderTrailingGap,
|
|
562
|
+
sx: { marginInlineStart: 0.5 }
|
|
336
563
|
},
|
|
337
|
-
|
|
564
|
+
trailingActions
|
|
338
565
|
)
|
|
339
|
-
), /* @__PURE__ */
|
|
340
|
-
StyledListItemIcon,
|
|
341
|
-
{
|
|
342
|
-
size: "small",
|
|
343
|
-
sx: {
|
|
344
|
-
color: "inherit"
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
/* @__PURE__ */ React4.createElement(Icon, { fontSize: "small" })
|
|
348
|
-
), /* @__PURE__ */ React4.createElement(
|
|
349
|
-
ListItemText,
|
|
350
|
-
{
|
|
351
|
-
primaryTypographyProps: { variant: "subtitle2", component: "span" },
|
|
352
|
-
primary: label
|
|
353
|
-
}
|
|
354
|
-
)), /* @__PURE__ */ React4.createElement(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React4.createElement(List, { dense: true }, children)), /* @__PURE__ */ React4.createElement(Divider, { sx: { mt: 1 } }));
|
|
566
|
+
), /* @__PURE__ */ React8.createElement(Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React8.createElement(List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React8.createElement(Divider, null));
|
|
355
567
|
}
|
|
356
568
|
|
|
357
569
|
// src/components/panel/posts-list/error-state.tsx
|
|
358
|
-
import * as
|
|
570
|
+
import * as React9 from "react";
|
|
359
571
|
import { Error404TemplateIcon } from "@elementor/icons";
|
|
360
|
-
import { Box, Link, Typography as Typography2 } from "@elementor/ui";
|
|
361
|
-
import { __ as
|
|
572
|
+
import { Box as Box3, Link, Typography as Typography2 } from "@elementor/ui";
|
|
573
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
362
574
|
function ErrorState() {
|
|
363
|
-
return /* @__PURE__ */
|
|
364
|
-
|
|
575
|
+
return /* @__PURE__ */ React9.createElement(
|
|
576
|
+
Box3,
|
|
365
577
|
{
|
|
366
578
|
sx: {
|
|
367
579
|
display: "flex",
|
|
@@ -372,9 +584,9 @@ function ErrorState() {
|
|
|
372
584
|
gap: "16px"
|
|
373
585
|
}
|
|
374
586
|
},
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
|
|
587
|
+
/* @__PURE__ */ React9.createElement(Error404TemplateIcon, null),
|
|
588
|
+
/* @__PURE__ */ React9.createElement(
|
|
589
|
+
Box3,
|
|
378
590
|
{
|
|
379
591
|
sx: {
|
|
380
592
|
display: "flex",
|
|
@@ -384,19 +596,19 @@ function ErrorState() {
|
|
|
384
596
|
gap: "8px"
|
|
385
597
|
}
|
|
386
598
|
},
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ React9.createElement(Typography2, { variant: "body1", color: "text.primary" }, __5("We couldn\u2019t display your pages.", "elementor")),
|
|
600
|
+
/* @__PURE__ */ React9.createElement(Box3, null, /* @__PURE__ */ React9.createElement(Typography2, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __5("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React9.createElement(Typography2, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __5("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React9.createElement(Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
|
|
389
601
|
)
|
|
390
602
|
);
|
|
391
603
|
}
|
|
392
604
|
|
|
393
605
|
// src/components/panel/posts-list/post-list-item.tsx
|
|
394
|
-
import * as
|
|
606
|
+
import * as React22 from "react";
|
|
395
607
|
|
|
396
608
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
397
|
-
import * as
|
|
609
|
+
import * as React11 from "react";
|
|
398
610
|
import { __useNavigateToDocument as useNavigateToDocument } from "@elementor/editor-documents";
|
|
399
|
-
import { __ as
|
|
611
|
+
import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
400
612
|
|
|
401
613
|
// src/hooks/use-posts-actions.ts
|
|
402
614
|
import { useMutation, useQueryClient } from "@elementor/query";
|
|
@@ -428,7 +640,7 @@ function useRecentPosts() {
|
|
|
428
640
|
// src/hooks/use-posts-actions.ts
|
|
429
641
|
function usePostActions(postTypeSlug) {
|
|
430
642
|
const invalidatePosts = useInvalidatePosts(postTypeSlug);
|
|
431
|
-
const onSuccess = () => invalidatePosts(
|
|
643
|
+
const onSuccess = () => invalidatePosts();
|
|
432
644
|
const createPost = useMutation({
|
|
433
645
|
mutationFn: (newPost) => createRequest(postTypeSlug, newPost),
|
|
434
646
|
onSuccess
|
|
@@ -454,28 +666,69 @@ function usePostActions(postTypeSlug) {
|
|
|
454
666
|
}
|
|
455
667
|
function useInvalidatePosts(postTypeSlug) {
|
|
456
668
|
const queryClient = useQueryClient();
|
|
457
|
-
return (
|
|
458
|
-
const queryKey =
|
|
459
|
-
queryClient.invalidateQueries({ queryKey: recentPostsQueryKey }
|
|
460
|
-
return queryClient.invalidateQueries({ queryKey }
|
|
669
|
+
return () => {
|
|
670
|
+
const queryKey = postsQueryKeyBase(postTypeSlug);
|
|
671
|
+
queryClient.invalidateQueries({ queryKey: recentPostsQueryKey });
|
|
672
|
+
return queryClient.invalidateQueries({ queryKey });
|
|
461
673
|
};
|
|
462
674
|
}
|
|
463
675
|
|
|
464
676
|
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
465
|
-
import * as
|
|
466
|
-
import { useRef, useState as useState3 } from "react";
|
|
677
|
+
import * as React10 from "react";
|
|
678
|
+
import { useRef as useRef2, useState as useState3 } from "react";
|
|
467
679
|
import { XIcon } from "@elementor/icons";
|
|
468
|
-
import { Box as
|
|
469
|
-
import { __ as
|
|
680
|
+
import { Box as Box4, CircularProgress, IconButton as IconButton2, ListItem, ListItemText as ListItemText3 } from "@elementor/ui";
|
|
681
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
682
|
+
var EDIT_ROW_FOCUS_BORDER_WIDTH_PX = 2;
|
|
683
|
+
var EDIT_ROW_MIN_HEIGHT_PX = 36;
|
|
684
|
+
var editModeListItemButtonSx = {
|
|
685
|
+
...contentPanelListItemButtonSx,
|
|
686
|
+
alignItems: "center",
|
|
687
|
+
backgroundColor: "transparent",
|
|
688
|
+
boxSizing: "border-box",
|
|
689
|
+
minHeight: EDIT_ROW_MIN_HEIGHT_PX,
|
|
690
|
+
py: 0
|
|
691
|
+
};
|
|
692
|
+
var editRowIndicatorSx = (hasError) => ({
|
|
693
|
+
alignItems: "center",
|
|
694
|
+
border: `${EDIT_ROW_FOCUS_BORDER_WIDTH_PX}px solid`,
|
|
695
|
+
borderColor: hasError ? "error.main" : "secondary.main",
|
|
696
|
+
borderRadius: 0.5,
|
|
697
|
+
boxSizing: "border-box",
|
|
698
|
+
display: "flex",
|
|
699
|
+
flex: 1,
|
|
700
|
+
minHeight: 0,
|
|
701
|
+
minWidth: 0,
|
|
702
|
+
px: 1,
|
|
703
|
+
py: 0
|
|
704
|
+
});
|
|
705
|
+
var editRowInputSx = {
|
|
706
|
+
...contentPanelListRowTitleSx,
|
|
707
|
+
backgroundColor: "transparent",
|
|
708
|
+
border: 0,
|
|
709
|
+
color: "text.secondary",
|
|
710
|
+
flex: 1,
|
|
711
|
+
fontFamily: "inherit",
|
|
712
|
+
lineHeight: 1.25,
|
|
713
|
+
minWidth: 0,
|
|
714
|
+
outline: 0,
|
|
715
|
+
padding: 0,
|
|
716
|
+
width: "100%"
|
|
717
|
+
};
|
|
470
718
|
function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
719
|
+
const { resetEditMode } = usePostListContext();
|
|
471
720
|
const [title, setTitle] = useState3(postTitle);
|
|
472
721
|
const [touched, setTouched] = useState3(false);
|
|
473
722
|
const [inputError, setInputError] = useState3(null);
|
|
474
|
-
const closeButton =
|
|
723
|
+
const closeButton = useRef2();
|
|
475
724
|
const onBlur = (e) => {
|
|
476
725
|
if (closeButton.current === e.relatedTarget) {
|
|
477
726
|
return;
|
|
478
727
|
}
|
|
728
|
+
if (!touched) {
|
|
729
|
+
resetEditMode();
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
479
732
|
runCallback();
|
|
480
733
|
};
|
|
481
734
|
const onFormSubmit = (e) => {
|
|
@@ -497,31 +750,47 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
|
497
750
|
}
|
|
498
751
|
const value = e.target.value;
|
|
499
752
|
if (!validateInput(value)) {
|
|
500
|
-
setInputError(
|
|
753
|
+
setInputError(__6("Name is required", "elementor"));
|
|
501
754
|
} else {
|
|
502
755
|
setInputError(null);
|
|
503
756
|
}
|
|
504
757
|
setTitle(value);
|
|
505
758
|
};
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
|
|
759
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
760
|
+
ListItem,
|
|
508
761
|
{
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
762
|
+
disablePadding: true,
|
|
763
|
+
sx: contentPanelListRowPaddingSx,
|
|
764
|
+
secondaryAction: /* @__PURE__ */ React10.createElement(CloseButton, { isLoading, closeButton })
|
|
765
|
+
},
|
|
766
|
+
/* @__PURE__ */ React10.createElement(
|
|
767
|
+
Box4,
|
|
768
|
+
{
|
|
769
|
+
component: "form",
|
|
770
|
+
onSubmit: onFormSubmit,
|
|
771
|
+
sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
|
|
772
|
+
},
|
|
773
|
+
/* @__PURE__ */ React10.createElement(Box4, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React10.createElement(
|
|
774
|
+
Box4,
|
|
775
|
+
{
|
|
776
|
+
autoFocus: true,
|
|
777
|
+
"aria-invalid": !!inputError,
|
|
778
|
+
"aria-label": __6("Name", "elementor"),
|
|
779
|
+
component: "input",
|
|
780
|
+
disabled: isLoading,
|
|
781
|
+
onBlur,
|
|
782
|
+
onChange,
|
|
783
|
+
sx: editRowInputSx,
|
|
784
|
+
type: "text",
|
|
785
|
+
value: title
|
|
786
|
+
}
|
|
787
|
+
))
|
|
788
|
+
)
|
|
789
|
+
), inputError && /* @__PURE__ */ React10.createElement(ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React10.createElement(ListItemText3, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
|
|
521
790
|
}
|
|
522
791
|
function CloseButton({ isLoading, closeButton }) {
|
|
523
792
|
const { resetEditMode } = usePostListContext();
|
|
524
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React10.createElement(IconButton2, { size: "tiny", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React10.createElement(CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React10.createElement(XIcon, { fontSize: "tiny" }));
|
|
525
794
|
}
|
|
526
795
|
|
|
527
796
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
@@ -543,10 +812,15 @@ function ListItemCreate() {
|
|
|
543
812
|
resetEditMode();
|
|
544
813
|
}
|
|
545
814
|
};
|
|
546
|
-
|
|
815
|
+
const newItemLabel = sprintf2(
|
|
816
|
+
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
817
|
+
__7("New %s", "elementor"),
|
|
818
|
+
postTypesMap[type].labels.singular_name
|
|
819
|
+
);
|
|
820
|
+
return /* @__PURE__ */ React11.createElement(
|
|
547
821
|
EditModeTemplate,
|
|
548
822
|
{
|
|
549
|
-
postTitle:
|
|
823
|
+
postTitle: newItemLabel,
|
|
550
824
|
isLoading: createPost.isPending,
|
|
551
825
|
callback: createPostCallback
|
|
552
826
|
}
|
|
@@ -554,9 +828,9 @@ function ListItemCreate() {
|
|
|
554
828
|
}
|
|
555
829
|
|
|
556
830
|
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx
|
|
557
|
-
import * as
|
|
831
|
+
import * as React12 from "react";
|
|
558
832
|
import { __useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
|
|
559
|
-
import { __ as
|
|
833
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
560
834
|
function ListItemDuplicate() {
|
|
561
835
|
const { type, editMode, resetEditMode } = usePostListContext();
|
|
562
836
|
const navigateToDocument = useNavigateToDocument2();
|
|
@@ -578,10 +852,10 @@ function ListItemDuplicate() {
|
|
|
578
852
|
resetEditMode();
|
|
579
853
|
}
|
|
580
854
|
};
|
|
581
|
-
return /* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ React12.createElement(
|
|
582
856
|
EditModeTemplate,
|
|
583
857
|
{
|
|
584
|
-
postTitle: `${editMode.details.title} ${
|
|
858
|
+
postTitle: `${editMode.details.title} ${__8("copy", "elementor")}`,
|
|
585
859
|
isLoading: duplicatePost.isPending,
|
|
586
860
|
callback: duplicatePostCallback
|
|
587
861
|
}
|
|
@@ -589,7 +863,7 @@ function ListItemDuplicate() {
|
|
|
589
863
|
}
|
|
590
864
|
|
|
591
865
|
// src/components/panel/posts-list/list-items/list-item-rename.tsx
|
|
592
|
-
import * as
|
|
866
|
+
import * as React13 from "react";
|
|
593
867
|
import { __useActiveDocument as useActiveDocument } from "@elementor/editor-documents";
|
|
594
868
|
|
|
595
869
|
// src/hooks/use-rename-active-document.ts
|
|
@@ -640,45 +914,51 @@ function ListItemRename({ post }) {
|
|
|
640
914
|
resetEditMode();
|
|
641
915
|
}
|
|
642
916
|
};
|
|
643
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ React13.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
|
|
644
918
|
}
|
|
645
919
|
|
|
646
920
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
647
|
-
import * as
|
|
921
|
+
import * as React21 from "react";
|
|
648
922
|
import {
|
|
649
923
|
__useActiveDocument as useActiveDocument3,
|
|
650
924
|
__useNavigateToDocument as useNavigateToDocument3
|
|
651
925
|
} from "@elementor/editor-documents";
|
|
652
926
|
import { DotsVerticalIcon, HomeIcon as HomeIcon2 } from "@elementor/icons";
|
|
653
927
|
import {
|
|
654
|
-
bindMenu,
|
|
655
|
-
bindTrigger,
|
|
928
|
+
bindMenu as bindMenu2,
|
|
929
|
+
bindTrigger as bindTrigger2,
|
|
656
930
|
Divider as Divider3,
|
|
657
931
|
IconButton as IconButton3,
|
|
658
|
-
ListItem as
|
|
659
|
-
ListItemButton,
|
|
660
|
-
ListItemText as
|
|
661
|
-
Menu,
|
|
932
|
+
ListItem as ListItem2,
|
|
933
|
+
ListItemButton as ListItemButton2,
|
|
934
|
+
ListItemText as ListItemText5,
|
|
935
|
+
Menu as Menu2,
|
|
662
936
|
Tooltip,
|
|
663
937
|
Typography as Typography4,
|
|
664
|
-
usePopupState
|
|
938
|
+
usePopupState as usePopupState2
|
|
665
939
|
} from "@elementor/ui";
|
|
666
|
-
import { __ as
|
|
940
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
667
941
|
|
|
668
942
|
// src/components/shared/page-title-and-status.tsx
|
|
669
|
-
import * as
|
|
670
|
-
import { Box as
|
|
943
|
+
import * as React14 from "react";
|
|
944
|
+
import { Box as Box5, Typography as Typography3 } from "@elementor/ui";
|
|
945
|
+
|
|
946
|
+
// src/hooks/use-reverse-html-entities.ts
|
|
947
|
+
import { useMemo as useMemo2 } from "react";
|
|
948
|
+
|
|
949
|
+
// src/utils/post-title-plain.ts
|
|
950
|
+
function getPostTitlePlain(renderedTitle) {
|
|
951
|
+
if (typeof document === "undefined") {
|
|
952
|
+
return renderedTitle;
|
|
953
|
+
}
|
|
954
|
+
const textarea = document.createElement("textarea");
|
|
955
|
+
textarea.innerHTML = renderedTitle;
|
|
956
|
+
return textarea.value;
|
|
957
|
+
}
|
|
671
958
|
|
|
672
959
|
// src/hooks/use-reverse-html-entities.ts
|
|
673
|
-
import { useMemo } from "react";
|
|
674
960
|
function useReverseHtmlEntities(escapedHTML = "") {
|
|
675
|
-
return
|
|
676
|
-
const textarea = document.createElement("textarea");
|
|
677
|
-
textarea.innerHTML = escapedHTML;
|
|
678
|
-
const { value } = textarea;
|
|
679
|
-
textarea.remove();
|
|
680
|
-
return value;
|
|
681
|
-
}, [escapedHTML]);
|
|
961
|
+
return useMemo2(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
|
|
682
962
|
}
|
|
683
963
|
|
|
684
964
|
// src/components/shared/page-title-and-status.tsx
|
|
@@ -686,13 +966,14 @@ var PageStatus = ({ status }) => {
|
|
|
686
966
|
if ("publish" === status) {
|
|
687
967
|
return null;
|
|
688
968
|
}
|
|
689
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ React14.createElement(
|
|
690
970
|
Typography3,
|
|
691
971
|
{
|
|
692
972
|
component: "span",
|
|
693
973
|
variant: "body2",
|
|
694
974
|
color: "text.secondary",
|
|
695
975
|
sx: {
|
|
976
|
+
...contentPanelListRowTitleSx,
|
|
696
977
|
textTransform: "capitalize",
|
|
697
978
|
fontStyle: "italic",
|
|
698
979
|
whiteSpace: "nowrap",
|
|
@@ -706,7 +987,7 @@ var PageStatus = ({ status }) => {
|
|
|
706
987
|
};
|
|
707
988
|
var PageTitle = ({ title }) => {
|
|
708
989
|
const modifiedTitle = useReverseHtmlEntities(title);
|
|
709
|
-
return /* @__PURE__ */
|
|
990
|
+
return /* @__PURE__ */ React14.createElement(
|
|
710
991
|
Typography3,
|
|
711
992
|
{
|
|
712
993
|
component: "span",
|
|
@@ -714,6 +995,7 @@ var PageTitle = ({ title }) => {
|
|
|
714
995
|
color: "text.secondary",
|
|
715
996
|
noWrap: true,
|
|
716
997
|
sx: {
|
|
998
|
+
...contentPanelListRowTitleSx,
|
|
717
999
|
flexBasis: "auto"
|
|
718
1000
|
}
|
|
719
1001
|
},
|
|
@@ -721,16 +1003,16 @@ var PageTitle = ({ title }) => {
|
|
|
721
1003
|
);
|
|
722
1004
|
};
|
|
723
1005
|
function PageTitleAndStatus({ title, status }) {
|
|
724
|
-
return /* @__PURE__ */
|
|
1006
|
+
return /* @__PURE__ */ React14.createElement(Box5, { display: "flex" }, /* @__PURE__ */ React14.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ React14.createElement(PageStatus, { status }));
|
|
725
1007
|
}
|
|
726
1008
|
|
|
727
1009
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
728
|
-
import * as
|
|
1010
|
+
import * as React16 from "react";
|
|
729
1011
|
import { useState as useState4 } from "react";
|
|
730
1012
|
import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
|
|
731
1013
|
import { TrashIcon } from "@elementor/icons";
|
|
732
1014
|
import {
|
|
733
|
-
Button
|
|
1015
|
+
Button,
|
|
734
1016
|
CircularProgress as CircularProgress2,
|
|
735
1017
|
Dialog,
|
|
736
1018
|
DialogActions,
|
|
@@ -739,21 +1021,21 @@ import {
|
|
|
739
1021
|
DialogTitle,
|
|
740
1022
|
Divider as Divider2
|
|
741
1023
|
} from "@elementor/ui";
|
|
742
|
-
import { __ as
|
|
1024
|
+
import { __ as __9, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
743
1025
|
|
|
744
1026
|
// src/components/panel/actions-menu/action-menu-item.tsx
|
|
745
|
-
import * as
|
|
746
|
-
import { ListItemIcon as ListItemIcon2, ListItemText as
|
|
1027
|
+
import * as React15 from "react";
|
|
1028
|
+
import { ListItemIcon as ListItemIcon2, ListItemText as ListItemText4, MenuItem as MenuItem2 } from "@elementor/ui";
|
|
747
1029
|
function ActionMenuItem({ title, icon: Icon, MenuItemProps }) {
|
|
748
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React15.createElement(MenuItem2, { ...MenuItemProps }, /* @__PURE__ */ React15.createElement(
|
|
749
1031
|
ListItemIcon2,
|
|
750
1032
|
{
|
|
751
1033
|
sx: {
|
|
752
1034
|
color: "inherit"
|
|
753
1035
|
}
|
|
754
1036
|
},
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
), /* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ React15.createElement(Icon, null)
|
|
1038
|
+
), /* @__PURE__ */ React15.createElement(ListItemText4, { primary: title }));
|
|
757
1039
|
}
|
|
758
1040
|
|
|
759
1041
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
@@ -763,10 +1045,10 @@ function Delete({ post }) {
|
|
|
763
1045
|
const isPostActive = activeDocument?.id === post.id;
|
|
764
1046
|
const userCanDelete = post.user_can.delete;
|
|
765
1047
|
const isDisabled = !userCanDelete || post.isHome || isPostActive;
|
|
766
|
-
return /* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
|
|
767
1049
|
ActionMenuItem,
|
|
768
1050
|
{
|
|
769
|
-
title:
|
|
1051
|
+
title: __9("Delete", "elementor"),
|
|
770
1052
|
icon: TrashIcon,
|
|
771
1053
|
MenuItemProps: {
|
|
772
1054
|
disabled: isDisabled,
|
|
@@ -774,7 +1056,7 @@ function Delete({ post }) {
|
|
|
774
1056
|
sx: { "&:hover": { color: "error.main" } }
|
|
775
1057
|
}
|
|
776
1058
|
}
|
|
777
|
-
), isDialogOpen && /* @__PURE__ */
|
|
1059
|
+
), isDialogOpen && /* @__PURE__ */ React16.createElement(DeleteDialog, { post, setIsDialogOpen }));
|
|
778
1060
|
}
|
|
779
1061
|
function DeleteDialog({
|
|
780
1062
|
post,
|
|
@@ -783,7 +1065,14 @@ function DeleteDialog({
|
|
|
783
1065
|
const { type } = usePostListContext();
|
|
784
1066
|
const { deletePost } = usePostActions(type);
|
|
785
1067
|
const { setError } = usePostListContext();
|
|
786
|
-
const dialogTitle =
|
|
1068
|
+
const dialogTitle = sprintf3(__9('Delete "%s"?', "elementor"), post.title.rendered);
|
|
1069
|
+
const dialogBody = type === "post" ? __9(
|
|
1070
|
+
"The post and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1071
|
+
"elementor"
|
|
1072
|
+
) : __9(
|
|
1073
|
+
"The page and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1074
|
+
"elementor"
|
|
1075
|
+
);
|
|
787
1076
|
const deletePage = async () => {
|
|
788
1077
|
try {
|
|
789
1078
|
await deletePost.mutateAsync(post.id);
|
|
@@ -798,28 +1087,26 @@ function DeleteDialog({
|
|
|
798
1087
|
}
|
|
799
1088
|
setIsDialogOpen(false);
|
|
800
1089
|
};
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
|
|
803
|
-
"elementor"
|
|
804
|
-
))), /* @__PURE__ */ React12.createElement(DialogActions, null, /* @__PURE__ */ React12.createElement(
|
|
805
|
-
Button2,
|
|
1090
|
+
return /* @__PURE__ */ React16.createElement(Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React16.createElement(DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React16.createElement(Divider2, null), /* @__PURE__ */ React16.createElement(DialogContent, null, /* @__PURE__ */ React16.createElement(DialogContentText, null, dialogBody)), /* @__PURE__ */ React16.createElement(DialogActions, null, /* @__PURE__ */ React16.createElement(
|
|
1091
|
+
Button,
|
|
806
1092
|
{
|
|
807
1093
|
variant: "contained",
|
|
808
1094
|
color: "secondary",
|
|
809
1095
|
onClick: handleCancel,
|
|
810
1096
|
disabled: deletePost.isPending
|
|
811
1097
|
},
|
|
812
|
-
|
|
813
|
-
), /* @__PURE__ */
|
|
1098
|
+
__9("Cancel", "elementor")
|
|
1099
|
+
), /* @__PURE__ */ React16.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __9("Delete", "elementor") : /* @__PURE__ */ React16.createElement(CircularProgress2, null))));
|
|
814
1100
|
}
|
|
815
1101
|
|
|
816
1102
|
// src/components/panel/actions-menu/actions/duplicate.tsx
|
|
817
|
-
import * as
|
|
1103
|
+
import * as React17 from "react";
|
|
818
1104
|
import { CopyIcon } from "@elementor/icons";
|
|
819
|
-
import { __ as
|
|
1105
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
820
1106
|
function Duplicate({ post, popupState }) {
|
|
821
|
-
const { setEditMode } = usePostListContext();
|
|
1107
|
+
const { setEditMode, type } = usePostListContext();
|
|
822
1108
|
const { data: user } = useUser();
|
|
1109
|
+
const createCapability = getPostTypeCreateCapability(type);
|
|
823
1110
|
const onClick = () => {
|
|
824
1111
|
popupState.close();
|
|
825
1112
|
setEditMode({
|
|
@@ -830,11 +1117,11 @@ function Duplicate({ post, popupState }) {
|
|
|
830
1117
|
}
|
|
831
1118
|
});
|
|
832
1119
|
};
|
|
833
|
-
const isDisabled = !user?.capabilities?.
|
|
834
|
-
return /* @__PURE__ */
|
|
1120
|
+
const isDisabled = !user?.capabilities?.[createCapability];
|
|
1121
|
+
return /* @__PURE__ */ React17.createElement(
|
|
835
1122
|
ActionMenuItem,
|
|
836
1123
|
{
|
|
837
|
-
title:
|
|
1124
|
+
title: __10("Duplicate", "elementor"),
|
|
838
1125
|
icon: CopyIcon,
|
|
839
1126
|
MenuItemProps: {
|
|
840
1127
|
disabled: isDisabled,
|
|
@@ -845,15 +1132,15 @@ function Duplicate({ post, popupState }) {
|
|
|
845
1132
|
}
|
|
846
1133
|
|
|
847
1134
|
// src/components/panel/actions-menu/actions/rename.tsx
|
|
848
|
-
import * as
|
|
1135
|
+
import * as React18 from "react";
|
|
849
1136
|
import { EraseIcon } from "@elementor/icons";
|
|
850
|
-
import { __ as
|
|
1137
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
851
1138
|
function Rename({ post }) {
|
|
852
1139
|
const { setEditMode } = usePostListContext();
|
|
853
|
-
return /* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ React18.createElement(
|
|
854
1141
|
ActionMenuItem,
|
|
855
1142
|
{
|
|
856
|
-
title:
|
|
1143
|
+
title: __11("Rename", "elementor"),
|
|
857
1144
|
icon: EraseIcon,
|
|
858
1145
|
MenuItemProps: {
|
|
859
1146
|
disabled: !post.user_can.edit,
|
|
@@ -871,10 +1158,10 @@ function Rename({ post }) {
|
|
|
871
1158
|
}
|
|
872
1159
|
|
|
873
1160
|
// src/components/panel/actions-menu/actions/set-home.tsx
|
|
874
|
-
import * as
|
|
1161
|
+
import * as React19 from "react";
|
|
875
1162
|
import { HomeIcon } from "@elementor/icons";
|
|
876
1163
|
import { CircularProgress as CircularProgress3 } from "@elementor/ui";
|
|
877
|
-
import { __ as
|
|
1164
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
878
1165
|
|
|
879
1166
|
// src/hooks/use-homepage-actions.ts
|
|
880
1167
|
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@elementor/query";
|
|
@@ -913,10 +1200,10 @@ function SetHome({ post, closeMenu }) {
|
|
|
913
1200
|
const isPostPublished = post.status === "publish";
|
|
914
1201
|
const isPostHomepage = !!post.isHome;
|
|
915
1202
|
const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending;
|
|
916
|
-
return /* @__PURE__ */
|
|
1203
|
+
return /* @__PURE__ */ React19.createElement(
|
|
917
1204
|
ActionMenuItem,
|
|
918
1205
|
{
|
|
919
|
-
title:
|
|
1206
|
+
title: __12("Set as homepage", "elementor"),
|
|
920
1207
|
icon: !updateSettingsMutation.isPending ? HomeIcon : CircularProgress3,
|
|
921
1208
|
MenuItemProps: {
|
|
922
1209
|
disabled: isDisabled,
|
|
@@ -927,13 +1214,13 @@ function SetHome({ post, closeMenu }) {
|
|
|
927
1214
|
}
|
|
928
1215
|
|
|
929
1216
|
// src/components/panel/actions-menu/actions/view.tsx
|
|
930
|
-
import * as
|
|
1217
|
+
import * as React20 from "react";
|
|
931
1218
|
import { EyeIcon } from "@elementor/icons";
|
|
932
|
-
import { __ as
|
|
1219
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
933
1220
|
function View({ post }) {
|
|
934
1221
|
const { type } = usePostListContext();
|
|
935
|
-
const title =
|
|
936
|
-
return /* @__PURE__ */
|
|
1222
|
+
const title = __13("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
|
|
1223
|
+
return /* @__PURE__ */ React20.createElement(
|
|
937
1224
|
ActionMenuItem,
|
|
938
1225
|
{
|
|
939
1226
|
title,
|
|
@@ -948,15 +1235,16 @@ function View({ post }) {
|
|
|
948
1235
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
949
1236
|
var DisabledPostTooltip = ({ children, isDisabled }) => {
|
|
950
1237
|
if (isDisabled) {
|
|
951
|
-
const title = /* @__PURE__ */
|
|
952
|
-
return /* @__PURE__ */
|
|
1238
|
+
const title = /* @__PURE__ */ React21.createElement(Typography4, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ React21.createElement("br", null), "To edit it directly, contact the site owner");
|
|
1239
|
+
return /* @__PURE__ */ React21.createElement(Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React21.createElement("span", null, children));
|
|
953
1240
|
}
|
|
954
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
|
|
955
1242
|
};
|
|
956
1243
|
function ListItemView({ post }) {
|
|
1244
|
+
const { type } = usePostListContext();
|
|
957
1245
|
const activeDocument = useActiveDocument3();
|
|
958
1246
|
const navigateToDocument = useNavigateToDocument3();
|
|
959
|
-
const popupState =
|
|
1247
|
+
const popupState = usePopupState2({
|
|
960
1248
|
variant: "popover",
|
|
961
1249
|
popupId: "post-actions",
|
|
962
1250
|
disableAutoFocus: true
|
|
@@ -965,40 +1253,56 @@ function ListItemView({ post }) {
|
|
|
965
1253
|
const status = isActive ? activeDocument?.status.value : post.status;
|
|
966
1254
|
const title = isActive ? activeDocument?.title : post.title.rendered;
|
|
967
1255
|
const isDisabled = !post.user_can.edit;
|
|
968
|
-
|
|
969
|
-
|
|
1256
|
+
const menuTriggerProps = bindTrigger2(popupState);
|
|
1257
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ React21.createElement(
|
|
1258
|
+
ListItem2,
|
|
970
1259
|
{
|
|
971
1260
|
disablePadding: true,
|
|
972
|
-
|
|
1261
|
+
sx: contentPanelListRowPaddingSx,
|
|
1262
|
+
secondaryAction: /* @__PURE__ */ React21.createElement(
|
|
1263
|
+
IconButton3,
|
|
1264
|
+
{
|
|
1265
|
+
"aria-label": __14("More actions", "elementor"),
|
|
1266
|
+
size: "tiny",
|
|
1267
|
+
...menuTriggerProps,
|
|
1268
|
+
onClick: (event) => {
|
|
1269
|
+
event.stopPropagation();
|
|
1270
|
+
menuTriggerProps.onClick?.(event);
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
/* @__PURE__ */ React21.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1274
|
+
)
|
|
973
1275
|
},
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
|
|
1276
|
+
/* @__PURE__ */ React21.createElement(
|
|
1277
|
+
ListItemButton2,
|
|
976
1278
|
{
|
|
977
|
-
|
|
1279
|
+
dense: true,
|
|
1280
|
+
disableGutters: true,
|
|
978
1281
|
disabled: isDisabled,
|
|
979
1282
|
onClick: () => {
|
|
980
1283
|
if (!isActive) {
|
|
981
1284
|
navigateToDocument(post.id);
|
|
982
1285
|
}
|
|
983
1286
|
},
|
|
984
|
-
|
|
1287
|
+
selected: isActive,
|
|
1288
|
+
shape: "rounded",
|
|
1289
|
+
sx: contentPanelListItemButtonSx
|
|
985
1290
|
},
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
post.isHome && /* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ React21.createElement(ListItemText5, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React21.createElement(PageTitleAndStatus, { title, status })),
|
|
1292
|
+
post.isHome && /* @__PURE__ */ React21.createElement(HomeIcon2, { titleAccess: __14("Homepage", "elementor"), color: "disabled" })
|
|
988
1293
|
)
|
|
989
|
-
)), /* @__PURE__ */
|
|
990
|
-
|
|
1294
|
+
)), /* @__PURE__ */ React21.createElement(
|
|
1295
|
+
Menu2,
|
|
991
1296
|
{
|
|
992
1297
|
PaperProps: { sx: { mt: 2, width: 200 } },
|
|
993
1298
|
MenuListProps: { dense: true },
|
|
994
|
-
...
|
|
1299
|
+
...bindMenu2(popupState)
|
|
995
1300
|
},
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */ React17.createElement(SetHome, { post, closeMenu: () => popupState.close() })
|
|
1301
|
+
/* @__PURE__ */ React21.createElement(Rename, { post }),
|
|
1302
|
+
/* @__PURE__ */ React21.createElement(Duplicate, { post, popupState }),
|
|
1303
|
+
/* @__PURE__ */ React21.createElement(Delete, { post }),
|
|
1304
|
+
/* @__PURE__ */ React21.createElement(View, { post }),
|
|
1305
|
+
type === "page" && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(Divider3, null), /* @__PURE__ */ React21.createElement(SetHome, { post, closeMenu: () => popupState.close() }))
|
|
1002
1306
|
));
|
|
1003
1307
|
}
|
|
1004
1308
|
|
|
@@ -1006,84 +1310,130 @@ function ListItemView({ post }) {
|
|
|
1006
1310
|
function PostListItem({ post }) {
|
|
1007
1311
|
const { editMode } = usePostListContext();
|
|
1008
1312
|
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
|
|
1009
|
-
return /* @__PURE__ */
|
|
1313
|
+
return /* @__PURE__ */ React22.createElement(ListItemRename, { post });
|
|
1010
1314
|
}
|
|
1011
1315
|
if ("create" === editMode.mode && !post) {
|
|
1012
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ React22.createElement(ListItemCreate, null);
|
|
1013
1317
|
}
|
|
1014
1318
|
if ("duplicate" === editMode.mode && !post) {
|
|
1015
|
-
return /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ React22.createElement(ListItemDuplicate, null);
|
|
1016
1320
|
}
|
|
1017
1321
|
if (!post) {
|
|
1018
1322
|
return null;
|
|
1019
1323
|
}
|
|
1020
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ React22.createElement(ListItemView, { post });
|
|
1021
1325
|
}
|
|
1022
1326
|
|
|
1023
1327
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
1328
|
+
var SEARCH_DEBOUNCE_MS = 300;
|
|
1024
1329
|
function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
1025
|
-
const { type, editMode } = usePostListContext();
|
|
1330
|
+
const { type, editMode, setEditMode } = usePostListContext();
|
|
1331
|
+
const { registerSection, unregisterSection, searchQuery } = useContentPanelCoordinator();
|
|
1332
|
+
const [isOpen, setIsOpen] = useState5(isOpenByDefault);
|
|
1333
|
+
const trimmedSearch = searchQuery.trim();
|
|
1334
|
+
const [debouncedSearch, setDebouncedSearch] = useState5(trimmedSearch);
|
|
1335
|
+
useEffect(() => {
|
|
1336
|
+
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
1337
|
+
return () => window.clearTimeout(handle);
|
|
1338
|
+
}, [trimmedSearch]);
|
|
1026
1339
|
const {
|
|
1027
1340
|
data: { posts, total },
|
|
1028
|
-
isLoading: postsLoading,
|
|
1029
1341
|
isError: postsError,
|
|
1342
|
+
isPending: postsPending,
|
|
1030
1343
|
fetchNextPage,
|
|
1031
1344
|
hasNextPage,
|
|
1032
1345
|
isFetchingNextPage
|
|
1033
|
-
} = usePosts(type);
|
|
1346
|
+
} = usePosts(type, debouncedSearch);
|
|
1034
1347
|
const { data: homepageId } = useHomepage();
|
|
1348
|
+
const isPageType = type === "page";
|
|
1349
|
+
useEffect(() => {
|
|
1350
|
+
registerSection(type, {
|
|
1351
|
+
setExpanded: setIsOpen,
|
|
1352
|
+
startCreate: () => setEditMode({ mode: "create", details: {} })
|
|
1353
|
+
});
|
|
1354
|
+
return () => unregisterSection(type);
|
|
1355
|
+
}, [registerSection, unregisterSection, type, setEditMode]);
|
|
1356
|
+
const filteredPosts = useMemo3(() => {
|
|
1357
|
+
if (!posts) {
|
|
1358
|
+
return [];
|
|
1359
|
+
}
|
|
1360
|
+
const mappedPosts = isPageType ? posts.map((post) => post.id === homepageId ? { ...post, isHome: true } : post) : posts;
|
|
1361
|
+
const sorted = isPageType ? [...mappedPosts].sort((a, b) => {
|
|
1362
|
+
if (a.id === homepageId) {
|
|
1363
|
+
return -1;
|
|
1364
|
+
}
|
|
1365
|
+
if (b.id === homepageId) {
|
|
1366
|
+
return 1;
|
|
1367
|
+
}
|
|
1368
|
+
return 0;
|
|
1369
|
+
}) : mappedPosts;
|
|
1370
|
+
return sorted;
|
|
1371
|
+
}, [posts, isPageType, homepageId]);
|
|
1372
|
+
useEffect(() => {
|
|
1373
|
+
if (debouncedSearch && filteredPosts.length > 0) {
|
|
1374
|
+
setIsOpen(true);
|
|
1375
|
+
}
|
|
1376
|
+
}, [debouncedSearch, filteredPosts.length]);
|
|
1035
1377
|
if (postsError) {
|
|
1036
|
-
return /* @__PURE__ */
|
|
1378
|
+
return /* @__PURE__ */ React23.createElement(ErrorState, null);
|
|
1037
1379
|
}
|
|
1038
|
-
if (!posts
|
|
1039
|
-
return /* @__PURE__ */
|
|
1380
|
+
if (postsPending && !posts?.length) {
|
|
1381
|
+
return /* @__PURE__ */ React23.createElement(Box6, { sx: { px: 2 } }, /* @__PURE__ */ React23.createElement(Box6, null, /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
1040
1382
|
}
|
|
1041
|
-
const
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1383
|
+
const displayCount = total;
|
|
1384
|
+
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
1385
|
+
const showNoResults = debouncedSearch && filteredPosts.length === 0;
|
|
1386
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1387
|
+
CollapsibleList,
|
|
1388
|
+
{
|
|
1389
|
+
count: displayCount,
|
|
1390
|
+
isOpen,
|
|
1391
|
+
onOpenChange: setIsOpen,
|
|
1392
|
+
title: sectionTitle,
|
|
1393
|
+
trailingActions: /* @__PURE__ */ React23.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
|
|
1394
|
+
},
|
|
1395
|
+
showNoResults && /* @__PURE__ */ React23.createElement(Box6, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React23.createElement(Typography5, { variant: "body2", color: "text.secondary" }, __15("No results found", "elementor"))),
|
|
1396
|
+
filteredPosts.map((post) => {
|
|
1397
|
+
return /* @__PURE__ */ React23.createElement(PostListItem, { key: post.id, post });
|
|
1398
|
+
}),
|
|
1399
|
+
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem, null),
|
|
1400
|
+
hasNextPage && /* @__PURE__ */ React23.createElement(
|
|
1401
|
+
Box6,
|
|
1402
|
+
{
|
|
1403
|
+
sx: {
|
|
1404
|
+
display: "flex",
|
|
1405
|
+
justifyContent: "center"
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1408
|
+
/* @__PURE__ */ React23.createElement(Button2, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(CircularProgress4, null) : __15("Load more", "elementor"))
|
|
1409
|
+
)
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
// src/components/panel/shell.tsx
|
|
1414
|
+
var Shell = () => {
|
|
1415
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState6(false);
|
|
1416
|
+
return /* @__PURE__ */ React24.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React24.createElement(Panel, null, /* @__PURE__ */ React24.createElement(PanelHeader, null, /* @__PURE__ */ React24.createElement(
|
|
1417
|
+
Stack2,
|
|
1059
1418
|
{
|
|
1060
|
-
display: "flex",
|
|
1061
|
-
justifyContent: "flex-end",
|
|
1062
1419
|
alignItems: "center",
|
|
1420
|
+
direction: "row",
|
|
1421
|
+
spacing: 0.5,
|
|
1063
1422
|
sx: {
|
|
1064
|
-
|
|
1065
|
-
px: 2
|
|
1423
|
+
...contentPanelHeaderStackSx
|
|
1066
1424
|
}
|
|
1067
1425
|
},
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
Box4,
|
|
1426
|
+
/* @__PURE__ */ React24.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __16("Site content", "elementor")),
|
|
1427
|
+
/* @__PURE__ */ React24.createElement(ContentPanelHeaderAdd, null)
|
|
1428
|
+
)), /* @__PURE__ */ React24.createElement(Divider4, null), /* @__PURE__ */ React24.createElement(PanelBody, null, /* @__PURE__ */ React24.createElement(ContentPanelSearch, null), /* @__PURE__ */ React24.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, panelPostTypeSlugs.map((postTypeSlug, index) => /* @__PURE__ */ React24.createElement(
|
|
1429
|
+
PostListContextProvider,
|
|
1073
1430
|
{
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1431
|
+
key: postTypeSlug,
|
|
1432
|
+
type: postTypeSlug,
|
|
1433
|
+
setError: () => setIsErrorSnackbarOpen(true)
|
|
1078
1434
|
},
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
))));
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
// src/components/panel/shell.tsx
|
|
1084
|
-
var Shell = () => {
|
|
1085
|
-
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState5(false);
|
|
1086
|
-
return /* @__PURE__ */ React20.createElement(Panel, null, /* @__PURE__ */ React20.createElement(PanelHeader, null, /* @__PURE__ */ React20.createElement(PanelHeaderTitle, null, __13("Pages", "elementor"))), /* @__PURE__ */ React20.createElement(PanelBody, null, /* @__PURE__ */ React20.createElement(PostListContextProvider, { type: "page", setError: () => setIsErrorSnackbarOpen(true) }, /* @__PURE__ */ React20.createElement(PostsCollapsibleList, { isOpenByDefault: true })), /* @__PURE__ */ React20.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) })));
|
|
1435
|
+
/* @__PURE__ */ React24.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 })
|
|
1436
|
+
))), /* @__PURE__ */ React24.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
|
|
1087
1437
|
};
|
|
1088
1438
|
var shell_default = Shell;
|
|
1089
1439
|
|
|
@@ -1094,39 +1444,39 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
|
|
|
1094
1444
|
});
|
|
1095
1445
|
|
|
1096
1446
|
// src/components/top-bar/recently-edited.tsx
|
|
1097
|
-
import * as
|
|
1447
|
+
import * as React29 from "react";
|
|
1098
1448
|
import {
|
|
1099
1449
|
__useActiveDocument as useActiveDocument4,
|
|
1100
1450
|
__useHostDocument as useHostDocument
|
|
1101
1451
|
} from "@elementor/editor-documents";
|
|
1102
|
-
import { ChevronDownIcon
|
|
1452
|
+
import { ChevronDownIcon } from "@elementor/icons";
|
|
1103
1453
|
import {
|
|
1104
|
-
bindMenu as
|
|
1105
|
-
bindTrigger as
|
|
1106
|
-
Button as
|
|
1107
|
-
Divider as
|
|
1108
|
-
ListItemText as
|
|
1454
|
+
bindMenu as bindMenu3,
|
|
1455
|
+
bindTrigger as bindTrigger3,
|
|
1456
|
+
Button as Button3,
|
|
1457
|
+
Divider as Divider5,
|
|
1458
|
+
ListItemText as ListItemText8,
|
|
1109
1459
|
ListSubheader,
|
|
1110
|
-
Menu as
|
|
1111
|
-
MenuItem as
|
|
1112
|
-
usePopupState as
|
|
1460
|
+
Menu as Menu3,
|
|
1461
|
+
MenuItem as MenuItem5,
|
|
1462
|
+
usePopupState as usePopupState3
|
|
1113
1463
|
} from "@elementor/ui";
|
|
1114
|
-
import { __ as
|
|
1464
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
1115
1465
|
|
|
1116
1466
|
// src/components/top-bar/create-post-list-item.tsx
|
|
1117
|
-
import * as
|
|
1467
|
+
import * as React25 from "react";
|
|
1118
1468
|
import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
|
|
1119
1469
|
import { useMixpanel } from "@elementor/events";
|
|
1120
1470
|
import { PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1121
|
-
import { CircularProgress as CircularProgress5, ListItemIcon as ListItemIcon3, ListItemText as
|
|
1122
|
-
import { __ as
|
|
1471
|
+
import { CircularProgress as CircularProgress5, ListItemIcon as ListItemIcon3, ListItemText as ListItemText6, MenuItem as MenuItem3 } from "@elementor/ui";
|
|
1472
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1123
1473
|
|
|
1124
1474
|
// src/hooks/use-create-page.ts
|
|
1125
|
-
import { useState as
|
|
1475
|
+
import { useState as useState7 } from "react";
|
|
1126
1476
|
import apiFetch5 from "@wordpress/api-fetch";
|
|
1127
1477
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
1128
1478
|
function useCreatePage() {
|
|
1129
|
-
const [isLoading, setIsLoading] =
|
|
1479
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1130
1480
|
return {
|
|
1131
1481
|
create: () => {
|
|
1132
1482
|
setIsLoading(true);
|
|
@@ -1149,8 +1499,8 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1149
1499
|
const navigateToDocument = useNavigateToDocument4();
|
|
1150
1500
|
const { data: user } = useUser();
|
|
1151
1501
|
const { dispatchEvent, config } = useMixpanel();
|
|
1152
|
-
return /* @__PURE__ */
|
|
1153
|
-
|
|
1502
|
+
return /* @__PURE__ */ React25.createElement(
|
|
1503
|
+
MenuItem3,
|
|
1154
1504
|
{
|
|
1155
1505
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
1156
1506
|
onClick: async () => {
|
|
@@ -1173,25 +1523,25 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1173
1523
|
},
|
|
1174
1524
|
...props
|
|
1175
1525
|
},
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
|
|
1526
|
+
/* @__PURE__ */ React25.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React25.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React25.createElement(PlusIcon2, { fontSize: "small" })),
|
|
1527
|
+
/* @__PURE__ */ React25.createElement(
|
|
1528
|
+
ListItemText6,
|
|
1179
1529
|
{
|
|
1180
1530
|
primaryTypographyProps: { variant: "body2" },
|
|
1181
|
-
primary:
|
|
1531
|
+
primary: __17("Add new page", "elementor")
|
|
1182
1532
|
}
|
|
1183
1533
|
)
|
|
1184
1534
|
);
|
|
1185
1535
|
}
|
|
1186
1536
|
|
|
1187
1537
|
// src/components/top-bar/indicator.tsx
|
|
1188
|
-
import * as
|
|
1189
|
-
import { Stack, Tooltip as BaseTooltip, Typography as
|
|
1538
|
+
import * as React26 from "react";
|
|
1539
|
+
import { Stack as Stack3, Tooltip as BaseTooltip, Typography as Typography6 } from "@elementor/ui";
|
|
1190
1540
|
function Indicator({ title, status }) {
|
|
1191
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ React26.createElement(Tooltip2, { title }, /* @__PURE__ */ React26.createElement(Stack3, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React26.createElement(Typography6, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React26.createElement(Typography6, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
1192
1542
|
}
|
|
1193
1543
|
function Tooltip2(props) {
|
|
1194
|
-
return /* @__PURE__ */
|
|
1544
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1195
1545
|
BaseTooltip,
|
|
1196
1546
|
{
|
|
1197
1547
|
PopperProps: {
|
|
@@ -1207,21 +1557,21 @@ function Tooltip2(props) {
|
|
|
1207
1557
|
}
|
|
1208
1558
|
|
|
1209
1559
|
// src/components/top-bar/post-list-item.tsx
|
|
1210
|
-
import * as
|
|
1560
|
+
import * as React28 from "react";
|
|
1211
1561
|
import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
|
|
1212
1562
|
import { useMixpanel as useMixpanel2 } from "@elementor/events";
|
|
1213
|
-
import { ListItemText as
|
|
1563
|
+
import { ListItemText as ListItemText7, MenuItem as MenuItem4 } from "@elementor/ui";
|
|
1214
1564
|
|
|
1215
1565
|
// src/components/top-bar/chip-doc-type.tsx
|
|
1216
|
-
import * as
|
|
1217
|
-
import { PostTypeIcon as
|
|
1218
|
-
import { Chip } from "@elementor/ui";
|
|
1566
|
+
import * as React27 from "react";
|
|
1567
|
+
import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
|
|
1568
|
+
import { Chip as Chip2 } from "@elementor/ui";
|
|
1219
1569
|
var iconsMap2 = getIconsMap();
|
|
1220
1570
|
function DocTypeChip({ postType, docType, label }) {
|
|
1221
1571
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
1222
|
-
const Icon = iconsMap2[docType] ||
|
|
1223
|
-
return /* @__PURE__ */
|
|
1224
|
-
|
|
1572
|
+
const Icon = iconsMap2[docType] || PostTypeIcon3;
|
|
1573
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1574
|
+
Chip2,
|
|
1225
1575
|
{
|
|
1226
1576
|
component: "span",
|
|
1227
1577
|
size: "small",
|
|
@@ -1229,7 +1579,7 @@ function DocTypeChip({ postType, docType, label }) {
|
|
|
1229
1579
|
label,
|
|
1230
1580
|
"data-value": docType,
|
|
1231
1581
|
color,
|
|
1232
|
-
icon: /* @__PURE__ */
|
|
1582
|
+
icon: /* @__PURE__ */ React27.createElement(Icon, null),
|
|
1233
1583
|
sx: { ml: 1, cursor: "inherit" }
|
|
1234
1584
|
}
|
|
1235
1585
|
);
|
|
@@ -1240,8 +1590,8 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1240
1590
|
const navigateToDocument = useNavigateToDocument5();
|
|
1241
1591
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
1242
1592
|
const { dispatchEvent, config } = useMixpanel2();
|
|
1243
|
-
return /* @__PURE__ */
|
|
1244
|
-
|
|
1593
|
+
return /* @__PURE__ */ React28.createElement(
|
|
1594
|
+
MenuItem4,
|
|
1245
1595
|
{
|
|
1246
1596
|
disabled: !post.user_can.edit,
|
|
1247
1597
|
onClick: async () => {
|
|
@@ -1263,15 +1613,15 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1263
1613
|
},
|
|
1264
1614
|
...props
|
|
1265
1615
|
},
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
|
|
1616
|
+
/* @__PURE__ */ React28.createElement(
|
|
1617
|
+
ListItemText7,
|
|
1268
1618
|
{
|
|
1269
1619
|
sx: { flexGrow: 0 },
|
|
1270
1620
|
primaryTypographyProps: { variant: "body2", noWrap: true },
|
|
1271
1621
|
primary: postTitle
|
|
1272
1622
|
}
|
|
1273
1623
|
),
|
|
1274
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ React28.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
|
|
1275
1625
|
);
|
|
1276
1626
|
}
|
|
1277
1627
|
|
|
@@ -1288,7 +1638,7 @@ function RecentlyEdited() {
|
|
|
1288
1638
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
1289
1639
|
};
|
|
1290
1640
|
const recentPosts = getRecentPosts();
|
|
1291
|
-
const popupState =
|
|
1641
|
+
const popupState = usePopupState3({
|
|
1292
1642
|
variant: "popover",
|
|
1293
1643
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
1294
1644
|
});
|
|
@@ -1296,13 +1646,13 @@ function RecentlyEdited() {
|
|
|
1296
1646
|
if (!document2) {
|
|
1297
1647
|
return null;
|
|
1298
1648
|
}
|
|
1299
|
-
const buttonProps =
|
|
1300
|
-
return /* @__PURE__ */
|
|
1301
|
-
|
|
1649
|
+
const buttonProps = bindTrigger3(popupState);
|
|
1650
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
1651
|
+
Button3,
|
|
1302
1652
|
{
|
|
1303
1653
|
color: "inherit",
|
|
1304
1654
|
size: "small",
|
|
1305
|
-
endIcon: /* @__PURE__ */
|
|
1655
|
+
endIcon: /* @__PURE__ */ React29.createElement(ChevronDownIcon, { fontSize: "small" }),
|
|
1306
1656
|
...buttonProps,
|
|
1307
1657
|
onClick: (e) => {
|
|
1308
1658
|
const extendedWindow = window;
|
|
@@ -1321,29 +1671,29 @@ function RecentlyEdited() {
|
|
|
1321
1671
|
buttonProps.onClick(e);
|
|
1322
1672
|
}
|
|
1323
1673
|
},
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
), /* @__PURE__ */
|
|
1326
|
-
|
|
1674
|
+
/* @__PURE__ */ React29.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
1675
|
+
), /* @__PURE__ */ React29.createElement(
|
|
1676
|
+
Menu3,
|
|
1327
1677
|
{
|
|
1328
1678
|
MenuListProps: {
|
|
1329
|
-
subheader: /* @__PURE__ */
|
|
1679
|
+
subheader: /* @__PURE__ */ React29.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __18("Recent", "elementor"))
|
|
1330
1680
|
},
|
|
1331
1681
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
1332
|
-
...
|
|
1682
|
+
...bindMenu3(popupState)
|
|
1333
1683
|
},
|
|
1334
|
-
recentPosts.map((post) => /* @__PURE__ */
|
|
1335
|
-
recentPosts.length === 0 && /* @__PURE__ */
|
|
1336
|
-
|
|
1684
|
+
recentPosts.map((post) => /* @__PURE__ */ React29.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
1685
|
+
recentPosts.length === 0 && /* @__PURE__ */ React29.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React29.createElement(
|
|
1686
|
+
ListItemText8,
|
|
1337
1687
|
{
|
|
1338
1688
|
primaryTypographyProps: {
|
|
1339
1689
|
variant: "caption",
|
|
1340
1690
|
fontStyle: "italic"
|
|
1341
1691
|
},
|
|
1342
|
-
primary:
|
|
1692
|
+
primary: __18("There are no other pages or templates on this site yet.", "elementor")
|
|
1343
1693
|
}
|
|
1344
1694
|
)),
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1695
|
+
/* @__PURE__ */ React29.createElement(Divider5, { disabled: recentPosts.length === 0 }),
|
|
1696
|
+
/* @__PURE__ */ React29.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
1347
1697
|
));
|
|
1348
1698
|
}
|
|
1349
1699
|
|
|
@@ -1355,12 +1705,12 @@ var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
|
|
|
1355
1705
|
|
|
1356
1706
|
// src/hooks/use-toggle-button-props.ts
|
|
1357
1707
|
import { PagesIcon } from "@elementor/icons";
|
|
1358
|
-
import { __ as
|
|
1708
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1359
1709
|
function useToggleButtonProps() {
|
|
1360
1710
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1361
1711
|
const { open, close } = usePanelActions();
|
|
1362
1712
|
return {
|
|
1363
|
-
title:
|
|
1713
|
+
title: __19("Site content", "elementor"),
|
|
1364
1714
|
icon: PagesIcon,
|
|
1365
1715
|
onClick: () => {
|
|
1366
1716
|
const extendedWindow = window;
|