@elementor/editor-site-navigation 4.5.0-1210 → 4.5.0-1211
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 +266 -106
- package/dist/index.mjs +245 -85
- package/package.json +10 -10
- package/src/components/panel/posts-list/collapsible-list.tsx +4 -1
- package/src/components/panel/posts-list/post-list-pagination-actions.tsx +76 -0
- package/src/components/panel/posts-list/posts-collapsible-list.tsx +61 -15
- package/src/hooks/use-post-list-pagination.ts +87 -0
package/dist/index.js
CHANGED
|
@@ -61,11 +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 React27 = __toESM(require("react"));
|
|
65
|
+
var import_react10 = require("react");
|
|
66
66
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
67
|
-
var
|
|
68
|
-
var
|
|
67
|
+
var import_ui17 = require("@elementor/ui");
|
|
68
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
69
69
|
|
|
70
70
|
// src/contexts/content-panel-coordinator.tsx
|
|
71
71
|
var React = __toESM(require("react"));
|
|
@@ -427,8 +427,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
427
427
|
var error_snackbar_default = ErrorSnackbar;
|
|
428
428
|
|
|
429
429
|
// src/components/panel/shell-panel-body-content.tsx
|
|
430
|
-
var
|
|
431
|
-
var
|
|
430
|
+
var React26 = __toESM(require("react"));
|
|
431
|
+
var import_ui16 = require("@elementor/ui");
|
|
432
432
|
|
|
433
433
|
// src/contexts/post-list-context.tsx
|
|
434
434
|
var React6 = __toESM(require("react"));
|
|
@@ -473,10 +473,10 @@ function usePostListContext() {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
476
|
-
var
|
|
477
|
-
var
|
|
478
|
-
var
|
|
479
|
-
var
|
|
476
|
+
var React24 = __toESM(require("react"));
|
|
477
|
+
var import_react9 = require("react");
|
|
478
|
+
var import_ui14 = require("@elementor/ui");
|
|
479
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
480
480
|
|
|
481
481
|
// src/hooks/use-homepage.ts
|
|
482
482
|
var import_query2 = require("@elementor/query");
|
|
@@ -505,6 +505,70 @@ function useHomepage() {
|
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
+
// src/hooks/use-post-list-pagination.ts
|
|
509
|
+
var import_react4 = require("react");
|
|
510
|
+
function usePostListPagination({
|
|
511
|
+
fetchNextPage,
|
|
512
|
+
hasNextPage,
|
|
513
|
+
isFetchingNextPage,
|
|
514
|
+
loadedCount,
|
|
515
|
+
resetKey,
|
|
516
|
+
totalCount
|
|
517
|
+
}) {
|
|
518
|
+
const [visibleCount, setVisibleCount] = (0, import_react4.useState)(POST_PER_PAGE);
|
|
519
|
+
const pendingVisibleTargetRef = (0, import_react4.useRef)(null);
|
|
520
|
+
(0, import_react4.useEffect)(() => {
|
|
521
|
+
setVisibleCount(POST_PER_PAGE);
|
|
522
|
+
pendingVisibleTargetRef.current = null;
|
|
523
|
+
}, [resetKey]);
|
|
524
|
+
(0, import_react4.useEffect)(() => {
|
|
525
|
+
const target = pendingVisibleTargetRef.current;
|
|
526
|
+
if (target === null) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (loadedCount >= target) {
|
|
530
|
+
setVisibleCount(target);
|
|
531
|
+
pendingVisibleTargetRef.current = null;
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (!isFetchingNextPage) {
|
|
535
|
+
setVisibleCount(Math.min(target, loadedCount));
|
|
536
|
+
pendingVisibleTargetRef.current = null;
|
|
537
|
+
}
|
|
538
|
+
}, [isFetchingNextPage, loadedCount]);
|
|
539
|
+
const canShowLess = visibleCount > POST_PER_PAGE;
|
|
540
|
+
const canLoadMore = visibleCount < loadedCount || hasNextPage;
|
|
541
|
+
const handleLoadMore = (0, import_react4.useCallback)(() => {
|
|
542
|
+
if (isFetchingNextPage || !canLoadMore) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const targetVisible = Math.min(visibleCount + POST_PER_PAGE, totalCount);
|
|
546
|
+
if (targetVisible <= loadedCount) {
|
|
547
|
+
setVisibleCount(Math.min(targetVisible, loadedCount));
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (hasNextPage) {
|
|
551
|
+
pendingVisibleTargetRef.current = targetVisible;
|
|
552
|
+
fetchNextPage();
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (visibleCount < loadedCount) {
|
|
556
|
+
setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
|
|
557
|
+
}
|
|
558
|
+
}, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
|
|
559
|
+
const handleShowLess = (0, import_react4.useCallback)(() => {
|
|
560
|
+
pendingVisibleTargetRef.current = null;
|
|
561
|
+
setVisibleCount(POST_PER_PAGE);
|
|
562
|
+
}, []);
|
|
563
|
+
return {
|
|
564
|
+
canLoadMore,
|
|
565
|
+
canShowLess,
|
|
566
|
+
handleLoadMore,
|
|
567
|
+
handleShowLess,
|
|
568
|
+
visibleCount
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
|
|
508
572
|
// src/hooks/use-posts.ts
|
|
509
573
|
var import_query3 = require("@elementor/query");
|
|
510
574
|
var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
|
|
@@ -567,7 +631,7 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
567
631
|
|
|
568
632
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
569
633
|
var React8 = __toESM(require("react"));
|
|
570
|
-
var
|
|
634
|
+
var import_react5 = require("react");
|
|
571
635
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
572
636
|
var import_ui5 = require("@elementor/ui");
|
|
573
637
|
var sectionHeaderListItemButtonSx = {
|
|
@@ -584,13 +648,14 @@ function getSectionHeaderAriaLabel(title, count) {
|
|
|
584
648
|
}
|
|
585
649
|
function CollapsibleList({
|
|
586
650
|
count,
|
|
651
|
+
headerRef,
|
|
587
652
|
isOpen,
|
|
588
653
|
onOpenChange,
|
|
589
654
|
title,
|
|
590
655
|
trailingActions,
|
|
591
656
|
children
|
|
592
657
|
}) {
|
|
593
|
-
const id = (0,
|
|
658
|
+
const id = (0, import_react5.useId)();
|
|
594
659
|
const labelId = `label-${id}`;
|
|
595
660
|
const contentId = `content-${id}`;
|
|
596
661
|
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, count);
|
|
@@ -609,6 +674,7 @@ function CollapsibleList({
|
|
|
609
674
|
/* @__PURE__ */ React8.createElement(
|
|
610
675
|
import_ui5.ListItemButton,
|
|
611
676
|
{
|
|
677
|
+
ref: headerRef,
|
|
612
678
|
id: labelId,
|
|
613
679
|
"aria-controls": contentId,
|
|
614
680
|
"aria-expanded": isOpen,
|
|
@@ -755,7 +821,7 @@ function useInvalidatePosts(postTypeSlug) {
|
|
|
755
821
|
|
|
756
822
|
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
757
823
|
var React10 = __toESM(require("react"));
|
|
758
|
-
var
|
|
824
|
+
var import_react6 = require("react");
|
|
759
825
|
var import_icons6 = require("@elementor/icons");
|
|
760
826
|
var import_ui7 = require("@elementor/ui");
|
|
761
827
|
var import_i18n6 = require("@wordpress/i18n");
|
|
@@ -797,10 +863,10 @@ var editRowInputSx = {
|
|
|
797
863
|
};
|
|
798
864
|
function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
799
865
|
const { resetEditMode } = usePostListContext();
|
|
800
|
-
const [title, setTitle] = (0,
|
|
801
|
-
const [touched, setTouched] = (0,
|
|
802
|
-
const [inputError, setInputError] = (0,
|
|
803
|
-
const closeButton = (0,
|
|
866
|
+
const [title, setTitle] = (0, import_react6.useState)(postTitle);
|
|
867
|
+
const [touched, setTouched] = (0, import_react6.useState)(false);
|
|
868
|
+
const [inputError, setInputError] = (0, import_react6.useState)(null);
|
|
869
|
+
const closeButton = (0, import_react6.useRef)();
|
|
804
870
|
const onBlur = (e) => {
|
|
805
871
|
if (closeButton.current === e.relatedTarget) {
|
|
806
872
|
return;
|
|
@@ -1010,7 +1076,7 @@ var import_ui8 = require("@elementor/ui");
|
|
|
1010
1076
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1011
1077
|
|
|
1012
1078
|
// src/hooks/use-reverse-html-entities.ts
|
|
1013
|
-
var
|
|
1079
|
+
var import_react7 = require("react");
|
|
1014
1080
|
|
|
1015
1081
|
// src/utils/post-title-plain.ts
|
|
1016
1082
|
function getPostTitlePlain(renderedTitle) {
|
|
@@ -1024,7 +1090,7 @@ function getPostTitlePlain(renderedTitle) {
|
|
|
1024
1090
|
|
|
1025
1091
|
// src/hooks/use-reverse-html-entities.ts
|
|
1026
1092
|
function useReverseHtmlEntities(escapedHTML = "") {
|
|
1027
|
-
return (0,
|
|
1093
|
+
return (0, import_react7.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
|
|
1028
1094
|
}
|
|
1029
1095
|
|
|
1030
1096
|
// src/components/shared/page-title-and-status.tsx
|
|
@@ -1114,7 +1180,7 @@ function PageTitleAndStatus({ title, status }) {
|
|
|
1114
1180
|
|
|
1115
1181
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
1116
1182
|
var React16 = __toESM(require("react"));
|
|
1117
|
-
var
|
|
1183
|
+
var import_react8 = require("react");
|
|
1118
1184
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
1119
1185
|
var import_icons7 = require("@elementor/icons");
|
|
1120
1186
|
var import_ui10 = require("@elementor/ui");
|
|
@@ -1137,7 +1203,7 @@ function ActionMenuItem({ title, icon: Icon, MenuItemProps }) {
|
|
|
1137
1203
|
|
|
1138
1204
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
1139
1205
|
function Delete({ post }) {
|
|
1140
|
-
const [isDialogOpen, setIsDialogOpen] = (0,
|
|
1206
|
+
const [isDialogOpen, setIsDialogOpen] = (0, import_react8.useState)(false);
|
|
1141
1207
|
const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
|
|
1142
1208
|
const isPostActive = activeDocument?.id === post.id;
|
|
1143
1209
|
const userCanDelete = post.user_can.delete;
|
|
@@ -1424,15 +1490,74 @@ function PostListItem({ post }) {
|
|
|
1424
1490
|
return /* @__PURE__ */ React22.createElement(ListItemView, { post });
|
|
1425
1491
|
}
|
|
1426
1492
|
|
|
1493
|
+
// src/components/panel/posts-list/post-list-pagination-actions.tsx
|
|
1494
|
+
var React23 = __toESM(require("react"));
|
|
1495
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1496
|
+
var import_ui13 = require("@elementor/ui");
|
|
1497
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1498
|
+
var listPaginationButtonProps = {
|
|
1499
|
+
color: "secondary",
|
|
1500
|
+
size: "small",
|
|
1501
|
+
variant: "outlined"
|
|
1502
|
+
};
|
|
1503
|
+
function PostListPaginationActions({
|
|
1504
|
+
canLoadMore,
|
|
1505
|
+
canShowLess,
|
|
1506
|
+
isLoadingMore,
|
|
1507
|
+
loadMoreButtonRef,
|
|
1508
|
+
onLoadMore,
|
|
1509
|
+
onShowLess
|
|
1510
|
+
}) {
|
|
1511
|
+
if (!canLoadMore && !canShowLess) {
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
const loadMoreLabel = (0, import_i18n16.__)("Load more", "elementor");
|
|
1515
|
+
const showLessLabel = (0, import_i18n16.__)("Show less", "elementor");
|
|
1516
|
+
const loadMoreButton = /* @__PURE__ */ React23.createElement(
|
|
1517
|
+
import_ui13.Button,
|
|
1518
|
+
{
|
|
1519
|
+
...listPaginationButtonProps,
|
|
1520
|
+
ref: loadMoreButtonRef,
|
|
1521
|
+
"aria-label": loadMoreLabel,
|
|
1522
|
+
disabled: isLoadingMore,
|
|
1523
|
+
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React23.createElement(import_editor_ui2.CollapseIcon, { open: false }),
|
|
1524
|
+
fullWidth: true,
|
|
1525
|
+
onClick: onLoadMore,
|
|
1526
|
+
sx: { flex: 1, my: 0.5 }
|
|
1527
|
+
},
|
|
1528
|
+
isLoadingMore ? /* @__PURE__ */ React23.createElement(import_ui13.CircularProgress, { size: 20 }) : loadMoreLabel
|
|
1529
|
+
);
|
|
1530
|
+
const showLessButton = /* @__PURE__ */ React23.createElement(
|
|
1531
|
+
import_ui13.Button,
|
|
1532
|
+
{
|
|
1533
|
+
...listPaginationButtonProps,
|
|
1534
|
+
"aria-label": showLessLabel,
|
|
1535
|
+
endIcon: /* @__PURE__ */ React23.createElement(import_editor_ui2.CollapseIcon, { open: true }),
|
|
1536
|
+
fullWidth: true,
|
|
1537
|
+
onClick: onShowLess,
|
|
1538
|
+
sx: { flex: 1, my: 0.5 }
|
|
1539
|
+
},
|
|
1540
|
+
showLessLabel
|
|
1541
|
+
);
|
|
1542
|
+
if (canShowLess && canLoadMore) {
|
|
1543
|
+
return /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React23.createElement(import_ui13.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
|
|
1544
|
+
}
|
|
1545
|
+
return /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1427
1548
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
1428
1549
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
1429
1550
|
function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
1430
1551
|
const { type, editMode, setEditMode } = usePostListContext();
|
|
1431
1552
|
const { registerSection, unregisterSection, searchQuery } = useContentPanelCoordinator();
|
|
1432
|
-
const [isOpen, setIsOpen] = (0,
|
|
1553
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(isOpenByDefault);
|
|
1433
1554
|
const trimmedSearch = searchQuery.trim();
|
|
1434
|
-
const [debouncedSearch, setDebouncedSearch] = (0,
|
|
1435
|
-
(0,
|
|
1555
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react9.useState)(trimmedSearch);
|
|
1556
|
+
const focusAfterShowLessRef = (0, import_react9.useRef)(false);
|
|
1557
|
+
const listTopRef = (0, import_react9.useRef)(null);
|
|
1558
|
+
const loadMoreButtonRef = (0, import_react9.useRef)(null);
|
|
1559
|
+
const sectionHeaderRef = (0, import_react9.useRef)(null);
|
|
1560
|
+
(0, import_react9.useEffect)(() => {
|
|
1436
1561
|
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
1437
1562
|
return () => window.clearTimeout(handle);
|
|
1438
1563
|
}, [trimmedSearch]);
|
|
@@ -1446,14 +1571,14 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1446
1571
|
} = usePosts(type, debouncedSearch);
|
|
1447
1572
|
const { data: homepageId } = useHomepage();
|
|
1448
1573
|
const isPageType = type === "page";
|
|
1449
|
-
(0,
|
|
1574
|
+
(0, import_react9.useEffect)(() => {
|
|
1450
1575
|
registerSection(type, {
|
|
1451
1576
|
setExpanded: setIsOpen,
|
|
1452
1577
|
startCreate: () => setEditMode({ mode: "create", details: {} })
|
|
1453
1578
|
});
|
|
1454
1579
|
return () => unregisterSection(type);
|
|
1455
1580
|
}, [registerSection, unregisterSection, type, setEditMode]);
|
|
1456
|
-
const filteredPosts = (0,
|
|
1581
|
+
const filteredPosts = (0, import_react9.useMemo)(() => {
|
|
1457
1582
|
if (!posts) {
|
|
1458
1583
|
return [];
|
|
1459
1584
|
}
|
|
@@ -1469,53 +1594,88 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1469
1594
|
}) : mappedPosts;
|
|
1470
1595
|
return sorted;
|
|
1471
1596
|
}, [posts, isPageType, homepageId]);
|
|
1472
|
-
|
|
1597
|
+
const pagination = usePostListPagination({
|
|
1598
|
+
fetchNextPage,
|
|
1599
|
+
hasNextPage,
|
|
1600
|
+
isFetchingNextPage,
|
|
1601
|
+
loadedCount: filteredPosts.length,
|
|
1602
|
+
resetKey: `${type}:${debouncedSearch}`,
|
|
1603
|
+
totalCount: total
|
|
1604
|
+
});
|
|
1605
|
+
const displayedPosts = (0, import_react9.useMemo)(
|
|
1606
|
+
() => filteredPosts.slice(0, pagination.visibleCount),
|
|
1607
|
+
[filteredPosts, pagination.visibleCount]
|
|
1608
|
+
);
|
|
1609
|
+
const handleShowLess = () => {
|
|
1610
|
+
focusAfterShowLessRef.current = true;
|
|
1611
|
+
pagination.handleShowLess();
|
|
1612
|
+
const listTop = listTopRef.current;
|
|
1613
|
+
if (listTop && typeof listTop.scrollIntoView === "function") {
|
|
1614
|
+
listTop.scrollIntoView({ block: "nearest" });
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
(0, import_react9.useEffect)(() => {
|
|
1618
|
+
if (!focusAfterShowLessRef.current) {
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
focusAfterShowLessRef.current = false;
|
|
1622
|
+
const loadMoreButton = loadMoreButtonRef.current;
|
|
1623
|
+
if (loadMoreButton) {
|
|
1624
|
+
loadMoreButton.focus();
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
sectionHeaderRef.current?.focus();
|
|
1628
|
+
}, [pagination.canLoadMore, pagination.visibleCount]);
|
|
1629
|
+
(0, import_react9.useEffect)(() => {
|
|
1473
1630
|
if (debouncedSearch && filteredPosts.length > 0) {
|
|
1474
1631
|
setIsOpen(true);
|
|
1475
1632
|
}
|
|
1476
1633
|
}, [debouncedSearch, filteredPosts.length]);
|
|
1477
1634
|
if (postsError) {
|
|
1478
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ React24.createElement(ErrorState, null);
|
|
1479
1636
|
}
|
|
1480
1637
|
if (postsPending && !posts?.length) {
|
|
1481
|
-
return /* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ React24.createElement(import_ui14.Box, { sx: { px: 2 } }, /* @__PURE__ */ React24.createElement(import_ui14.Box, null, /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
1482
1639
|
}
|
|
1483
1640
|
const displayCount = total;
|
|
1484
1641
|
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
1485
1642
|
const showNoResults = debouncedSearch && filteredPosts.length === 0;
|
|
1486
|
-
return /* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ React24.createElement(
|
|
1487
1644
|
CollapsibleList,
|
|
1488
1645
|
{
|
|
1489
1646
|
count: displayCount,
|
|
1647
|
+
headerRef: sectionHeaderRef,
|
|
1490
1648
|
isOpen,
|
|
1491
1649
|
onOpenChange: setIsOpen,
|
|
1492
1650
|
title: sectionTitle,
|
|
1493
|
-
trailingActions: /* @__PURE__ */
|
|
1651
|
+
trailingActions: /* @__PURE__ */ React24.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
|
|
1494
1652
|
},
|
|
1495
|
-
showNoResults && /* @__PURE__ */
|
|
1496
|
-
|
|
1497
|
-
|
|
1653
|
+
showNoResults && /* @__PURE__ */ React24.createElement(import_ui14.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React24.createElement(import_ui14.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n17.__)("No results found", "elementor"))),
|
|
1654
|
+
/* @__PURE__ */ React24.createElement(import_ui14.Box, { ref: listTopRef }),
|
|
1655
|
+
displayedPosts.map((post) => {
|
|
1656
|
+
return /* @__PURE__ */ React24.createElement(PostListItem, { key: post.id, post });
|
|
1498
1657
|
}),
|
|
1499
|
-
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */
|
|
1500
|
-
|
|
1501
|
-
|
|
1658
|
+
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React24.createElement(PostListItem, null),
|
|
1659
|
+
/* @__PURE__ */ React24.createElement(
|
|
1660
|
+
PostListPaginationActions,
|
|
1502
1661
|
{
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1662
|
+
canLoadMore: pagination.canLoadMore,
|
|
1663
|
+
canShowLess: pagination.canShowLess,
|
|
1664
|
+
isLoadingMore: isFetchingNextPage,
|
|
1665
|
+
loadMoreButtonRef,
|
|
1666
|
+
onLoadMore: pagination.handleLoadMore,
|
|
1667
|
+
onShowLess: handleShowLess
|
|
1668
|
+
}
|
|
1509
1669
|
)
|
|
1510
1670
|
);
|
|
1511
1671
|
}
|
|
1512
1672
|
|
|
1513
1673
|
// src/components/panel/user-load-error.tsx
|
|
1514
|
-
var
|
|
1515
|
-
var
|
|
1516
|
-
var
|
|
1674
|
+
var React25 = __toESM(require("react"));
|
|
1675
|
+
var import_ui15 = require("@elementor/ui");
|
|
1676
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
1517
1677
|
function UserLoadError() {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ React25.createElement(import_ui15.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React25.createElement(import_ui15.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n18.__)(
|
|
1519
1679
|
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
1520
1680
|
"elementor"
|
|
1521
1681
|
)));
|
|
@@ -1529,20 +1689,20 @@ function ShellPanelBodyContent({
|
|
|
1529
1689
|
showUserLoadError
|
|
1530
1690
|
}) {
|
|
1531
1691
|
if (isUserPending) {
|
|
1532
|
-
return /* @__PURE__ */
|
|
1692
|
+
return /* @__PURE__ */ React26.createElement(import_ui16.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React26.createElement(import_ui16.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React26.createElement(import_ui16.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
1533
1693
|
}
|
|
1534
1694
|
if (showUserLoadError) {
|
|
1535
|
-
return /* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ React26.createElement(UserLoadError, null);
|
|
1536
1696
|
}
|
|
1537
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ React26.createElement(import_ui16.List, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React26.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React26.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
|
|
1538
1698
|
}
|
|
1539
1699
|
|
|
1540
1700
|
// src/components/panel/shell.tsx
|
|
1541
1701
|
var Shell = () => {
|
|
1542
|
-
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0,
|
|
1702
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react10.useState)(false);
|
|
1543
1703
|
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
1544
|
-
return /* @__PURE__ */
|
|
1545
|
-
|
|
1704
|
+
return /* @__PURE__ */ React27.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React27.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React27.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React27.createElement(
|
|
1705
|
+
import_ui17.Stack,
|
|
1546
1706
|
{
|
|
1547
1707
|
alignItems: "center",
|
|
1548
1708
|
direction: "row",
|
|
@@ -1551,9 +1711,9 @@ var Shell = () => {
|
|
|
1551
1711
|
...contentPanelHeaderStackSx
|
|
1552
1712
|
}
|
|
1553
1713
|
},
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
)), /* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ React27.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n19.__)("Site content", "elementor")),
|
|
1715
|
+
/* @__PURE__ */ React27.createElement(ContentPanelHeaderAdd, null)
|
|
1716
|
+
)), /* @__PURE__ */ React27.createElement(import_ui17.Divider, null), /* @__PURE__ */ React27.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React27.createElement(ContentPanelSearch, null), /* @__PURE__ */ React27.createElement(
|
|
1557
1717
|
ShellPanelBodyContent,
|
|
1558
1718
|
{
|
|
1559
1719
|
accessiblePostTypes,
|
|
@@ -1561,7 +1721,7 @@ var Shell = () => {
|
|
|
1561
1721
|
onListError: () => setIsErrorSnackbarOpen(true),
|
|
1562
1722
|
showUserLoadError
|
|
1563
1723
|
}
|
|
1564
|
-
), /* @__PURE__ */
|
|
1724
|
+
), /* @__PURE__ */ React27.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
|
|
1565
1725
|
};
|
|
1566
1726
|
var shell_default = Shell;
|
|
1567
1727
|
|
|
@@ -1572,26 +1732,26 @@ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.creat
|
|
|
1572
1732
|
});
|
|
1573
1733
|
|
|
1574
1734
|
// src/components/top-bar/recently-edited.tsx
|
|
1575
|
-
var
|
|
1735
|
+
var React32 = __toESM(require("react"));
|
|
1576
1736
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
1577
1737
|
var import_icons15 = require("@elementor/icons");
|
|
1578
|
-
var
|
|
1579
|
-
var
|
|
1738
|
+
var import_ui22 = require("@elementor/ui");
|
|
1739
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
1580
1740
|
|
|
1581
1741
|
// src/components/top-bar/create-post-list-item.tsx
|
|
1582
|
-
var
|
|
1742
|
+
var React28 = __toESM(require("react"));
|
|
1583
1743
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1584
1744
|
var import_events = require("@elementor/events");
|
|
1585
1745
|
var import_icons13 = require("@elementor/icons");
|
|
1586
|
-
var
|
|
1587
|
-
var
|
|
1746
|
+
var import_ui18 = require("@elementor/ui");
|
|
1747
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1588
1748
|
|
|
1589
1749
|
// src/hooks/use-create-page.ts
|
|
1590
|
-
var
|
|
1750
|
+
var import_react11 = require("react");
|
|
1591
1751
|
var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
|
|
1592
1752
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
1593
1753
|
function useCreatePage() {
|
|
1594
|
-
const [isLoading, setIsLoading] = (0,
|
|
1754
|
+
const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
|
|
1595
1755
|
return {
|
|
1596
1756
|
create: () => {
|
|
1597
1757
|
setIsLoading(true);
|
|
@@ -1614,8 +1774,8 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1614
1774
|
const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
|
|
1615
1775
|
const { data: user } = useUser();
|
|
1616
1776
|
const { dispatchEvent, config } = (0, import_events.useMixpanel)();
|
|
1617
|
-
return /* @__PURE__ */
|
|
1618
|
-
|
|
1777
|
+
return /* @__PURE__ */ React28.createElement(
|
|
1778
|
+
import_ui18.MenuItem,
|
|
1619
1779
|
{
|
|
1620
1780
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
1621
1781
|
onClick: async () => {
|
|
@@ -1638,26 +1798,26 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1638
1798
|
},
|
|
1639
1799
|
...props
|
|
1640
1800
|
},
|
|
1641
|
-
/* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
|
|
1801
|
+
/* @__PURE__ */ React28.createElement(import_ui18.ListItemIcon, null, isLoading ? /* @__PURE__ */ React28.createElement(import_ui18.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React28.createElement(import_icons13.PlusIcon, { fontSize: "small" })),
|
|
1802
|
+
/* @__PURE__ */ React28.createElement(
|
|
1803
|
+
import_ui18.ListItemText,
|
|
1644
1804
|
{
|
|
1645
1805
|
primaryTypographyProps: { variant: "body2" },
|
|
1646
|
-
primary: (0,
|
|
1806
|
+
primary: (0, import_i18n20.__)("Add new page", "elementor")
|
|
1647
1807
|
}
|
|
1648
1808
|
)
|
|
1649
1809
|
);
|
|
1650
1810
|
}
|
|
1651
1811
|
|
|
1652
1812
|
// src/components/top-bar/indicator.tsx
|
|
1653
|
-
var
|
|
1654
|
-
var
|
|
1813
|
+
var React29 = __toESM(require("react"));
|
|
1814
|
+
var import_ui19 = require("@elementor/ui");
|
|
1655
1815
|
function Indicator({ title, status }) {
|
|
1656
|
-
return /* @__PURE__ */
|
|
1816
|
+
return /* @__PURE__ */ React29.createElement(Tooltip2, { title }, /* @__PURE__ */ React29.createElement(import_ui19.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React29.createElement(import_ui19.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React29.createElement(import_ui19.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
1657
1817
|
}
|
|
1658
1818
|
function Tooltip2(props) {
|
|
1659
|
-
return /* @__PURE__ */
|
|
1660
|
-
|
|
1819
|
+
return /* @__PURE__ */ React29.createElement(
|
|
1820
|
+
import_ui19.Tooltip,
|
|
1661
1821
|
{
|
|
1662
1822
|
PopperProps: {
|
|
1663
1823
|
sx: {
|
|
@@ -1672,21 +1832,21 @@ function Tooltip2(props) {
|
|
|
1672
1832
|
}
|
|
1673
1833
|
|
|
1674
1834
|
// src/components/top-bar/post-list-item.tsx
|
|
1675
|
-
var
|
|
1835
|
+
var React31 = __toESM(require("react"));
|
|
1676
1836
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
1677
1837
|
var import_events2 = require("@elementor/events");
|
|
1678
|
-
var
|
|
1838
|
+
var import_ui21 = require("@elementor/ui");
|
|
1679
1839
|
|
|
1680
1840
|
// src/components/top-bar/chip-doc-type.tsx
|
|
1681
|
-
var
|
|
1841
|
+
var React30 = __toESM(require("react"));
|
|
1682
1842
|
var import_icons14 = require("@elementor/icons");
|
|
1683
|
-
var
|
|
1843
|
+
var import_ui20 = require("@elementor/ui");
|
|
1684
1844
|
var iconsMap2 = getIconsMap();
|
|
1685
1845
|
function DocTypeChip({ postType, docType, label }) {
|
|
1686
1846
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
1687
1847
|
const Icon = iconsMap2[docType] || import_icons14.PostTypeIcon;
|
|
1688
|
-
return /* @__PURE__ */
|
|
1689
|
-
|
|
1848
|
+
return /* @__PURE__ */ React30.createElement(
|
|
1849
|
+
import_ui20.Chip,
|
|
1690
1850
|
{
|
|
1691
1851
|
component: "span",
|
|
1692
1852
|
size: "small",
|
|
@@ -1694,7 +1854,7 @@ function DocTypeChip({ postType, docType, label }) {
|
|
|
1694
1854
|
label,
|
|
1695
1855
|
"data-value": docType,
|
|
1696
1856
|
color,
|
|
1697
|
-
icon: /* @__PURE__ */
|
|
1857
|
+
icon: /* @__PURE__ */ React30.createElement(Icon, null),
|
|
1698
1858
|
sx: { ml: 1, cursor: "inherit" }
|
|
1699
1859
|
}
|
|
1700
1860
|
);
|
|
@@ -1705,8 +1865,8 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1705
1865
|
const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
|
|
1706
1866
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
1707
1867
|
const { dispatchEvent, config } = (0, import_events2.useMixpanel)();
|
|
1708
|
-
return /* @__PURE__ */
|
|
1709
|
-
|
|
1868
|
+
return /* @__PURE__ */ React31.createElement(
|
|
1869
|
+
import_ui21.MenuItem,
|
|
1710
1870
|
{
|
|
1711
1871
|
disabled: !post.user_can.edit,
|
|
1712
1872
|
onClick: async () => {
|
|
@@ -1728,15 +1888,15 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1728
1888
|
},
|
|
1729
1889
|
...props
|
|
1730
1890
|
},
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
|
|
1891
|
+
/* @__PURE__ */ React31.createElement(
|
|
1892
|
+
import_ui21.ListItemText,
|
|
1733
1893
|
{
|
|
1734
1894
|
sx: { flexGrow: 0 },
|
|
1735
1895
|
primaryTypographyProps: { variant: "body2", noWrap: true },
|
|
1736
1896
|
primary: postTitle
|
|
1737
1897
|
}
|
|
1738
1898
|
),
|
|
1739
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ React31.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
|
|
1740
1900
|
);
|
|
1741
1901
|
}
|
|
1742
1902
|
|
|
@@ -1753,7 +1913,7 @@ function RecentlyEdited() {
|
|
|
1753
1913
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
1754
1914
|
};
|
|
1755
1915
|
const recentPosts = getRecentPosts();
|
|
1756
|
-
const popupState = (0,
|
|
1916
|
+
const popupState = (0, import_ui22.usePopupState)({
|
|
1757
1917
|
variant: "popover",
|
|
1758
1918
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
1759
1919
|
});
|
|
@@ -1761,13 +1921,13 @@ function RecentlyEdited() {
|
|
|
1761
1921
|
if (!document2) {
|
|
1762
1922
|
return null;
|
|
1763
1923
|
}
|
|
1764
|
-
const buttonProps = (0,
|
|
1765
|
-
return /* @__PURE__ */
|
|
1766
|
-
|
|
1924
|
+
const buttonProps = (0, import_ui22.bindTrigger)(popupState);
|
|
1925
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(
|
|
1926
|
+
import_ui22.Button,
|
|
1767
1927
|
{
|
|
1768
1928
|
color: "inherit",
|
|
1769
1929
|
size: "small",
|
|
1770
|
-
endIcon: /* @__PURE__ */
|
|
1930
|
+
endIcon: /* @__PURE__ */ React32.createElement(import_icons15.ChevronDownIcon, { fontSize: "small" }),
|
|
1771
1931
|
...buttonProps,
|
|
1772
1932
|
onClick: (e) => {
|
|
1773
1933
|
const extendedWindow = window;
|
|
@@ -1786,40 +1946,40 @@ function RecentlyEdited() {
|
|
|
1786
1946
|
buttonProps.onClick(e);
|
|
1787
1947
|
}
|
|
1788
1948
|
},
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
), /* @__PURE__ */
|
|
1791
|
-
|
|
1949
|
+
/* @__PURE__ */ React32.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
1950
|
+
), /* @__PURE__ */ React32.createElement(
|
|
1951
|
+
import_ui22.Menu,
|
|
1792
1952
|
{
|
|
1793
1953
|
MenuListProps: {
|
|
1794
|
-
subheader: /* @__PURE__ */
|
|
1954
|
+
subheader: /* @__PURE__ */ React32.createElement(import_ui22.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n21.__)("Recent", "elementor"))
|
|
1795
1955
|
},
|
|
1796
1956
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
1797
|
-
...(0,
|
|
1957
|
+
...(0, import_ui22.bindMenu)(popupState)
|
|
1798
1958
|
},
|
|
1799
|
-
recentPosts.map((post) => /* @__PURE__ */
|
|
1800
|
-
recentPosts.length === 0 && /* @__PURE__ */
|
|
1801
|
-
|
|
1959
|
+
recentPosts.map((post) => /* @__PURE__ */ React32.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
1960
|
+
recentPosts.length === 0 && /* @__PURE__ */ React32.createElement(import_ui22.MenuItem, { disabled: true }, /* @__PURE__ */ React32.createElement(
|
|
1961
|
+
import_ui22.ListItemText,
|
|
1802
1962
|
{
|
|
1803
1963
|
primaryTypographyProps: {
|
|
1804
1964
|
variant: "caption",
|
|
1805
1965
|
fontStyle: "italic"
|
|
1806
1966
|
},
|
|
1807
|
-
primary: (0,
|
|
1967
|
+
primary: (0, import_i18n21.__)("There are no other pages or templates on this site yet.", "elementor")
|
|
1808
1968
|
}
|
|
1809
1969
|
)),
|
|
1810
|
-
/* @__PURE__ */
|
|
1811
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ React32.createElement(import_ui22.Divider, { disabled: recentPosts.length === 0 }),
|
|
1971
|
+
/* @__PURE__ */ React32.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
1812
1972
|
));
|
|
1813
1973
|
}
|
|
1814
1974
|
|
|
1815
1975
|
// src/hooks/use-toggle-button-props.ts
|
|
1816
1976
|
var import_icons16 = require("@elementor/icons");
|
|
1817
|
-
var
|
|
1977
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
1818
1978
|
function useToggleButtonProps() {
|
|
1819
1979
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1820
1980
|
const { open, close } = usePanelActions();
|
|
1821
1981
|
return {
|
|
1822
|
-
title: (0,
|
|
1982
|
+
title: (0, import_i18n22.__)("Site content", "elementor"),
|
|
1823
1983
|
icon: import_icons16.PagesIcon,
|
|
1824
1984
|
onClick: () => {
|
|
1825
1985
|
const extendedWindow = window;
|