@strapi/content-manager 0.0.0-experimental.af7e4e2471a04cc7f17b8ed3474530810efc02bc → 0.0.0-experimental.b05633daea1bf090c66312b8ab30ec13bdb52f57
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-aeNlfgi9.mjs → ComponentConfigurationPage-A5f-t42A.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-aeNlfgi9.mjs.map → ComponentConfigurationPage-A5f-t42A.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-_EzKh4uq.js → ComponentConfigurationPage-BtmEfYUS.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-_EzKh4uq.js.map → ComponentConfigurationPage-BtmEfYUS.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-DaK5-ltL.js → EditConfigurationPage-CXLQhPpj.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-DaK5-ltL.js.map → EditConfigurationPage-CXLQhPpj.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DBVSBjCB.mjs → EditConfigurationPage-DN6yaDFZ.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DBVSBjCB.mjs.map → EditConfigurationPage-DN6yaDFZ.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-C3qKSunQ.js → EditViewPage-BW-BJJVg.js} +4 -5
- package/dist/_chunks/{EditViewPage-C3qKSunQ.js.map → EditViewPage-BW-BJJVg.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BeRi9xCR.mjs → EditViewPage-ONky_-8U.mjs} +3 -3
- package/dist/_chunks/{EditViewPage-BeRi9xCR.mjs.map → EditViewPage-ONky_-8U.mjs.map} +1 -1
- package/dist/_chunks/{Field-CfbMEZLv.mjs → Field-B4gAYDmQ.mjs} +126 -67
- package/dist/_chunks/Field-B4gAYDmQ.mjs.map +1 -0
- package/dist/_chunks/{Field-BwLr5b0V.js → Field-BMlzghtV.js} +128 -69
- package/dist/_chunks/Field-BMlzghtV.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-BSInvgp4.js → Form-DQPyv3UY.js} +5 -6
- package/dist/_chunks/{Form-BSInvgp4.js.map → Form-DQPyv3UY.js.map} +1 -1
- package/dist/_chunks/{Form-Br-9I4vG.mjs → Form-e4RpNQY0.mjs} +3 -3
- package/dist/_chunks/{Form-Br-9I4vG.mjs.map → Form-e4RpNQY0.mjs.map} +1 -1
- package/dist/_chunks/{History-BQ721fHN.mjs → History-Bk2VCzmJ.mjs} +8 -6
- package/dist/_chunks/History-Bk2VCzmJ.mjs.map +1 -0
- package/dist/_chunks/{History-BHH0axCz.js → History-CzkXjAR0.js} +8 -7
- package/dist/_chunks/History-CzkXjAR0.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-B7VtZkjG.js → ListConfigurationPage-B9TbaEqp.js} +4 -5
- package/dist/_chunks/{ListConfigurationPage-B7VtZkjG.js.map → ListConfigurationPage-B9TbaEqp.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BVtVADtP.mjs → ListConfigurationPage-BhNCzkQd.mjs} +3 -3
- package/dist/_chunks/{ListConfigurationPage-BVtVADtP.mjs.map → ListConfigurationPage-BhNCzkQd.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-C4UCZKeD.js → ListViewPage-CIHO4H2J.js} +51 -51
- package/dist/_chunks/ListViewPage-CIHO4H2J.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Dq7nBEKD.mjs → ListViewPage-mK-sFVGU.mjs} +50 -49
- package/dist/_chunks/ListViewPage-mK-sFVGU.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CQlgc_9h.mjs → NoContentTypePage-BSVg7nZI.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CQlgc_9h.mjs.map → NoContentTypePage-BSVg7nZI.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-YNlmMHbx.js → NoContentTypePage-Dbfi49ek.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-YNlmMHbx.js.map → NoContentTypePage-Dbfi49ek.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CERDW9_P.js → NoPermissionsPage-CDvWOtEy.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CERDW9_P.js.map → NoPermissionsPage-CDvWOtEy.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CT2YbxJK.mjs → NoPermissionsPage-zpYME1_X.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CT2YbxJK.mjs.map → NoPermissionsPage-zpYME1_X.mjs.map} +1 -1
- package/dist/_chunks/{Preview-D9FlX2H8.js → Preview-8U27vy1U.js} +48 -12
- package/dist/_chunks/Preview-8U27vy1U.js.map +1 -0
- package/dist/_chunks/{Preview-GZFXtAgo.mjs → Preview-Dd3kQluA.mjs} +49 -12
- package/dist/_chunks/Preview-Dd3kQluA.mjs.map +1 -0
- package/dist/_chunks/{Relations-49C4HPsL.mjs → Relations-BvdARGTL.mjs} +6 -8
- package/dist/_chunks/{Relations-49C4HPsL.mjs.map → Relations-BvdARGTL.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CcJBqH7I.js → Relations-CFMS6Dm8.js} +7 -10
- package/dist/_chunks/{Relations-CcJBqH7I.js.map → Relations-CFMS6Dm8.js.map} +1 -1
- package/dist/_chunks/{en-DTWPCdTS.js → en-BzQmavmK.js} +9 -3
- package/dist/_chunks/{en-DTWPCdTS.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-CfIXaZf9.mjs → en-CSxLmrh1.mjs} +9 -3
- package/dist/_chunks/{en-CfIXaZf9.mjs.map → en-CSxLmrh1.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-CP5EOEiH.mjs → index-B3tHjkLZ.mjs} +253 -148
- package/dist/_chunks/index-B3tHjkLZ.mjs.map +1 -0
- package/dist/_chunks/{index-DUjGm1xz.js → index-TSBwtMDV.js} +253 -149
- package/dist/_chunks/index-TSBwtMDV.js.map +1 -0
- package/dist/_chunks/{layout-B3LdnMTA.mjs → layout-C71zeI19.mjs} +4 -4
- package/dist/_chunks/{layout-B3LdnMTA.mjs.map → layout-C71zeI19.mjs.map} +1 -1
- package/dist/_chunks/{layout-zHc8BsKI.js → layout-CB2vrWLp.js} +5 -6
- package/dist/_chunks/{layout-zHc8BsKI.js.map → layout-CB2vrWLp.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-DrsZXRl-.js → relations-8mON7ZVQ.js} +2 -2
- package/dist/_chunks/{relations-DrsZXRl-.js.map → relations-8mON7ZVQ.js.map} +1 -1
- package/dist/_chunks/{relations-DnT2jc-S.mjs → relations-DcEHhh0U.mjs} +2 -2
- package/dist/_chunks/{relations-DnT2jc-S.mjs.map → relations-DcEHhh0U.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 +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -1
- 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/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
- 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/preview/services/preview.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 +74 -49
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +74 -48
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +2 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/package.json +12 -10
- package/dist/_chunks/Field-BwLr5b0V.js.map +0 -1
- package/dist/_chunks/Field-CfbMEZLv.mjs.map +0 -1
- package/dist/_chunks/History-BHH0axCz.js.map +0 -1
- package/dist/_chunks/History-BQ721fHN.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-C4UCZKeD.js.map +0 -1
- package/dist/_chunks/ListViewPage-Dq7nBEKD.mjs.map +0 -1
- package/dist/_chunks/Preview-D9FlX2H8.js.map +0 -1
- package/dist/_chunks/Preview-GZFXtAgo.mjs.map +0 -1
- package/dist/_chunks/index-CP5EOEiH.mjs.map +0 -1
- package/dist/_chunks/index-DUjGm1xz.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";
|
@@ -168,7 +175,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
168
175
|
"InitialData",
|
169
176
|
"HistoryVersion",
|
170
177
|
"Relations",
|
171
|
-
"UidAvailability"
|
178
|
+
"UidAvailability",
|
179
|
+
"RecentDocumentList"
|
172
180
|
]
|
173
181
|
});
|
174
182
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -186,7 +194,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
186
194
|
if (error) {
|
187
195
|
return [];
|
188
196
|
}
|
189
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
197
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
190
198
|
}
|
191
199
|
}),
|
192
200
|
cloneDocument: builder.mutation({
|
@@ -200,7 +208,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
200
208
|
}),
|
201
209
|
invalidatesTags: (_result, _error, { model }) => [
|
202
210
|
{ type: "Document", id: `${model}_LIST` },
|
203
|
-
{ type: "UidAvailability", id: model }
|
211
|
+
{ type: "UidAvailability", id: model },
|
212
|
+
"RecentDocumentList"
|
204
213
|
]
|
205
214
|
}),
|
206
215
|
/**
|
@@ -219,7 +228,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
219
228
|
invalidatesTags: (result, _error, { model }) => [
|
220
229
|
{ type: "Document", id: `${model}_LIST` },
|
221
230
|
"Relations",
|
222
|
-
{ type: "UidAvailability", id: model }
|
231
|
+
{ type: "UidAvailability", id: model },
|
232
|
+
"RecentDocumentList"
|
223
233
|
]
|
224
234
|
}),
|
225
235
|
deleteDocument: builder.mutation({
|
@@ -231,7 +241,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
231
241
|
}
|
232
242
|
}),
|
233
243
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
234
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
244
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
245
|
+
"RecentDocumentList"
|
235
246
|
]
|
236
247
|
}),
|
237
248
|
deleteManyDocuments: builder.mutation({
|
@@ -243,7 +254,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
243
254
|
params
|
244
255
|
}
|
245
256
|
}),
|
246
|
-
invalidatesTags: (_res, _error, { model }) => [
|
257
|
+
invalidatesTags: (_res, _error, { model }) => [
|
258
|
+
{ type: "Document", id: `${model}_LIST` },
|
259
|
+
"RecentDocumentList"
|
260
|
+
]
|
247
261
|
}),
|
248
262
|
discardDocument: builder.mutation({
|
249
263
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -261,7 +275,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
261
275
|
},
|
262
276
|
{ type: "Document", id: `${model}_LIST` },
|
263
277
|
"Relations",
|
264
|
-
{ type: "UidAvailability", id: model }
|
278
|
+
{ type: "UidAvailability", id: model },
|
279
|
+
"RecentDocumentList"
|
265
280
|
];
|
266
281
|
}
|
267
282
|
}),
|
@@ -274,7 +289,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
274
289
|
url: `/content-manager/collection-types/${model}`,
|
275
290
|
method: "GET",
|
276
291
|
config: {
|
277
|
-
params
|
292
|
+
params: stringify(params, { encode: true })
|
278
293
|
}
|
279
294
|
}),
|
280
295
|
providesTags: (result, _error, arg) => {
|
@@ -356,7 +371,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
356
371
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
357
372
|
},
|
358
373
|
{ type: "Document", id: `${model}_LIST` },
|
359
|
-
"Relations"
|
374
|
+
"Relations",
|
375
|
+
"RecentDocumentList"
|
360
376
|
];
|
361
377
|
}
|
362
378
|
}),
|
@@ -387,7 +403,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
387
403
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
388
404
|
},
|
389
405
|
"Relations",
|
390
|
-
{ type: "UidAvailability", id: model }
|
406
|
+
{ type: "UidAvailability", id: model },
|
407
|
+
"RecentDocumentList",
|
408
|
+
"RecentDocumentList"
|
391
409
|
];
|
392
410
|
},
|
393
411
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -417,7 +435,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
417
435
|
{
|
418
436
|
type: "Document",
|
419
437
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
420
|
-
}
|
438
|
+
},
|
439
|
+
"RecentDocumentList"
|
421
440
|
];
|
422
441
|
}
|
423
442
|
}),
|
@@ -430,7 +449,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
430
449
|
params
|
431
450
|
}
|
432
451
|
}),
|
433
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
452
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
453
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
454
|
+
"RecentDocumentList"
|
455
|
+
]
|
434
456
|
})
|
435
457
|
})
|
436
458
|
});
|
@@ -453,8 +475,7 @@ const {
|
|
453
475
|
useUnpublishManyDocumentsMutation
|
454
476
|
} = documentApi;
|
455
477
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
478
|
+
if (!query) return query;
|
458
479
|
const { plugins: _, ...validQueryParams } = {
|
459
480
|
...query,
|
460
481
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +483,6 @@ const buildValidParams = (query) => {
|
|
462
483
|
{}
|
463
484
|
)
|
464
485
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
486
|
return validQueryParams;
|
469
487
|
};
|
470
488
|
const isBaseQueryError = (error) => {
|
@@ -1664,7 +1682,7 @@ const useDocumentActions = () => {
|
|
1664
1682
|
};
|
1665
1683
|
};
|
1666
1684
|
const ProtectedHistoryPage = React.lazy(
|
1667
|
-
() => import("./History-
|
1685
|
+
() => import("./History-Bk2VCzmJ.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1686
|
);
|
1669
1687
|
const routes$2 = [
|
1670
1688
|
{
|
@@ -1677,7 +1695,7 @@ const routes$2 = [
|
|
1677
1695
|
}
|
1678
1696
|
];
|
1679
1697
|
const ProtectedPreviewPage = React.lazy(
|
1680
|
-
() => import("./Preview-
|
1698
|
+
() => import("./Preview-Dd3kQluA.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1681
1699
|
);
|
1682
1700
|
const routes$1 = [
|
1683
1701
|
{
|
@@ -1690,31 +1708,31 @@ const routes$1 = [
|
|
1690
1708
|
}
|
1691
1709
|
];
|
1692
1710
|
const ProtectedEditViewPage = lazy(
|
1693
|
-
() => import("./EditViewPage-
|
1711
|
+
() => import("./EditViewPage-ONky_-8U.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1694
1712
|
);
|
1695
1713
|
const ProtectedListViewPage = lazy(
|
1696
|
-
() => import("./ListViewPage-
|
1714
|
+
() => import("./ListViewPage-mK-sFVGU.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1697
1715
|
);
|
1698
1716
|
const ProtectedListConfiguration = lazy(
|
1699
|
-
() => import("./ListConfigurationPage-
|
1717
|
+
() => import("./ListConfigurationPage-BhNCzkQd.mjs").then((mod) => ({
|
1700
1718
|
default: mod.ProtectedListConfiguration
|
1701
1719
|
}))
|
1702
1720
|
);
|
1703
1721
|
const ProtectedEditConfigurationPage = lazy(
|
1704
|
-
() => import("./EditConfigurationPage-
|
1722
|
+
() => import("./EditConfigurationPage-DN6yaDFZ.mjs").then((mod) => ({
|
1705
1723
|
default: mod.ProtectedEditConfigurationPage
|
1706
1724
|
}))
|
1707
1725
|
);
|
1708
1726
|
const ProtectedComponentConfigurationPage = lazy(
|
1709
|
-
() => import("./ComponentConfigurationPage-
|
1727
|
+
() => import("./ComponentConfigurationPage-A5f-t42A.mjs").then((mod) => ({
|
1710
1728
|
default: mod.ProtectedComponentConfigurationPage
|
1711
1729
|
}))
|
1712
1730
|
);
|
1713
1731
|
const NoPermissions = lazy(
|
1714
|
-
() => import("./NoPermissionsPage-
|
1732
|
+
() => import("./NoPermissionsPage-zpYME1_X.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1715
1733
|
);
|
1716
1734
|
const NoContentType = lazy(
|
1717
|
-
() => import("./NoContentTypePage-
|
1735
|
+
() => import("./NoContentTypePage-BSVg7nZI.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1718
1736
|
);
|
1719
1737
|
const CollectionTypePages = () => {
|
1720
1738
|
const { collectionType } = useParams();
|
@@ -1859,6 +1877,11 @@ const DocumentActionButton = (action) => {
|
|
1859
1877
|
) : null
|
1860
1878
|
] });
|
1861
1879
|
};
|
1880
|
+
const MenuItem = styled(Menu.Item)`
|
1881
|
+
&:hover {
|
1882
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1883
|
+
}
|
1884
|
+
`;
|
1862
1885
|
const DocumentActionsMenu = ({
|
1863
1886
|
actions: actions2,
|
1864
1887
|
children,
|
@@ -1917,11 +1940,13 @@ const DocumentActionsMenu = ({
|
|
1917
1940
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1918
1941
|
actions2.map((action) => {
|
1919
1942
|
return /* @__PURE__ */ jsx(
|
1920
|
-
|
1943
|
+
MenuItem,
|
1921
1944
|
{
|
1922
1945
|
disabled: action.disabled,
|
1923
1946
|
onSelect: handleClick(action),
|
1924
1947
|
display: "block",
|
1948
|
+
isVariantDanger: action.variant === "danger",
|
1949
|
+
isDisabled: action.disabled,
|
1925
1950
|
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1926
1951
|
Flex,
|
1927
1952
|
{
|
@@ -2077,6 +2102,7 @@ const PublishAction$1 = ({
|
|
2077
2102
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2078
2103
|
const isListView = useMatch(LIST_PATH) !== null;
|
2079
2104
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2105
|
+
const { id } = useParams();
|
2080
2106
|
const { formatMessage } = useIntl();
|
2081
2107
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2082
2108
|
const { publish } = useDocumentActions();
|
@@ -2179,10 +2205,12 @@ const PublishAction$1 = ({
|
|
2179
2205
|
transformData(formValues)
|
2180
2206
|
);
|
2181
2207
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2208
|
+
if (id === "create") {
|
2209
|
+
navigate({
|
2210
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2211
|
+
search: rawQuery
|
2212
|
+
});
|
2213
|
+
}
|
2186
2214
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2187
2215
|
setErrors(formatValidationErrors(res.error));
|
2188
2216
|
}
|
@@ -2235,6 +2263,7 @@ const PublishAction$1 = ({
|
|
2235
2263
|
};
|
2236
2264
|
};
|
2237
2265
|
PublishAction$1.type = "publish";
|
2266
|
+
PublishAction$1.position = "panel";
|
2238
2267
|
const UpdateAction = ({
|
2239
2268
|
activeTab,
|
2240
2269
|
documentId,
|
@@ -2257,96 +2286,134 @@ const UpdateAction = ({
|
|
2257
2286
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2258
2287
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2259
2288
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
status: "draft"
|
2289
|
+
const handleUpdate = React.useCallback(async () => {
|
2290
|
+
setSubmitting(true);
|
2291
|
+
try {
|
2292
|
+
if (!modified) {
|
2293
|
+
return;
|
2294
|
+
}
|
2295
|
+
const { errors } = await validate(true, {
|
2296
|
+
status: "draft"
|
2297
|
+
});
|
2298
|
+
if (errors) {
|
2299
|
+
toggleNotification({
|
2300
|
+
type: "danger",
|
2301
|
+
message: formatMessage({
|
2302
|
+
id: "content-manager.validation.error",
|
2303
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2304
|
+
})
|
2277
2305
|
});
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
model,
|
2292
|
-
documentId: cloneMatch.params.origin,
|
2293
|
-
params
|
2294
|
-
},
|
2295
|
-
transformData(document)
|
2296
|
-
);
|
2297
|
-
if ("data" in res) {
|
2298
|
-
navigate(
|
2299
|
-
{
|
2300
|
-
pathname: `../${res.data.documentId}`,
|
2301
|
-
search: rawQuery
|
2302
|
-
},
|
2303
|
-
{ relative: "path" }
|
2304
|
-
);
|
2305
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2306
|
-
setErrors(formatValidationErrors(res.error));
|
2307
|
-
}
|
2308
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2309
|
-
const res = await update(
|
2306
|
+
return;
|
2307
|
+
}
|
2308
|
+
if (isCloning) {
|
2309
|
+
const res = await clone(
|
2310
|
+
{
|
2311
|
+
model,
|
2312
|
+
documentId: cloneMatch.params.origin,
|
2313
|
+
params
|
2314
|
+
},
|
2315
|
+
transformData(document)
|
2316
|
+
);
|
2317
|
+
if ("data" in res) {
|
2318
|
+
navigate(
|
2310
2319
|
{
|
2311
|
-
|
2312
|
-
|
2313
|
-
documentId,
|
2314
|
-
params
|
2320
|
+
pathname: `../${res.data.documentId}`,
|
2321
|
+
search: rawQuery
|
2315
2322
|
},
|
2316
|
-
|
2323
|
+
{ relative: "path" }
|
2317
2324
|
);
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2325
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2326
|
+
setErrors(formatValidationErrors(res.error));
|
2327
|
+
}
|
2328
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2329
|
+
const res = await update(
|
2330
|
+
{
|
2331
|
+
collectionType,
|
2332
|
+
model,
|
2333
|
+
documentId,
|
2334
|
+
params
|
2335
|
+
},
|
2336
|
+
transformData(document)
|
2337
|
+
);
|
2338
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2339
|
+
setErrors(formatValidationErrors(res.error));
|
2323
2340
|
} else {
|
2324
|
-
|
2341
|
+
resetForm();
|
2342
|
+
}
|
2343
|
+
} else {
|
2344
|
+
const res = await create(
|
2345
|
+
{
|
2346
|
+
model,
|
2347
|
+
params
|
2348
|
+
},
|
2349
|
+
transformData(document)
|
2350
|
+
);
|
2351
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2352
|
+
navigate(
|
2325
2353
|
{
|
2326
|
-
|
2327
|
-
|
2354
|
+
pathname: `../${res.data.documentId}`,
|
2355
|
+
search: rawQuery
|
2328
2356
|
},
|
2329
|
-
|
2357
|
+
{ replace: true, relative: "path" }
|
2330
2358
|
);
|
2331
|
-
|
2332
|
-
|
2333
|
-
{
|
2334
|
-
pathname: `../${res.data.documentId}`,
|
2335
|
-
search: rawQuery
|
2336
|
-
},
|
2337
|
-
{ replace: true, relative: "path" }
|
2338
|
-
);
|
2339
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2340
|
-
setErrors(formatValidationErrors(res.error));
|
2341
|
-
}
|
2359
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2360
|
+
setErrors(formatValidationErrors(res.error));
|
2342
2361
|
}
|
2343
|
-
} finally {
|
2344
|
-
setSubmitting(false);
|
2345
2362
|
}
|
2363
|
+
} finally {
|
2364
|
+
setSubmitting(false);
|
2346
2365
|
}
|
2366
|
+
}, [
|
2367
|
+
clone,
|
2368
|
+
cloneMatch?.params.origin,
|
2369
|
+
collectionType,
|
2370
|
+
create,
|
2371
|
+
document,
|
2372
|
+
documentId,
|
2373
|
+
formatMessage,
|
2374
|
+
formatValidationErrors,
|
2375
|
+
isCloning,
|
2376
|
+
model,
|
2377
|
+
modified,
|
2378
|
+
navigate,
|
2379
|
+
params,
|
2380
|
+
rawQuery,
|
2381
|
+
resetForm,
|
2382
|
+
setErrors,
|
2383
|
+
setSubmitting,
|
2384
|
+
toggleNotification,
|
2385
|
+
update,
|
2386
|
+
validate
|
2387
|
+
]);
|
2388
|
+
React.useEffect(() => {
|
2389
|
+
const handleKeyDown = (e) => {
|
2390
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2391
|
+
e.preventDefault();
|
2392
|
+
handleUpdate();
|
2393
|
+
}
|
2394
|
+
};
|
2395
|
+
window.addEventListener("keydown", handleKeyDown);
|
2396
|
+
return () => {
|
2397
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2398
|
+
};
|
2399
|
+
}, [handleUpdate]);
|
2400
|
+
return {
|
2401
|
+
/**
|
2402
|
+
* Disabled when:
|
2403
|
+
* - the form is submitting
|
2404
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2405
|
+
* - the active tab is the published tab
|
2406
|
+
*/
|
2407
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2408
|
+
label: formatMessage({
|
2409
|
+
id: "global.save",
|
2410
|
+
defaultMessage: "Save"
|
2411
|
+
}),
|
2412
|
+
onClick: handleUpdate
|
2347
2413
|
};
|
2348
2414
|
};
|
2349
2415
|
UpdateAction.type = "update";
|
2416
|
+
UpdateAction.position = "panel";
|
2350
2417
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2351
2418
|
KEEP: "keep",
|
2352
2419
|
DISCARD: "discard"
|
@@ -2469,6 +2536,7 @@ const UnpublishAction$1 = ({
|
|
2469
2536
|
};
|
2470
2537
|
};
|
2471
2538
|
UnpublishAction$1.type = "unpublish";
|
2539
|
+
UnpublishAction$1.position = "panel";
|
2472
2540
|
const DiscardAction = ({
|
2473
2541
|
activeTab,
|
2474
2542
|
documentId,
|
@@ -2519,6 +2587,7 @@ const DiscardAction = ({
|
|
2519
2587
|
};
|
2520
2588
|
};
|
2521
2589
|
DiscardAction.type = "discard";
|
2590
|
+
DiscardAction.position = "panel";
|
2522
2591
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2523
2592
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2524
2593
|
const RelativeTime = React.forwardRef(
|
@@ -2638,7 +2707,7 @@ const HeaderToolbar = () => {
|
|
2638
2707
|
meta: isCloning ? void 0 : meta,
|
2639
2708
|
collectionType
|
2640
2709
|
},
|
2641
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2710
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2642
2711
|
children: (actions2) => {
|
2643
2712
|
const headerActions = actions2.filter((action) => {
|
2644
2713
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2846,6 +2915,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2846
2915
|
};
|
2847
2916
|
};
|
2848
2917
|
ConfigureTheViewAction.type = "configure-the-view";
|
2918
|
+
ConfigureTheViewAction.position = "header";
|
2849
2919
|
const EditTheModelAction = ({ model }) => {
|
2850
2920
|
const navigate = useNavigate();
|
2851
2921
|
const { formatMessage } = useIntl();
|
@@ -2862,6 +2932,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2862
2932
|
};
|
2863
2933
|
};
|
2864
2934
|
EditTheModelAction.type = "edit-the-model";
|
2935
|
+
EditTheModelAction.position = "header";
|
2865
2936
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2866
2937
|
const navigate = useNavigate();
|
2867
2938
|
const { formatMessage } = useIntl();
|
@@ -2935,6 +3006,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2935
3006
|
};
|
2936
3007
|
};
|
2937
3008
|
DeleteAction$1.type = "delete";
|
3009
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2938
3010
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2939
3011
|
const Panels = () => {
|
2940
3012
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2997,7 +3069,7 @@ const ActionsPanelContent = () => {
|
|
2997
3069
|
DescriptionComponentRenderer,
|
2998
3070
|
{
|
2999
3071
|
props,
|
3000
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3072
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3001
3073
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
3002
3074
|
}
|
3003
3075
|
),
|
@@ -3451,8 +3523,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3451
3523
|
const refetchList = () => {
|
3452
3524
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3453
3525
|
};
|
3454
|
-
if (!showPublishButton)
|
3455
|
-
return null;
|
3526
|
+
if (!showPublishButton) return null;
|
3456
3527
|
return {
|
3457
3528
|
actionType: "publish",
|
3458
3529
|
variant: "tertiary",
|
@@ -3520,8 +3591,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3520
3591
|
selectRow([]);
|
3521
3592
|
}
|
3522
3593
|
};
|
3523
|
-
if (!hasDeletePermission)
|
3524
|
-
return null;
|
3594
|
+
if (!hasDeletePermission) return null;
|
3525
3595
|
return {
|
3526
3596
|
variant: "danger-light",
|
3527
3597
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3570,8 +3640,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3570
3640
|
}
|
3571
3641
|
};
|
3572
3642
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3573
|
-
if (!showUnpublishButton)
|
3574
|
-
return null;
|
3643
|
+
if (!showUnpublishButton) return null;
|
3575
3644
|
return {
|
3576
3645
|
variant: "tertiary",
|
3577
3646
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3676,7 +3745,7 @@ const TableActions = ({ document }) => {
|
|
3676
3745
|
DescriptionComponentRenderer,
|
3677
3746
|
{
|
3678
3747
|
props,
|
3679
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3748
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3680
3749
|
children: (actions2) => {
|
3681
3750
|
const tableRowActions = actions2.filter((action) => {
|
3682
3751
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3735,6 +3804,7 @@ const EditAction = ({ documentId }) => {
|
|
3735
3804
|
};
|
3736
3805
|
};
|
3737
3806
|
EditAction.type = "edit";
|
3807
|
+
EditAction.position = "table-row";
|
3738
3808
|
const StyledPencil = styled(Pencil)`
|
3739
3809
|
path {
|
3740
3810
|
fill: currentColor;
|
@@ -3811,6 +3881,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3811
3881
|
};
|
3812
3882
|
};
|
3813
3883
|
CloneAction.type = "clone";
|
3884
|
+
CloneAction.position = "table-row";
|
3814
3885
|
const StyledDuplicate = styled(Duplicate)`
|
3815
3886
|
path {
|
3816
3887
|
fill: currentColor;
|
@@ -3897,7 +3968,14 @@ class ContentManagerPlugin {
|
|
3897
3968
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3898
3969
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3899
3970
|
getBulkActions: () => this.bulkActions,
|
3900
|
-
getDocumentActions: () =>
|
3971
|
+
getDocumentActions: (position) => {
|
3972
|
+
if (position) {
|
3973
|
+
return this.documentActions.filter(
|
3974
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3975
|
+
);
|
3976
|
+
}
|
3977
|
+
return this.documentActions;
|
3978
|
+
},
|
3901
3979
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3902
3980
|
getHeaderActions: () => this.headerActions
|
3903
3981
|
}
|
@@ -3907,10 +3985,8 @@ class ContentManagerPlugin {
|
|
3907
3985
|
const getPrintableType = (value) => {
|
3908
3986
|
const nativeType = typeof value;
|
3909
3987
|
if (nativeType === "object") {
|
3910
|
-
if (value === null)
|
3911
|
-
|
3912
|
-
if (Array.isArray(value))
|
3913
|
-
return "array";
|
3988
|
+
if (value === null) return "null";
|
3989
|
+
if (Array.isArray(value)) return "array";
|
3914
3990
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3915
3991
|
return value.constructor.name;
|
3916
3992
|
}
|
@@ -3921,17 +3997,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3921
3997
|
const { formatMessage } = useIntl();
|
3922
3998
|
const [{ query }] = useQueryParams();
|
3923
3999
|
const navigate = useNavigate();
|
4000
|
+
const { trackUsage } = useTracking();
|
4001
|
+
const { pathname } = useLocation();
|
3924
4002
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3925
4003
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3926
4004
|
return null;
|
3927
4005
|
}
|
4006
|
+
const handleOnClick = () => {
|
4007
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4008
|
+
trackUsage("willNavigate", {
|
4009
|
+
from: pathname,
|
4010
|
+
to: `${pathname}/${destination.pathname}`
|
4011
|
+
});
|
4012
|
+
navigate(destination);
|
4013
|
+
};
|
3928
4014
|
return {
|
3929
4015
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3930
4016
|
label: formatMessage({
|
3931
4017
|
id: "content-manager.history.document-action",
|
3932
4018
|
defaultMessage: "Content History"
|
3933
4019
|
}),
|
3934
|
-
onClick:
|
4020
|
+
onClick: handleOnClick,
|
3935
4021
|
disabled: (
|
3936
4022
|
/**
|
3937
4023
|
* The user is creating a new document.
|
@@ -3953,6 +4039,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3953
4039
|
};
|
3954
4040
|
};
|
3955
4041
|
HistoryAction.type = "history";
|
4042
|
+
HistoryAction.position = "header";
|
3956
4043
|
const historyAdmin = {
|
3957
4044
|
bootstrap(app) {
|
3958
4045
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4015,10 +4102,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4015
4102
|
})
|
4016
4103
|
});
|
4017
4104
|
const { useGetPreviewUrlQuery } = previewApi;
|
4105
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4106
|
+
if (isShown) {
|
4107
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4108
|
+
}
|
4109
|
+
return children;
|
4110
|
+
};
|
4018
4111
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4019
4112
|
const { formatMessage } = useIntl();
|
4020
4113
|
const { trackUsage } = useTracking();
|
4114
|
+
const { pathname } = useLocation();
|
4021
4115
|
const [{ query }] = useQueryParams();
|
4116
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4022
4117
|
const { data, error } = useGetPreviewUrlQuery({
|
4023
4118
|
params: {
|
4024
4119
|
contentType: model
|
@@ -4032,33 +4127,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4032
4127
|
if (!data?.data?.url || error) {
|
4033
4128
|
return null;
|
4034
4129
|
}
|
4035
|
-
const
|
4036
|
-
|
4130
|
+
const trackNavigation = () => {
|
4131
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4132
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4037
4133
|
};
|
4038
4134
|
return {
|
4039
4135
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4040
|
-
content: /* @__PURE__ */ jsx(
|
4041
|
-
|
4136
|
+
content: /* @__PURE__ */ jsx(
|
4137
|
+
ConditionalTooltip,
|
4042
4138
|
{
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4046
|
-
|
4047
|
-
|
4048
|
-
children:
|
4049
|
-
|
4050
|
-
|
4051
|
-
|
4139
|
+
label: formatMessage({
|
4140
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4141
|
+
defaultMessage: "Please save to open the preview"
|
4142
|
+
}),
|
4143
|
+
isShown: isModified,
|
4144
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4145
|
+
Button,
|
4146
|
+
{
|
4147
|
+
variant: "tertiary",
|
4148
|
+
tag: Link,
|
4149
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4150
|
+
onClick: trackNavigation,
|
4151
|
+
width: "100%",
|
4152
|
+
disabled: isModified,
|
4153
|
+
pointerEvents: isModified ? "none" : void 0,
|
4154
|
+
tabIndex: isModified ? -1 : void 0,
|
4155
|
+
children: formatMessage({
|
4156
|
+
id: "content-manager.preview.panel.button",
|
4157
|
+
defaultMessage: "Open preview"
|
4158
|
+
})
|
4159
|
+
}
|
4160
|
+
) })
|
4052
4161
|
}
|
4053
|
-
)
|
4162
|
+
)
|
4054
4163
|
};
|
4055
4164
|
};
|
4056
|
-
const FEATURE_ID = "preview";
|
4057
4165
|
const previewAdmin = {
|
4058
4166
|
bootstrap(app) {
|
4059
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4060
|
-
return;
|
4061
|
-
}
|
4062
4167
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4063
4168
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4064
4169
|
}
|
@@ -4082,7 +4187,7 @@ const index = {
|
|
4082
4187
|
app.router.addRoute({
|
4083
4188
|
path: "content-manager/*",
|
4084
4189
|
lazy: async () => {
|
4085
|
-
const { Layout } = await import("./layout-
|
4190
|
+
const { Layout } = await import("./layout-C71zeI19.mjs");
|
4086
4191
|
return {
|
4087
4192
|
Component: Layout
|
4088
4193
|
};
|
@@ -4102,7 +4207,7 @@ const index = {
|
|
4102
4207
|
async registerTrads({ locales }) {
|
4103
4208
|
const importedTrads = await Promise.all(
|
4104
4209
|
locales.map((locale) => {
|
4105
|
-
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-
|
4210
|
+
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 }) => {
|
4106
4211
|
return {
|
4107
4212
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4108
4213
|
locale
|
@@ -4164,4 +4269,4 @@ export {
|
|
4164
4269
|
capitalise as y,
|
4165
4270
|
useUpdateContentTypeConfigurationMutation as z
|
4166
4271
|
};
|
4167
|
-
//# sourceMappingURL=index-
|
4272
|
+
//# sourceMappingURL=index-B3tHjkLZ.mjs.map
|