@strapi/content-manager 0.0.0-next.d6ed4fcf2c833656b8c91a90909c1e77c79379e5 → 0.0.0-next.dad3c50630ca4fd9eccdcbe549ee632fc572e23d

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.
Files changed (120) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DywpTZeV.js → ComponentConfigurationPage-BLWQy8ru.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DywpTZeV.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-BgCLcjXO.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-BgCLcjXO.mjs.map → ComponentConfigurationPage-CtIa3aa2.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-BNjOAHNS.mjs → EditConfigurationPage-DsPR2DVk.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-BNjOAHNS.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-CxRlP5if.js → EditConfigurationPage-RQkymxCy.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-CxRlP5if.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-BRewdTqE.js → EditViewPage-B-kExt8C.js} +3 -3
  10. package/dist/_chunks/{EditViewPage-BRewdTqE.js.map → EditViewPage-B-kExt8C.js.map} +1 -1
  11. package/dist/_chunks/{EditViewPage-CD_hqc1J.mjs → EditViewPage-BPyVuPfM.mjs} +3 -3
  12. package/dist/_chunks/{EditViewPage-CD_hqc1J.mjs.map → EditViewPage-BPyVuPfM.mjs.map} +1 -1
  13. package/dist/_chunks/{Field-DwvmENVf.js → Field-DPIsQRre.js} +117 -61
  14. package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
  15. package/dist/_chunks/{Field-BPkQ-3Ku.mjs → Field-Dltnt1km.mjs} +116 -61
  16. package/dist/_chunks/Field-Dltnt1km.mjs.map +1 -0
  17. package/dist/_chunks/{Form-C_Gwv8P_.js → Form-BFi4MXMT.js} +2 -2
  18. package/dist/_chunks/{Form-C_Gwv8P_.js.map → Form-BFi4MXMT.js.map} +1 -1
  19. package/dist/_chunks/{Form-Czi0cf_2.mjs → Form-C1IcWm1u.mjs} +2 -2
  20. package/dist/_chunks/{Form-Czi0cf_2.mjs.map → Form-C1IcWm1u.mjs.map} +1 -1
  21. package/dist/_chunks/{History-CIQHyi4T.mjs → History-04ChQ4pl.mjs} +32 -8
  22. package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
  23. package/dist/_chunks/{History-C1TKAig-.js → History-wjcK4L0C.js} +32 -8
  24. package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-DcZsfyEL.mjs → ListConfigurationPage-BYqPYLSU.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-DcZsfyEL.mjs.map → ListConfigurationPage-BYqPYLSU.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-D-NGRLYu.js → ListConfigurationPage-CRbxIC3J.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-D-NGRLYu.js.map → ListConfigurationPage-CRbxIC3J.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-xv5IQoZp.js → ListViewPage-D5NY9183.js} +3 -3
  30. package/dist/_chunks/{ListViewPage-xv5IQoZp.js.map → ListViewPage-D5NY9183.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-C10McTK1.mjs → ListViewPage-FU2LBuhl.mjs} +3 -3
  32. package/dist/_chunks/{ListViewPage-C10McTK1.mjs.map → ListViewPage-FU2LBuhl.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-Dzw5Yj5u.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-Dzw5Yj5u.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-CPc0Cd3S.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-CPc0Cd3S.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-DAe5CDCC.js → NoPermissionsPage-C5jwn70o.js} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-DAe5CDCC.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-wfPBh2_0.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-wfPBh2_0.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
  41. package/dist/_chunks/{Preview-BVFFm7uB.mjs → Preview-BMYN548c.mjs} +33 -11
  42. package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
  43. package/dist/_chunks/{Preview-B7LyGT_b.js → Preview-DaOihysv.js} +32 -10
  44. package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
  45. package/dist/_chunks/{Relations-BmYR1AjY.js → Relations-CTGM7Hv5.js} +3 -3
  46. package/dist/_chunks/{Relations-BmYR1AjY.js.map → Relations-CTGM7Hv5.js.map} +1 -1
  47. package/dist/_chunks/{Relations-JPhWxk-s.mjs → Relations-gscPkxjF.mjs} +3 -3
  48. package/dist/_chunks/{Relations-JPhWxk-s.mjs.map → Relations-gscPkxjF.mjs.map} +1 -1
  49. package/dist/_chunks/{en-BK8Xyl5I.js → en-BzQmavmK.js} +7 -2
  50. package/dist/_chunks/{en-BK8Xyl5I.js.map → en-BzQmavmK.js.map} +1 -1
  51. package/dist/_chunks/{en-Dtk_ot79.mjs → en-CSxLmrh1.mjs} +7 -2
  52. package/dist/_chunks/{en-Dtk_ot79.mjs.map → en-CSxLmrh1.mjs.map} +1 -1
  53. package/dist/_chunks/{index-C2Q_PLWj.js → index-Ca7YWlAA.js} +191 -112
  54. package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
  55. package/dist/_chunks/{index-DLIkNVnQ.mjs → index-DqasUQ6Q.mjs} +191 -112
  56. package/dist/_chunks/index-DqasUQ6Q.mjs.map +1 -0
  57. package/dist/_chunks/{layout-7AsWJzZJ.js → layout-BW80JSCd.js} +3 -3
  58. package/dist/_chunks/{layout-7AsWJzZJ.js.map → layout-BW80JSCd.js.map} +1 -1
  59. package/dist/_chunks/{layout-qE8qkNH_.mjs → layout-W3clJSCy.mjs} +3 -3
  60. package/dist/_chunks/{layout-qE8qkNH_.mjs.map → layout-W3clJSCy.mjs.map} +1 -1
  61. package/dist/_chunks/{relations-BjHH_1Am.mjs → relations-BlDkoeWh.mjs} +2 -2
  62. package/dist/_chunks/{relations-BjHH_1Am.mjs.map → relations-BlDkoeWh.mjs.map} +1 -1
  63. package/dist/_chunks/{relations-EifVzf_2.js → relations-C9Usz9k5.js} +2 -2
  64. package/dist/_chunks/{relations-EifVzf_2.js.map → relations-C9Usz9k5.js.map} +1 -1
  65. package/dist/admin/index.js +2 -1
  66. package/dist/admin/index.js.map +1 -1
  67. package/dist/admin/index.mjs +2 -1
  68. package/dist/admin/src/content-manager.d.ts +3 -2
  69. package/dist/admin/src/exports.d.ts +1 -0
  70. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  71. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  72. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
  73. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  74. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  75. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  76. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  77. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  78. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  79. package/dist/admin/src/services/api.d.ts +1 -1
  80. package/dist/admin/src/services/components.d.ts +2 -2
  81. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  82. package/dist/admin/src/services/documents.d.ts +16 -16
  83. package/dist/admin/src/services/init.d.ts +1 -1
  84. package/dist/admin/src/services/relations.d.ts +2 -2
  85. package/dist/admin/src/services/uid.d.ts +3 -3
  86. package/dist/server/index.js +156 -142
  87. package/dist/server/index.js.map +1 -1
  88. package/dist/server/index.mjs +157 -143
  89. package/dist/server/index.mjs.map +1 -1
  90. package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
  91. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  92. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  93. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  94. package/dist/server/src/history/services/history.d.ts +3 -3
  95. package/dist/server/src/history/services/history.d.ts.map +1 -1
  96. package/dist/server/src/history/services/utils.d.ts +6 -10
  97. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  98. package/dist/server/src/index.d.ts +3 -2
  99. package/dist/server/src/index.d.ts.map +1 -1
  100. package/dist/server/src/preview/index.d.ts.map +1 -1
  101. package/dist/server/src/services/document-metadata.d.ts +4 -2
  102. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  103. package/dist/server/src/services/index.d.ts +3 -2
  104. package/dist/server/src/services/index.d.ts.map +1 -1
  105. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  106. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  107. package/dist/server/src/services/utils/populate.d.ts +2 -2
  108. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  109. package/package.json +8 -6
  110. package/dist/_chunks/Field-BPkQ-3Ku.mjs.map +0 -1
  111. package/dist/_chunks/Field-DwvmENVf.js.map +0 -1
  112. package/dist/_chunks/History-C1TKAig-.js.map +0 -1
  113. package/dist/_chunks/History-CIQHyi4T.mjs.map +0 -1
  114. package/dist/_chunks/Preview-B7LyGT_b.js.map +0 -1
  115. package/dist/_chunks/Preview-BVFFm7uB.mjs.map +0 -1
  116. package/dist/_chunks/index-C2Q_PLWj.js.map +0 -1
  117. package/dist/_chunks/index-DLIkNVnQ.mjs.map +0 -1
  118. package/dist/admin/src/preview/constants.d.ts +0 -1
  119. package/dist/server/src/preview/constants.d.ts +0 -2
  120. package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -175,7 +175,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
175
175
  "InitialData",
176
176
  "HistoryVersion",
177
177
  "Relations",
178
- "UidAvailability"
178
+ "UidAvailability",
179
+ "RecentDocumentList"
179
180
  ]
180
181
  });
181
182
  const documentApi = contentManagerApi.injectEndpoints({
@@ -193,7 +194,7 @@ const documentApi = contentManagerApi.injectEndpoints({
193
194
  if (error) {
194
195
  return [];
195
196
  }
196
- return [{ type: "Document", id: `${model}_LIST` }];
197
+ return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
197
198
  }
198
199
  }),
199
200
  cloneDocument: builder.mutation({
@@ -207,7 +208,8 @@ const documentApi = contentManagerApi.injectEndpoints({
207
208
  }),
208
209
  invalidatesTags: (_result, _error, { model }) => [
209
210
  { type: "Document", id: `${model}_LIST` },
210
- { type: "UidAvailability", id: model }
211
+ { type: "UidAvailability", id: model },
212
+ "RecentDocumentList"
211
213
  ]
212
214
  }),
213
215
  /**
@@ -226,8 +228,21 @@ const documentApi = contentManagerApi.injectEndpoints({
226
228
  invalidatesTags: (result, _error, { model }) => [
227
229
  { type: "Document", id: `${model}_LIST` },
228
230
  "Relations",
229
- { type: "UidAvailability", id: model }
230
- ]
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
+ }
231
246
  }),
232
247
  deleteDocument: builder.mutation({
233
248
  query: ({ collectionType, model, documentId, params }) => ({
@@ -238,7 +253,8 @@ const documentApi = contentManagerApi.injectEndpoints({
238
253
  }
239
254
  }),
240
255
  invalidatesTags: (_result, _error, { collectionType, model }) => [
241
- { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
256
+ { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
257
+ "RecentDocumentList"
242
258
  ]
243
259
  }),
244
260
  deleteManyDocuments: builder.mutation({
@@ -250,7 +266,10 @@ const documentApi = contentManagerApi.injectEndpoints({
250
266
  params
251
267
  }
252
268
  }),
253
- invalidatesTags: (_res, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
269
+ invalidatesTags: (_res, _error, { model }) => [
270
+ { type: "Document", id: `${model}_LIST` },
271
+ "RecentDocumentList"
272
+ ]
254
273
  }),
255
274
  discardDocument: builder.mutation({
256
275
  query: ({ collectionType, model, documentId, params }) => ({
@@ -268,7 +287,8 @@ const documentApi = contentManagerApi.injectEndpoints({
268
287
  },
269
288
  { type: "Document", id: `${model}_LIST` },
270
289
  "Relations",
271
- { type: "UidAvailability", id: model }
290
+ { type: "UidAvailability", id: model },
291
+ "RecentDocumentList"
272
292
  ];
273
293
  }
274
294
  }),
@@ -363,7 +383,8 @@ const documentApi = contentManagerApi.injectEndpoints({
363
383
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
364
384
  },
365
385
  { type: "Document", id: `${model}_LIST` },
366
- "Relations"
386
+ "Relations",
387
+ "RecentDocumentList"
367
388
  ];
368
389
  }
369
390
  }),
@@ -394,7 +415,9 @@ const documentApi = contentManagerApi.injectEndpoints({
394
415
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
395
416
  },
396
417
  "Relations",
397
- { type: "UidAvailability", id: model }
418
+ { type: "UidAvailability", id: model },
419
+ "RecentDocumentList",
420
+ "RecentDocumentList"
398
421
  ];
399
422
  },
400
423
  async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
@@ -424,7 +447,8 @@ const documentApi = contentManagerApi.injectEndpoints({
424
447
  {
425
448
  type: "Document",
426
449
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
427
- }
450
+ },
451
+ "RecentDocumentList"
428
452
  ];
429
453
  }
430
454
  }),
@@ -437,7 +461,10 @@ const documentApi = contentManagerApi.injectEndpoints({
437
461
  params
438
462
  }
439
463
  }),
440
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
464
+ invalidatesTags: (_res, _error, { model, documentIds }) => [
465
+ ...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
466
+ "RecentDocumentList"
467
+ ]
441
468
  })
442
469
  })
443
470
  });
@@ -1667,7 +1694,7 @@ const useDocumentActions = () => {
1667
1694
  };
1668
1695
  };
1669
1696
  const ProtectedHistoryPage = React.lazy(
1670
- () => import("./History-CIQHyi4T.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1697
+ () => import("./History-04ChQ4pl.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1671
1698
  );
1672
1699
  const routes$2 = [
1673
1700
  {
@@ -1680,7 +1707,7 @@ const routes$2 = [
1680
1707
  }
1681
1708
  ];
1682
1709
  const ProtectedPreviewPage = React.lazy(
1683
- () => import("./Preview-BVFFm7uB.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1710
+ () => import("./Preview-BMYN548c.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1684
1711
  );
1685
1712
  const routes$1 = [
1686
1713
  {
@@ -1693,31 +1720,31 @@ const routes$1 = [
1693
1720
  }
1694
1721
  ];
1695
1722
  const ProtectedEditViewPage = lazy(
1696
- () => import("./EditViewPage-CD_hqc1J.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1723
+ () => import("./EditViewPage-BPyVuPfM.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1697
1724
  );
1698
1725
  const ProtectedListViewPage = lazy(
1699
- () => import("./ListViewPage-C10McTK1.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1726
+ () => import("./ListViewPage-FU2LBuhl.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1700
1727
  );
1701
1728
  const ProtectedListConfiguration = lazy(
1702
- () => import("./ListConfigurationPage-DcZsfyEL.mjs").then((mod) => ({
1729
+ () => import("./ListConfigurationPage-BYqPYLSU.mjs").then((mod) => ({
1703
1730
  default: mod.ProtectedListConfiguration
1704
1731
  }))
1705
1732
  );
1706
1733
  const ProtectedEditConfigurationPage = lazy(
1707
- () => import("./EditConfigurationPage-BNjOAHNS.mjs").then((mod) => ({
1734
+ () => import("./EditConfigurationPage-DsPR2DVk.mjs").then((mod) => ({
1708
1735
  default: mod.ProtectedEditConfigurationPage
1709
1736
  }))
1710
1737
  );
1711
1738
  const ProtectedComponentConfigurationPage = lazy(
1712
- () => import("./ComponentConfigurationPage-BgCLcjXO.mjs").then((mod) => ({
1739
+ () => import("./ComponentConfigurationPage-CtIa3aa2.mjs").then((mod) => ({
1713
1740
  default: mod.ProtectedComponentConfigurationPage
1714
1741
  }))
1715
1742
  );
1716
1743
  const NoPermissions = lazy(
1717
- () => import("./NoPermissionsPage-wfPBh2_0.mjs").then((mod) => ({ default: mod.NoPermissions }))
1744
+ () => import("./NoPermissionsPage-jqve7C8l.mjs").then((mod) => ({ default: mod.NoPermissions }))
1718
1745
  );
1719
1746
  const NoContentType = lazy(
1720
- () => import("./NoContentTypePage-CPc0Cd3S.mjs").then((mod) => ({ default: mod.NoContentType }))
1747
+ () => import("./NoContentTypePage-DCKUkwb8.mjs").then((mod) => ({ default: mod.NoContentType }))
1721
1748
  );
1722
1749
  const CollectionTypePages = () => {
1723
1750
  const { collectionType } = useParams();
@@ -2248,6 +2275,7 @@ const PublishAction$1 = ({
2248
2275
  };
2249
2276
  };
2250
2277
  PublishAction$1.type = "publish";
2278
+ PublishAction$1.position = "panel";
2251
2279
  const UpdateAction = ({
2252
2280
  activeTab,
2253
2281
  documentId,
@@ -2270,6 +2298,117 @@ const UpdateAction = ({
2270
2298
  const validate = useForm("UpdateAction", (state) => state.validate);
2271
2299
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2272
2300
  const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
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
+ })
2317
+ });
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(
2331
+ {
2332
+ pathname: `../${res.data.documentId}`,
2333
+ search: rawQuery
2334
+ },
2335
+ { relative: "path" }
2336
+ );
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));
2352
+ } else {
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(
2365
+ {
2366
+ pathname: `../${res.data.documentId}`,
2367
+ search: rawQuery
2368
+ },
2369
+ { replace: true, relative: "path" }
2370
+ );
2371
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2372
+ setErrors(formatValidationErrors(res.error));
2373
+ }
2374
+ }
2375
+ } finally {
2376
+ setSubmitting(false);
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]);
2273
2412
  return {
2274
2413
  /**
2275
2414
  * Disabled when:
@@ -2282,84 +2421,11 @@ const UpdateAction = ({
2282
2421
  id: "global.save",
2283
2422
  defaultMessage: "Save"
2284
2423
  }),
2285
- onClick: async () => {
2286
- setSubmitting(true);
2287
- try {
2288
- const { errors } = await validate(true, {
2289
- status: "draft"
2290
- });
2291
- if (errors) {
2292
- toggleNotification({
2293
- type: "danger",
2294
- message: formatMessage({
2295
- id: "content-manager.validation.error",
2296
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2297
- })
2298
- });
2299
- return;
2300
- }
2301
- if (isCloning) {
2302
- const res = await clone(
2303
- {
2304
- model,
2305
- documentId: cloneMatch.params.origin,
2306
- params
2307
- },
2308
- transformData(document)
2309
- );
2310
- if ("data" in res) {
2311
- navigate(
2312
- {
2313
- pathname: `../${res.data.documentId}`,
2314
- search: rawQuery
2315
- },
2316
- { relative: "path" }
2317
- );
2318
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2319
- setErrors(formatValidationErrors(res.error));
2320
- }
2321
- } else if (documentId || collectionType === SINGLE_TYPES) {
2322
- const res = await update(
2323
- {
2324
- collectionType,
2325
- model,
2326
- documentId,
2327
- params
2328
- },
2329
- transformData(document)
2330
- );
2331
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2332
- setErrors(formatValidationErrors(res.error));
2333
- } else {
2334
- resetForm();
2335
- }
2336
- } else {
2337
- const res = await create(
2338
- {
2339
- model,
2340
- params
2341
- },
2342
- transformData(document)
2343
- );
2344
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2345
- navigate(
2346
- {
2347
- pathname: `../${res.data.documentId}`,
2348
- search: rawQuery
2349
- },
2350
- { replace: true, relative: "path" }
2351
- );
2352
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2353
- setErrors(formatValidationErrors(res.error));
2354
- }
2355
- }
2356
- } finally {
2357
- setSubmitting(false);
2358
- }
2359
- }
2424
+ onClick: handleUpdate
2360
2425
  };
2361
2426
  };
2362
2427
  UpdateAction.type = "update";
2428
+ UpdateAction.position = "panel";
2363
2429
  const UNPUBLISH_DRAFT_OPTIONS = {
2364
2430
  KEEP: "keep",
2365
2431
  DISCARD: "discard"
@@ -2482,6 +2548,7 @@ const UnpublishAction$1 = ({
2482
2548
  };
2483
2549
  };
2484
2550
  UnpublishAction$1.type = "unpublish";
2551
+ UnpublishAction$1.position = "panel";
2485
2552
  const DiscardAction = ({
2486
2553
  activeTab,
2487
2554
  documentId,
@@ -2532,6 +2599,7 @@ const DiscardAction = ({
2532
2599
  };
2533
2600
  };
2534
2601
  DiscardAction.type = "discard";
2602
+ DiscardAction.position = "panel";
2535
2603
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2536
2604
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2537
2605
  const RelativeTime = React.forwardRef(
@@ -2651,7 +2719,7 @@ const HeaderToolbar = () => {
2651
2719
  meta: isCloning ? void 0 : meta,
2652
2720
  collectionType
2653
2721
  },
2654
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2722
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2655
2723
  children: (actions2) => {
2656
2724
  const headerActions = actions2.filter((action) => {
2657
2725
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2859,6 +2927,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2859
2927
  };
2860
2928
  };
2861
2929
  ConfigureTheViewAction.type = "configure-the-view";
2930
+ ConfigureTheViewAction.position = "header";
2862
2931
  const EditTheModelAction = ({ model }) => {
2863
2932
  const navigate = useNavigate();
2864
2933
  const { formatMessage } = useIntl();
@@ -2875,6 +2944,7 @@ const EditTheModelAction = ({ model }) => {
2875
2944
  };
2876
2945
  };
2877
2946
  EditTheModelAction.type = "edit-the-model";
2947
+ EditTheModelAction.position = "header";
2878
2948
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2879
2949
  const navigate = useNavigate();
2880
2950
  const { formatMessage } = useIntl();
@@ -2948,6 +3018,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2948
3018
  };
2949
3019
  };
2950
3020
  DeleteAction$1.type = "delete";
3021
+ DeleteAction$1.position = ["header", "table-row"];
2951
3022
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2952
3023
  const Panels = () => {
2953
3024
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3010,7 +3081,7 @@ const ActionsPanelContent = () => {
3010
3081
  DescriptionComponentRenderer,
3011
3082
  {
3012
3083
  props,
3013
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3084
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3014
3085
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3015
3086
  }
3016
3087
  ),
@@ -3686,7 +3757,7 @@ const TableActions = ({ document }) => {
3686
3757
  DescriptionComponentRenderer,
3687
3758
  {
3688
3759
  props,
3689
- 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"),
3690
3761
  children: (actions2) => {
3691
3762
  const tableRowActions = actions2.filter((action) => {
3692
3763
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3745,6 +3816,7 @@ const EditAction = ({ documentId }) => {
3745
3816
  };
3746
3817
  };
3747
3818
  EditAction.type = "edit";
3819
+ EditAction.position = "table-row";
3748
3820
  const StyledPencil = styled(Pencil)`
3749
3821
  path {
3750
3822
  fill: currentColor;
@@ -3821,6 +3893,7 @@ const CloneAction = ({ model, documentId }) => {
3821
3893
  };
3822
3894
  };
3823
3895
  CloneAction.type = "clone";
3896
+ CloneAction.position = "table-row";
3824
3897
  const StyledDuplicate = styled(Duplicate)`
3825
3898
  path {
3826
3899
  fill: currentColor;
@@ -3907,7 +3980,14 @@ class ContentManagerPlugin {
3907
3980
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3908
3981
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3909
3982
  getBulkActions: () => this.bulkActions,
3910
- getDocumentActions: () => this.documentActions,
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
+ },
3911
3991
  getEditViewSidePanels: () => this.editViewSidePanels,
3912
3992
  getHeaderActions: () => this.headerActions
3913
3993
  }
@@ -3971,6 +4051,7 @@ const HistoryAction = ({ model, document }) => {
3971
4051
  };
3972
4052
  };
3973
4053
  HistoryAction.type = "history";
4054
+ HistoryAction.position = "header";
3974
4055
  const historyAdmin = {
3975
4056
  bootstrap(app) {
3976
4057
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4064,7 +4145,7 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4064
4145
  };
4065
4146
  return {
4066
4147
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4067
- content: /* @__PURE__ */ jsx(Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsx(
4148
+ content: /* @__PURE__ */ jsx(
4068
4149
  ConditionalTooltip,
4069
4150
  {
4070
4151
  label: formatMessage({
@@ -4072,31 +4153,29 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4072
4153
  defaultMessage: "Please save to open the preview"
4073
4154
  }),
4074
4155
  isShown: isModified,
4075
- children: /* @__PURE__ */ jsx(
4156
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4076
4157
  Button,
4077
4158
  {
4078
4159
  variant: "tertiary",
4079
4160
  tag: Link,
4080
4161
  to: { pathname: "preview", search: stringify(query, { encode: false }) },
4081
4162
  onClick: trackNavigation,
4082
- flex: "auto",
4163
+ width: "100%",
4083
4164
  disabled: isModified,
4165
+ pointerEvents: isModified ? "none" : void 0,
4166
+ tabIndex: isModified ? -1 : void 0,
4084
4167
  children: formatMessage({
4085
4168
  id: "content-manager.preview.panel.button",
4086
4169
  defaultMessage: "Open preview"
4087
4170
  })
4088
4171
  }
4089
- )
4172
+ ) })
4090
4173
  }
4091
- ) })
4174
+ )
4092
4175
  };
4093
4176
  };
4094
- const FEATURE_ID = "preview";
4095
4177
  const previewAdmin = {
4096
4178
  bootstrap(app) {
4097
- if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4098
- return;
4099
- }
4100
4179
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4101
4180
  contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4102
4181
  }
@@ -4120,7 +4199,7 @@ const index = {
4120
4199
  app.router.addRoute({
4121
4200
  path: "content-manager/*",
4122
4201
  lazy: async () => {
4123
- const { Layout } = await import("./layout-qE8qkNH_.mjs");
4202
+ const { Layout } = await import("./layout-W3clJSCy.mjs");
4124
4203
  return {
4125
4204
  Component: Layout
4126
4205
  };
@@ -4140,7 +4219,7 @@ const index = {
4140
4219
  async registerTrads({ locales }) {
4141
4220
  const importedTrads = await Promise.all(
4142
4221
  locales.map((locale) => {
4143
- 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 }) => {
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 }) => {
4144
4223
  return {
4145
4224
  data: prefixPluginTranslations(data, PLUGIN_ID),
4146
4225
  locale
@@ -4202,4 +4281,4 @@ export {
4202
4281
  capitalise as y,
4203
4282
  useUpdateContentTypeConfigurationMutation as z
4204
4283
  };
4205
- //# sourceMappingURL=index-DLIkNVnQ.mjs.map
4284
+ //# sourceMappingURL=index-DqasUQ6Q.mjs.map