@strapi/content-manager 0.0.0-next.d65d44102fd32871728c0d74ec4f2519b7cc0a16 → 0.0.0-next.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca

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 (110) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-UduDBv3m.js → ComponentConfigurationPage-BlzvDpbX.js} +4 -5
  4. package/dist/_chunks/{ComponentConfigurationPage-UduDBv3m.js.map → ComponentConfigurationPage-BlzvDpbX.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-DhWA-JzT.mjs → ComponentConfigurationPage-DaPOlQaD.mjs} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage-DhWA-JzT.mjs.map → ComponentConfigurationPage-DaPOlQaD.mjs.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-5tmx_7Hp.mjs → EditConfigurationPage-BZPXItXo.mjs} +3 -3
  11. package/dist/_chunks/{EditConfigurationPage-5tmx_7Hp.mjs.map → EditConfigurationPage-BZPXItXo.mjs.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-Cp9UzUfs.js → EditConfigurationPage-uy-v43AR.js} +4 -5
  13. package/dist/_chunks/{EditConfigurationPage-Cp9UzUfs.js.map → EditConfigurationPage-uy-v43AR.js.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-C7l2Emuj.js → EditViewPage-DT6A4ayX.js} +4 -5
  15. package/dist/_chunks/{EditViewPage-C7l2Emuj.js.map → EditViewPage-DT6A4ayX.js.map} +1 -1
  16. package/dist/_chunks/{EditViewPage-BKoISUOu.mjs → EditViewPage-oOLeTySr.mjs} +3 -3
  17. package/dist/_chunks/{EditViewPage-BKoISUOu.mjs.map → EditViewPage-oOLeTySr.mjs.map} +1 -1
  18. package/dist/_chunks/{Field-BZxzYf1x.mjs → Field-D7dv2aUX.mjs} +129 -96
  19. package/dist/_chunks/Field-D7dv2aUX.mjs.map +1 -0
  20. package/dist/_chunks/{Field-BPSJpDfE.js → Field-kYFVIGiP.js} +132 -99
  21. package/dist/_chunks/Field-kYFVIGiP.js.map +1 -0
  22. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  23. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  24. package/dist/_chunks/{Form-8qyOU6YG.mjs → Form-BxR6sc29.mjs} +3 -3
  25. package/dist/_chunks/{Form-8qyOU6YG.mjs.map → Form-BxR6sc29.mjs.map} +1 -1
  26. package/dist/_chunks/{Form-DLkqDd2G.js → Form-CCijSg3V.js} +5 -6
  27. package/dist/_chunks/{Form-DLkqDd2G.js.map → Form-CCijSg3V.js.map} +1 -1
  28. package/dist/_chunks/{History-DYMicybF.js → History-BMndx49M.js} +5 -6
  29. package/dist/_chunks/{History-DYMicybF.js.map → History-BMndx49M.js.map} +1 -1
  30. package/dist/_chunks/{History-N_kRb1Yr.mjs → History-D8F7aYQU.mjs} +4 -4
  31. package/dist/_chunks/{History-N_kRb1Yr.mjs.map → History-D8F7aYQU.mjs.map} +1 -1
  32. package/dist/_chunks/{ListConfigurationPage-rUF9iGWq.js → ListConfigurationPage-DouY1EWM.js} +4 -5
  33. package/dist/_chunks/{ListConfigurationPage-rUF9iGWq.js.map → ListConfigurationPage-DouY1EWM.js.map} +1 -1
  34. package/dist/_chunks/{ListConfigurationPage-BM3qVxug.mjs → ListConfigurationPage-DqAdSPwC.mjs} +3 -3
  35. package/dist/_chunks/{ListConfigurationPage-BM3qVxug.mjs.map → ListConfigurationPage-DqAdSPwC.mjs.map} +1 -1
  36. package/dist/_chunks/{ListViewPage-BSLzd7cZ.js → ListViewPage-BPVmh9pq.js} +4 -5
  37. package/dist/_chunks/{ListViewPage-BSLzd7cZ.js.map → ListViewPage-BPVmh9pq.js.map} +1 -1
  38. package/dist/_chunks/{ListViewPage-CWilGbZb.mjs → ListViewPage-C73F0jPh.mjs} +3 -3
  39. package/dist/_chunks/{ListViewPage-CWilGbZb.mjs.map → ListViewPage-C73F0jPh.mjs.map} +1 -1
  40. package/dist/_chunks/{NoContentTypePage-VWYlePwI.mjs → NoContentTypePage-B5w7iJOF.mjs} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-VWYlePwI.mjs.map → NoContentTypePage-B5w7iJOF.mjs.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-CQccVhIX.js → NoContentTypePage-BwcL--4H.js} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-CQccVhIX.js.map → NoContentTypePage-BwcL--4H.js.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-Af32Gg2m.js → NoPermissionsPage-BMFKVcwJ.js} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-Af32Gg2m.js.map → NoPermissionsPage-BMFKVcwJ.js.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-CS2tCmfr.mjs → NoPermissionsPage-UnEgMGK4.mjs} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-CS2tCmfr.mjs.map → NoPermissionsPage-UnEgMGK4.mjs.map} +1 -1
  48. package/dist/_chunks/{Preview-D4KzuJFL.js → Preview-B7PR3Ok_.js} +33 -12
  49. package/dist/_chunks/Preview-B7PR3Ok_.js.map +1 -0
  50. package/dist/_chunks/{Preview-kPkuZbBJ.mjs → Preview-DECOhK0D.mjs} +33 -11
  51. package/dist/_chunks/Preview-DECOhK0D.mjs.map +1 -0
  52. package/dist/_chunks/{Relations-5k27Rh54.mjs → Relations-DinMQJ4B.mjs} +6 -8
  53. package/dist/_chunks/{Relations-5k27Rh54.mjs.map → Relations-DinMQJ4B.mjs.map} +1 -1
  54. package/dist/_chunks/{Relations-D_Ki5aVM.js → Relations-lndx3aQk.js} +7 -10
  55. package/dist/_chunks/{Relations-D_Ki5aVM.js.map → Relations-lndx3aQk.js.map} +1 -1
  56. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  57. package/dist/_chunks/{index-BLPa8Dq-.mjs → index-C2SagWVW.mjs} +167 -114
  58. package/dist/_chunks/index-C2SagWVW.mjs.map +1 -0
  59. package/dist/_chunks/{index-DwOsF7wF.js → index-Cnw4gqee.js} +168 -116
  60. package/dist/_chunks/index-Cnw4gqee.js.map +1 -0
  61. package/dist/_chunks/{layout-2Si0j0jO.mjs → layout-DY_D9MGA.mjs} +4 -4
  62. package/dist/_chunks/{layout-2Si0j0jO.mjs.map → layout-DY_D9MGA.mjs.map} +1 -1
  63. package/dist/_chunks/{layout-CN2bFL9V.js → layout-ivwIVPnV.js} +5 -6
  64. package/dist/_chunks/{layout-CN2bFL9V.js.map → layout-ivwIVPnV.js.map} +1 -1
  65. package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
  66. package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
  67. package/dist/_chunks/{relations-B0E0XUY7.js → relations-B7C7O_Pv.js} +2 -2
  68. package/dist/_chunks/{relations-B0E0XUY7.js.map → relations-B7C7O_Pv.js.map} +1 -1
  69. package/dist/_chunks/{relations-CAxDjUJF.mjs → relations-Boc5Y9kX.mjs} +2 -2
  70. package/dist/_chunks/{relations-CAxDjUJF.mjs.map → relations-Boc5Y9kX.mjs.map} +1 -1
  71. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  72. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  73. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  74. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  75. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  76. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  77. package/dist/admin/index.js +1 -1
  78. package/dist/admin/index.mjs +1 -1
  79. package/dist/admin/src/content-manager.d.ts +3 -2
  80. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  81. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  82. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  83. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  84. package/dist/server/index.js +92 -102
  85. package/dist/server/index.js.map +1 -1
  86. package/dist/server/index.mjs +92 -101
  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/index.d.ts +3 -2
  91. package/dist/server/src/index.d.ts.map +1 -1
  92. package/dist/server/src/preview/index.d.ts.map +1 -1
  93. package/dist/server/src/services/document-metadata.d.ts +4 -2
  94. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  95. package/dist/server/src/services/index.d.ts +3 -2
  96. package/dist/server/src/services/index.d.ts.map +1 -1
  97. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  98. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  99. package/dist/server/src/services/utils/populate.d.ts +2 -2
  100. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  101. package/package.json +9 -7
  102. package/dist/_chunks/Field-BPSJpDfE.js.map +0 -1
  103. package/dist/_chunks/Field-BZxzYf1x.mjs.map +0 -1
  104. package/dist/_chunks/Preview-D4KzuJFL.js.map +0 -1
  105. package/dist/_chunks/Preview-kPkuZbBJ.mjs.map +0 -1
  106. package/dist/_chunks/index-BLPa8Dq-.mjs.map +0 -1
  107. package/dist/_chunks/index-DwOsF7wF.js.map +0 -1
  108. package/dist/admin/src/preview/constants.d.ts +0 -1
  109. package/dist/server/src/preview/constants.d.ts +0 -2
  110. package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -15,8 +15,7 @@ const dateFns = require("date-fns");
15
15
  const toolkit = require("@reduxjs/toolkit");
16
16
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
17
17
  function _interopNamespace(e) {
18
- if (e && e.__esModule)
19
- return e;
18
+ if (e && e.__esModule) return e;
20
19
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
21
20
  if (e) {
22
21
  for (const k in e) {
@@ -36,13 +35,20 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
36
35
  const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
37
36
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
38
37
  const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
39
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
38
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
40
39
  const v = glob[path];
41
40
  if (v) {
42
41
  return typeof v === "function" ? v() : Promise.resolve(v);
43
42
  }
44
43
  return new Promise((_, reject) => {
45
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
44
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
45
+ reject.bind(
46
+ null,
47
+ new Error(
48
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
49
+ )
50
+ )
51
+ );
46
52
  });
47
53
  };
48
54
  const PLUGIN_ID = "content-manager";
@@ -475,8 +481,7 @@ const {
475
481
  useUnpublishManyDocumentsMutation
476
482
  } = documentApi;
477
483
  const buildValidParams = (query) => {
478
- if (!query)
479
- return query;
484
+ if (!query) return query;
480
485
  const { plugins: _, ...validQueryParams } = {
481
486
  ...query,
482
487
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -1683,7 +1688,7 @@ const useDocumentActions = () => {
1683
1688
  };
1684
1689
  };
1685
1690
  const ProtectedHistoryPage = React__namespace.lazy(
1686
- () => Promise.resolve().then(() => require("./History-DYMicybF.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1691
+ () => Promise.resolve().then(() => require("./History-BMndx49M.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1687
1692
  );
1688
1693
  const routes$2 = [
1689
1694
  {
@@ -1696,7 +1701,7 @@ const routes$2 = [
1696
1701
  }
1697
1702
  ];
1698
1703
  const ProtectedPreviewPage = React__namespace.lazy(
1699
- () => Promise.resolve().then(() => require("./Preview-D4KzuJFL.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1704
+ () => Promise.resolve().then(() => require("./Preview-B7PR3Ok_.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1700
1705
  );
1701
1706
  const routes$1 = [
1702
1707
  {
@@ -1709,31 +1714,31 @@ const routes$1 = [
1709
1714
  }
1710
1715
  ];
1711
1716
  const ProtectedEditViewPage = React.lazy(
1712
- () => Promise.resolve().then(() => require("./EditViewPage-C7l2Emuj.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1717
+ () => Promise.resolve().then(() => require("./EditViewPage-DT6A4ayX.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1713
1718
  );
1714
1719
  const ProtectedListViewPage = React.lazy(
1715
- () => Promise.resolve().then(() => require("./ListViewPage-BSLzd7cZ.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1720
+ () => Promise.resolve().then(() => require("./ListViewPage-BPVmh9pq.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1716
1721
  );
1717
1722
  const ProtectedListConfiguration = React.lazy(
1718
- () => Promise.resolve().then(() => require("./ListConfigurationPage-rUF9iGWq.js")).then((mod) => ({
1723
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-DouY1EWM.js")).then((mod) => ({
1719
1724
  default: mod.ProtectedListConfiguration
1720
1725
  }))
1721
1726
  );
1722
1727
  const ProtectedEditConfigurationPage = React.lazy(
1723
- () => Promise.resolve().then(() => require("./EditConfigurationPage-Cp9UzUfs.js")).then((mod) => ({
1728
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-uy-v43AR.js")).then((mod) => ({
1724
1729
  default: mod.ProtectedEditConfigurationPage
1725
1730
  }))
1726
1731
  );
1727
1732
  const ProtectedComponentConfigurationPage = React.lazy(
1728
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-UduDBv3m.js")).then((mod) => ({
1733
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-BlzvDpbX.js")).then((mod) => ({
1729
1734
  default: mod.ProtectedComponentConfigurationPage
1730
1735
  }))
1731
1736
  );
1732
1737
  const NoPermissions = React.lazy(
1733
- () => Promise.resolve().then(() => require("./NoPermissionsPage-Af32Gg2m.js")).then((mod) => ({ default: mod.NoPermissions }))
1738
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-BMFKVcwJ.js")).then((mod) => ({ default: mod.NoPermissions }))
1734
1739
  );
1735
1740
  const NoContentType = React.lazy(
1736
- () => Promise.resolve().then(() => require("./NoContentTypePage-CQccVhIX.js")).then((mod) => ({ default: mod.NoContentType }))
1741
+ () => Promise.resolve().then(() => require("./NoContentTypePage-BwcL--4H.js")).then((mod) => ({ default: mod.NoContentType }))
1737
1742
  );
1738
1743
  const CollectionTypePages = () => {
1739
1744
  const { collectionType } = reactRouterDom.useParams();
@@ -2264,6 +2269,7 @@ const PublishAction$1 = ({
2264
2269
  };
2265
2270
  };
2266
2271
  PublishAction$1.type = "publish";
2272
+ PublishAction$1.position = "panel";
2267
2273
  const UpdateAction = ({
2268
2274
  activeTab,
2269
2275
  documentId,
@@ -2286,6 +2292,117 @@ const UpdateAction = ({
2286
2292
  const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
2287
2293
  const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
2288
2294
  const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
2295
+ const handleUpdate = React__namespace.useCallback(async () => {
2296
+ setSubmitting(true);
2297
+ try {
2298
+ if (!modified) {
2299
+ return;
2300
+ }
2301
+ const { errors } = await validate(true, {
2302
+ status: "draft"
2303
+ });
2304
+ if (errors) {
2305
+ toggleNotification({
2306
+ type: "danger",
2307
+ message: formatMessage({
2308
+ id: "content-manager.validation.error",
2309
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2310
+ })
2311
+ });
2312
+ return;
2313
+ }
2314
+ if (isCloning) {
2315
+ const res = await clone(
2316
+ {
2317
+ model,
2318
+ documentId: cloneMatch.params.origin,
2319
+ params
2320
+ },
2321
+ transformData(document)
2322
+ );
2323
+ if ("data" in res) {
2324
+ navigate(
2325
+ {
2326
+ pathname: `../${res.data.documentId}`,
2327
+ search: rawQuery
2328
+ },
2329
+ { relative: "path" }
2330
+ );
2331
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2332
+ setErrors(formatValidationErrors(res.error));
2333
+ }
2334
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2335
+ const res = await update(
2336
+ {
2337
+ collectionType,
2338
+ model,
2339
+ documentId,
2340
+ params
2341
+ },
2342
+ transformData(document)
2343
+ );
2344
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2345
+ setErrors(formatValidationErrors(res.error));
2346
+ } else {
2347
+ resetForm();
2348
+ }
2349
+ } else {
2350
+ const res = await create(
2351
+ {
2352
+ model,
2353
+ params
2354
+ },
2355
+ transformData(document)
2356
+ );
2357
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2358
+ navigate(
2359
+ {
2360
+ pathname: `../${res.data.documentId}`,
2361
+ search: rawQuery
2362
+ },
2363
+ { replace: true, relative: "path" }
2364
+ );
2365
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2366
+ setErrors(formatValidationErrors(res.error));
2367
+ }
2368
+ }
2369
+ } finally {
2370
+ setSubmitting(false);
2371
+ }
2372
+ }, [
2373
+ clone,
2374
+ cloneMatch?.params.origin,
2375
+ collectionType,
2376
+ create,
2377
+ document,
2378
+ documentId,
2379
+ formatMessage,
2380
+ formatValidationErrors,
2381
+ isCloning,
2382
+ model,
2383
+ modified,
2384
+ navigate,
2385
+ params,
2386
+ rawQuery,
2387
+ resetForm,
2388
+ setErrors,
2389
+ setSubmitting,
2390
+ toggleNotification,
2391
+ update,
2392
+ validate
2393
+ ]);
2394
+ React__namespace.useEffect(() => {
2395
+ const handleKeyDown = (e) => {
2396
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2397
+ e.preventDefault();
2398
+ handleUpdate();
2399
+ }
2400
+ };
2401
+ window.addEventListener("keydown", handleKeyDown);
2402
+ return () => {
2403
+ window.removeEventListener("keydown", handleKeyDown);
2404
+ };
2405
+ }, [handleUpdate]);
2289
2406
  return {
2290
2407
  /**
2291
2408
  * Disabled when:
@@ -2298,84 +2415,11 @@ const UpdateAction = ({
2298
2415
  id: "global.save",
2299
2416
  defaultMessage: "Save"
2300
2417
  }),
2301
- onClick: async () => {
2302
- setSubmitting(true);
2303
- try {
2304
- const { errors } = await validate(true, {
2305
- status: "draft"
2306
- });
2307
- if (errors) {
2308
- toggleNotification({
2309
- type: "danger",
2310
- message: formatMessage({
2311
- id: "content-manager.validation.error",
2312
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2313
- })
2314
- });
2315
- return;
2316
- }
2317
- if (isCloning) {
2318
- const res = await clone(
2319
- {
2320
- model,
2321
- documentId: cloneMatch.params.origin,
2322
- params
2323
- },
2324
- transformData(document)
2325
- );
2326
- if ("data" in res) {
2327
- navigate(
2328
- {
2329
- pathname: `../${res.data.documentId}`,
2330
- search: rawQuery
2331
- },
2332
- { relative: "path" }
2333
- );
2334
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2335
- setErrors(formatValidationErrors(res.error));
2336
- }
2337
- } else if (documentId || collectionType === SINGLE_TYPES) {
2338
- const res = await update(
2339
- {
2340
- collectionType,
2341
- model,
2342
- documentId,
2343
- params
2344
- },
2345
- transformData(document)
2346
- );
2347
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2348
- setErrors(formatValidationErrors(res.error));
2349
- } else {
2350
- resetForm();
2351
- }
2352
- } else {
2353
- const res = await create(
2354
- {
2355
- model,
2356
- params
2357
- },
2358
- transformData(document)
2359
- );
2360
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2361
- navigate(
2362
- {
2363
- pathname: `../${res.data.documentId}`,
2364
- search: rawQuery
2365
- },
2366
- { replace: true, relative: "path" }
2367
- );
2368
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2369
- setErrors(formatValidationErrors(res.error));
2370
- }
2371
- }
2372
- } finally {
2373
- setSubmitting(false);
2374
- }
2375
- }
2418
+ onClick: handleUpdate
2376
2419
  };
2377
2420
  };
2378
2421
  UpdateAction.type = "update";
2422
+ UpdateAction.position = "panel";
2379
2423
  const UNPUBLISH_DRAFT_OPTIONS = {
2380
2424
  KEEP: "keep",
2381
2425
  DISCARD: "discard"
@@ -2498,6 +2542,7 @@ const UnpublishAction$1 = ({
2498
2542
  };
2499
2543
  };
2500
2544
  UnpublishAction$1.type = "unpublish";
2545
+ UnpublishAction$1.position = "panel";
2501
2546
  const DiscardAction = ({
2502
2547
  activeTab,
2503
2548
  documentId,
@@ -2548,6 +2593,7 @@ const DiscardAction = ({
2548
2593
  };
2549
2594
  };
2550
2595
  DiscardAction.type = "discard";
2596
+ DiscardAction.position = "panel";
2551
2597
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2552
2598
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2553
2599
  const RelativeTime = React__namespace.forwardRef(
@@ -2667,7 +2713,7 @@ const HeaderToolbar = () => {
2667
2713
  meta: isCloning ? void 0 : meta,
2668
2714
  collectionType
2669
2715
  },
2670
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2716
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2671
2717
  children: (actions2) => {
2672
2718
  const headerActions = actions2.filter((action) => {
2673
2719
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2875,6 +2921,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2875
2921
  };
2876
2922
  };
2877
2923
  ConfigureTheViewAction.type = "configure-the-view";
2924
+ ConfigureTheViewAction.position = "header";
2878
2925
  const EditTheModelAction = ({ model }) => {
2879
2926
  const navigate = reactRouterDom.useNavigate();
2880
2927
  const { formatMessage } = reactIntl.useIntl();
@@ -2891,6 +2938,7 @@ const EditTheModelAction = ({ model }) => {
2891
2938
  };
2892
2939
  };
2893
2940
  EditTheModelAction.type = "edit-the-model";
2941
+ EditTheModelAction.position = "header";
2894
2942
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2895
2943
  const navigate = reactRouterDom.useNavigate();
2896
2944
  const { formatMessage } = reactIntl.useIntl();
@@ -2964,6 +3012,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2964
3012
  };
2965
3013
  };
2966
3014
  DeleteAction$1.type = "delete";
3015
+ DeleteAction$1.position = ["header", "table-row"];
2967
3016
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2968
3017
  const Panels = () => {
2969
3018
  const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
@@ -3026,7 +3075,7 @@ const ActionsPanelContent = () => {
3026
3075
  strapiAdmin.DescriptionComponentRenderer,
3027
3076
  {
3028
3077
  props,
3029
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3078
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3030
3079
  children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
3031
3080
  }
3032
3081
  ),
@@ -3480,8 +3529,7 @@ const PublishAction = ({ documents, model }) => {
3480
3529
  const refetchList = () => {
3481
3530
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3482
3531
  };
3483
- if (!showPublishButton)
3484
- return null;
3532
+ if (!showPublishButton) return null;
3485
3533
  return {
3486
3534
  actionType: "publish",
3487
3535
  variant: "tertiary",
@@ -3549,8 +3597,7 @@ const DeleteAction = ({ documents, model }) => {
3549
3597
  selectRow([]);
3550
3598
  }
3551
3599
  };
3552
- if (!hasDeletePermission)
3553
- return null;
3600
+ if (!hasDeletePermission) return null;
3554
3601
  return {
3555
3602
  variant: "danger-light",
3556
3603
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3599,8 +3646,7 @@ const UnpublishAction = ({ documents, model }) => {
3599
3646
  }
3600
3647
  };
3601
3648
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3602
- if (!showUnpublishButton)
3603
- return null;
3649
+ if (!showUnpublishButton) return null;
3604
3650
  return {
3605
3651
  variant: "tertiary",
3606
3652
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3705,7 +3751,7 @@ const TableActions = ({ document }) => {
3705
3751
  strapiAdmin.DescriptionComponentRenderer,
3706
3752
  {
3707
3753
  props,
3708
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3754
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3709
3755
  children: (actions2) => {
3710
3756
  const tableRowActions = actions2.filter((action) => {
3711
3757
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3764,6 +3810,7 @@ const EditAction = ({ documentId }) => {
3764
3810
  };
3765
3811
  };
3766
3812
  EditAction.type = "edit";
3813
+ EditAction.position = "table-row";
3767
3814
  const StyledPencil = styledComponents.styled(Icons.Pencil)`
3768
3815
  path {
3769
3816
  fill: currentColor;
@@ -3840,6 +3887,7 @@ const CloneAction = ({ model, documentId }) => {
3840
3887
  };
3841
3888
  };
3842
3889
  CloneAction.type = "clone";
3890
+ CloneAction.position = "table-row";
3843
3891
  const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
3844
3892
  path {
3845
3893
  fill: currentColor;
@@ -3926,7 +3974,14 @@ class ContentManagerPlugin {
3926
3974
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3927
3975
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3928
3976
  getBulkActions: () => this.bulkActions,
3929
- getDocumentActions: () => this.documentActions,
3977
+ getDocumentActions: (position) => {
3978
+ if (position) {
3979
+ return this.documentActions.filter(
3980
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
3981
+ );
3982
+ }
3983
+ return this.documentActions;
3984
+ },
3930
3985
  getEditViewSidePanels: () => this.editViewSidePanels,
3931
3986
  getHeaderActions: () => this.headerActions
3932
3987
  }
@@ -3936,10 +3991,8 @@ class ContentManagerPlugin {
3936
3991
  const getPrintableType = (value) => {
3937
3992
  const nativeType = typeof value;
3938
3993
  if (nativeType === "object") {
3939
- if (value === null)
3940
- return "null";
3941
- if (Array.isArray(value))
3942
- return "array";
3994
+ if (value === null) return "null";
3995
+ if (Array.isArray(value)) return "array";
3943
3996
  if (value instanceof Object && value.constructor.name !== "Object") {
3944
3997
  return value.constructor.name;
3945
3998
  }
@@ -3992,6 +4045,7 @@ const HistoryAction = ({ model, document }) => {
3992
4045
  };
3993
4046
  };
3994
4047
  HistoryAction.type = "history";
4048
+ HistoryAction.position = "header";
3995
4049
  const historyAdmin = {
3996
4050
  bootstrap(app) {
3997
4051
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4085,7 +4139,7 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4085
4139
  };
4086
4140
  return {
4087
4141
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4088
- content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4142
+ content: /* @__PURE__ */ jsxRuntime.jsx(
4089
4143
  ConditionalTooltip,
4090
4144
  {
4091
4145
  label: formatMessage({
@@ -4093,31 +4147,29 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4093
4147
  defaultMessage: "Please save to open the preview"
4094
4148
  }),
4095
4149
  isShown: isModified,
4096
- children: /* @__PURE__ */ jsxRuntime.jsx(
4150
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4097
4151
  designSystem.Button,
4098
4152
  {
4099
4153
  variant: "tertiary",
4100
4154
  tag: reactRouterDom.Link,
4101
4155
  to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
4102
4156
  onClick: trackNavigation,
4103
- flex: "auto",
4157
+ width: "100%",
4104
4158
  disabled: isModified,
4159
+ pointerEvents: isModified ? "none" : void 0,
4160
+ tabIndex: isModified ? -1 : void 0,
4105
4161
  children: formatMessage({
4106
4162
  id: "content-manager.preview.panel.button",
4107
4163
  defaultMessage: "Open preview"
4108
4164
  })
4109
4165
  }
4110
- )
4166
+ ) })
4111
4167
  }
4112
- ) })
4168
+ )
4113
4169
  };
4114
4170
  };
4115
- const FEATURE_ID = "preview";
4116
4171
  const previewAdmin = {
4117
4172
  bootstrap(app) {
4118
- if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4119
- return;
4120
- }
4121
4173
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4122
4174
  contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4123
4175
  }
@@ -4141,7 +4193,7 @@ const index = {
4141
4193
  app.router.addRoute({
4142
4194
  path: "content-manager/*",
4143
4195
  lazy: async () => {
4144
- const { Layout } = await Promise.resolve().then(() => require("./layout-CN2bFL9V.js"));
4196
+ const { Layout } = await Promise.resolve().then(() => require("./layout-ivwIVPnV.js"));
4145
4197
  return {
4146
4198
  Component: Layout
4147
4199
  };
@@ -4161,7 +4213,7 @@ const index = {
4161
4213
  async registerTrads({ locales }) {
4162
4214
  const importedTrads = await Promise.all(
4163
4215
  locales.map((locale) => {
4164
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BK8Xyl5I.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4216
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BK8Xyl5I.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
4165
4217
  return {
4166
4218
  data: prefixPluginTranslations(data, PLUGIN_ID),
4167
4219
  locale
@@ -4221,4 +4273,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
4221
4273
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4222
4274
  exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
4223
4275
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
4224
- //# sourceMappingURL=index-DwOsF7wF.js.map
4276
+ //# sourceMappingURL=index-Cnw4gqee.js.map