@strapi/content-manager 0.0.0-experimental.0faf8967355707d2684ecb8579b03979ad5df042 → 0.0.0-experimental.108b2cd7ad1be9676807f94bb93dfe71248936f8
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-BX0PmIl_.js → ComponentConfigurationPage-BLWQy8ru.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-BX0PmIl_.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D1l2o3w3.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-D1l2o3w3.mjs.map → ComponentConfigurationPage-CtIa3aa2.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-uDsDO3-f.mjs → EditConfigurationPage-DsPR2DVk.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-uDsDO3-f.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Sed22MMc.js → EditConfigurationPage-RQkymxCy.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-Sed22MMc.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-CcWIJyJa.js → EditViewPage-B-kExt8C.js} +38 -9
- package/dist/_chunks/EditViewPage-B-kExt8C.js.map +1 -0
- package/dist/_chunks/{EditViewPage-Bg7aQ3vS.mjs → EditViewPage-BPyVuPfM.mjs} +38 -8
- package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +1 -0
- package/dist/_chunks/{Field-BnTZJ0fG.js → Field-DPIsQRre.js} +186 -127
- package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
- package/dist/_chunks/{Field-Cf1nzyOi.mjs → Field-Dltnt1km.mjs} +184 -125
- package/dist/_chunks/Field-Dltnt1km.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-BH04zZdW.js → Form-BFi4MXMT.js} +6 -7
- package/dist/_chunks/Form-BFi4MXMT.js.map +1 -0
- package/dist/_chunks/{Form-CXe7dOCt.mjs → Form-C1IcWm1u.mjs} +4 -4
- package/dist/_chunks/Form-C1IcWm1u.mjs.map +1 -0
- package/dist/_chunks/{History-Cg_rjVg_.mjs → History-04ChQ4pl.mjs} +71 -104
- package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
- package/dist/_chunks/{History-CAM3gN3h.js → History-wjcK4L0C.js} +70 -104
- package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-51n8mFbZ.mjs → ListConfigurationPage-BYqPYLSU.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BYqPYLSU.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DMBKzujx.js → ListConfigurationPage-CRbxIC3J.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-CRbxIC3J.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DFzs-3jf.js → ListViewPage-D5NY9183.js} +63 -41
- package/dist/_chunks/ListViewPage-D5NY9183.js.map +1 -0
- package/dist/_chunks/{ListViewPage-RzuT8-b2.mjs → ListViewPage-FU2LBuhl.mjs} +62 -39
- package/dist/_chunks/ListViewPage-FU2LBuhl.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BNfF_UU1.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BNfF_UU1.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CldwfMNH.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CldwfMNH.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DwcEM1UU.js → NoPermissionsPage-C5jwn70o.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DwcEM1UU.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DhRIJOX9.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DhRIJOX9.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
- package/dist/_chunks/Preview-BMYN548c.mjs +294 -0
- package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
- package/dist/_chunks/Preview-DaOihysv.js +312 -0
- package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
- package/dist/_chunks/{Relations-DnFXuS0x.js → Relations-CTGM7Hv5.js} +47 -23
- package/dist/_chunks/Relations-CTGM7Hv5.js.map +1 -0
- package/dist/_chunks/{Relations-D3LEWajT.mjs → Relations-gscPkxjF.mjs} +47 -22
- package/dist/_chunks/Relations-gscPkxjF.mjs.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BzQmavmK.js} +21 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-CSxLmrh1.mjs} +21 -4
- package/dist/_chunks/{en-DKV44jRb.mjs.map → en-CSxLmrh1.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-DhdyY1Y8.js → index-Ca7YWlAA.js} +413 -209
- package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
- package/dist/_chunks/{index-CtuQXm7x.mjs → index-DqasUQ6Q.mjs} +416 -212
- package/dist/_chunks/index-DqasUQ6Q.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-DeADP3ln.js → layout-BW80JSCd.js} +5 -6
- package/dist/_chunks/{layout-DeADP3ln.js.map → layout-BW80JSCd.js.map} +1 -1
- package/dist/_chunks/{layout-BQCvMBx_.mjs → layout-W3clJSCy.mjs} +4 -4
- package/dist/_chunks/{layout-BQCvMBx_.mjs.map → layout-W3clJSCy.mjs.map} +1 -1
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-tS4X2RK8.mjs → relations-BlDkoeWh.mjs} +6 -7
- package/dist/_chunks/relations-BlDkoeWh.mjs.map +1 -0
- package/dist/_chunks/{relations-BVo_S6No.js → relations-C9Usz9k5.js} +6 -7
- package/dist/_chunks/relations-C9Usz9k5.js.map +1 -0
- 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 +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- 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/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -19
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/server/index.js +566 -318
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +567 -318
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +16 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +6 -11
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +7 -6
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.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 +12 -10
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +7 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +14 -12
- package/dist/_chunks/EditViewPage-Bg7aQ3vS.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CcWIJyJa.js.map +0 -1
- package/dist/_chunks/Field-BnTZJ0fG.js.map +0 -1
- package/dist/_chunks/Field-Cf1nzyOi.mjs.map +0 -1
- package/dist/_chunks/Form-BH04zZdW.js.map +0 -1
- package/dist/_chunks/Form-CXe7dOCt.mjs.map +0 -1
- package/dist/_chunks/History-CAM3gN3h.js.map +0 -1
- package/dist/_chunks/History-Cg_rjVg_.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-51n8mFbZ.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DMBKzujx.js.map +0 -1
- package/dist/_chunks/ListViewPage-DFzs-3jf.js.map +0 -1
- package/dist/_chunks/ListViewPage-RzuT8-b2.mjs.map +0 -1
- package/dist/_chunks/Relations-D3LEWajT.mjs.map +0 -1
- package/dist/_chunks/Relations-DnFXuS0x.js.map +0 -1
- package/dist/_chunks/index-CtuQXm7x.mjs.map +0 -1
- package/dist/_chunks/index-DhdyY1Y8.js.map +0 -1
- package/dist/_chunks/relations-BVo_S6No.js.map +0 -1
- package/dist/_chunks/relations-tS4X2RK8.mjs.map +0 -1
@@ -1,25 +1,33 @@
|
|
1
1
|
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
3
|
-
import { useStrapiApp, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler,
|
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
|
+
import mapValues from "lodash/fp/mapValues";
|
7
8
|
import { useIntl } from "react-intl";
|
8
9
|
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
|
+
import { styled } from "styled-components";
|
9
11
|
import * as yup from "yup";
|
10
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
11
14
|
import pipe from "lodash/fp/pipe";
|
12
15
|
import { intervalToDuration, isPast } from "date-fns";
|
13
|
-
import { styled } from "styled-components";
|
14
|
-
import { stringify } from "qs";
|
15
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
16
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
17
18
|
const v = glob[path];
|
18
19
|
if (v) {
|
19
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
20
21
|
}
|
21
22
|
return new Promise((_, reject) => {
|
22
|
-
(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
|
+
);
|
23
31
|
});
|
24
32
|
};
|
25
33
|
const PLUGIN_ID = "content-manager";
|
@@ -100,6 +108,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
100
108
|
if (!slug) {
|
101
109
|
throw new Error("Cannot find the slug param in the URL");
|
102
110
|
}
|
111
|
+
const [{ rawQuery }] = useQueryParams();
|
103
112
|
const userPermissions = useAuth("DocumentRBAC", (state) => state.permissions);
|
104
113
|
const contentTypePermissions = React.useMemo(() => {
|
105
114
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -110,7 +119,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
110
119
|
return { ...acc, [action]: [permission] };
|
111
120
|
}, {});
|
112
121
|
}, [slug, userPermissions]);
|
113
|
-
const { isLoading, allowedActions } = useRBAC(
|
122
|
+
const { isLoading, allowedActions } = useRBAC(
|
123
|
+
contentTypePermissions,
|
124
|
+
permissions ?? void 0,
|
125
|
+
// TODO: useRBAC context should be typed and built differently
|
126
|
+
// We are passing raw query as context to the hook so that it can
|
127
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
128
|
+
rawQuery
|
129
|
+
);
|
114
130
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
115
131
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
116
132
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -159,7 +175,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
159
175
|
"InitialData",
|
160
176
|
"HistoryVersion",
|
161
177
|
"Relations",
|
162
|
-
"UidAvailability"
|
178
|
+
"UidAvailability",
|
179
|
+
"RecentDocumentList"
|
163
180
|
]
|
164
181
|
});
|
165
182
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -177,7 +194,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
177
194
|
if (error) {
|
178
195
|
return [];
|
179
196
|
}
|
180
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
197
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
181
198
|
}
|
182
199
|
}),
|
183
200
|
cloneDocument: builder.mutation({
|
@@ -191,7 +208,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
191
208
|
}),
|
192
209
|
invalidatesTags: (_result, _error, { model }) => [
|
193
210
|
{ type: "Document", id: `${model}_LIST` },
|
194
|
-
{ type: "UidAvailability", id: model }
|
211
|
+
{ type: "UidAvailability", id: model },
|
212
|
+
"RecentDocumentList"
|
195
213
|
]
|
196
214
|
}),
|
197
215
|
/**
|
@@ -210,8 +228,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
210
228
|
invalidatesTags: (result, _error, { model }) => [
|
211
229
|
{ type: "Document", id: `${model}_LIST` },
|
212
230
|
"Relations",
|
213
|
-
{ type: "UidAvailability", id: model }
|
214
|
-
|
231
|
+
{ type: "UidAvailability", id: model },
|
232
|
+
"RecentDocumentList"
|
233
|
+
],
|
234
|
+
transformResponse: (response, meta, arg) => {
|
235
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
236
|
+
return {
|
237
|
+
data: response,
|
238
|
+
meta: {
|
239
|
+
availableStatus: [],
|
240
|
+
availableLocales: []
|
241
|
+
}
|
242
|
+
};
|
243
|
+
}
|
244
|
+
return response;
|
245
|
+
}
|
215
246
|
}),
|
216
247
|
deleteDocument: builder.mutation({
|
217
248
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -222,7 +253,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
222
253
|
}
|
223
254
|
}),
|
224
255
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
225
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
256
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
257
|
+
"RecentDocumentList"
|
226
258
|
]
|
227
259
|
}),
|
228
260
|
deleteManyDocuments: builder.mutation({
|
@@ -234,7 +266,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
234
266
|
params
|
235
267
|
}
|
236
268
|
}),
|
237
|
-
invalidatesTags: (_res, _error, { model }) => [
|
269
|
+
invalidatesTags: (_res, _error, { model }) => [
|
270
|
+
{ type: "Document", id: `${model}_LIST` },
|
271
|
+
"RecentDocumentList"
|
272
|
+
]
|
238
273
|
}),
|
239
274
|
discardDocument: builder.mutation({
|
240
275
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -252,7 +287,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
252
287
|
},
|
253
288
|
{ type: "Document", id: `${model}_LIST` },
|
254
289
|
"Relations",
|
255
|
-
{ type: "UidAvailability", id: model }
|
290
|
+
{ type: "UidAvailability", id: model },
|
291
|
+
"RecentDocumentList"
|
256
292
|
];
|
257
293
|
}
|
258
294
|
}),
|
@@ -265,7 +301,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
265
301
|
url: `/content-manager/collection-types/${model}`,
|
266
302
|
method: "GET",
|
267
303
|
config: {
|
268
|
-
params
|
304
|
+
params: stringify(params, { encode: true })
|
269
305
|
}
|
270
306
|
}),
|
271
307
|
providesTags: (result, _error, arg) => {
|
@@ -347,7 +383,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
347
383
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
348
384
|
},
|
349
385
|
{ type: "Document", id: `${model}_LIST` },
|
350
|
-
"Relations"
|
386
|
+
"Relations",
|
387
|
+
"RecentDocumentList"
|
351
388
|
];
|
352
389
|
}
|
353
390
|
}),
|
@@ -378,7 +415,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
378
415
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
379
416
|
},
|
380
417
|
"Relations",
|
381
|
-
{ type: "UidAvailability", id: model }
|
418
|
+
{ type: "UidAvailability", id: model },
|
419
|
+
"RecentDocumentList",
|
420
|
+
"RecentDocumentList"
|
382
421
|
];
|
383
422
|
},
|
384
423
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -408,7 +447,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
408
447
|
{
|
409
448
|
type: "Document",
|
410
449
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
411
|
-
}
|
450
|
+
},
|
451
|
+
"RecentDocumentList"
|
412
452
|
];
|
413
453
|
}
|
414
454
|
}),
|
@@ -421,7 +461,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
421
461
|
params
|
422
462
|
}
|
423
463
|
}),
|
424
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
464
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
465
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
466
|
+
"RecentDocumentList"
|
467
|
+
]
|
425
468
|
})
|
426
469
|
})
|
427
470
|
});
|
@@ -444,8 +487,7 @@ const {
|
|
444
487
|
useUnpublishManyDocumentsMutation
|
445
488
|
} = documentApi;
|
446
489
|
const buildValidParams = (query) => {
|
447
|
-
if (!query)
|
448
|
-
return query;
|
490
|
+
if (!query) return query;
|
449
491
|
const { plugins: _, ...validQueryParams } = {
|
450
492
|
...query,
|
451
493
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -453,20 +495,20 @@ const buildValidParams = (query) => {
|
|
453
495
|
{}
|
454
496
|
)
|
455
497
|
};
|
456
|
-
if ("_q" in validQueryParams) {
|
457
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
458
|
-
}
|
459
498
|
return validQueryParams;
|
460
499
|
};
|
461
500
|
const isBaseQueryError = (error) => {
|
462
501
|
return error.name !== void 0;
|
463
502
|
};
|
464
|
-
const arrayValidator = (options) => ({
|
503
|
+
const arrayValidator = (attribute, options) => ({
|
465
504
|
message: translatedErrors.required,
|
466
505
|
test(value) {
|
467
506
|
if (options.status === "draft") {
|
468
507
|
return true;
|
469
508
|
}
|
509
|
+
if (!attribute.required) {
|
510
|
+
return true;
|
511
|
+
}
|
470
512
|
if (!value) {
|
471
513
|
return false;
|
472
514
|
}
|
@@ -500,7 +542,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
500
542
|
...acc,
|
501
543
|
[name]: transformSchema(
|
502
544
|
yup.array().of(createModelSchema(attributes3).nullable(false))
|
503
|
-
).test(arrayValidator(options))
|
545
|
+
).test(arrayValidator(attribute, options))
|
504
546
|
};
|
505
547
|
} else {
|
506
548
|
return {
|
@@ -527,7 +569,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
527
569
|
}
|
528
570
|
)
|
529
571
|
)
|
530
|
-
).test(arrayValidator(options))
|
572
|
+
).test(arrayValidator(attribute, options))
|
531
573
|
};
|
532
574
|
case "relation":
|
533
575
|
return {
|
@@ -625,10 +667,7 @@ const nullableSchema = (schema) => {
|
|
625
667
|
schema
|
626
668
|
);
|
627
669
|
};
|
628
|
-
const addNullableValidation = (
|
629
|
-
if (attribute.required) {
|
630
|
-
return schema;
|
631
|
-
}
|
670
|
+
const addNullableValidation = () => (schema) => {
|
632
671
|
return nullableSchema(schema);
|
633
672
|
};
|
634
673
|
const addRequiredValidation = (attribute, options) => (schema) => {
|
@@ -960,9 +999,10 @@ const formatEditLayout = (data, {
|
|
960
999
|
currentPanelIndex += 2;
|
961
1000
|
} else {
|
962
1001
|
if (!panels[currentPanelIndex]) {
|
963
|
-
panels.push([]);
|
1002
|
+
panels.push([row]);
|
1003
|
+
} else {
|
1004
|
+
panels[currentPanelIndex].push(row);
|
964
1005
|
}
|
965
|
-
panels[currentPanelIndex].push(row);
|
966
1006
|
}
|
967
1007
|
return panels;
|
968
1008
|
}, []);
|
@@ -1166,16 +1206,18 @@ const useDoc = () => {
|
|
1166
1206
|
if (!slug) {
|
1167
1207
|
throw new Error("Could not find model in url params");
|
1168
1208
|
}
|
1209
|
+
const document = useDocument(
|
1210
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1211
|
+
{
|
1212
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1213
|
+
}
|
1214
|
+
);
|
1215
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1169
1216
|
return {
|
1170
1217
|
collectionType,
|
1171
1218
|
model: slug,
|
1172
|
-
id:
|
1173
|
-
...
|
1174
|
-
{ documentId: origin || id, model: slug, collectionType, params },
|
1175
|
-
{
|
1176
|
-
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1177
|
-
}
|
1178
|
-
)
|
1219
|
+
id: returnId,
|
1220
|
+
...document
|
1179
1221
|
};
|
1180
1222
|
};
|
1181
1223
|
const useContentManagerContext = () => {
|
@@ -1218,9 +1260,6 @@ const useContentManagerContext = () => {
|
|
1218
1260
|
};
|
1219
1261
|
};
|
1220
1262
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1221
|
-
if (!pluginId) {
|
1222
|
-
throw new TypeError("pluginId can't be empty");
|
1223
|
-
}
|
1224
1263
|
return Object.keys(trad).reduce((acc, current) => {
|
1225
1264
|
acc[`${pluginId}.${current}`] = trad[current];
|
1226
1265
|
return acc;
|
@@ -1654,10 +1693,10 @@ const useDocumentActions = () => {
|
|
1654
1693
|
update
|
1655
1694
|
};
|
1656
1695
|
};
|
1657
|
-
const ProtectedHistoryPage = lazy(
|
1658
|
-
() => import("./History-
|
1696
|
+
const ProtectedHistoryPage = React.lazy(
|
1697
|
+
() => import("./History-04ChQ4pl.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1659
1698
|
);
|
1660
|
-
const routes$
|
1699
|
+
const routes$2 = [
|
1661
1700
|
{
|
1662
1701
|
path: ":collectionType/:slug/:id/history",
|
1663
1702
|
Component: ProtectedHistoryPage
|
@@ -1667,32 +1706,45 @@ const routes$1 = [
|
|
1667
1706
|
Component: ProtectedHistoryPage
|
1668
1707
|
}
|
1669
1708
|
];
|
1709
|
+
const ProtectedPreviewPage = React.lazy(
|
1710
|
+
() => import("./Preview-BMYN548c.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1711
|
+
);
|
1712
|
+
const routes$1 = [
|
1713
|
+
{
|
1714
|
+
path: ":collectionType/:slug/:id/preview",
|
1715
|
+
Component: ProtectedPreviewPage
|
1716
|
+
},
|
1717
|
+
{
|
1718
|
+
path: ":collectionType/:slug/preview",
|
1719
|
+
Component: ProtectedPreviewPage
|
1720
|
+
}
|
1721
|
+
];
|
1670
1722
|
const ProtectedEditViewPage = lazy(
|
1671
|
-
() => import("./EditViewPage-
|
1723
|
+
() => import("./EditViewPage-BPyVuPfM.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1672
1724
|
);
|
1673
1725
|
const ProtectedListViewPage = lazy(
|
1674
|
-
() => import("./ListViewPage-
|
1726
|
+
() => import("./ListViewPage-FU2LBuhl.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1675
1727
|
);
|
1676
1728
|
const ProtectedListConfiguration = lazy(
|
1677
|
-
() => import("./ListConfigurationPage-
|
1729
|
+
() => import("./ListConfigurationPage-BYqPYLSU.mjs").then((mod) => ({
|
1678
1730
|
default: mod.ProtectedListConfiguration
|
1679
1731
|
}))
|
1680
1732
|
);
|
1681
1733
|
const ProtectedEditConfigurationPage = lazy(
|
1682
|
-
() => import("./EditConfigurationPage-
|
1734
|
+
() => import("./EditConfigurationPage-DsPR2DVk.mjs").then((mod) => ({
|
1683
1735
|
default: mod.ProtectedEditConfigurationPage
|
1684
1736
|
}))
|
1685
1737
|
);
|
1686
1738
|
const ProtectedComponentConfigurationPage = lazy(
|
1687
|
-
() => import("./ComponentConfigurationPage-
|
1739
|
+
() => import("./ComponentConfigurationPage-CtIa3aa2.mjs").then((mod) => ({
|
1688
1740
|
default: mod.ProtectedComponentConfigurationPage
|
1689
1741
|
}))
|
1690
1742
|
);
|
1691
1743
|
const NoPermissions = lazy(
|
1692
|
-
() => import("./NoPermissionsPage-
|
1744
|
+
() => import("./NoPermissionsPage-jqve7C8l.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1693
1745
|
);
|
1694
1746
|
const NoContentType = lazy(
|
1695
|
-
() => import("./NoContentTypePage-
|
1747
|
+
() => import("./NoContentTypePage-DCKUkwb8.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1696
1748
|
);
|
1697
1749
|
const CollectionTypePages = () => {
|
1698
1750
|
const { collectionType } = useParams();
|
@@ -1704,7 +1756,7 @@ const CollectionTypePages = () => {
|
|
1704
1756
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1705
1757
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1706
1758
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1707
|
-
const LIST_PATH = `/content-manager
|
1759
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1708
1760
|
const routes = [
|
1709
1761
|
{
|
1710
1762
|
path: LIST_RELATIVE_PATH,
|
@@ -1738,6 +1790,7 @@ const routes = [
|
|
1738
1790
|
path: "no-content-types",
|
1739
1791
|
Component: NoContentType
|
1740
1792
|
},
|
1793
|
+
...routes$2,
|
1741
1794
|
...routes$1
|
1742
1795
|
];
|
1743
1796
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1836,6 +1889,11 @@ const DocumentActionButton = (action) => {
|
|
1836
1889
|
) : null
|
1837
1890
|
] });
|
1838
1891
|
};
|
1892
|
+
const MenuItem = styled(Menu.Item)`
|
1893
|
+
&:hover {
|
1894
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1895
|
+
}
|
1896
|
+
`;
|
1839
1897
|
const DocumentActionsMenu = ({
|
1840
1898
|
actions: actions2,
|
1841
1899
|
children,
|
@@ -1894,48 +1952,32 @@ const DocumentActionsMenu = ({
|
|
1894
1952
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1895
1953
|
actions2.map((action) => {
|
1896
1954
|
return /* @__PURE__ */ jsx(
|
1897
|
-
|
1955
|
+
MenuItem,
|
1898
1956
|
{
|
1899
1957
|
disabled: action.disabled,
|
1900
1958
|
onSelect: handleClick(action),
|
1901
1959
|
display: "block",
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
Flex,
|
1924
|
-
{
|
1925
|
-
alignItems: "center",
|
1926
|
-
background: "alternative100",
|
1927
|
-
borderStyle: "solid",
|
1928
|
-
borderColor: "alternative200",
|
1929
|
-
borderWidth: "1px",
|
1930
|
-
height: 5,
|
1931
|
-
paddingLeft: 2,
|
1932
|
-
paddingRight: 2,
|
1933
|
-
hasRadius: true,
|
1934
|
-
color: "alternative600",
|
1935
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1936
|
-
}
|
1937
|
-
)
|
1938
|
-
] })
|
1960
|
+
isVariantDanger: action.variant === "danger",
|
1961
|
+
isDisabled: action.disabled,
|
1962
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1963
|
+
Flex,
|
1964
|
+
{
|
1965
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1966
|
+
gap: 2,
|
1967
|
+
tag: "span",
|
1968
|
+
children: [
|
1969
|
+
/* @__PURE__ */ jsx(
|
1970
|
+
Flex,
|
1971
|
+
{
|
1972
|
+
tag: "span",
|
1973
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1974
|
+
children: action.icon
|
1975
|
+
}
|
1976
|
+
),
|
1977
|
+
action.label
|
1978
|
+
]
|
1979
|
+
}
|
1980
|
+
) })
|
1939
1981
|
},
|
1940
1982
|
action.id
|
1941
1983
|
);
|
@@ -2046,6 +2088,18 @@ const DocumentActionModal = ({
|
|
2046
2088
|
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
2047
2089
|
] }) });
|
2048
2090
|
};
|
2091
|
+
const transformData = (data) => {
|
2092
|
+
if (Array.isArray(data)) {
|
2093
|
+
return data.map(transformData);
|
2094
|
+
}
|
2095
|
+
if (typeof data === "object" && data !== null) {
|
2096
|
+
if ("apiData" in data) {
|
2097
|
+
return data.apiData;
|
2098
|
+
}
|
2099
|
+
return mapValues(transformData)(data);
|
2100
|
+
}
|
2101
|
+
return data;
|
2102
|
+
};
|
2049
2103
|
const PublishAction$1 = ({
|
2050
2104
|
activeTab,
|
2051
2105
|
documentId,
|
@@ -2060,6 +2114,7 @@ const PublishAction$1 = ({
|
|
2060
2114
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2061
2115
|
const isListView = useMatch(LIST_PATH) !== null;
|
2062
2116
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2117
|
+
const { id } = useParams();
|
2063
2118
|
const { formatMessage } = useIntl();
|
2064
2119
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2065
2120
|
const { publish } = useDocumentActions();
|
@@ -2159,13 +2214,15 @@ const PublishAction$1 = ({
|
|
2159
2214
|
documentId,
|
2160
2215
|
params
|
2161
2216
|
},
|
2162
|
-
formValues
|
2217
|
+
transformData(formValues)
|
2163
2218
|
);
|
2164
2219
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2220
|
+
if (id === "create") {
|
2221
|
+
navigate({
|
2222
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2223
|
+
search: rawQuery
|
2224
|
+
});
|
2225
|
+
}
|
2169
2226
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2170
2227
|
setErrors(formatValidationErrors(res.error));
|
2171
2228
|
}
|
@@ -2218,6 +2275,7 @@ const PublishAction$1 = ({
|
|
2218
2275
|
};
|
2219
2276
|
};
|
2220
2277
|
PublishAction$1.type = "publish";
|
2278
|
+
PublishAction$1.position = "panel";
|
2221
2279
|
const UpdateAction = ({
|
2222
2280
|
activeTab,
|
2223
2281
|
documentId,
|
@@ -2240,96 +2298,134 @@ const UpdateAction = ({
|
|
2240
2298
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2241
2299
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2242
2300
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
status: "draft"
|
2301
|
+
const handleUpdate = React.useCallback(async () => {
|
2302
|
+
setSubmitting(true);
|
2303
|
+
try {
|
2304
|
+
if (!modified) {
|
2305
|
+
return;
|
2306
|
+
}
|
2307
|
+
const { errors } = await validate(true, {
|
2308
|
+
status: "draft"
|
2309
|
+
});
|
2310
|
+
if (errors) {
|
2311
|
+
toggleNotification({
|
2312
|
+
type: "danger",
|
2313
|
+
message: formatMessage({
|
2314
|
+
id: "content-manager.validation.error",
|
2315
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2316
|
+
})
|
2260
2317
|
});
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
model,
|
2275
|
-
documentId: cloneMatch.params.origin,
|
2276
|
-
params
|
2277
|
-
},
|
2278
|
-
document
|
2279
|
-
);
|
2280
|
-
if ("data" in res) {
|
2281
|
-
navigate(
|
2282
|
-
{
|
2283
|
-
pathname: `../${res.data.documentId}`,
|
2284
|
-
search: rawQuery
|
2285
|
-
},
|
2286
|
-
{ relative: "path" }
|
2287
|
-
);
|
2288
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2289
|
-
setErrors(formatValidationErrors(res.error));
|
2290
|
-
}
|
2291
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2292
|
-
const res = await update(
|
2318
|
+
return;
|
2319
|
+
}
|
2320
|
+
if (isCloning) {
|
2321
|
+
const res = await clone(
|
2322
|
+
{
|
2323
|
+
model,
|
2324
|
+
documentId: cloneMatch.params.origin,
|
2325
|
+
params
|
2326
|
+
},
|
2327
|
+
transformData(document)
|
2328
|
+
);
|
2329
|
+
if ("data" in res) {
|
2330
|
+
navigate(
|
2293
2331
|
{
|
2294
|
-
|
2295
|
-
|
2296
|
-
documentId,
|
2297
|
-
params
|
2332
|
+
pathname: `../${res.data.documentId}`,
|
2333
|
+
search: rawQuery
|
2298
2334
|
},
|
2299
|
-
|
2335
|
+
{ relative: "path" }
|
2300
2336
|
);
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2337
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2338
|
+
setErrors(formatValidationErrors(res.error));
|
2339
|
+
}
|
2340
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2341
|
+
const res = await update(
|
2342
|
+
{
|
2343
|
+
collectionType,
|
2344
|
+
model,
|
2345
|
+
documentId,
|
2346
|
+
params
|
2347
|
+
},
|
2348
|
+
transformData(document)
|
2349
|
+
);
|
2350
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2351
|
+
setErrors(formatValidationErrors(res.error));
|
2306
2352
|
} else {
|
2307
|
-
|
2353
|
+
resetForm();
|
2354
|
+
}
|
2355
|
+
} else {
|
2356
|
+
const res = await create(
|
2357
|
+
{
|
2358
|
+
model,
|
2359
|
+
params
|
2360
|
+
},
|
2361
|
+
transformData(document)
|
2362
|
+
);
|
2363
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2364
|
+
navigate(
|
2308
2365
|
{
|
2309
|
-
|
2310
|
-
|
2366
|
+
pathname: `../${res.data.documentId}`,
|
2367
|
+
search: rawQuery
|
2311
2368
|
},
|
2312
|
-
|
2369
|
+
{ replace: true, relative: "path" }
|
2313
2370
|
);
|
2314
|
-
|
2315
|
-
|
2316
|
-
{
|
2317
|
-
pathname: `../${res.data.documentId}`,
|
2318
|
-
search: rawQuery
|
2319
|
-
},
|
2320
|
-
{ replace: true, relative: "path" }
|
2321
|
-
);
|
2322
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2323
|
-
setErrors(formatValidationErrors(res.error));
|
2324
|
-
}
|
2371
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2372
|
+
setErrors(formatValidationErrors(res.error));
|
2325
2373
|
}
|
2326
|
-
} finally {
|
2327
|
-
setSubmitting(false);
|
2328
2374
|
}
|
2375
|
+
} finally {
|
2376
|
+
setSubmitting(false);
|
2329
2377
|
}
|
2378
|
+
}, [
|
2379
|
+
clone,
|
2380
|
+
cloneMatch?.params.origin,
|
2381
|
+
collectionType,
|
2382
|
+
create,
|
2383
|
+
document,
|
2384
|
+
documentId,
|
2385
|
+
formatMessage,
|
2386
|
+
formatValidationErrors,
|
2387
|
+
isCloning,
|
2388
|
+
model,
|
2389
|
+
modified,
|
2390
|
+
navigate,
|
2391
|
+
params,
|
2392
|
+
rawQuery,
|
2393
|
+
resetForm,
|
2394
|
+
setErrors,
|
2395
|
+
setSubmitting,
|
2396
|
+
toggleNotification,
|
2397
|
+
update,
|
2398
|
+
validate
|
2399
|
+
]);
|
2400
|
+
React.useEffect(() => {
|
2401
|
+
const handleKeyDown = (e) => {
|
2402
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2403
|
+
e.preventDefault();
|
2404
|
+
handleUpdate();
|
2405
|
+
}
|
2406
|
+
};
|
2407
|
+
window.addEventListener("keydown", handleKeyDown);
|
2408
|
+
return () => {
|
2409
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2410
|
+
};
|
2411
|
+
}, [handleUpdate]);
|
2412
|
+
return {
|
2413
|
+
/**
|
2414
|
+
* Disabled when:
|
2415
|
+
* - the form is submitting
|
2416
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2417
|
+
* - the active tab is the published tab
|
2418
|
+
*/
|
2419
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2420
|
+
label: formatMessage({
|
2421
|
+
id: "global.save",
|
2422
|
+
defaultMessage: "Save"
|
2423
|
+
}),
|
2424
|
+
onClick: handleUpdate
|
2330
2425
|
};
|
2331
2426
|
};
|
2332
2427
|
UpdateAction.type = "update";
|
2428
|
+
UpdateAction.position = "panel";
|
2333
2429
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2334
2430
|
KEEP: "keep",
|
2335
2431
|
DISCARD: "discard"
|
@@ -2452,6 +2548,7 @@ const UnpublishAction$1 = ({
|
|
2452
2548
|
};
|
2453
2549
|
};
|
2454
2550
|
UnpublishAction$1.type = "unpublish";
|
2551
|
+
UnpublishAction$1.position = "panel";
|
2455
2552
|
const DiscardAction = ({
|
2456
2553
|
activeTab,
|
2457
2554
|
documentId,
|
@@ -2502,6 +2599,7 @@ const DiscardAction = ({
|
|
2502
2599
|
};
|
2503
2600
|
};
|
2504
2601
|
DiscardAction.type = "discard";
|
2602
|
+
DiscardAction.position = "panel";
|
2505
2603
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2506
2604
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2507
2605
|
const RelativeTime = React.forwardRef(
|
@@ -2514,7 +2612,7 @@ const RelativeTime = React.forwardRef(
|
|
2514
2612
|
});
|
2515
2613
|
const unit = intervals.find((intervalUnit) => {
|
2516
2614
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2517
|
-
});
|
2615
|
+
}) ?? "seconds";
|
2518
2616
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2519
2617
|
const customInterval = customIntervals.find(
|
2520
2618
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2548,19 +2646,29 @@ const getDisplayName = ({
|
|
2548
2646
|
return email ?? "";
|
2549
2647
|
};
|
2550
2648
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2551
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2649
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2552
2650
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2553
|
-
|
2651
|
+
const { formatMessage } = useIntl();
|
2652
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2653
|
+
id: `content-manager.containers.List.${status}`,
|
2654
|
+
defaultMessage: capitalise(status)
|
2655
|
+
}) }) });
|
2554
2656
|
};
|
2555
2657
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2556
2658
|
const { formatMessage } = useIntl();
|
2557
2659
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2660
|
+
const params = useParams();
|
2558
2661
|
const title = isCreating ? formatMessage({
|
2559
2662
|
id: "content-manager.containers.edit.title.new",
|
2560
2663
|
defaultMessage: "Create an entry"
|
2561
2664
|
}) : documentTitle;
|
2562
2665
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2563
|
-
/* @__PURE__ */ jsx(
|
2666
|
+
/* @__PURE__ */ jsx(
|
2667
|
+
BackButton,
|
2668
|
+
{
|
2669
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2670
|
+
}
|
2671
|
+
),
|
2564
2672
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2565
2673
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2566
2674
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2611,7 +2719,7 @@ const HeaderToolbar = () => {
|
|
2611
2719
|
meta: isCloning ? void 0 : meta,
|
2612
2720
|
collectionType
|
2613
2721
|
},
|
2614
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2722
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2615
2723
|
children: (actions2) => {
|
2616
2724
|
const headerActions = actions2.filter((action) => {
|
2617
2725
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2819,6 +2927,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2819
2927
|
};
|
2820
2928
|
};
|
2821
2929
|
ConfigureTheViewAction.type = "configure-the-view";
|
2930
|
+
ConfigureTheViewAction.position = "header";
|
2822
2931
|
const EditTheModelAction = ({ model }) => {
|
2823
2932
|
const navigate = useNavigate();
|
2824
2933
|
const { formatMessage } = useIntl();
|
@@ -2835,6 +2944,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2835
2944
|
};
|
2836
2945
|
};
|
2837
2946
|
EditTheModelAction.type = "edit-the-model";
|
2947
|
+
EditTheModelAction.position = "header";
|
2838
2948
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2839
2949
|
const navigate = useNavigate();
|
2840
2950
|
const { formatMessage } = useIntl();
|
@@ -2908,6 +3018,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2908
3018
|
};
|
2909
3019
|
};
|
2910
3020
|
DeleteAction$1.type = "delete";
|
3021
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2911
3022
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2912
3023
|
const Panels = () => {
|
2913
3024
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2970,7 +3081,7 @@ const ActionsPanelContent = () => {
|
|
2970
3081
|
DescriptionComponentRenderer,
|
2971
3082
|
{
|
2972
3083
|
props,
|
2973
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3084
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2974
3085
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2975
3086
|
}
|
2976
3087
|
),
|
@@ -2997,7 +3108,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
|
|
2997
3108
|
justifyContent: "stretch",
|
2998
3109
|
alignItems: "flex-start",
|
2999
3110
|
children: [
|
3000
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3111
|
+
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3001
3112
|
children
|
3002
3113
|
]
|
3003
3114
|
}
|
@@ -3247,18 +3358,10 @@ const SelectedEntriesTableContent = ({
|
|
3247
3358
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3248
3359
|
},
|
3249
3360
|
state: { from: pathname },
|
3250
|
-
label: formatMessage(
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
{
|
3255
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3256
|
-
defaultMessage: "item line {number}"
|
3257
|
-
},
|
3258
|
-
{ number: index2 + 1 }
|
3259
|
-
)
|
3260
|
-
}
|
3261
|
-
),
|
3361
|
+
label: formatMessage({
|
3362
|
+
id: "content-manager.bulk-publish.edit",
|
3363
|
+
defaultMessage: "Edit"
|
3364
|
+
}),
|
3262
3365
|
target: "_blank",
|
3263
3366
|
marginLeft: "auto",
|
3264
3367
|
variant: "ghost",
|
@@ -3432,8 +3535,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3432
3535
|
const refetchList = () => {
|
3433
3536
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3434
3537
|
};
|
3435
|
-
if (!showPublishButton)
|
3436
|
-
return null;
|
3538
|
+
if (!showPublishButton) return null;
|
3437
3539
|
return {
|
3438
3540
|
actionType: "publish",
|
3439
3541
|
variant: "tertiary",
|
@@ -3501,8 +3603,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3501
3603
|
selectRow([]);
|
3502
3604
|
}
|
3503
3605
|
};
|
3504
|
-
if (!hasDeletePermission)
|
3505
|
-
return null;
|
3606
|
+
if (!hasDeletePermission) return null;
|
3506
3607
|
return {
|
3507
3608
|
variant: "danger-light",
|
3508
3609
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3551,8 +3652,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3551
3652
|
}
|
3552
3653
|
};
|
3553
3654
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3554
|
-
if (!showUnpublishButton)
|
3555
|
-
return null;
|
3655
|
+
if (!showUnpublishButton) return null;
|
3556
3656
|
return {
|
3557
3657
|
variant: "tertiary",
|
3558
3658
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3657,7 +3757,7 @@ const TableActions = ({ document }) => {
|
|
3657
3757
|
DescriptionComponentRenderer,
|
3658
3758
|
{
|
3659
3759
|
props,
|
3660
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3760
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3661
3761
|
children: (actions2) => {
|
3662
3762
|
const tableRowActions = actions2.filter((action) => {
|
3663
3763
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3716,6 +3816,7 @@ const EditAction = ({ documentId }) => {
|
|
3716
3816
|
};
|
3717
3817
|
};
|
3718
3818
|
EditAction.type = "edit";
|
3819
|
+
EditAction.position = "table-row";
|
3719
3820
|
const StyledPencil = styled(Pencil)`
|
3720
3821
|
path {
|
3721
3822
|
fill: currentColor;
|
@@ -3792,6 +3893,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3792
3893
|
};
|
3793
3894
|
};
|
3794
3895
|
CloneAction.type = "clone";
|
3896
|
+
CloneAction.position = "table-row";
|
3795
3897
|
const StyledDuplicate = styled(Duplicate)`
|
3796
3898
|
path {
|
3797
3899
|
fill: currentColor;
|
@@ -3878,7 +3980,14 @@ class ContentManagerPlugin {
|
|
3878
3980
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3879
3981
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3880
3982
|
getBulkActions: () => this.bulkActions,
|
3881
|
-
getDocumentActions: () =>
|
3983
|
+
getDocumentActions: (position) => {
|
3984
|
+
if (position) {
|
3985
|
+
return this.documentActions.filter(
|
3986
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3987
|
+
);
|
3988
|
+
}
|
3989
|
+
return this.documentActions;
|
3990
|
+
},
|
3882
3991
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3883
3992
|
getHeaderActions: () => this.headerActions
|
3884
3993
|
}
|
@@ -3888,10 +3997,8 @@ class ContentManagerPlugin {
|
|
3888
3997
|
const getPrintableType = (value) => {
|
3889
3998
|
const nativeType = typeof value;
|
3890
3999
|
if (nativeType === "object") {
|
3891
|
-
if (value === null)
|
3892
|
-
|
3893
|
-
if (Array.isArray(value))
|
3894
|
-
return "array";
|
4000
|
+
if (value === null) return "null";
|
4001
|
+
if (Array.isArray(value)) return "array";
|
3895
4002
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3896
4003
|
return value.constructor.name;
|
3897
4004
|
}
|
@@ -3902,17 +4009,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3902
4009
|
const { formatMessage } = useIntl();
|
3903
4010
|
const [{ query }] = useQueryParams();
|
3904
4011
|
const navigate = useNavigate();
|
4012
|
+
const { trackUsage } = useTracking();
|
4013
|
+
const { pathname } = useLocation();
|
3905
4014
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3906
4015
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3907
4016
|
return null;
|
3908
4017
|
}
|
4018
|
+
const handleOnClick = () => {
|
4019
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4020
|
+
trackUsage("willNavigate", {
|
4021
|
+
from: pathname,
|
4022
|
+
to: `${pathname}/${destination.pathname}`
|
4023
|
+
});
|
4024
|
+
navigate(destination);
|
4025
|
+
};
|
3909
4026
|
return {
|
3910
4027
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3911
4028
|
label: formatMessage({
|
3912
4029
|
id: "content-manager.history.document-action",
|
3913
4030
|
defaultMessage: "Content History"
|
3914
4031
|
}),
|
3915
|
-
onClick:
|
4032
|
+
onClick: handleOnClick,
|
3916
4033
|
disabled: (
|
3917
4034
|
/**
|
3918
4035
|
* The user is creating a new document.
|
@@ -3934,6 +4051,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3934
4051
|
};
|
3935
4052
|
};
|
3936
4053
|
HistoryAction.type = "history";
|
4054
|
+
HistoryAction.position = "header";
|
3937
4055
|
const historyAdmin = {
|
3938
4056
|
bootstrap(app) {
|
3939
4057
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3980,6 +4098,88 @@ const { setInitialData } = actions;
|
|
3980
4098
|
const reducer = combineReducers({
|
3981
4099
|
app: reducer$1
|
3982
4100
|
});
|
4101
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4102
|
+
endpoints: (builder) => ({
|
4103
|
+
getPreviewUrl: builder.query({
|
4104
|
+
query({ query, params }) {
|
4105
|
+
return {
|
4106
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4107
|
+
method: "GET",
|
4108
|
+
config: {
|
4109
|
+
params: query
|
4110
|
+
}
|
4111
|
+
};
|
4112
|
+
}
|
4113
|
+
})
|
4114
|
+
})
|
4115
|
+
});
|
4116
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4117
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4118
|
+
if (isShown) {
|
4119
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4120
|
+
}
|
4121
|
+
return children;
|
4122
|
+
};
|
4123
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4124
|
+
const { formatMessage } = useIntl();
|
4125
|
+
const { trackUsage } = useTracking();
|
4126
|
+
const { pathname } = useLocation();
|
4127
|
+
const [{ query }] = useQueryParams();
|
4128
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4129
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4130
|
+
params: {
|
4131
|
+
contentType: model
|
4132
|
+
},
|
4133
|
+
query: {
|
4134
|
+
documentId,
|
4135
|
+
locale: document?.locale,
|
4136
|
+
status: document?.status
|
4137
|
+
}
|
4138
|
+
});
|
4139
|
+
if (!data?.data?.url || error) {
|
4140
|
+
return null;
|
4141
|
+
}
|
4142
|
+
const trackNavigation = () => {
|
4143
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4144
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4145
|
+
};
|
4146
|
+
return {
|
4147
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4148
|
+
content: /* @__PURE__ */ jsx(
|
4149
|
+
ConditionalTooltip,
|
4150
|
+
{
|
4151
|
+
label: formatMessage({
|
4152
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4153
|
+
defaultMessage: "Please save to open the preview"
|
4154
|
+
}),
|
4155
|
+
isShown: isModified,
|
4156
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4157
|
+
Button,
|
4158
|
+
{
|
4159
|
+
variant: "tertiary",
|
4160
|
+
tag: Link,
|
4161
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4162
|
+
onClick: trackNavigation,
|
4163
|
+
width: "100%",
|
4164
|
+
disabled: isModified,
|
4165
|
+
pointerEvents: isModified ? "none" : void 0,
|
4166
|
+
tabIndex: isModified ? -1 : void 0,
|
4167
|
+
children: formatMessage({
|
4168
|
+
id: "content-manager.preview.panel.button",
|
4169
|
+
defaultMessage: "Open preview"
|
4170
|
+
})
|
4171
|
+
}
|
4172
|
+
) })
|
4173
|
+
}
|
4174
|
+
)
|
4175
|
+
};
|
4176
|
+
};
|
4177
|
+
const previewAdmin = {
|
4178
|
+
bootstrap(app) {
|
4179
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4180
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4181
|
+
}
|
4182
|
+
};
|
3983
4183
|
const index = {
|
3984
4184
|
register(app) {
|
3985
4185
|
const cm = new ContentManagerPlugin();
|
@@ -3999,7 +4199,7 @@ const index = {
|
|
3999
4199
|
app.router.addRoute({
|
4000
4200
|
path: "content-manager/*",
|
4001
4201
|
lazy: async () => {
|
4002
|
-
const { Layout } = await import("./layout-
|
4202
|
+
const { Layout } = await import("./layout-W3clJSCy.mjs");
|
4003
4203
|
return {
|
4004
4204
|
Component: Layout
|
4005
4205
|
};
|
@@ -4012,11 +4212,14 @@ const index = {
|
|
4012
4212
|
if (typeof historyAdmin.bootstrap === "function") {
|
4013
4213
|
historyAdmin.bootstrap(app);
|
4014
4214
|
}
|
4215
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4216
|
+
previewAdmin.bootstrap(app);
|
4217
|
+
}
|
4015
4218
|
},
|
4016
4219
|
async registerTrads({ locales }) {
|
4017
4220
|
const importedTrads = await Promise.all(
|
4018
4221
|
locales.map((locale) => {
|
4019
|
-
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-
|
4222
|
+
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-CSxLmrh1.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 }) => {
|
4020
4223
|
return {
|
4021
4224
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4022
4225
|
locale
|
@@ -4043,9 +4246,10 @@ export {
|
|
4043
4246
|
HOOKS as H,
|
4044
4247
|
InjectionZone as I,
|
4045
4248
|
useDocument as J,
|
4046
|
-
|
4047
|
-
|
4048
|
-
|
4249
|
+
useGetPreviewUrlQuery as K,
|
4250
|
+
index as L,
|
4251
|
+
useContentManagerContext as M,
|
4252
|
+
useDocumentActions as N,
|
4049
4253
|
Panels as P,
|
4050
4254
|
RelativeTime as R,
|
4051
4255
|
SINGLE_TYPES as S,
|
@@ -4077,4 +4281,4 @@ export {
|
|
4077
4281
|
capitalise as y,
|
4078
4282
|
useUpdateContentTypeConfigurationMutation as z
|
4079
4283
|
};
|
4080
|
-
//# sourceMappingURL=index-
|
4284
|
+
//# sourceMappingURL=index-DqasUQ6Q.mjs.map
|