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