@strapi/content-manager 0.0.0-next.36632203b17974c18103c138ffbef53a82e448c3 → 0.0.0-next.39bf1ab0d2e327b0a192d2f5adcb4182de865411
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/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DhwMhiRn.mjs → ComponentConfigurationPage-CzVt9QCC.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DhwMhiRn.mjs.map → ComponentConfigurationPage-CzVt9QCC.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js → ComponentConfigurationPage-DYq8aqos.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js.map → ComponentConfigurationPage-DYq8aqos.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-BG7rpPjL.js → EditConfigurationPage-C9IATpr0.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-BG7rpPjL.js.map → EditConfigurationPage-C9IATpr0.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs → EditConfigurationPage-CLDwrUv5.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs.map → EditConfigurationPage-CLDwrUv5.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BUtpHsMz.js → EditViewPage-Ch-uBvbv.js} +30 -7
- package/dist/_chunks/EditViewPage-Ch-uBvbv.js.map +1 -0
- package/dist/_chunks/{EditViewPage-hiwZg61J.mjs → EditViewPage-DtKM7Jgw.mjs} +29 -5
- package/dist/_chunks/EditViewPage-DtKM7Jgw.mjs.map +1 -0
- package/dist/_chunks/{Field-DEdug-Ll.js → Field-B9ADaInZ.js} +66 -67
- package/dist/_chunks/Field-B9ADaInZ.js.map +1 -0
- package/dist/_chunks/{Field-BQQLwyUs.mjs → Field-Bn1jgMeF.mjs} +65 -65
- package/dist/_chunks/Field-Bn1jgMeF.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DwJovCha.mjs → Form-BB5i9Pxl.mjs} +3 -3
- package/dist/_chunks/{Form-DwJovCha.mjs.map → Form-BB5i9Pxl.mjs.map} +1 -1
- package/dist/_chunks/{Form-v5pkY-X_.js → Form-C3kjKrPw.js} +5 -6
- package/dist/_chunks/{Form-v5pkY-X_.js.map → Form-C3kjKrPw.js.map} +1 -1
- package/dist/_chunks/{History-40apIShV.js → History-AwrK0-SA.js} +9 -57
- package/dist/_chunks/History-AwrK0-SA.js.map +1 -0
- package/dist/_chunks/{History-B9uJsxZl.mjs → History-Cw2Q7OQL.mjs} +9 -56
- package/dist/_chunks/History-Cw2Q7OQL.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CA4oi4Hj.mjs → ListConfigurationPage-B47JIu1e.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-B47JIu1e.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DAGbWDIL.js → ListConfigurationPage-CNTJ0DBm.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-CNTJ0DBm.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CjaHQ2_V.js → ListViewPage-Be_UEBar.js} +64 -53
- package/dist/_chunks/ListViewPage-Be_UEBar.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Ca8F1NL-.mjs → ListViewPage-DuvjX6ra.mjs} +63 -51
- package/dist/_chunks/ListViewPage-DuvjX6ra.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js → NoContentTypePage-B1J0KUCO.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js.map → NoContentTypePage-B1J0KUCO.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs → NoContentTypePage-C6M-Q0Tv.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs.map → NoContentTypePage-C6M-Q0Tv.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs → NoPermissionsPage-CAi3zCAD.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs.map → NoPermissionsPage-CAi3zCAD.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js → NoPermissionsPage-CN34TlEE.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js.map → NoPermissionsPage-CN34TlEE.js.map} +1 -1
- package/dist/_chunks/{Preview-DRJhcaIO.mjs → Preview-BrBRcL10.mjs} +99 -73
- package/dist/_chunks/Preview-BrBRcL10.mjs.map +1 -0
- package/dist/_chunks/{Preview-V8XOfrQf.js → Preview-DOqm5jcJ.js} +97 -72
- package/dist/_chunks/Preview-DOqm5jcJ.js.map +1 -0
- package/dist/_chunks/{Relations-DGWa9W2j.mjs → Relations-_K-HYOiM.mjs} +6 -8
- package/dist/_chunks/{Relations-DGWa9W2j.mjs.map → Relations-_K-HYOiM.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CGerEwji.js → Relations-xtKZHtTN.js} +7 -10
- package/dist/_chunks/{Relations-CGerEwji.js.map → Relations-xtKZHtTN.js.map} +1 -1
- package/dist/_chunks/{en-CHOp_xJv.js → en-BK8Xyl5I.js} +6 -3
- package/dist/_chunks/{en-CHOp_xJv.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-D_BMf0hT.mjs → en-Dtk_ot79.mjs} +6 -3
- package/dist/_chunks/{en-D_BMf0hT.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-tN1hpOMN.js → index-BlX-OdHL.js} +261 -188
- package/dist/_chunks/index-BlX-OdHL.js.map +1 -0
- package/dist/_chunks/{index-V8MWkDSd.mjs → index-tETMKK2G.mjs} +261 -187
- package/dist/_chunks/index-tETMKK2G.mjs.map +1 -0
- package/dist/_chunks/{layout-Bue_C6ui.mjs → layout-BaQBaz56.mjs} +4 -4
- package/dist/_chunks/{layout-Bue_C6ui.mjs.map → layout-BaQBaz56.mjs.map} +1 -1
- package/dist/_chunks/{layout-BzX903CL.js → layout-D8Sz3KxF.js} +5 -6
- package/dist/_chunks/{layout-BzX903CL.js.map → layout-D8Sz3KxF.js.map} +1 -1
- package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
- package/dist/_chunks/{relations-C4HcWYYJ.js → relations-CAbbX8Sa.js} +2 -2
- package/dist/_chunks/{relations-C4HcWYYJ.js.map → relations-CAbbX8Sa.js.map} +1 -1
- package/dist/_chunks/{relations-C8eyDiIO.mjs → relations-CsfmCqOU.mjs} +2 -2
- package/dist/_chunks/{relations-C8eyDiIO.mjs.map → relations-CsfmCqOU.mjs.map} +1 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/documents.d.ts +0 -3
- package/dist/server/index.js +74 -45
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +74 -44
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +2 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/_chunks/EditViewPage-BUtpHsMz.js.map +0 -1
- package/dist/_chunks/EditViewPage-hiwZg61J.mjs.map +0 -1
- package/dist/_chunks/Field-BQQLwyUs.mjs.map +0 -1
- package/dist/_chunks/Field-DEdug-Ll.js.map +0 -1
- package/dist/_chunks/History-40apIShV.js.map +0 -1
- package/dist/_chunks/History-B9uJsxZl.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CA4oi4Hj.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DAGbWDIL.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ca8F1NL-.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CjaHQ2_V.js.map +0 -1
- package/dist/_chunks/Preview-DRJhcaIO.mjs.map +0 -1
- package/dist/_chunks/Preview-V8XOfrQf.js.map +0 -1
- package/dist/_chunks/index-V8MWkDSd.mjs.map +0 -1
- package/dist/_chunks/index-tN1hpOMN.js.map +0 -1
@@ -3,24 +3,31 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
4
4
|
import * as React from "react";
|
5
5
|
import { lazy } from "react";
|
6
|
-
import {
|
6
|
+
import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
|
7
7
|
import mapValues from "lodash/fp/mapValues";
|
8
8
|
import { useIntl } from "react-intl";
|
9
9
|
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
|
+
import { styled } from "styled-components";
|
10
11
|
import * as yup from "yup";
|
11
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
12
14
|
import pipe from "lodash/fp/pipe";
|
13
15
|
import { intervalToDuration, isPast } from "date-fns";
|
14
|
-
import { styled } from "styled-components";
|
15
|
-
import { stringify } from "qs";
|
16
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
17
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
18
18
|
const v = glob[path];
|
19
19
|
if (v) {
|
20
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
21
21
|
}
|
22
22
|
return new Promise((_, reject) => {
|
23
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
24
|
+
reject.bind(
|
25
|
+
null,
|
26
|
+
new Error(
|
27
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
28
|
+
)
|
29
|
+
)
|
30
|
+
);
|
24
31
|
});
|
25
32
|
};
|
26
33
|
const PLUGIN_ID = "content-manager";
|
@@ -274,7 +281,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
274
281
|
url: `/content-manager/collection-types/${model}`,
|
275
282
|
method: "GET",
|
276
283
|
config: {
|
277
|
-
params
|
284
|
+
params: stringify(params, { encode: true })
|
278
285
|
}
|
279
286
|
}),
|
280
287
|
providesTags: (result, _error, arg) => {
|
@@ -453,8 +460,7 @@ const {
|
|
453
460
|
useUnpublishManyDocumentsMutation
|
454
461
|
} = documentApi;
|
455
462
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
463
|
+
if (!query) return query;
|
458
464
|
const { plugins: _, ...validQueryParams } = {
|
459
465
|
...query,
|
460
466
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +468,6 @@ const buildValidParams = (query) => {
|
|
462
468
|
{}
|
463
469
|
)
|
464
470
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
471
|
return validQueryParams;
|
469
472
|
};
|
470
473
|
const isBaseQueryError = (error) => {
|
@@ -1664,7 +1667,7 @@ const useDocumentActions = () => {
|
|
1664
1667
|
};
|
1665
1668
|
};
|
1666
1669
|
const ProtectedHistoryPage = React.lazy(
|
1667
|
-
() => import("./History-
|
1670
|
+
() => import("./History-Cw2Q7OQL.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1671
|
);
|
1669
1672
|
const routes$2 = [
|
1670
1673
|
{
|
@@ -1677,7 +1680,7 @@ const routes$2 = [
|
|
1677
1680
|
}
|
1678
1681
|
];
|
1679
1682
|
const ProtectedPreviewPage = React.lazy(
|
1680
|
-
() => import("./Preview-
|
1683
|
+
() => import("./Preview-BrBRcL10.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1681
1684
|
);
|
1682
1685
|
const routes$1 = [
|
1683
1686
|
{
|
@@ -1690,31 +1693,31 @@ const routes$1 = [
|
|
1690
1693
|
}
|
1691
1694
|
];
|
1692
1695
|
const ProtectedEditViewPage = lazy(
|
1693
|
-
() => import("./EditViewPage-
|
1696
|
+
() => import("./EditViewPage-DtKM7Jgw.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1694
1697
|
);
|
1695
1698
|
const ProtectedListViewPage = lazy(
|
1696
|
-
() => import("./ListViewPage-
|
1699
|
+
() => import("./ListViewPage-DuvjX6ra.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1697
1700
|
);
|
1698
1701
|
const ProtectedListConfiguration = lazy(
|
1699
|
-
() => import("./ListConfigurationPage-
|
1702
|
+
() => import("./ListConfigurationPage-B47JIu1e.mjs").then((mod) => ({
|
1700
1703
|
default: mod.ProtectedListConfiguration
|
1701
1704
|
}))
|
1702
1705
|
);
|
1703
1706
|
const ProtectedEditConfigurationPage = lazy(
|
1704
|
-
() => import("./EditConfigurationPage-
|
1707
|
+
() => import("./EditConfigurationPage-CLDwrUv5.mjs").then((mod) => ({
|
1705
1708
|
default: mod.ProtectedEditConfigurationPage
|
1706
1709
|
}))
|
1707
1710
|
);
|
1708
1711
|
const ProtectedComponentConfigurationPage = lazy(
|
1709
|
-
() => import("./ComponentConfigurationPage-
|
1712
|
+
() => import("./ComponentConfigurationPage-CzVt9QCC.mjs").then((mod) => ({
|
1710
1713
|
default: mod.ProtectedComponentConfigurationPage
|
1711
1714
|
}))
|
1712
1715
|
);
|
1713
1716
|
const NoPermissions = lazy(
|
1714
|
-
() => import("./NoPermissionsPage-
|
1717
|
+
() => import("./NoPermissionsPage-CAi3zCAD.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1715
1718
|
);
|
1716
1719
|
const NoContentType = lazy(
|
1717
|
-
() => import("./NoContentTypePage-
|
1720
|
+
() => import("./NoContentTypePage-C6M-Q0Tv.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1718
1721
|
);
|
1719
1722
|
const CollectionTypePages = () => {
|
1720
1723
|
const { collectionType } = useParams();
|
@@ -1726,7 +1729,7 @@ const CollectionTypePages = () => {
|
|
1726
1729
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1727
1730
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1728
1731
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1729
|
-
const LIST_PATH = `/content-manager
|
1732
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1730
1733
|
const routes = [
|
1731
1734
|
{
|
1732
1735
|
path: LIST_RELATIVE_PATH,
|
@@ -1859,6 +1862,11 @@ const DocumentActionButton = (action) => {
|
|
1859
1862
|
) : null
|
1860
1863
|
] });
|
1861
1864
|
};
|
1865
|
+
const MenuItem = styled(Menu.Item)`
|
1866
|
+
&:hover {
|
1867
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1868
|
+
}
|
1869
|
+
`;
|
1862
1870
|
const DocumentActionsMenu = ({
|
1863
1871
|
actions: actions2,
|
1864
1872
|
children,
|
@@ -1917,48 +1925,32 @@ const DocumentActionsMenu = ({
|
|
1917
1925
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1918
1926
|
actions2.map((action) => {
|
1919
1927
|
return /* @__PURE__ */ jsx(
|
1920
|
-
|
1928
|
+
MenuItem,
|
1921
1929
|
{
|
1922
1930
|
disabled: action.disabled,
|
1923
1931
|
onSelect: handleClick(action),
|
1924
1932
|
display: "block",
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
Flex,
|
1947
|
-
{
|
1948
|
-
alignItems: "center",
|
1949
|
-
background: "alternative100",
|
1950
|
-
borderStyle: "solid",
|
1951
|
-
borderColor: "alternative200",
|
1952
|
-
borderWidth: "1px",
|
1953
|
-
height: 5,
|
1954
|
-
paddingLeft: 2,
|
1955
|
-
paddingRight: 2,
|
1956
|
-
hasRadius: true,
|
1957
|
-
color: "alternative600",
|
1958
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1959
|
-
}
|
1960
|
-
)
|
1961
|
-
] })
|
1933
|
+
isVariantDanger: action.variant === "danger",
|
1934
|
+
isDisabled: action.disabled,
|
1935
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1936
|
+
Flex,
|
1937
|
+
{
|
1938
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1939
|
+
gap: 2,
|
1940
|
+
tag: "span",
|
1941
|
+
children: [
|
1942
|
+
/* @__PURE__ */ jsx(
|
1943
|
+
Flex,
|
1944
|
+
{
|
1945
|
+
tag: "span",
|
1946
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1947
|
+
children: action.icon
|
1948
|
+
}
|
1949
|
+
),
|
1950
|
+
action.label
|
1951
|
+
]
|
1952
|
+
}
|
1953
|
+
) })
|
1962
1954
|
},
|
1963
1955
|
action.id
|
1964
1956
|
);
|
@@ -2095,6 +2087,7 @@ const PublishAction$1 = ({
|
|
2095
2087
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2096
2088
|
const isListView = useMatch(LIST_PATH) !== null;
|
2097
2089
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2090
|
+
const { id } = useParams();
|
2098
2091
|
const { formatMessage } = useIntl();
|
2099
2092
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2100
2093
|
const { publish } = useDocumentActions();
|
@@ -2197,10 +2190,12 @@ const PublishAction$1 = ({
|
|
2197
2190
|
transformData(formValues)
|
2198
2191
|
);
|
2199
2192
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2193
|
+
if (id === "create") {
|
2194
|
+
navigate({
|
2195
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2196
|
+
search: rawQuery
|
2197
|
+
});
|
2198
|
+
}
|
2204
2199
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2205
2200
|
setErrors(formatValidationErrors(res.error));
|
2206
2201
|
}
|
@@ -2253,6 +2248,7 @@ const PublishAction$1 = ({
|
|
2253
2248
|
};
|
2254
2249
|
};
|
2255
2250
|
PublishAction$1.type = "publish";
|
2251
|
+
PublishAction$1.position = "panel";
|
2256
2252
|
const UpdateAction = ({
|
2257
2253
|
activeTab,
|
2258
2254
|
documentId,
|
@@ -2275,96 +2271,134 @@ const UpdateAction = ({
|
|
2275
2271
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2276
2272
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2277
2273
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
status: "draft"
|
2274
|
+
const handleUpdate = React.useCallback(async () => {
|
2275
|
+
setSubmitting(true);
|
2276
|
+
try {
|
2277
|
+
if (!modified) {
|
2278
|
+
return;
|
2279
|
+
}
|
2280
|
+
const { errors } = await validate(true, {
|
2281
|
+
status: "draft"
|
2282
|
+
});
|
2283
|
+
if (errors) {
|
2284
|
+
toggleNotification({
|
2285
|
+
type: "danger",
|
2286
|
+
message: formatMessage({
|
2287
|
+
id: "content-manager.validation.error",
|
2288
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2289
|
+
})
|
2295
2290
|
});
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
model,
|
2310
|
-
documentId: cloneMatch.params.origin,
|
2311
|
-
params
|
2312
|
-
},
|
2313
|
-
transformData(document)
|
2314
|
-
);
|
2315
|
-
if ("data" in res) {
|
2316
|
-
navigate(
|
2317
|
-
{
|
2318
|
-
pathname: `../${res.data.documentId}`,
|
2319
|
-
search: rawQuery
|
2320
|
-
},
|
2321
|
-
{ relative: "path" }
|
2322
|
-
);
|
2323
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2324
|
-
setErrors(formatValidationErrors(res.error));
|
2325
|
-
}
|
2326
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2327
|
-
const res = await update(
|
2291
|
+
return;
|
2292
|
+
}
|
2293
|
+
if (isCloning) {
|
2294
|
+
const res = await clone(
|
2295
|
+
{
|
2296
|
+
model,
|
2297
|
+
documentId: cloneMatch.params.origin,
|
2298
|
+
params
|
2299
|
+
},
|
2300
|
+
transformData(document)
|
2301
|
+
);
|
2302
|
+
if ("data" in res) {
|
2303
|
+
navigate(
|
2328
2304
|
{
|
2329
|
-
|
2330
|
-
|
2331
|
-
documentId,
|
2332
|
-
params
|
2305
|
+
pathname: `../${res.data.documentId}`,
|
2306
|
+
search: rawQuery
|
2333
2307
|
},
|
2334
|
-
|
2308
|
+
{ relative: "path" }
|
2335
2309
|
);
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2310
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2311
|
+
setErrors(formatValidationErrors(res.error));
|
2312
|
+
}
|
2313
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2314
|
+
const res = await update(
|
2315
|
+
{
|
2316
|
+
collectionType,
|
2317
|
+
model,
|
2318
|
+
documentId,
|
2319
|
+
params
|
2320
|
+
},
|
2321
|
+
transformData(document)
|
2322
|
+
);
|
2323
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2324
|
+
setErrors(formatValidationErrors(res.error));
|
2341
2325
|
} else {
|
2342
|
-
|
2326
|
+
resetForm();
|
2327
|
+
}
|
2328
|
+
} else {
|
2329
|
+
const res = await create(
|
2330
|
+
{
|
2331
|
+
model,
|
2332
|
+
params
|
2333
|
+
},
|
2334
|
+
transformData(document)
|
2335
|
+
);
|
2336
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2337
|
+
navigate(
|
2343
2338
|
{
|
2344
|
-
|
2345
|
-
|
2339
|
+
pathname: `../${res.data.documentId}`,
|
2340
|
+
search: rawQuery
|
2346
2341
|
},
|
2347
|
-
|
2342
|
+
{ replace: true, relative: "path" }
|
2348
2343
|
);
|
2349
|
-
|
2350
|
-
|
2351
|
-
{
|
2352
|
-
pathname: `../${res.data.documentId}`,
|
2353
|
-
search: rawQuery
|
2354
|
-
},
|
2355
|
-
{ replace: true, relative: "path" }
|
2356
|
-
);
|
2357
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2358
|
-
setErrors(formatValidationErrors(res.error));
|
2359
|
-
}
|
2344
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2345
|
+
setErrors(formatValidationErrors(res.error));
|
2360
2346
|
}
|
2361
|
-
} finally {
|
2362
|
-
setSubmitting(false);
|
2363
2347
|
}
|
2348
|
+
} finally {
|
2349
|
+
setSubmitting(false);
|
2364
2350
|
}
|
2351
|
+
}, [
|
2352
|
+
clone,
|
2353
|
+
cloneMatch?.params.origin,
|
2354
|
+
collectionType,
|
2355
|
+
create,
|
2356
|
+
document,
|
2357
|
+
documentId,
|
2358
|
+
formatMessage,
|
2359
|
+
formatValidationErrors,
|
2360
|
+
isCloning,
|
2361
|
+
model,
|
2362
|
+
modified,
|
2363
|
+
navigate,
|
2364
|
+
params,
|
2365
|
+
rawQuery,
|
2366
|
+
resetForm,
|
2367
|
+
setErrors,
|
2368
|
+
setSubmitting,
|
2369
|
+
toggleNotification,
|
2370
|
+
update,
|
2371
|
+
validate
|
2372
|
+
]);
|
2373
|
+
React.useEffect(() => {
|
2374
|
+
const handleKeyDown = (e) => {
|
2375
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2376
|
+
e.preventDefault();
|
2377
|
+
handleUpdate();
|
2378
|
+
}
|
2379
|
+
};
|
2380
|
+
window.addEventListener("keydown", handleKeyDown);
|
2381
|
+
return () => {
|
2382
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2383
|
+
};
|
2384
|
+
}, [handleUpdate]);
|
2385
|
+
return {
|
2386
|
+
/**
|
2387
|
+
* Disabled when:
|
2388
|
+
* - the form is submitting
|
2389
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2390
|
+
* - the active tab is the published tab
|
2391
|
+
*/
|
2392
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2393
|
+
label: formatMessage({
|
2394
|
+
id: "global.save",
|
2395
|
+
defaultMessage: "Save"
|
2396
|
+
}),
|
2397
|
+
onClick: handleUpdate
|
2365
2398
|
};
|
2366
2399
|
};
|
2367
2400
|
UpdateAction.type = "update";
|
2401
|
+
UpdateAction.position = "panel";
|
2368
2402
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2369
2403
|
KEEP: "keep",
|
2370
2404
|
DISCARD: "discard"
|
@@ -2487,6 +2521,7 @@ const UnpublishAction$1 = ({
|
|
2487
2521
|
};
|
2488
2522
|
};
|
2489
2523
|
UnpublishAction$1.type = "unpublish";
|
2524
|
+
UnpublishAction$1.position = "panel";
|
2490
2525
|
const DiscardAction = ({
|
2491
2526
|
activeTab,
|
2492
2527
|
documentId,
|
@@ -2537,6 +2572,7 @@ const DiscardAction = ({
|
|
2537
2572
|
};
|
2538
2573
|
};
|
2539
2574
|
DiscardAction.type = "discard";
|
2575
|
+
DiscardAction.position = "panel";
|
2540
2576
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2541
2577
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2542
2578
|
const RelativeTime = React.forwardRef(
|
@@ -2549,7 +2585,7 @@ const RelativeTime = React.forwardRef(
|
|
2549
2585
|
});
|
2550
2586
|
const unit = intervals.find((intervalUnit) => {
|
2551
2587
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2552
|
-
});
|
2588
|
+
}) ?? "seconds";
|
2553
2589
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2554
2590
|
const customInterval = customIntervals.find(
|
2555
2591
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2583,10 +2619,10 @@ const getDisplayName = ({
|
|
2583
2619
|
return email ?? "";
|
2584
2620
|
};
|
2585
2621
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2586
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2622
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2587
2623
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2588
2624
|
const { formatMessage } = useIntl();
|
2589
|
-
return /* @__PURE__ */ jsx(Status, { ...restProps,
|
2625
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2590
2626
|
id: `content-manager.containers.List.${status}`,
|
2591
2627
|
defaultMessage: capitalise(status)
|
2592
2628
|
}) }) });
|
@@ -2594,12 +2630,18 @@ const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
|
2594
2630
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2595
2631
|
const { formatMessage } = useIntl();
|
2596
2632
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2633
|
+
const params = useParams();
|
2597
2634
|
const title = isCreating ? formatMessage({
|
2598
2635
|
id: "content-manager.containers.edit.title.new",
|
2599
2636
|
defaultMessage: "Create an entry"
|
2600
2637
|
}) : documentTitle;
|
2601
2638
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2602
|
-
/* @__PURE__ */ jsx(
|
2639
|
+
/* @__PURE__ */ jsx(
|
2640
|
+
BackButton,
|
2641
|
+
{
|
2642
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2643
|
+
}
|
2644
|
+
),
|
2603
2645
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2604
2646
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2605
2647
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2650,7 +2692,7 @@ const HeaderToolbar = () => {
|
|
2650
2692
|
meta: isCloning ? void 0 : meta,
|
2651
2693
|
collectionType
|
2652
2694
|
},
|
2653
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2695
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2654
2696
|
children: (actions2) => {
|
2655
2697
|
const headerActions = actions2.filter((action) => {
|
2656
2698
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2858,6 +2900,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2858
2900
|
};
|
2859
2901
|
};
|
2860
2902
|
ConfigureTheViewAction.type = "configure-the-view";
|
2903
|
+
ConfigureTheViewAction.position = "header";
|
2861
2904
|
const EditTheModelAction = ({ model }) => {
|
2862
2905
|
const navigate = useNavigate();
|
2863
2906
|
const { formatMessage } = useIntl();
|
@@ -2874,6 +2917,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2874
2917
|
};
|
2875
2918
|
};
|
2876
2919
|
EditTheModelAction.type = "edit-the-model";
|
2920
|
+
EditTheModelAction.position = "header";
|
2877
2921
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2878
2922
|
const navigate = useNavigate();
|
2879
2923
|
const { formatMessage } = useIntl();
|
@@ -2947,6 +2991,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2947
2991
|
};
|
2948
2992
|
};
|
2949
2993
|
DeleteAction$1.type = "delete";
|
2994
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2950
2995
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2951
2996
|
const Panels = () => {
|
2952
2997
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -3009,7 +3054,7 @@ const ActionsPanelContent = () => {
|
|
3009
3054
|
DescriptionComponentRenderer,
|
3010
3055
|
{
|
3011
3056
|
props,
|
3012
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3057
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3013
3058
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
3014
3059
|
}
|
3015
3060
|
),
|
@@ -3286,18 +3331,10 @@ const SelectedEntriesTableContent = ({
|
|
3286
3331
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3287
3332
|
},
|
3288
3333
|
state: { from: pathname },
|
3289
|
-
label: formatMessage(
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
{
|
3294
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3295
|
-
defaultMessage: "item line {number}"
|
3296
|
-
},
|
3297
|
-
{ number: index2 + 1 }
|
3298
|
-
)
|
3299
|
-
}
|
3300
|
-
),
|
3334
|
+
label: formatMessage({
|
3335
|
+
id: "content-manager.bulk-publish.edit",
|
3336
|
+
defaultMessage: "Edit"
|
3337
|
+
}),
|
3301
3338
|
target: "_blank",
|
3302
3339
|
marginLeft: "auto",
|
3303
3340
|
variant: "ghost",
|
@@ -3471,8 +3508,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3471
3508
|
const refetchList = () => {
|
3472
3509
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3473
3510
|
};
|
3474
|
-
if (!showPublishButton)
|
3475
|
-
return null;
|
3511
|
+
if (!showPublishButton) return null;
|
3476
3512
|
return {
|
3477
3513
|
actionType: "publish",
|
3478
3514
|
variant: "tertiary",
|
@@ -3540,8 +3576,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3540
3576
|
selectRow([]);
|
3541
3577
|
}
|
3542
3578
|
};
|
3543
|
-
if (!hasDeletePermission)
|
3544
|
-
return null;
|
3579
|
+
if (!hasDeletePermission) return null;
|
3545
3580
|
return {
|
3546
3581
|
variant: "danger-light",
|
3547
3582
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3590,8 +3625,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3590
3625
|
}
|
3591
3626
|
};
|
3592
3627
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3593
|
-
if (!showUnpublishButton)
|
3594
|
-
return null;
|
3628
|
+
if (!showUnpublishButton) return null;
|
3595
3629
|
return {
|
3596
3630
|
variant: "tertiary",
|
3597
3631
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3696,7 +3730,7 @@ const TableActions = ({ document }) => {
|
|
3696
3730
|
DescriptionComponentRenderer,
|
3697
3731
|
{
|
3698
3732
|
props,
|
3699
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3733
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3700
3734
|
children: (actions2) => {
|
3701
3735
|
const tableRowActions = actions2.filter((action) => {
|
3702
3736
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3755,6 +3789,7 @@ const EditAction = ({ documentId }) => {
|
|
3755
3789
|
};
|
3756
3790
|
};
|
3757
3791
|
EditAction.type = "edit";
|
3792
|
+
EditAction.position = "table-row";
|
3758
3793
|
const StyledPencil = styled(Pencil)`
|
3759
3794
|
path {
|
3760
3795
|
fill: currentColor;
|
@@ -3831,6 +3866,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3831
3866
|
};
|
3832
3867
|
};
|
3833
3868
|
CloneAction.type = "clone";
|
3869
|
+
CloneAction.position = "table-row";
|
3834
3870
|
const StyledDuplicate = styled(Duplicate)`
|
3835
3871
|
path {
|
3836
3872
|
fill: currentColor;
|
@@ -3917,7 +3953,14 @@ class ContentManagerPlugin {
|
|
3917
3953
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3918
3954
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3919
3955
|
getBulkActions: () => this.bulkActions,
|
3920
|
-
getDocumentActions: () =>
|
3956
|
+
getDocumentActions: (position) => {
|
3957
|
+
if (position) {
|
3958
|
+
return this.documentActions.filter(
|
3959
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3960
|
+
);
|
3961
|
+
}
|
3962
|
+
return this.documentActions;
|
3963
|
+
},
|
3921
3964
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3922
3965
|
getHeaderActions: () => this.headerActions
|
3923
3966
|
}
|
@@ -3927,10 +3970,8 @@ class ContentManagerPlugin {
|
|
3927
3970
|
const getPrintableType = (value) => {
|
3928
3971
|
const nativeType = typeof value;
|
3929
3972
|
if (nativeType === "object") {
|
3930
|
-
if (value === null)
|
3931
|
-
|
3932
|
-
if (Array.isArray(value))
|
3933
|
-
return "array";
|
3973
|
+
if (value === null) return "null";
|
3974
|
+
if (Array.isArray(value)) return "array";
|
3934
3975
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3935
3976
|
return value.constructor.name;
|
3936
3977
|
}
|
@@ -3941,17 +3982,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3941
3982
|
const { formatMessage } = useIntl();
|
3942
3983
|
const [{ query }] = useQueryParams();
|
3943
3984
|
const navigate = useNavigate();
|
3985
|
+
const { trackUsage } = useTracking();
|
3986
|
+
const { pathname } = useLocation();
|
3944
3987
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3945
3988
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3946
3989
|
return null;
|
3947
3990
|
}
|
3991
|
+
const handleOnClick = () => {
|
3992
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
3993
|
+
trackUsage("willNavigate", {
|
3994
|
+
from: pathname,
|
3995
|
+
to: `${pathname}/${destination.pathname}`
|
3996
|
+
});
|
3997
|
+
navigate(destination);
|
3998
|
+
};
|
3948
3999
|
return {
|
3949
4000
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3950
4001
|
label: formatMessage({
|
3951
4002
|
id: "content-manager.history.document-action",
|
3952
4003
|
defaultMessage: "Content History"
|
3953
4004
|
}),
|
3954
|
-
onClick:
|
4005
|
+
onClick: handleOnClick,
|
3955
4006
|
disabled: (
|
3956
4007
|
/**
|
3957
4008
|
* The user is creating a new document.
|
@@ -3973,6 +4024,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3973
4024
|
};
|
3974
4025
|
};
|
3975
4026
|
HistoryAction.type = "history";
|
4027
|
+
HistoryAction.position = "header";
|
3976
4028
|
const historyAdmin = {
|
3977
4029
|
bootstrap(app) {
|
3978
4030
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4035,10 +4087,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4035
4087
|
})
|
4036
4088
|
});
|
4037
4089
|
const { useGetPreviewUrlQuery } = previewApi;
|
4090
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4091
|
+
if (isShown) {
|
4092
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4093
|
+
}
|
4094
|
+
return children;
|
4095
|
+
};
|
4038
4096
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4039
4097
|
const { formatMessage } = useIntl();
|
4040
4098
|
const { trackUsage } = useTracking();
|
4099
|
+
const { pathname } = useLocation();
|
4041
4100
|
const [{ query }] = useQueryParams();
|
4101
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4042
4102
|
const { data, error } = useGetPreviewUrlQuery({
|
4043
4103
|
params: {
|
4044
4104
|
contentType: model
|
@@ -4052,25 +4112,39 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4052
4112
|
if (!data?.data?.url || error) {
|
4053
4113
|
return null;
|
4054
4114
|
}
|
4055
|
-
const
|
4056
|
-
|
4115
|
+
const trackNavigation = () => {
|
4116
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4117
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4057
4118
|
};
|
4058
4119
|
return {
|
4059
4120
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4060
|
-
content: /* @__PURE__ */ jsx(
|
4061
|
-
|
4121
|
+
content: /* @__PURE__ */ jsx(
|
4122
|
+
ConditionalTooltip,
|
4062
4123
|
{
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4068
|
-
children:
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4124
|
+
label: formatMessage({
|
4125
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4126
|
+
defaultMessage: "Please save to open the preview"
|
4127
|
+
}),
|
4128
|
+
isShown: isModified,
|
4129
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4130
|
+
Button,
|
4131
|
+
{
|
4132
|
+
variant: "tertiary",
|
4133
|
+
tag: Link,
|
4134
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4135
|
+
onClick: trackNavigation,
|
4136
|
+
width: "100%",
|
4137
|
+
disabled: isModified,
|
4138
|
+
pointerEvents: isModified ? "none" : void 0,
|
4139
|
+
tabIndex: isModified ? -1 : void 0,
|
4140
|
+
children: formatMessage({
|
4141
|
+
id: "content-manager.preview.panel.button",
|
4142
|
+
defaultMessage: "Open preview"
|
4143
|
+
})
|
4144
|
+
}
|
4145
|
+
) })
|
4072
4146
|
}
|
4073
|
-
)
|
4147
|
+
)
|
4074
4148
|
};
|
4075
4149
|
};
|
4076
4150
|
const FEATURE_ID = "preview";
|
@@ -4102,7 +4176,7 @@ const index = {
|
|
4102
4176
|
app.router.addRoute({
|
4103
4177
|
path: "content-manager/*",
|
4104
4178
|
lazy: async () => {
|
4105
|
-
const { Layout } = await import("./layout-
|
4179
|
+
const { Layout } = await import("./layout-BaQBaz56.mjs");
|
4106
4180
|
return {
|
4107
4181
|
Component: Layout
|
4108
4182
|
};
|
@@ -4122,7 +4196,7 @@ const index = {
|
|
4122
4196
|
async registerTrads({ locales }) {
|
4123
4197
|
const importedTrads = await Promise.all(
|
4124
4198
|
locales.map((locale) => {
|
4125
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-
|
4199
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4126
4200
|
return {
|
4127
4201
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4128
4202
|
locale
|
@@ -4184,4 +4258,4 @@ export {
|
|
4184
4258
|
capitalise as y,
|
4185
4259
|
useUpdateContentTypeConfigurationMutation as z
|
4186
4260
|
};
|
4187
|
-
//# sourceMappingURL=index-
|
4261
|
+
//# sourceMappingURL=index-tETMKK2G.mjs.map
|