@strapi/content-manager 0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81 → 0.0.0-next.f698d55751345c4ca87477ef683475c1a68f310a
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-_g_oKvB0.js → ComponentConfigurationPage-BTR_hQow.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-_g_oKvB0.js.map → ComponentConfigurationPage-BTR_hQow.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-WXfrBq-Q.mjs → ComponentConfigurationPage-bLQr82ce.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-WXfrBq-Q.mjs.map → ComponentConfigurationPage-bLQr82ce.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-CRbOzCGy.mjs → EditConfigurationPage-BhRSnUsL.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CRbOzCGy.mjs.map → EditConfigurationPage-BhRSnUsL.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-PD0wJ9L3.js → EditConfigurationPage-z39Wv3E6.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-PD0wJ9L3.js.map → EditConfigurationPage-z39Wv3E6.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-5Vpyf6AO.mjs → EditViewPage-BCjNxNlY.mjs} +3 -3
- package/dist/_chunks/{EditViewPage-5Vpyf6AO.mjs.map → EditViewPage-BCjNxNlY.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-B_tonadE.js → EditViewPage-wujOq90c.js} +4 -5
- package/dist/_chunks/{EditViewPage-B_tonadE.js.map → EditViewPage-wujOq90c.js.map} +1 -1
- package/dist/_chunks/{Field-CbqsLSaw.js → Field-B5QXnctJ.js} +128 -69
- package/dist/_chunks/Field-B5QXnctJ.js.map +1 -0
- package/dist/_chunks/{Field-CvMC_y_i.mjs → Field-Byr3mPTl.mjs} +126 -67
- package/dist/_chunks/Field-Byr3mPTl.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-DcK34IgP.mjs → Form-BZgvE8C8.mjs} +3 -3
- package/dist/_chunks/{Form-DcK34IgP.mjs.map → Form-BZgvE8C8.mjs.map} +1 -1
- package/dist/_chunks/{Form-BB0z-JxK.js → Form-D7mexvm3.js} +5 -6
- package/dist/_chunks/{Form-BB0z-JxK.js.map → Form-D7mexvm3.js.map} +1 -1
- package/dist/_chunks/{History-Bcj_FGwn.mjs → History-CqNgxkqK.mjs} +5 -5
- package/dist/_chunks/History-CqNgxkqK.mjs.map +1 -0
- package/dist/_chunks/{History-BD4ZcdUO.js → History-DYl2A8Z_.js} +6 -7
- package/dist/_chunks/History-DYl2A8Z_.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BLxjX7Pw.js → ListConfigurationPage-BXnu_OoY.js} +4 -5
- package/dist/_chunks/{ListConfigurationPage-BLxjX7Pw.js.map → ListConfigurationPage-BXnu_OoY.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-D6cBGWEz.mjs → ListConfigurationPage-BbQjzKkQ.mjs} +3 -3
- package/dist/_chunks/{ListConfigurationPage-D6cBGWEz.mjs.map → ListConfigurationPage-BbQjzKkQ.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-nUnSzeLc.js → ListViewPage-BtSi8C1l.js} +51 -51
- package/dist/_chunks/ListViewPage-BtSi8C1l.js.map +1 -0
- package/dist/_chunks/{ListViewPage-_2xuTV87.mjs → ListViewPage-D4ofkbjR.mjs} +50 -49
- package/dist/_chunks/ListViewPage-D4ofkbjR.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DerCWb61.js → NoContentTypePage-CitJeOq4.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DerCWb61.js.map → NoContentTypePage-CitJeOq4.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-D07aE8fc.mjs → NoContentTypePage-DyUx5mXh.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-D07aE8fc.mjs.map → NoContentTypePage-DyUx5mXh.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Bft8fI7p.mjs → NoPermissionsPage-DhIiyWkk.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Bft8fI7p.mjs.map → NoPermissionsPage-DhIiyWkk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BrcLxQs2.js → NoPermissionsPage-DzgWz0M-.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BrcLxQs2.js.map → NoPermissionsPage-DzgWz0M-.js.map} +1 -1
- package/dist/_chunks/{Preview-_n0hyyGd.mjs → Preview-BaYGJ0nb.mjs} +49 -12
- package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +1 -0
- package/dist/_chunks/{Preview-d3J-Ku7A.js → Preview-DfNx8Ke-.js} +48 -12
- package/dist/_chunks/Preview-DfNx8Ke-.js.map +1 -0
- package/dist/_chunks/{Relations-C_1bopDf.mjs → Relations-DM2yUTST.mjs} +6 -8
- package/dist/_chunks/{Relations-C_1bopDf.mjs.map → Relations-DM2yUTST.mjs.map} +1 -1
- package/dist/_chunks/{Relations-BIX7Mm2F.js → Relations-DuKCaXrv.js} +7 -10
- package/dist/_chunks/{Relations-BIX7Mm2F.js.map → Relations-DuKCaXrv.js.map} +1 -1
- package/dist/_chunks/{en-DTWPCdTS.js → en-BK8Xyl5I.js} +3 -2
- package/dist/_chunks/{en-DTWPCdTS.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-CfIXaZf9.mjs → en-Dtk_ot79.mjs} +3 -2
- package/dist/_chunks/{en-CfIXaZf9.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-PscLJrm0.js → index-BUWEmX8m.js} +207 -135
- package/dist/_chunks/index-BUWEmX8m.js.map +1 -0
- package/dist/_chunks/{index-NgJzBbDY.mjs → index-DVAIIsOs.mjs} +206 -133
- package/dist/_chunks/index-DVAIIsOs.mjs.map +1 -0
- package/dist/_chunks/{layout-D5HneXd1.mjs → layout-Bxsv5mP7.mjs} +4 -4
- package/dist/_chunks/{layout-D5HneXd1.mjs.map → layout-Bxsv5mP7.mjs.map} +1 -1
- package/dist/_chunks/{layout-BFjOzyo2.js → layout-C3fN7Ejz.js} +5 -6
- package/dist/_chunks/{layout-BFjOzyo2.js.map → layout-C3fN7Ejz.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-BPyA_0mB.js → relations-BPZKAoEY.js} +2 -2
- package/dist/_chunks/{relations-BPyA_0mB.js.map → relations-BPZKAoEY.js.map} +1 -1
- package/dist/_chunks/{relations-BIjRMG_U.mjs → relations-o3pPhzY4.mjs} +2 -2
- package/dist/_chunks/{relations-BIjRMG_U.mjs.map → relations-o3pPhzY4.mjs.map} +1 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/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/services/documents.d.ts +0 -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-CbqsLSaw.js.map +0 -1
- package/dist/_chunks/Field-CvMC_y_i.mjs.map +0 -1
- package/dist/_chunks/History-BD4ZcdUO.js.map +0 -1
- package/dist/_chunks/History-Bcj_FGwn.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-_2xuTV87.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-nUnSzeLc.js.map +0 -1
- package/dist/_chunks/Preview-_n0hyyGd.mjs.map +0 -1
- package/dist/_chunks/Preview-d3J-Ku7A.js.map +0 -1
- package/dist/_chunks/index-NgJzBbDY.mjs.map +0 -1
- package/dist/_chunks/index-PscLJrm0.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
@@ -10,17 +10,24 @@ import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink
|
|
10
10
|
import { styled } from "styled-components";
|
11
11
|
import * as yup from "yup";
|
12
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
13
14
|
import pipe from "lodash/fp/pipe";
|
14
15
|
import { intervalToDuration, isPast } from "date-fns";
|
15
|
-
import { stringify } from "qs";
|
16
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
17
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
18
18
|
const v = glob[path];
|
19
19
|
if (v) {
|
20
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
21
21
|
}
|
22
22
|
return new Promise((_, reject) => {
|
23
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
24
|
+
reject.bind(
|
25
|
+
null,
|
26
|
+
new Error(
|
27
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
28
|
+
)
|
29
|
+
)
|
30
|
+
);
|
24
31
|
});
|
25
32
|
};
|
26
33
|
const PLUGIN_ID = "content-manager";
|
@@ -274,7 +281,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
274
281
|
url: `/content-manager/collection-types/${model}`,
|
275
282
|
method: "GET",
|
276
283
|
config: {
|
277
|
-
params
|
284
|
+
params: stringify(params, { encode: true })
|
278
285
|
}
|
279
286
|
}),
|
280
287
|
providesTags: (result, _error, arg) => {
|
@@ -453,8 +460,7 @@ const {
|
|
453
460
|
useUnpublishManyDocumentsMutation
|
454
461
|
} = documentApi;
|
455
462
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
463
|
+
if (!query) return query;
|
458
464
|
const { plugins: _, ...validQueryParams } = {
|
459
465
|
...query,
|
460
466
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +468,6 @@ const buildValidParams = (query) => {
|
|
462
468
|
{}
|
463
469
|
)
|
464
470
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
471
|
return validQueryParams;
|
469
472
|
};
|
470
473
|
const isBaseQueryError = (error) => {
|
@@ -1664,7 +1667,7 @@ const useDocumentActions = () => {
|
|
1664
1667
|
};
|
1665
1668
|
};
|
1666
1669
|
const ProtectedHistoryPage = React.lazy(
|
1667
|
-
() => import("./History-
|
1670
|
+
() => import("./History-CqNgxkqK.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1671
|
);
|
1669
1672
|
const routes$2 = [
|
1670
1673
|
{
|
@@ -1677,7 +1680,7 @@ const routes$2 = [
|
|
1677
1680
|
}
|
1678
1681
|
];
|
1679
1682
|
const ProtectedPreviewPage = React.lazy(
|
1680
|
-
() => import("./Preview-
|
1683
|
+
() => import("./Preview-BaYGJ0nb.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1681
1684
|
);
|
1682
1685
|
const routes$1 = [
|
1683
1686
|
{
|
@@ -1690,31 +1693,31 @@ const routes$1 = [
|
|
1690
1693
|
}
|
1691
1694
|
];
|
1692
1695
|
const ProtectedEditViewPage = lazy(
|
1693
|
-
() => import("./EditViewPage-
|
1696
|
+
() => import("./EditViewPage-BCjNxNlY.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1694
1697
|
);
|
1695
1698
|
const ProtectedListViewPage = lazy(
|
1696
|
-
() => import("./ListViewPage-
|
1699
|
+
() => import("./ListViewPage-D4ofkbjR.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1697
1700
|
);
|
1698
1701
|
const ProtectedListConfiguration = lazy(
|
1699
|
-
() => import("./ListConfigurationPage-
|
1702
|
+
() => import("./ListConfigurationPage-BbQjzKkQ.mjs").then((mod) => ({
|
1700
1703
|
default: mod.ProtectedListConfiguration
|
1701
1704
|
}))
|
1702
1705
|
);
|
1703
1706
|
const ProtectedEditConfigurationPage = lazy(
|
1704
|
-
() => import("./EditConfigurationPage-
|
1707
|
+
() => import("./EditConfigurationPage-BhRSnUsL.mjs").then((mod) => ({
|
1705
1708
|
default: mod.ProtectedEditConfigurationPage
|
1706
1709
|
}))
|
1707
1710
|
);
|
1708
1711
|
const ProtectedComponentConfigurationPage = lazy(
|
1709
|
-
() => import("./ComponentConfigurationPage-
|
1712
|
+
() => import("./ComponentConfigurationPage-bLQr82ce.mjs").then((mod) => ({
|
1710
1713
|
default: mod.ProtectedComponentConfigurationPage
|
1711
1714
|
}))
|
1712
1715
|
);
|
1713
1716
|
const NoPermissions = lazy(
|
1714
|
-
() => import("./NoPermissionsPage-
|
1717
|
+
() => import("./NoPermissionsPage-DhIiyWkk.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1715
1718
|
);
|
1716
1719
|
const NoContentType = lazy(
|
1717
|
-
() => import("./NoContentTypePage-
|
1720
|
+
() => import("./NoContentTypePage-DyUx5mXh.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1718
1721
|
);
|
1719
1722
|
const CollectionTypePages = () => {
|
1720
1723
|
const { collectionType } = useParams();
|
@@ -2084,6 +2087,7 @@ const PublishAction$1 = ({
|
|
2084
2087
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2085
2088
|
const isListView = useMatch(LIST_PATH) !== null;
|
2086
2089
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2090
|
+
const { id } = useParams();
|
2087
2091
|
const { formatMessage } = useIntl();
|
2088
2092
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2089
2093
|
const { publish } = useDocumentActions();
|
@@ -2186,10 +2190,12 @@ const PublishAction$1 = ({
|
|
2186
2190
|
transformData(formValues)
|
2187
2191
|
);
|
2188
2192
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
+
if (id === "create") {
|
2194
|
+
navigate({
|
2195
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2196
|
+
search: rawQuery
|
2197
|
+
});
|
2198
|
+
}
|
2193
2199
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2194
2200
|
setErrors(formatValidationErrors(res.error));
|
2195
2201
|
}
|
@@ -2242,6 +2248,7 @@ const PublishAction$1 = ({
|
|
2242
2248
|
};
|
2243
2249
|
};
|
2244
2250
|
PublishAction$1.type = "publish";
|
2251
|
+
PublishAction$1.position = "panel";
|
2245
2252
|
const UpdateAction = ({
|
2246
2253
|
activeTab,
|
2247
2254
|
documentId,
|
@@ -2264,96 +2271,134 @@ const UpdateAction = ({
|
|
2264
2271
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2265
2272
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2266
2273
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
status: "draft"
|
2274
|
+
const handleUpdate = React.useCallback(async () => {
|
2275
|
+
setSubmitting(true);
|
2276
|
+
try {
|
2277
|
+
if (!modified) {
|
2278
|
+
return;
|
2279
|
+
}
|
2280
|
+
const { errors } = await validate(true, {
|
2281
|
+
status: "draft"
|
2282
|
+
});
|
2283
|
+
if (errors) {
|
2284
|
+
toggleNotification({
|
2285
|
+
type: "danger",
|
2286
|
+
message: formatMessage({
|
2287
|
+
id: "content-manager.validation.error",
|
2288
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2289
|
+
})
|
2284
2290
|
});
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
model,
|
2299
|
-
documentId: cloneMatch.params.origin,
|
2300
|
-
params
|
2301
|
-
},
|
2302
|
-
transformData(document)
|
2303
|
-
);
|
2304
|
-
if ("data" in res) {
|
2305
|
-
navigate(
|
2306
|
-
{
|
2307
|
-
pathname: `../${res.data.documentId}`,
|
2308
|
-
search: rawQuery
|
2309
|
-
},
|
2310
|
-
{ relative: "path" }
|
2311
|
-
);
|
2312
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2313
|
-
setErrors(formatValidationErrors(res.error));
|
2314
|
-
}
|
2315
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2316
|
-
const res = await update(
|
2291
|
+
return;
|
2292
|
+
}
|
2293
|
+
if (isCloning) {
|
2294
|
+
const res = await clone(
|
2295
|
+
{
|
2296
|
+
model,
|
2297
|
+
documentId: cloneMatch.params.origin,
|
2298
|
+
params
|
2299
|
+
},
|
2300
|
+
transformData(document)
|
2301
|
+
);
|
2302
|
+
if ("data" in res) {
|
2303
|
+
navigate(
|
2317
2304
|
{
|
2318
|
-
|
2319
|
-
|
2320
|
-
documentId,
|
2321
|
-
params
|
2305
|
+
pathname: `../${res.data.documentId}`,
|
2306
|
+
search: rawQuery
|
2322
2307
|
},
|
2323
|
-
|
2308
|
+
{ relative: "path" }
|
2324
2309
|
);
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2310
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2311
|
+
setErrors(formatValidationErrors(res.error));
|
2312
|
+
}
|
2313
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2314
|
+
const res = await update(
|
2315
|
+
{
|
2316
|
+
collectionType,
|
2317
|
+
model,
|
2318
|
+
documentId,
|
2319
|
+
params
|
2320
|
+
},
|
2321
|
+
transformData(document)
|
2322
|
+
);
|
2323
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2324
|
+
setErrors(formatValidationErrors(res.error));
|
2330
2325
|
} else {
|
2331
|
-
|
2326
|
+
resetForm();
|
2327
|
+
}
|
2328
|
+
} else {
|
2329
|
+
const res = await create(
|
2330
|
+
{
|
2331
|
+
model,
|
2332
|
+
params
|
2333
|
+
},
|
2334
|
+
transformData(document)
|
2335
|
+
);
|
2336
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2337
|
+
navigate(
|
2332
2338
|
{
|
2333
|
-
|
2334
|
-
|
2339
|
+
pathname: `../${res.data.documentId}`,
|
2340
|
+
search: rawQuery
|
2335
2341
|
},
|
2336
|
-
|
2342
|
+
{ replace: true, relative: "path" }
|
2337
2343
|
);
|
2338
|
-
|
2339
|
-
|
2340
|
-
{
|
2341
|
-
pathname: `../${res.data.documentId}`,
|
2342
|
-
search: rawQuery
|
2343
|
-
},
|
2344
|
-
{ replace: true, relative: "path" }
|
2345
|
-
);
|
2346
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2347
|
-
setErrors(formatValidationErrors(res.error));
|
2348
|
-
}
|
2344
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2345
|
+
setErrors(formatValidationErrors(res.error));
|
2349
2346
|
}
|
2350
|
-
} finally {
|
2351
|
-
setSubmitting(false);
|
2352
2347
|
}
|
2348
|
+
} finally {
|
2349
|
+
setSubmitting(false);
|
2353
2350
|
}
|
2351
|
+
}, [
|
2352
|
+
clone,
|
2353
|
+
cloneMatch?.params.origin,
|
2354
|
+
collectionType,
|
2355
|
+
create,
|
2356
|
+
document,
|
2357
|
+
documentId,
|
2358
|
+
formatMessage,
|
2359
|
+
formatValidationErrors,
|
2360
|
+
isCloning,
|
2361
|
+
model,
|
2362
|
+
modified,
|
2363
|
+
navigate,
|
2364
|
+
params,
|
2365
|
+
rawQuery,
|
2366
|
+
resetForm,
|
2367
|
+
setErrors,
|
2368
|
+
setSubmitting,
|
2369
|
+
toggleNotification,
|
2370
|
+
update,
|
2371
|
+
validate
|
2372
|
+
]);
|
2373
|
+
React.useEffect(() => {
|
2374
|
+
const handleKeyDown = (e) => {
|
2375
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2376
|
+
e.preventDefault();
|
2377
|
+
handleUpdate();
|
2378
|
+
}
|
2379
|
+
};
|
2380
|
+
window.addEventListener("keydown", handleKeyDown);
|
2381
|
+
return () => {
|
2382
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2383
|
+
};
|
2384
|
+
}, [handleUpdate]);
|
2385
|
+
return {
|
2386
|
+
/**
|
2387
|
+
* Disabled when:
|
2388
|
+
* - the form is submitting
|
2389
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2390
|
+
* - the active tab is the published tab
|
2391
|
+
*/
|
2392
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2393
|
+
label: formatMessage({
|
2394
|
+
id: "global.save",
|
2395
|
+
defaultMessage: "Save"
|
2396
|
+
}),
|
2397
|
+
onClick: handleUpdate
|
2354
2398
|
};
|
2355
2399
|
};
|
2356
2400
|
UpdateAction.type = "update";
|
2401
|
+
UpdateAction.position = "panel";
|
2357
2402
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2358
2403
|
KEEP: "keep",
|
2359
2404
|
DISCARD: "discard"
|
@@ -2476,6 +2521,7 @@ const UnpublishAction$1 = ({
|
|
2476
2521
|
};
|
2477
2522
|
};
|
2478
2523
|
UnpublishAction$1.type = "unpublish";
|
2524
|
+
UnpublishAction$1.position = "panel";
|
2479
2525
|
const DiscardAction = ({
|
2480
2526
|
activeTab,
|
2481
2527
|
documentId,
|
@@ -2526,6 +2572,7 @@ const DiscardAction = ({
|
|
2526
2572
|
};
|
2527
2573
|
};
|
2528
2574
|
DiscardAction.type = "discard";
|
2575
|
+
DiscardAction.position = "panel";
|
2529
2576
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2530
2577
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2531
2578
|
const RelativeTime = React.forwardRef(
|
@@ -2645,7 +2692,7 @@ const HeaderToolbar = () => {
|
|
2645
2692
|
meta: isCloning ? void 0 : meta,
|
2646
2693
|
collectionType
|
2647
2694
|
},
|
2648
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2695
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2649
2696
|
children: (actions2) => {
|
2650
2697
|
const headerActions = actions2.filter((action) => {
|
2651
2698
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2853,6 +2900,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2853
2900
|
};
|
2854
2901
|
};
|
2855
2902
|
ConfigureTheViewAction.type = "configure-the-view";
|
2903
|
+
ConfigureTheViewAction.position = "header";
|
2856
2904
|
const EditTheModelAction = ({ model }) => {
|
2857
2905
|
const navigate = useNavigate();
|
2858
2906
|
const { formatMessage } = useIntl();
|
@@ -2869,6 +2917,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2869
2917
|
};
|
2870
2918
|
};
|
2871
2919
|
EditTheModelAction.type = "edit-the-model";
|
2920
|
+
EditTheModelAction.position = "header";
|
2872
2921
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2873
2922
|
const navigate = useNavigate();
|
2874
2923
|
const { formatMessage } = useIntl();
|
@@ -2942,6 +2991,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2942
2991
|
};
|
2943
2992
|
};
|
2944
2993
|
DeleteAction$1.type = "delete";
|
2994
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2945
2995
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2946
2996
|
const Panels = () => {
|
2947
2997
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -3004,7 +3054,7 @@ const ActionsPanelContent = () => {
|
|
3004
3054
|
DescriptionComponentRenderer,
|
3005
3055
|
{
|
3006
3056
|
props,
|
3007
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3057
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3008
3058
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
3009
3059
|
}
|
3010
3060
|
),
|
@@ -3458,8 +3508,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3458
3508
|
const refetchList = () => {
|
3459
3509
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3460
3510
|
};
|
3461
|
-
if (!showPublishButton)
|
3462
|
-
return null;
|
3511
|
+
if (!showPublishButton) return null;
|
3463
3512
|
return {
|
3464
3513
|
actionType: "publish",
|
3465
3514
|
variant: "tertiary",
|
@@ -3527,8 +3576,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3527
3576
|
selectRow([]);
|
3528
3577
|
}
|
3529
3578
|
};
|
3530
|
-
if (!hasDeletePermission)
|
3531
|
-
return null;
|
3579
|
+
if (!hasDeletePermission) return null;
|
3532
3580
|
return {
|
3533
3581
|
variant: "danger-light",
|
3534
3582
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3577,8 +3625,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3577
3625
|
}
|
3578
3626
|
};
|
3579
3627
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3580
|
-
if (!showUnpublishButton)
|
3581
|
-
return null;
|
3628
|
+
if (!showUnpublishButton) return null;
|
3582
3629
|
return {
|
3583
3630
|
variant: "tertiary",
|
3584
3631
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3683,7 +3730,7 @@ const TableActions = ({ document }) => {
|
|
3683
3730
|
DescriptionComponentRenderer,
|
3684
3731
|
{
|
3685
3732
|
props,
|
3686
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3733
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3687
3734
|
children: (actions2) => {
|
3688
3735
|
const tableRowActions = actions2.filter((action) => {
|
3689
3736
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3742,6 +3789,7 @@ const EditAction = ({ documentId }) => {
|
|
3742
3789
|
};
|
3743
3790
|
};
|
3744
3791
|
EditAction.type = "edit";
|
3792
|
+
EditAction.position = "table-row";
|
3745
3793
|
const StyledPencil = styled(Pencil)`
|
3746
3794
|
path {
|
3747
3795
|
fill: currentColor;
|
@@ -3818,6 +3866,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3818
3866
|
};
|
3819
3867
|
};
|
3820
3868
|
CloneAction.type = "clone";
|
3869
|
+
CloneAction.position = "table-row";
|
3821
3870
|
const StyledDuplicate = styled(Duplicate)`
|
3822
3871
|
path {
|
3823
3872
|
fill: currentColor;
|
@@ -3904,7 +3953,14 @@ class ContentManagerPlugin {
|
|
3904
3953
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3905
3954
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3906
3955
|
getBulkActions: () => this.bulkActions,
|
3907
|
-
getDocumentActions: () =>
|
3956
|
+
getDocumentActions: (position) => {
|
3957
|
+
if (position) {
|
3958
|
+
return this.documentActions.filter(
|
3959
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3960
|
+
);
|
3961
|
+
}
|
3962
|
+
return this.documentActions;
|
3963
|
+
},
|
3908
3964
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3909
3965
|
getHeaderActions: () => this.headerActions
|
3910
3966
|
}
|
@@ -3914,10 +3970,8 @@ class ContentManagerPlugin {
|
|
3914
3970
|
const getPrintableType = (value) => {
|
3915
3971
|
const nativeType = typeof value;
|
3916
3972
|
if (nativeType === "object") {
|
3917
|
-
if (value === null)
|
3918
|
-
|
3919
|
-
if (Array.isArray(value))
|
3920
|
-
return "array";
|
3973
|
+
if (value === null) return "null";
|
3974
|
+
if (Array.isArray(value)) return "array";
|
3921
3975
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3922
3976
|
return value.constructor.name;
|
3923
3977
|
}
|
@@ -3970,6 +4024,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3970
4024
|
};
|
3971
4025
|
};
|
3972
4026
|
HistoryAction.type = "history";
|
4027
|
+
HistoryAction.position = "header";
|
3973
4028
|
const historyAdmin = {
|
3974
4029
|
bootstrap(app) {
|
3975
4030
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4032,10 +4087,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4032
4087
|
})
|
4033
4088
|
});
|
4034
4089
|
const { useGetPreviewUrlQuery } = previewApi;
|
4090
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4091
|
+
if (isShown) {
|
4092
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4093
|
+
}
|
4094
|
+
return children;
|
4095
|
+
};
|
4035
4096
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4036
4097
|
const { formatMessage } = useIntl();
|
4037
4098
|
const { trackUsage } = useTracking();
|
4099
|
+
const { pathname } = useLocation();
|
4038
4100
|
const [{ query }] = useQueryParams();
|
4101
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4039
4102
|
const { data, error } = useGetPreviewUrlQuery({
|
4040
4103
|
params: {
|
4041
4104
|
contentType: model
|
@@ -4049,33 +4112,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4049
4112
|
if (!data?.data?.url || error) {
|
4050
4113
|
return null;
|
4051
4114
|
}
|
4052
|
-
const
|
4053
|
-
|
4115
|
+
const trackNavigation = () => {
|
4116
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4117
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4054
4118
|
};
|
4055
4119
|
return {
|
4056
4120
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4057
|
-
content: /* @__PURE__ */ jsx(
|
4058
|
-
|
4121
|
+
content: /* @__PURE__ */ jsx(
|
4122
|
+
ConditionalTooltip,
|
4059
4123
|
{
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4065
|
-
children:
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4124
|
+
label: formatMessage({
|
4125
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4126
|
+
defaultMessage: "Please save to open the preview"
|
4127
|
+
}),
|
4128
|
+
isShown: isModified,
|
4129
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4130
|
+
Button,
|
4131
|
+
{
|
4132
|
+
variant: "tertiary",
|
4133
|
+
tag: Link,
|
4134
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4135
|
+
onClick: trackNavigation,
|
4136
|
+
width: "100%",
|
4137
|
+
disabled: isModified,
|
4138
|
+
pointerEvents: isModified ? "none" : void 0,
|
4139
|
+
tabIndex: isModified ? -1 : void 0,
|
4140
|
+
children: formatMessage({
|
4141
|
+
id: "content-manager.preview.panel.button",
|
4142
|
+
defaultMessage: "Open preview"
|
4143
|
+
})
|
4144
|
+
}
|
4145
|
+
) })
|
4069
4146
|
}
|
4070
|
-
)
|
4147
|
+
)
|
4071
4148
|
};
|
4072
4149
|
};
|
4073
|
-
const FEATURE_ID = "preview";
|
4074
4150
|
const previewAdmin = {
|
4075
4151
|
bootstrap(app) {
|
4076
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4077
|
-
return;
|
4078
|
-
}
|
4079
4152
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4080
4153
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4081
4154
|
}
|
@@ -4099,7 +4172,7 @@ const index = {
|
|
4099
4172
|
app.router.addRoute({
|
4100
4173
|
path: "content-manager/*",
|
4101
4174
|
lazy: async () => {
|
4102
|
-
const { Layout } = await import("./layout-
|
4175
|
+
const { Layout } = await import("./layout-Bxsv5mP7.mjs");
|
4103
4176
|
return {
|
4104
4177
|
Component: Layout
|
4105
4178
|
};
|
@@ -4119,7 +4192,7 @@ const index = {
|
|
4119
4192
|
async registerTrads({ locales }) {
|
4120
4193
|
const importedTrads = await Promise.all(
|
4121
4194
|
locales.map((locale) => {
|
4122
|
-
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-
|
4195
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4123
4196
|
return {
|
4124
4197
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4125
4198
|
locale
|
@@ -4181,4 +4254,4 @@ export {
|
|
4181
4254
|
capitalise as y,
|
4182
4255
|
useUpdateContentTypeConfigurationMutation as z
|
4183
4256
|
};
|
4184
|
-
//# sourceMappingURL=index-
|
4257
|
+
//# sourceMappingURL=index-DVAIIsOs.mjs.map
|