@strapi/content-manager 0.0.0-next.3fdd03038d558a8190aa7e17574020c5f65395e6 → 0.0.0-next.40d132bcf8139c1d691684ec83a5834c98dfd41f
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-Cmm0LJof.js → ComponentConfigurationPage-BSEZcJVB.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs.map → ComponentConfigurationPage-BiASGi7x.mjs.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-CseHna9y.js → EditConfigurationPage-D2rtvneE.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-CseHna9y.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs → EditConfigurationPage-vN4zupij.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BhjvFXZr.js → EditViewPage-BwisF04Q.js} +12 -5
- package/dist/_chunks/EditViewPage-BwisF04Q.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BB9VeS-u.mjs → EditViewPage-_A31Cl4g.mjs} +11 -3
- package/dist/_chunks/EditViewPage-_A31Cl4g.mjs.map +1 -0
- package/dist/_chunks/{Field-CWi7XMCa.mjs → Field-CvIunNOj.mjs} +146 -114
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-B03STsf9.js → Field-Dsu6-FrM.js} +148 -116
- package/dist/_chunks/Field-Dsu6-FrM.js.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-B5b7zgoL.mjs → Form-DK0fG0Gj.mjs} +3 -3
- package/dist/_chunks/{Form-B5b7zgoL.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-DH5m7r5s.js → Form-DUwWcCmA.js} +5 -6
- package/dist/_chunks/{Form-DH5m7r5s.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-CNO4Db6U.js → History-CeCDhoJG.js} +9 -57
- package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
- package/dist/_chunks/{History-Dhy0xF0L.mjs → History-DP8gmXpm.mjs} +9 -56
- package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-C_FCilGf.mjs → ListConfigurationPage-BCkO5iuN.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-BCkO5iuN.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DE7NESsr.js → ListConfigurationPage-C-bAd44a.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-C-bAd44a.js.map +1 -0
- package/dist/_chunks/{ListViewPage-C7p0PteR.js → ListViewPage-BKTZFhsM.js} +51 -51
- package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B6Ut2BH0.mjs → ListViewPage-Cf_DgaFV.mjs} +50 -49
- package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
- package/dist/_chunks/{Preview-_gomrUna.mjs → Preview-C4NBzKUV.mjs} +78 -72
- package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
- package/dist/_chunks/{Preview-CICG4cRf.js → Preview-CT28Ckpg.js} +77 -72
- package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
- package/dist/_chunks/{Relations-BEvinUkU.mjs → Relations-C8uC89cT.mjs} +6 -8
- package/dist/_chunks/{Relations-BEvinUkU.mjs.map → Relations-C8uC89cT.mjs.map} +1 -1
- package/dist/_chunks/{Relations-uyLoal2t.js → Relations-CvkPCng_.js} +7 -10
- package/dist/_chunks/{Relations-uyLoal2t.js.map → Relations-CvkPCng_.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-D_AvCmmG.js → index-CnX_j5h-.js} +274 -193
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-BagcPV6I.mjs → index-Dh2aGTGJ.mjs} +274 -192
- package/dist/_chunks/index-Dh2aGTGJ.mjs.map +1 -0
- package/dist/_chunks/{layout-DKEX3X49.mjs → layout-B5qsPihj.mjs} +4 -4
- package/dist/_chunks/{layout-DKEX3X49.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-Dk0odfYR.js → layout-B_qdWGny.js} +5 -6
- package/dist/_chunks/{layout-Dk0odfYR.js.map → layout-B_qdWGny.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-C312DwGU.js → relations-ChcieiF5.js} +2 -2
- package/dist/_chunks/{relations-C312DwGU.js.map → relations-ChcieiF5.js.map} +1 -1
- package/dist/_chunks/{relations-DDoMdwk6.mjs → relations-DMXpNY-e.mjs} +2 -2
- package/dist/_chunks/{relations-DDoMdwk6.mjs.map → relations-DMXpNY-e.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/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -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 +151 -112
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +152 -112
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -2
- package/dist/server/src/index.d.ts.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/dist/server/src/services/document-metadata.d.ts +4 -2
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +3 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +12 -10
- package/dist/_chunks/EditViewPage-BB9VeS-u.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-BhjvFXZr.js.map +0 -1
- package/dist/_chunks/Field-B03STsf9.js.map +0 -1
- package/dist/_chunks/Field-CWi7XMCa.mjs.map +0 -1
- package/dist/_chunks/History-CNO4Db6U.js.map +0 -1
- package/dist/_chunks/History-Dhy0xF0L.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-C_FCilGf.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DE7NESsr.js.map +0 -1
- package/dist/_chunks/ListViewPage-B6Ut2BH0.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-C7p0PteR.js.map +0 -1
- package/dist/_chunks/Preview-CICG4cRf.js.map +0 -1
- package/dist/_chunks/Preview-_gomrUna.mjs.map +0 -1
- package/dist/_chunks/index-BagcPV6I.mjs.map +0 -1
- package/dist/_chunks/index-D_AvCmmG.js.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.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";
|
@@ -220,7 +227,19 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
220
227
|
{ type: "Document", id: `${model}_LIST` },
|
221
228
|
"Relations",
|
222
229
|
{ type: "UidAvailability", id: model }
|
223
|
-
]
|
230
|
+
],
|
231
|
+
transformResponse: (response, meta, arg) => {
|
232
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
233
|
+
return {
|
234
|
+
data: response,
|
235
|
+
meta: {
|
236
|
+
availableStatus: [],
|
237
|
+
availableLocales: []
|
238
|
+
}
|
239
|
+
};
|
240
|
+
}
|
241
|
+
return response;
|
242
|
+
}
|
224
243
|
}),
|
225
244
|
deleteDocument: builder.mutation({
|
226
245
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -274,7 +293,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
274
293
|
url: `/content-manager/collection-types/${model}`,
|
275
294
|
method: "GET",
|
276
295
|
config: {
|
277
|
-
params
|
296
|
+
params: stringify(params, { encode: true })
|
278
297
|
}
|
279
298
|
}),
|
280
299
|
providesTags: (result, _error, arg) => {
|
@@ -453,8 +472,7 @@ const {
|
|
453
472
|
useUnpublishManyDocumentsMutation
|
454
473
|
} = documentApi;
|
455
474
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
475
|
+
if (!query) return query;
|
458
476
|
const { plugins: _, ...validQueryParams } = {
|
459
477
|
...query,
|
460
478
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +480,6 @@ const buildValidParams = (query) => {
|
|
462
480
|
{}
|
463
481
|
)
|
464
482
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
483
|
return validQueryParams;
|
469
484
|
};
|
470
485
|
const isBaseQueryError = (error) => {
|
@@ -1664,7 +1679,7 @@ const useDocumentActions = () => {
|
|
1664
1679
|
};
|
1665
1680
|
};
|
1666
1681
|
const ProtectedHistoryPage = React.lazy(
|
1667
|
-
() => import("./History-
|
1682
|
+
() => import("./History-DP8gmXpm.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1683
|
);
|
1669
1684
|
const routes$2 = [
|
1670
1685
|
{
|
@@ -1677,7 +1692,7 @@ const routes$2 = [
|
|
1677
1692
|
}
|
1678
1693
|
];
|
1679
1694
|
const ProtectedPreviewPage = React.lazy(
|
1680
|
-
() => import("./Preview-
|
1695
|
+
() => import("./Preview-C4NBzKUV.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1681
1696
|
);
|
1682
1697
|
const routes$1 = [
|
1683
1698
|
{
|
@@ -1690,31 +1705,31 @@ const routes$1 = [
|
|
1690
1705
|
}
|
1691
1706
|
];
|
1692
1707
|
const ProtectedEditViewPage = lazy(
|
1693
|
-
() => import("./EditViewPage-
|
1708
|
+
() => import("./EditViewPage-_A31Cl4g.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1694
1709
|
);
|
1695
1710
|
const ProtectedListViewPage = lazy(
|
1696
|
-
() => import("./ListViewPage-
|
1711
|
+
() => import("./ListViewPage-Cf_DgaFV.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1697
1712
|
);
|
1698
1713
|
const ProtectedListConfiguration = lazy(
|
1699
|
-
() => import("./ListConfigurationPage-
|
1714
|
+
() => import("./ListConfigurationPage-BCkO5iuN.mjs").then((mod) => ({
|
1700
1715
|
default: mod.ProtectedListConfiguration
|
1701
1716
|
}))
|
1702
1717
|
);
|
1703
1718
|
const ProtectedEditConfigurationPage = lazy(
|
1704
|
-
() => import("./EditConfigurationPage-
|
1719
|
+
() => import("./EditConfigurationPage-vN4zupij.mjs").then((mod) => ({
|
1705
1720
|
default: mod.ProtectedEditConfigurationPage
|
1706
1721
|
}))
|
1707
1722
|
);
|
1708
1723
|
const ProtectedComponentConfigurationPage = lazy(
|
1709
|
-
() => import("./ComponentConfigurationPage-
|
1724
|
+
() => import("./ComponentConfigurationPage-BiASGi7x.mjs").then((mod) => ({
|
1710
1725
|
default: mod.ProtectedComponentConfigurationPage
|
1711
1726
|
}))
|
1712
1727
|
);
|
1713
1728
|
const NoPermissions = lazy(
|
1714
|
-
() => import("./NoPermissionsPage-
|
1729
|
+
() => import("./NoPermissionsPage-BALVSJ7x.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1715
1730
|
);
|
1716
1731
|
const NoContentType = lazy(
|
1717
|
-
() => import("./NoContentTypePage-
|
1732
|
+
() => import("./NoContentTypePage-nHIyvJcB.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1718
1733
|
);
|
1719
1734
|
const CollectionTypePages = () => {
|
1720
1735
|
const { collectionType } = useParams();
|
@@ -1726,7 +1741,7 @@ const CollectionTypePages = () => {
|
|
1726
1741
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1727
1742
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1728
1743
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1729
|
-
const LIST_PATH = `/content-manager
|
1744
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1730
1745
|
const routes = [
|
1731
1746
|
{
|
1732
1747
|
path: LIST_RELATIVE_PATH,
|
@@ -1859,6 +1874,11 @@ const DocumentActionButton = (action) => {
|
|
1859
1874
|
) : null
|
1860
1875
|
] });
|
1861
1876
|
};
|
1877
|
+
const MenuItem = styled(Menu.Item)`
|
1878
|
+
&:hover {
|
1879
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1880
|
+
}
|
1881
|
+
`;
|
1862
1882
|
const DocumentActionsMenu = ({
|
1863
1883
|
actions: actions2,
|
1864
1884
|
children,
|
@@ -1917,48 +1937,32 @@ const DocumentActionsMenu = ({
|
|
1917
1937
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1918
1938
|
actions2.map((action) => {
|
1919
1939
|
return /* @__PURE__ */ jsx(
|
1920
|
-
|
1940
|
+
MenuItem,
|
1921
1941
|
{
|
1922
1942
|
disabled: action.disabled,
|
1923
1943
|
onSelect: handleClick(action),
|
1924
1944
|
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
|
-
] })
|
1945
|
+
isVariantDanger: action.variant === "danger",
|
1946
|
+
isDisabled: action.disabled,
|
1947
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1948
|
+
Flex,
|
1949
|
+
{
|
1950
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1951
|
+
gap: 2,
|
1952
|
+
tag: "span",
|
1953
|
+
children: [
|
1954
|
+
/* @__PURE__ */ jsx(
|
1955
|
+
Flex,
|
1956
|
+
{
|
1957
|
+
tag: "span",
|
1958
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1959
|
+
children: action.icon
|
1960
|
+
}
|
1961
|
+
),
|
1962
|
+
action.label
|
1963
|
+
]
|
1964
|
+
}
|
1965
|
+
) })
|
1962
1966
|
},
|
1963
1967
|
action.id
|
1964
1968
|
);
|
@@ -2095,6 +2099,7 @@ const PublishAction$1 = ({
|
|
2095
2099
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2096
2100
|
const isListView = useMatch(LIST_PATH) !== null;
|
2097
2101
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2102
|
+
const { id } = useParams();
|
2098
2103
|
const { formatMessage } = useIntl();
|
2099
2104
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2100
2105
|
const { publish } = useDocumentActions();
|
@@ -2197,10 +2202,12 @@ const PublishAction$1 = ({
|
|
2197
2202
|
transformData(formValues)
|
2198
2203
|
);
|
2199
2204
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2205
|
+
if (id === "create") {
|
2206
|
+
navigate({
|
2207
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2208
|
+
search: rawQuery
|
2209
|
+
});
|
2210
|
+
}
|
2204
2211
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2205
2212
|
setErrors(formatValidationErrors(res.error));
|
2206
2213
|
}
|
@@ -2253,6 +2260,7 @@ const PublishAction$1 = ({
|
|
2253
2260
|
};
|
2254
2261
|
};
|
2255
2262
|
PublishAction$1.type = "publish";
|
2263
|
+
PublishAction$1.position = "panel";
|
2256
2264
|
const UpdateAction = ({
|
2257
2265
|
activeTab,
|
2258
2266
|
documentId,
|
@@ -2275,96 +2283,134 @@ const UpdateAction = ({
|
|
2275
2283
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2276
2284
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2277
2285
|
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"
|
2286
|
+
const handleUpdate = React.useCallback(async () => {
|
2287
|
+
setSubmitting(true);
|
2288
|
+
try {
|
2289
|
+
if (!modified) {
|
2290
|
+
return;
|
2291
|
+
}
|
2292
|
+
const { errors } = await validate(true, {
|
2293
|
+
status: "draft"
|
2294
|
+
});
|
2295
|
+
if (errors) {
|
2296
|
+
toggleNotification({
|
2297
|
+
type: "danger",
|
2298
|
+
message: formatMessage({
|
2299
|
+
id: "content-manager.validation.error",
|
2300
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2301
|
+
})
|
2295
2302
|
});
|
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(
|
2303
|
+
return;
|
2304
|
+
}
|
2305
|
+
if (isCloning) {
|
2306
|
+
const res = await clone(
|
2307
|
+
{
|
2308
|
+
model,
|
2309
|
+
documentId: cloneMatch.params.origin,
|
2310
|
+
params
|
2311
|
+
},
|
2312
|
+
transformData(document)
|
2313
|
+
);
|
2314
|
+
if ("data" in res) {
|
2315
|
+
navigate(
|
2328
2316
|
{
|
2329
|
-
|
2330
|
-
|
2331
|
-
documentId,
|
2332
|
-
params
|
2317
|
+
pathname: `../${res.data.documentId}`,
|
2318
|
+
search: rawQuery
|
2333
2319
|
},
|
2334
|
-
|
2320
|
+
{ relative: "path" }
|
2335
2321
|
);
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2322
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2323
|
+
setErrors(formatValidationErrors(res.error));
|
2324
|
+
}
|
2325
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2326
|
+
const res = await update(
|
2327
|
+
{
|
2328
|
+
collectionType,
|
2329
|
+
model,
|
2330
|
+
documentId,
|
2331
|
+
params
|
2332
|
+
},
|
2333
|
+
transformData(document)
|
2334
|
+
);
|
2335
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2336
|
+
setErrors(formatValidationErrors(res.error));
|
2341
2337
|
} else {
|
2342
|
-
|
2338
|
+
resetForm();
|
2339
|
+
}
|
2340
|
+
} else {
|
2341
|
+
const res = await create(
|
2342
|
+
{
|
2343
|
+
model,
|
2344
|
+
params
|
2345
|
+
},
|
2346
|
+
transformData(document)
|
2347
|
+
);
|
2348
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2349
|
+
navigate(
|
2343
2350
|
{
|
2344
|
-
|
2345
|
-
|
2351
|
+
pathname: `../${res.data.documentId}`,
|
2352
|
+
search: rawQuery
|
2346
2353
|
},
|
2347
|
-
|
2354
|
+
{ replace: true, relative: "path" }
|
2348
2355
|
);
|
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
|
-
}
|
2356
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2357
|
+
setErrors(formatValidationErrors(res.error));
|
2360
2358
|
}
|
2361
|
-
} finally {
|
2362
|
-
setSubmitting(false);
|
2363
2359
|
}
|
2360
|
+
} finally {
|
2361
|
+
setSubmitting(false);
|
2364
2362
|
}
|
2363
|
+
}, [
|
2364
|
+
clone,
|
2365
|
+
cloneMatch?.params.origin,
|
2366
|
+
collectionType,
|
2367
|
+
create,
|
2368
|
+
document,
|
2369
|
+
documentId,
|
2370
|
+
formatMessage,
|
2371
|
+
formatValidationErrors,
|
2372
|
+
isCloning,
|
2373
|
+
model,
|
2374
|
+
modified,
|
2375
|
+
navigate,
|
2376
|
+
params,
|
2377
|
+
rawQuery,
|
2378
|
+
resetForm,
|
2379
|
+
setErrors,
|
2380
|
+
setSubmitting,
|
2381
|
+
toggleNotification,
|
2382
|
+
update,
|
2383
|
+
validate
|
2384
|
+
]);
|
2385
|
+
React.useEffect(() => {
|
2386
|
+
const handleKeyDown = (e) => {
|
2387
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2388
|
+
e.preventDefault();
|
2389
|
+
handleUpdate();
|
2390
|
+
}
|
2391
|
+
};
|
2392
|
+
window.addEventListener("keydown", handleKeyDown);
|
2393
|
+
return () => {
|
2394
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2395
|
+
};
|
2396
|
+
}, [handleUpdate]);
|
2397
|
+
return {
|
2398
|
+
/**
|
2399
|
+
* Disabled when:
|
2400
|
+
* - the form is submitting
|
2401
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2402
|
+
* - the active tab is the published tab
|
2403
|
+
*/
|
2404
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2405
|
+
label: formatMessage({
|
2406
|
+
id: "global.save",
|
2407
|
+
defaultMessage: "Save"
|
2408
|
+
}),
|
2409
|
+
onClick: handleUpdate
|
2365
2410
|
};
|
2366
2411
|
};
|
2367
2412
|
UpdateAction.type = "update";
|
2413
|
+
UpdateAction.position = "panel";
|
2368
2414
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2369
2415
|
KEEP: "keep",
|
2370
2416
|
DISCARD: "discard"
|
@@ -2487,6 +2533,7 @@ const UnpublishAction$1 = ({
|
|
2487
2533
|
};
|
2488
2534
|
};
|
2489
2535
|
UnpublishAction$1.type = "unpublish";
|
2536
|
+
UnpublishAction$1.position = "panel";
|
2490
2537
|
const DiscardAction = ({
|
2491
2538
|
activeTab,
|
2492
2539
|
documentId,
|
@@ -2537,6 +2584,7 @@ const DiscardAction = ({
|
|
2537
2584
|
};
|
2538
2585
|
};
|
2539
2586
|
DiscardAction.type = "discard";
|
2587
|
+
DiscardAction.position = "panel";
|
2540
2588
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2541
2589
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2542
2590
|
const RelativeTime = React.forwardRef(
|
@@ -2549,7 +2597,7 @@ const RelativeTime = React.forwardRef(
|
|
2549
2597
|
});
|
2550
2598
|
const unit = intervals.find((intervalUnit) => {
|
2551
2599
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2552
|
-
});
|
2600
|
+
}) ?? "seconds";
|
2553
2601
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2554
2602
|
const customInterval = customIntervals.find(
|
2555
2603
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2583,10 +2631,10 @@ const getDisplayName = ({
|
|
2583
2631
|
return email ?? "";
|
2584
2632
|
};
|
2585
2633
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2586
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2634
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2587
2635
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2588
2636
|
const { formatMessage } = useIntl();
|
2589
|
-
return /* @__PURE__ */ jsx(Status, { ...restProps,
|
2637
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2590
2638
|
id: `content-manager.containers.List.${status}`,
|
2591
2639
|
defaultMessage: capitalise(status)
|
2592
2640
|
}) }) });
|
@@ -2594,12 +2642,18 @@ const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
|
2594
2642
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2595
2643
|
const { formatMessage } = useIntl();
|
2596
2644
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2645
|
+
const params = useParams();
|
2597
2646
|
const title = isCreating ? formatMessage({
|
2598
2647
|
id: "content-manager.containers.edit.title.new",
|
2599
2648
|
defaultMessage: "Create an entry"
|
2600
2649
|
}) : documentTitle;
|
2601
2650
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2602
|
-
/* @__PURE__ */ jsx(
|
2651
|
+
/* @__PURE__ */ jsx(
|
2652
|
+
BackButton,
|
2653
|
+
{
|
2654
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2655
|
+
}
|
2656
|
+
),
|
2603
2657
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2604
2658
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2605
2659
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2650,7 +2704,7 @@ const HeaderToolbar = () => {
|
|
2650
2704
|
meta: isCloning ? void 0 : meta,
|
2651
2705
|
collectionType
|
2652
2706
|
},
|
2653
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2707
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2654
2708
|
children: (actions2) => {
|
2655
2709
|
const headerActions = actions2.filter((action) => {
|
2656
2710
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2858,6 +2912,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2858
2912
|
};
|
2859
2913
|
};
|
2860
2914
|
ConfigureTheViewAction.type = "configure-the-view";
|
2915
|
+
ConfigureTheViewAction.position = "header";
|
2861
2916
|
const EditTheModelAction = ({ model }) => {
|
2862
2917
|
const navigate = useNavigate();
|
2863
2918
|
const { formatMessage } = useIntl();
|
@@ -2874,6 +2929,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2874
2929
|
};
|
2875
2930
|
};
|
2876
2931
|
EditTheModelAction.type = "edit-the-model";
|
2932
|
+
EditTheModelAction.position = "header";
|
2877
2933
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2878
2934
|
const navigate = useNavigate();
|
2879
2935
|
const { formatMessage } = useIntl();
|
@@ -2947,6 +3003,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2947
3003
|
};
|
2948
3004
|
};
|
2949
3005
|
DeleteAction$1.type = "delete";
|
3006
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2950
3007
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2951
3008
|
const Panels = () => {
|
2952
3009
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -3009,7 +3066,7 @@ const ActionsPanelContent = () => {
|
|
3009
3066
|
DescriptionComponentRenderer,
|
3010
3067
|
{
|
3011
3068
|
props,
|
3012
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3069
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3013
3070
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
3014
3071
|
}
|
3015
3072
|
),
|
@@ -3286,18 +3343,10 @@ const SelectedEntriesTableContent = ({
|
|
3286
3343
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3287
3344
|
},
|
3288
3345
|
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
|
-
),
|
3346
|
+
label: formatMessage({
|
3347
|
+
id: "content-manager.bulk-publish.edit",
|
3348
|
+
defaultMessage: "Edit"
|
3349
|
+
}),
|
3301
3350
|
target: "_blank",
|
3302
3351
|
marginLeft: "auto",
|
3303
3352
|
variant: "ghost",
|
@@ -3471,8 +3520,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3471
3520
|
const refetchList = () => {
|
3472
3521
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3473
3522
|
};
|
3474
|
-
if (!showPublishButton)
|
3475
|
-
return null;
|
3523
|
+
if (!showPublishButton) return null;
|
3476
3524
|
return {
|
3477
3525
|
actionType: "publish",
|
3478
3526
|
variant: "tertiary",
|
@@ -3540,8 +3588,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3540
3588
|
selectRow([]);
|
3541
3589
|
}
|
3542
3590
|
};
|
3543
|
-
if (!hasDeletePermission)
|
3544
|
-
return null;
|
3591
|
+
if (!hasDeletePermission) return null;
|
3545
3592
|
return {
|
3546
3593
|
variant: "danger-light",
|
3547
3594
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3590,8 +3637,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3590
3637
|
}
|
3591
3638
|
};
|
3592
3639
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3593
|
-
if (!showUnpublishButton)
|
3594
|
-
return null;
|
3640
|
+
if (!showUnpublishButton) return null;
|
3595
3641
|
return {
|
3596
3642
|
variant: "tertiary",
|
3597
3643
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3696,7 +3742,7 @@ const TableActions = ({ document }) => {
|
|
3696
3742
|
DescriptionComponentRenderer,
|
3697
3743
|
{
|
3698
3744
|
props,
|
3699
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3745
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3700
3746
|
children: (actions2) => {
|
3701
3747
|
const tableRowActions = actions2.filter((action) => {
|
3702
3748
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3755,6 +3801,7 @@ const EditAction = ({ documentId }) => {
|
|
3755
3801
|
};
|
3756
3802
|
};
|
3757
3803
|
EditAction.type = "edit";
|
3804
|
+
EditAction.position = "table-row";
|
3758
3805
|
const StyledPencil = styled(Pencil)`
|
3759
3806
|
path {
|
3760
3807
|
fill: currentColor;
|
@@ -3831,6 +3878,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3831
3878
|
};
|
3832
3879
|
};
|
3833
3880
|
CloneAction.type = "clone";
|
3881
|
+
CloneAction.position = "table-row";
|
3834
3882
|
const StyledDuplicate = styled(Duplicate)`
|
3835
3883
|
path {
|
3836
3884
|
fill: currentColor;
|
@@ -3917,7 +3965,14 @@ class ContentManagerPlugin {
|
|
3917
3965
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3918
3966
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3919
3967
|
getBulkActions: () => this.bulkActions,
|
3920
|
-
getDocumentActions: () =>
|
3968
|
+
getDocumentActions: (position) => {
|
3969
|
+
if (position) {
|
3970
|
+
return this.documentActions.filter(
|
3971
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3972
|
+
);
|
3973
|
+
}
|
3974
|
+
return this.documentActions;
|
3975
|
+
},
|
3921
3976
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3922
3977
|
getHeaderActions: () => this.headerActions
|
3923
3978
|
}
|
@@ -3927,10 +3982,8 @@ class ContentManagerPlugin {
|
|
3927
3982
|
const getPrintableType = (value) => {
|
3928
3983
|
const nativeType = typeof value;
|
3929
3984
|
if (nativeType === "object") {
|
3930
|
-
if (value === null)
|
3931
|
-
|
3932
|
-
if (Array.isArray(value))
|
3933
|
-
return "array";
|
3985
|
+
if (value === null) return "null";
|
3986
|
+
if (Array.isArray(value)) return "array";
|
3934
3987
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3935
3988
|
return value.constructor.name;
|
3936
3989
|
}
|
@@ -3941,17 +3994,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3941
3994
|
const { formatMessage } = useIntl();
|
3942
3995
|
const [{ query }] = useQueryParams();
|
3943
3996
|
const navigate = useNavigate();
|
3997
|
+
const { trackUsage } = useTracking();
|
3998
|
+
const { pathname } = useLocation();
|
3944
3999
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3945
4000
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3946
4001
|
return null;
|
3947
4002
|
}
|
4003
|
+
const handleOnClick = () => {
|
4004
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4005
|
+
trackUsage("willNavigate", {
|
4006
|
+
from: pathname,
|
4007
|
+
to: `${pathname}/${destination.pathname}`
|
4008
|
+
});
|
4009
|
+
navigate(destination);
|
4010
|
+
};
|
3948
4011
|
return {
|
3949
4012
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3950
4013
|
label: formatMessage({
|
3951
4014
|
id: "content-manager.history.document-action",
|
3952
4015
|
defaultMessage: "Content History"
|
3953
4016
|
}),
|
3954
|
-
onClick:
|
4017
|
+
onClick: handleOnClick,
|
3955
4018
|
disabled: (
|
3956
4019
|
/**
|
3957
4020
|
* The user is creating a new document.
|
@@ -3973,6 +4036,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3973
4036
|
};
|
3974
4037
|
};
|
3975
4038
|
HistoryAction.type = "history";
|
4039
|
+
HistoryAction.position = "header";
|
3976
4040
|
const historyAdmin = {
|
3977
4041
|
bootstrap(app) {
|
3978
4042
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4035,10 +4099,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4035
4099
|
})
|
4036
4100
|
});
|
4037
4101
|
const { useGetPreviewUrlQuery } = previewApi;
|
4102
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4103
|
+
if (isShown) {
|
4104
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4105
|
+
}
|
4106
|
+
return children;
|
4107
|
+
};
|
4038
4108
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4039
4109
|
const { formatMessage } = useIntl();
|
4040
4110
|
const { trackUsage } = useTracking();
|
4111
|
+
const { pathname } = useLocation();
|
4041
4112
|
const [{ query }] = useQueryParams();
|
4113
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4042
4114
|
const { data, error } = useGetPreviewUrlQuery({
|
4043
4115
|
params: {
|
4044
4116
|
contentType: model
|
@@ -4052,33 +4124,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4052
4124
|
if (!data?.data?.url || error) {
|
4053
4125
|
return null;
|
4054
4126
|
}
|
4055
|
-
const
|
4056
|
-
|
4127
|
+
const trackNavigation = () => {
|
4128
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4129
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4057
4130
|
};
|
4058
4131
|
return {
|
4059
4132
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4060
|
-
content: /* @__PURE__ */ jsx(
|
4061
|
-
|
4133
|
+
content: /* @__PURE__ */ jsx(
|
4134
|
+
ConditionalTooltip,
|
4062
4135
|
{
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4068
|
-
children:
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4136
|
+
label: formatMessage({
|
4137
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4138
|
+
defaultMessage: "Please save to open the preview"
|
4139
|
+
}),
|
4140
|
+
isShown: isModified,
|
4141
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4142
|
+
Button,
|
4143
|
+
{
|
4144
|
+
variant: "tertiary",
|
4145
|
+
tag: Link,
|
4146
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4147
|
+
onClick: trackNavigation,
|
4148
|
+
width: "100%",
|
4149
|
+
disabled: isModified,
|
4150
|
+
pointerEvents: isModified ? "none" : void 0,
|
4151
|
+
tabIndex: isModified ? -1 : void 0,
|
4152
|
+
children: formatMessage({
|
4153
|
+
id: "content-manager.preview.panel.button",
|
4154
|
+
defaultMessage: "Open preview"
|
4155
|
+
})
|
4156
|
+
}
|
4157
|
+
) })
|
4072
4158
|
}
|
4073
|
-
)
|
4159
|
+
)
|
4074
4160
|
};
|
4075
4161
|
};
|
4076
|
-
const FEATURE_ID = "preview";
|
4077
4162
|
const previewAdmin = {
|
4078
4163
|
bootstrap(app) {
|
4079
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4080
|
-
return;
|
4081
|
-
}
|
4082
4164
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4083
4165
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4084
4166
|
}
|
@@ -4102,7 +4184,7 @@ const index = {
|
|
4102
4184
|
app.router.addRoute({
|
4103
4185
|
path: "content-manager/*",
|
4104
4186
|
lazy: async () => {
|
4105
|
-
const { Layout } = await import("./layout-
|
4187
|
+
const { Layout } = await import("./layout-B5qsPihj.mjs");
|
4106
4188
|
return {
|
4107
4189
|
Component: Layout
|
4108
4190
|
};
|
@@ -4122,7 +4204,7 @@ const index = {
|
|
4122
4204
|
async registerTrads({ locales }) {
|
4123
4205
|
const importedTrads = await Promise.all(
|
4124
4206
|
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-
|
4207
|
+
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
4208
|
return {
|
4127
4209
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4128
4210
|
locale
|
@@ -4184,4 +4266,4 @@ export {
|
|
4184
4266
|
capitalise as y,
|
4185
4267
|
useUpdateContentTypeConfigurationMutation as z
|
4186
4268
|
};
|
4187
|
-
//# sourceMappingURL=index-
|
4269
|
+
//# sourceMappingURL=index-Dh2aGTGJ.mjs.map
|