@strapi/content-manager 0.0.0-next.7315bad3dd6542d457c3c837db874e3e6336ae9f → 0.0.0-next.76a9dc5ca66301db734af3bc2111406c17ccb860

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 (118) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DHV8IFbd.js → ComponentConfigurationPage-BLWQy8ru.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DHV8IFbd.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-D4J64ny7.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-D4J64ny7.mjs.map → ComponentConfigurationPage-CtIa3aa2.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-DMnf8orh.mjs → EditConfigurationPage-DsPR2DVk.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-DMnf8orh.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-q76oeVU1.js → EditConfigurationPage-RQkymxCy.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-q76oeVU1.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-BXoY-ITh.js → EditViewPage-B-kExt8C.js} +3 -3
  10. package/dist/_chunks/{EditViewPage-BXoY-ITh.js.map → EditViewPage-B-kExt8C.js.map} +1 -1
  11. package/dist/_chunks/{EditViewPage-COVXj9bh.mjs → EditViewPage-BPyVuPfM.mjs} +3 -3
  12. package/dist/_chunks/{EditViewPage-COVXj9bh.mjs.map → EditViewPage-BPyVuPfM.mjs.map} +1 -1
  13. package/dist/_chunks/{Field-Dj1nOvt8.js → Field-DPIsQRre.js} +117 -61
  14. package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
  15. package/dist/_chunks/{Field-CcppsFQR.mjs → Field-Dltnt1km.mjs} +116 -61
  16. package/dist/_chunks/Field-Dltnt1km.mjs.map +1 -0
  17. package/dist/_chunks/{Form-aTchNxab.js → Form-BFi4MXMT.js} +2 -2
  18. package/dist/_chunks/{Form-aTchNxab.js.map → Form-BFi4MXMT.js.map} +1 -1
  19. package/dist/_chunks/{Form-DbWwH0-A.mjs → Form-C1IcWm1u.mjs} +2 -2
  20. package/dist/_chunks/{Form-DbWwH0-A.mjs.map → Form-C1IcWm1u.mjs.map} +1 -1
  21. package/dist/_chunks/{History-tU567_hc.mjs → History-04ChQ4pl.mjs} +32 -8
  22. package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
  23. package/dist/_chunks/{History-Cs6XM6EU.js → History-wjcK4L0C.js} +32 -8
  24. package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-DQryo_4i.mjs → ListConfigurationPage-BYqPYLSU.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-DQryo_4i.mjs.map → ListConfigurationPage-BYqPYLSU.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-7LeytuFD.js → ListConfigurationPage-CRbxIC3J.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-7LeytuFD.js.map → ListConfigurationPage-CRbxIC3J.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-CaGBu5H5.js → ListViewPage-D5NY9183.js} +3 -3
  30. package/dist/_chunks/{ListViewPage-CaGBu5H5.js.map → ListViewPage-D5NY9183.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-B50esy_x.mjs → ListViewPage-FU2LBuhl.mjs} +3 -3
  32. package/dist/_chunks/{ListViewPage-B50esy_x.mjs.map → ListViewPage-FU2LBuhl.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-BaBE00IO.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-BaBE00IO.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-CiPP8cLx.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-CiPP8cLx.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-DQn5cqZz.js → NoPermissionsPage-C5jwn70o.js} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-DQn5cqZz.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-0-CW106p.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-0-CW106p.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
  41. package/dist/_chunks/{Preview-C1dBkhXf.mjs → Preview-BMYN548c.mjs} +33 -11
  42. package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
  43. package/dist/_chunks/{Preview-DH1h7kJ6.js → Preview-DaOihysv.js} +32 -10
  44. package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
  45. package/dist/_chunks/{Relations-CkECnBOd.js → Relations-CTGM7Hv5.js} +3 -3
  46. package/dist/_chunks/{Relations-CkECnBOd.js.map → Relations-CTGM7Hv5.js.map} +1 -1
  47. package/dist/_chunks/{Relations-Bvne4TvU.mjs → Relations-gscPkxjF.mjs} +3 -3
  48. package/dist/_chunks/{Relations-Bvne4TvU.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-BN1pPa5v.js → index-Ca7YWlAA.js} +170 -108
  54. package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
  55. package/dist/_chunks/{index-ByPZ754U.mjs → index-DqasUQ6Q.mjs} +170 -108
  56. package/dist/_chunks/index-DqasUQ6Q.mjs.map +1 -0
  57. package/dist/_chunks/{layout-nBPDlXjr.js → layout-BW80JSCd.js} +3 -3
  58. package/dist/_chunks/{layout-nBPDlXjr.js.map → layout-BW80JSCd.js.map} +1 -1
  59. package/dist/_chunks/{layout-CUTOYU8I.mjs → layout-W3clJSCy.mjs} +3 -3
  60. package/dist/_chunks/{layout-CUTOYU8I.mjs.map → layout-W3clJSCy.mjs.map} +1 -1
  61. package/dist/_chunks/{relations-CBc5HYHC.mjs → relations-BlDkoeWh.mjs} +2 -2
  62. package/dist/_chunks/{relations-CBc5HYHC.mjs.map → relations-BlDkoeWh.mjs.map} +1 -1
  63. package/dist/_chunks/{relations-B6B-b7lI.js → relations-C9Usz9k5.js} +2 -2
  64. package/dist/_chunks/{relations-B6B-b7lI.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/exports.d.ts +1 -0
  69. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  70. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
  71. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  72. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  73. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  74. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  75. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  76. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  77. package/dist/admin/src/services/api.d.ts +1 -1
  78. package/dist/admin/src/services/components.d.ts +2 -2
  79. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  80. package/dist/admin/src/services/documents.d.ts +16 -16
  81. package/dist/admin/src/services/init.d.ts +1 -1
  82. package/dist/admin/src/services/relations.d.ts +2 -2
  83. package/dist/admin/src/services/uid.d.ts +3 -3
  84. package/dist/server/index.js +156 -142
  85. package/dist/server/index.js.map +1 -1
  86. package/dist/server/index.mjs +157 -143
  87. package/dist/server/index.mjs.map +1 -1
  88. package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
  89. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  90. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  91. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  92. package/dist/server/src/history/services/history.d.ts +3 -3
  93. package/dist/server/src/history/services/history.d.ts.map +1 -1
  94. package/dist/server/src/history/services/utils.d.ts +6 -10
  95. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  96. package/dist/server/src/index.d.ts +3 -2
  97. package/dist/server/src/index.d.ts.map +1 -1
  98. package/dist/server/src/preview/index.d.ts.map +1 -1
  99. package/dist/server/src/services/document-metadata.d.ts +4 -2
  100. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  101. package/dist/server/src/services/index.d.ts +3 -2
  102. package/dist/server/src/services/index.d.ts.map +1 -1
  103. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  104. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  105. package/dist/server/src/services/utils/populate.d.ts +2 -2
  106. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  107. package/package.json +8 -7
  108. package/dist/_chunks/Field-CcppsFQR.mjs.map +0 -1
  109. package/dist/_chunks/Field-Dj1nOvt8.js.map +0 -1
  110. package/dist/_chunks/History-Cs6XM6EU.js.map +0 -1
  111. package/dist/_chunks/History-tU567_hc.mjs.map +0 -1
  112. package/dist/_chunks/Preview-C1dBkhXf.mjs.map +0 -1
  113. package/dist/_chunks/Preview-DH1h7kJ6.js.map +0 -1
  114. package/dist/_chunks/index-BN1pPa5v.js.map +0 -1
  115. package/dist/_chunks/index-ByPZ754U.mjs.map +0 -1
  116. package/dist/admin/src/preview/constants.d.ts +0 -1
  117. package/dist/server/src/preview/constants.d.ts +0 -2
  118. 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-tU567_hc.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-C1dBkhXf.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-COVXj9bh.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-B50esy_x.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-DQryo_4i.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-DMnf8orh.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-D4J64ny7.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-0-CW106p.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-CiPP8cLx.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();
@@ -2271,6 +2298,117 @@ const UpdateAction = ({
2271
2298
  const validate = useForm("UpdateAction", (state) => state.validate);
2272
2299
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2273
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]);
2274
2412
  return {
2275
2413
  /**
2276
2414
  * Disabled when:
@@ -2283,81 +2421,7 @@ const UpdateAction = ({
2283
2421
  id: "global.save",
2284
2422
  defaultMessage: "Save"
2285
2423
  }),
2286
- onClick: async () => {
2287
- setSubmitting(true);
2288
- try {
2289
- const { errors } = await validate(true, {
2290
- status: "draft"
2291
- });
2292
- if (errors) {
2293
- toggleNotification({
2294
- type: "danger",
2295
- message: formatMessage({
2296
- id: "content-manager.validation.error",
2297
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2298
- })
2299
- });
2300
- return;
2301
- }
2302
- if (isCloning) {
2303
- const res = await clone(
2304
- {
2305
- model,
2306
- documentId: cloneMatch.params.origin,
2307
- params
2308
- },
2309
- transformData(document)
2310
- );
2311
- if ("data" in res) {
2312
- navigate(
2313
- {
2314
- pathname: `../${res.data.documentId}`,
2315
- search: rawQuery
2316
- },
2317
- { relative: "path" }
2318
- );
2319
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2320
- setErrors(formatValidationErrors(res.error));
2321
- }
2322
- } else if (documentId || collectionType === SINGLE_TYPES) {
2323
- const res = await update(
2324
- {
2325
- collectionType,
2326
- model,
2327
- documentId,
2328
- params
2329
- },
2330
- transformData(document)
2331
- );
2332
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2333
- setErrors(formatValidationErrors(res.error));
2334
- } else {
2335
- resetForm();
2336
- }
2337
- } else {
2338
- const res = await create(
2339
- {
2340
- model,
2341
- params
2342
- },
2343
- transformData(document)
2344
- );
2345
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2346
- navigate(
2347
- {
2348
- pathname: `../${res.data.documentId}`,
2349
- search: rawQuery
2350
- },
2351
- { replace: true, relative: "path" }
2352
- );
2353
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2354
- setErrors(formatValidationErrors(res.error));
2355
- }
2356
- }
2357
- } finally {
2358
- setSubmitting(false);
2359
- }
2360
- }
2424
+ onClick: handleUpdate
2361
2425
  };
2362
2426
  };
2363
2427
  UpdateAction.type = "update";
@@ -4081,7 +4145,7 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4081
4145
  };
4082
4146
  return {
4083
4147
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4084
- content: /* @__PURE__ */ jsx(Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsx(
4148
+ content: /* @__PURE__ */ jsx(
4085
4149
  ConditionalTooltip,
4086
4150
  {
4087
4151
  label: formatMessage({
@@ -4089,31 +4153,29 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4089
4153
  defaultMessage: "Please save to open the preview"
4090
4154
  }),
4091
4155
  isShown: isModified,
4092
- children: /* @__PURE__ */ jsx(
4156
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4093
4157
  Button,
4094
4158
  {
4095
4159
  variant: "tertiary",
4096
4160
  tag: Link,
4097
4161
  to: { pathname: "preview", search: stringify(query, { encode: false }) },
4098
4162
  onClick: trackNavigation,
4099
- flex: "auto",
4163
+ width: "100%",
4100
4164
  disabled: isModified,
4165
+ pointerEvents: isModified ? "none" : void 0,
4166
+ tabIndex: isModified ? -1 : void 0,
4101
4167
  children: formatMessage({
4102
4168
  id: "content-manager.preview.panel.button",
4103
4169
  defaultMessage: "Open preview"
4104
4170
  })
4105
4171
  }
4106
- )
4172
+ ) })
4107
4173
  }
4108
- ) })
4174
+ )
4109
4175
  };
4110
4176
  };
4111
- const FEATURE_ID = "preview";
4112
4177
  const previewAdmin = {
4113
4178
  bootstrap(app) {
4114
- if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4115
- return;
4116
- }
4117
4179
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4118
4180
  contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4119
4181
  }
@@ -4137,7 +4199,7 @@ const index = {
4137
4199
  app.router.addRoute({
4138
4200
  path: "content-manager/*",
4139
4201
  lazy: async () => {
4140
- const { Layout } = await import("./layout-CUTOYU8I.mjs");
4202
+ const { Layout } = await import("./layout-W3clJSCy.mjs");
4141
4203
  return {
4142
4204
  Component: Layout
4143
4205
  };
@@ -4157,7 +4219,7 @@ const index = {
4157
4219
  async registerTrads({ locales }) {
4158
4220
  const importedTrads = await Promise.all(
4159
4221
  locales.map((locale) => {
4160
- 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 }) => {
4161
4223
  return {
4162
4224
  data: prefixPluginTranslations(data, PLUGIN_ID),
4163
4225
  locale
@@ -4219,4 +4281,4 @@ export {
4219
4281
  capitalise as y,
4220
4282
  useUpdateContentTypeConfigurationMutation as z
4221
4283
  };
4222
- //# sourceMappingURL=index-ByPZ754U.mjs.map
4284
+ //# sourceMappingURL=index-DqasUQ6Q.mjs.map