@strapi/content-manager 0.0.0-next.eedb036f0a7ac282d2a645d8a40625091bd28b1e → 0.0.0-next.f09127d8df0234ad0b771b931b044b7c2e09c686

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 (127) 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-ClKl_TA2.js → ComponentConfigurationPage-BSEZcJVB.js} +4 -5
  4. package/dist/_chunks/{ComponentConfigurationPage-ClKl_TA2.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-D3ZWDAHG.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage-D3ZWDAHG.mjs.map → ComponentConfigurationPage-BiASGi7x.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-OWez0Kxp.js → EditConfigurationPage-D2rtvneE.js} +4 -5
  11. package/dist/_chunks/{EditConfigurationPage-OWez0Kxp.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BYCBSJxP.mjs → EditConfigurationPage-vN4zupij.mjs} +3 -3
  13. package/dist/_chunks/{EditConfigurationPage-BYCBSJxP.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-BEs5iGDi.js → EditViewPage-BwisF04Q.js} +4 -5
  15. package/dist/_chunks/{EditViewPage-BEs5iGDi.js.map → EditViewPage-BwisF04Q.js.map} +1 -1
  16. package/dist/_chunks/{EditViewPage-5pdbvsO_.mjs → EditViewPage-_A31Cl4g.mjs} +3 -3
  17. package/dist/_chunks/{EditViewPage-5pdbvsO_.mjs.map → EditViewPage-_A31Cl4g.mjs.map} +1 -1
  18. package/dist/_chunks/{Field-DcKuFHYK.mjs → Field-CvIunNOj.mjs} +131 -98
  19. package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
  20. package/dist/_chunks/{Field-DNHm4wHx.js → Field-Dsu6-FrM.js} +133 -100
  21. package/dist/_chunks/Field-Dsu6-FrM.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-CGwM_-5c.mjs → Form-DK0fG0Gj.mjs} +3 -3
  25. package/dist/_chunks/{Form-CGwM_-5c.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
  26. package/dist/_chunks/{Form-CoRxWJOz.js → Form-DUwWcCmA.js} +5 -6
  27. package/dist/_chunks/{Form-CoRxWJOz.js.map → Form-DUwWcCmA.js.map} +1 -1
  28. package/dist/_chunks/{History-BcUTQrfG.js → History-CeCDhoJG.js} +6 -7
  29. package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
  30. package/dist/_chunks/{History-DEvr3Q_V.mjs → History-DP8gmXpm.mjs} +5 -5
  31. package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-BM4zZZcM.mjs → ListConfigurationPage-BCkO5iuN.mjs} +3 -3
  33. package/dist/_chunks/{ListConfigurationPage-BM4zZZcM.mjs.map → ListConfigurationPage-BCkO5iuN.mjs.map} +1 -1
  34. package/dist/_chunks/{ListConfigurationPage-BE_Ho7tV.js → ListConfigurationPage-C-bAd44a.js} +4 -5
  35. package/dist/_chunks/{ListConfigurationPage-BE_Ho7tV.js.map → ListConfigurationPage-C-bAd44a.js.map} +1 -1
  36. package/dist/_chunks/{ListViewPage-BkT8Eao0.js → ListViewPage-BKTZFhsM.js} +51 -51
  37. package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-BK2mkrql.mjs → ListViewPage-Cf_DgaFV.mjs} +50 -49
  39. package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-C8mtyc4H.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-C8mtyc4H.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BvcAutu9.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BvcAutu9.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-BmbRz7PR.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-BmbRz7PR.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-B5Y9Y78B.js → NoPermissionsPage-CChGWBj5.js} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-B5Y9Y78B.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
  48. package/dist/_chunks/{Preview-DcexhKJE.mjs → Preview-C4NBzKUV.mjs} +39 -12
  49. package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
  50. package/dist/_chunks/{Preview-BF8ZDYqS.js → Preview-CT28Ckpg.js} +38 -12
  51. package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
  52. package/dist/_chunks/{Relations-BjIzc4EK.mjs → Relations-C8uC89cT.mjs} +6 -8
  53. package/dist/_chunks/{Relations-BjIzc4EK.mjs.map → Relations-C8uC89cT.mjs.map} +1 -1
  54. package/dist/_chunks/{Relations-BKnoK1R0.js → Relations-CvkPCng_.js} +7 -10
  55. package/dist/_chunks/{Relations-BKnoK1R0.js.map → Relations-CvkPCng_.js.map} +1 -1
  56. package/dist/_chunks/{en-DTWPCdTS.js → en-BK8Xyl5I.js} +3 -2
  57. package/dist/_chunks/{en-DTWPCdTS.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-CfIXaZf9.mjs → en-Dtk_ot79.mjs} +3 -2
  59. package/dist/_chunks/{en-CfIXaZf9.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  61. package/dist/_chunks/{index-DOzAG2cq.js → index-CnX_j5h-.js} +215 -133
  62. package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
  63. package/dist/_chunks/{index-BW-rXkjn.mjs → index-Dh2aGTGJ.mjs} +214 -131
  64. package/dist/_chunks/index-Dh2aGTGJ.mjs.map +1 -0
  65. package/dist/_chunks/{layout-DFVbgjp2.mjs → layout-B5qsPihj.mjs} +4 -4
  66. package/dist/_chunks/{layout-DFVbgjp2.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
  67. package/dist/_chunks/{layout-RC3W2obV.js → layout-B_qdWGny.js} +5 -6
  68. package/dist/_chunks/{layout-RC3W2obV.js.map → layout-B_qdWGny.js.map} +1 -1
  69. package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
  70. package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
  71. package/dist/_chunks/{relations-zam7-5H7.js → relations-ChcieiF5.js} +2 -2
  72. package/dist/_chunks/{relations-zam7-5H7.js.map → relations-ChcieiF5.js.map} +1 -1
  73. package/dist/_chunks/{relations-Dogh8HWI.mjs → relations-DMXpNY-e.mjs} +2 -2
  74. package/dist/_chunks/{relations-Dogh8HWI.mjs.map → relations-DMXpNY-e.mjs.map} +1 -1
  75. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  76. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  77. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  78. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  79. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  80. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  81. package/dist/admin/index.js +1 -1
  82. package/dist/admin/index.mjs +1 -1
  83. package/dist/admin/src/content-manager.d.ts +3 -2
  84. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  85. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  86. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  87. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  88. package/dist/admin/src/services/documents.d.ts +0 -3
  89. package/dist/server/index.js +148 -111
  90. package/dist/server/index.js.map +1 -1
  91. package/dist/server/index.mjs +149 -111
  92. package/dist/server/index.mjs.map +1 -1
  93. package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
  94. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  95. package/dist/server/src/index.d.ts +3 -2
  96. package/dist/server/src/index.d.ts.map +1 -1
  97. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
  98. package/dist/server/src/preview/index.d.ts.map +1 -1
  99. package/dist/server/src/preview/services/index.d.ts +1 -0
  100. package/dist/server/src/preview/services/index.d.ts.map +1 -1
  101. package/dist/server/src/preview/services/preview-config.d.ts +2 -0
  102. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  103. package/dist/server/src/preview/utils.d.ts +1 -0
  104. package/dist/server/src/preview/utils.d.ts.map +1 -1
  105. package/dist/server/src/register.d.ts.map +1 -1
  106. package/dist/server/src/services/document-metadata.d.ts +4 -2
  107. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  108. package/dist/server/src/services/index.d.ts +3 -2
  109. package/dist/server/src/services/index.d.ts.map +1 -1
  110. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  111. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  112. package/dist/server/src/services/utils/populate.d.ts +2 -2
  113. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  114. package/package.json +11 -9
  115. package/dist/_chunks/Field-DNHm4wHx.js.map +0 -1
  116. package/dist/_chunks/Field-DcKuFHYK.mjs.map +0 -1
  117. package/dist/_chunks/History-BcUTQrfG.js.map +0 -1
  118. package/dist/_chunks/History-DEvr3Q_V.mjs.map +0 -1
  119. package/dist/_chunks/ListViewPage-BK2mkrql.mjs.map +0 -1
  120. package/dist/_chunks/ListViewPage-BkT8Eao0.js.map +0 -1
  121. package/dist/_chunks/Preview-BF8ZDYqS.js.map +0 -1
  122. package/dist/_chunks/Preview-DcexhKJE.mjs.map +0 -1
  123. package/dist/_chunks/index-BW-rXkjn.mjs.map +0 -1
  124. package/dist/_chunks/index-DOzAG2cq.js.map +0 -1
  125. package/dist/admin/src/preview/constants.d.ts +0 -1
  126. package/dist/server/src/preview/constants.d.ts +0 -2
  127. package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -10,17 +10,24 @@ import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink
10
10
  import { styled } from "styled-components";
11
11
  import * as yup from "yup";
12
12
  import { ValidationError } from "yup";
13
+ import { stringify } from "qs";
13
14
  import pipe from "lodash/fp/pipe";
14
15
  import { intervalToDuration, isPast } from "date-fns";
15
- import { stringify } from "qs";
16
16
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
17
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
17
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
18
18
  const v = glob[path];
19
19
  if (v) {
20
20
  return typeof v === "function" ? v() : Promise.resolve(v);
21
21
  }
22
22
  return new Promise((_, reject) => {
23
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
23
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
24
+ reject.bind(
25
+ null,
26
+ new Error(
27
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
28
+ )
29
+ )
30
+ );
24
31
  });
25
32
  };
26
33
  const PLUGIN_ID = "content-manager";
@@ -220,7 +227,19 @@ const documentApi = contentManagerApi.injectEndpoints({
220
227
  { type: "Document", id: `${model}_LIST` },
221
228
  "Relations",
222
229
  { type: "UidAvailability", id: model }
223
- ]
230
+ ],
231
+ transformResponse: (response, meta, arg) => {
232
+ if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
233
+ return {
234
+ data: response,
235
+ meta: {
236
+ availableStatus: [],
237
+ availableLocales: []
238
+ }
239
+ };
240
+ }
241
+ return response;
242
+ }
224
243
  }),
225
244
  deleteDocument: builder.mutation({
226
245
  query: ({ collectionType, model, documentId, params }) => ({
@@ -274,7 +293,7 @@ const documentApi = contentManagerApi.injectEndpoints({
274
293
  url: `/content-manager/collection-types/${model}`,
275
294
  method: "GET",
276
295
  config: {
277
- params
296
+ params: stringify(params, { encode: true })
278
297
  }
279
298
  }),
280
299
  providesTags: (result, _error, arg) => {
@@ -453,8 +472,7 @@ const {
453
472
  useUnpublishManyDocumentsMutation
454
473
  } = documentApi;
455
474
  const buildValidParams = (query) => {
456
- if (!query)
457
- return query;
475
+ if (!query) return query;
458
476
  const { plugins: _, ...validQueryParams } = {
459
477
  ...query,
460
478
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -462,9 +480,6 @@ const buildValidParams = (query) => {
462
480
  {}
463
481
  )
464
482
  };
465
- if ("_q" in validQueryParams) {
466
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
467
- }
468
483
  return validQueryParams;
469
484
  };
470
485
  const isBaseQueryError = (error) => {
@@ -1664,7 +1679,7 @@ const useDocumentActions = () => {
1664
1679
  };
1665
1680
  };
1666
1681
  const ProtectedHistoryPage = React.lazy(
1667
- () => import("./History-DEvr3Q_V.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1682
+ () => import("./History-DP8gmXpm.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1668
1683
  );
1669
1684
  const routes$2 = [
1670
1685
  {
@@ -1677,7 +1692,7 @@ const routes$2 = [
1677
1692
  }
1678
1693
  ];
1679
1694
  const ProtectedPreviewPage = React.lazy(
1680
- () => import("./Preview-DcexhKJE.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1695
+ () => import("./Preview-C4NBzKUV.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1681
1696
  );
1682
1697
  const routes$1 = [
1683
1698
  {
@@ -1690,31 +1705,31 @@ const routes$1 = [
1690
1705
  }
1691
1706
  ];
1692
1707
  const ProtectedEditViewPage = lazy(
1693
- () => import("./EditViewPage-5pdbvsO_.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1708
+ () => import("./EditViewPage-_A31Cl4g.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1694
1709
  );
1695
1710
  const ProtectedListViewPage = lazy(
1696
- () => import("./ListViewPage-BK2mkrql.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1711
+ () => import("./ListViewPage-Cf_DgaFV.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1697
1712
  );
1698
1713
  const ProtectedListConfiguration = lazy(
1699
- () => import("./ListConfigurationPage-BM4zZZcM.mjs").then((mod) => ({
1714
+ () => import("./ListConfigurationPage-BCkO5iuN.mjs").then((mod) => ({
1700
1715
  default: mod.ProtectedListConfiguration
1701
1716
  }))
1702
1717
  );
1703
1718
  const ProtectedEditConfigurationPage = lazy(
1704
- () => import("./EditConfigurationPage-BYCBSJxP.mjs").then((mod) => ({
1719
+ () => import("./EditConfigurationPage-vN4zupij.mjs").then((mod) => ({
1705
1720
  default: mod.ProtectedEditConfigurationPage
1706
1721
  }))
1707
1722
  );
1708
1723
  const ProtectedComponentConfigurationPage = lazy(
1709
- () => import("./ComponentConfigurationPage-D3ZWDAHG.mjs").then((mod) => ({
1724
+ () => import("./ComponentConfigurationPage-BiASGi7x.mjs").then((mod) => ({
1710
1725
  default: mod.ProtectedComponentConfigurationPage
1711
1726
  }))
1712
1727
  );
1713
1728
  const NoPermissions = lazy(
1714
- () => import("./NoPermissionsPage-BmbRz7PR.mjs").then((mod) => ({ default: mod.NoPermissions }))
1729
+ () => import("./NoPermissionsPage-BALVSJ7x.mjs").then((mod) => ({ default: mod.NoPermissions }))
1715
1730
  );
1716
1731
  const NoContentType = lazy(
1717
- () => import("./NoContentTypePage-BvcAutu9.mjs").then((mod) => ({ default: mod.NoContentType }))
1732
+ () => import("./NoContentTypePage-nHIyvJcB.mjs").then((mod) => ({ default: mod.NoContentType }))
1718
1733
  );
1719
1734
  const CollectionTypePages = () => {
1720
1735
  const { collectionType } = useParams();
@@ -2084,6 +2099,7 @@ const PublishAction$1 = ({
2084
2099
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
2085
2100
  const isListView = useMatch(LIST_PATH) !== null;
2086
2101
  const isCloning = useMatch(CLONE_PATH) !== null;
2102
+ const { id } = useParams();
2087
2103
  const { formatMessage } = useIntl();
2088
2104
  const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
2089
2105
  const { publish } = useDocumentActions();
@@ -2186,10 +2202,12 @@ const PublishAction$1 = ({
2186
2202
  transformData(formValues)
2187
2203
  );
2188
2204
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2189
- navigate({
2190
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2191
- search: rawQuery
2192
- });
2205
+ if (id === "create") {
2206
+ navigate({
2207
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2208
+ search: rawQuery
2209
+ });
2210
+ }
2193
2211
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2194
2212
  setErrors(formatValidationErrors(res.error));
2195
2213
  }
@@ -2242,6 +2260,7 @@ const PublishAction$1 = ({
2242
2260
  };
2243
2261
  };
2244
2262
  PublishAction$1.type = "publish";
2263
+ PublishAction$1.position = "panel";
2245
2264
  const UpdateAction = ({
2246
2265
  activeTab,
2247
2266
  documentId,
@@ -2264,6 +2283,117 @@ const UpdateAction = ({
2264
2283
  const validate = useForm("UpdateAction", (state) => state.validate);
2265
2284
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2266
2285
  const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
2286
+ const handleUpdate = React.useCallback(async () => {
2287
+ setSubmitting(true);
2288
+ try {
2289
+ if (!modified) {
2290
+ return;
2291
+ }
2292
+ const { errors } = await validate(true, {
2293
+ status: "draft"
2294
+ });
2295
+ if (errors) {
2296
+ toggleNotification({
2297
+ type: "danger",
2298
+ message: formatMessage({
2299
+ id: "content-manager.validation.error",
2300
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2301
+ })
2302
+ });
2303
+ return;
2304
+ }
2305
+ if (isCloning) {
2306
+ const res = await clone(
2307
+ {
2308
+ model,
2309
+ documentId: cloneMatch.params.origin,
2310
+ params
2311
+ },
2312
+ transformData(document)
2313
+ );
2314
+ if ("data" in res) {
2315
+ navigate(
2316
+ {
2317
+ pathname: `../${res.data.documentId}`,
2318
+ search: rawQuery
2319
+ },
2320
+ { relative: "path" }
2321
+ );
2322
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2323
+ setErrors(formatValidationErrors(res.error));
2324
+ }
2325
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2326
+ const res = await update(
2327
+ {
2328
+ collectionType,
2329
+ model,
2330
+ documentId,
2331
+ params
2332
+ },
2333
+ transformData(document)
2334
+ );
2335
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2336
+ setErrors(formatValidationErrors(res.error));
2337
+ } else {
2338
+ resetForm();
2339
+ }
2340
+ } else {
2341
+ const res = await create(
2342
+ {
2343
+ model,
2344
+ params
2345
+ },
2346
+ transformData(document)
2347
+ );
2348
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2349
+ navigate(
2350
+ {
2351
+ pathname: `../${res.data.documentId}`,
2352
+ search: rawQuery
2353
+ },
2354
+ { replace: true, relative: "path" }
2355
+ );
2356
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2357
+ setErrors(formatValidationErrors(res.error));
2358
+ }
2359
+ }
2360
+ } finally {
2361
+ setSubmitting(false);
2362
+ }
2363
+ }, [
2364
+ clone,
2365
+ cloneMatch?.params.origin,
2366
+ collectionType,
2367
+ create,
2368
+ document,
2369
+ documentId,
2370
+ formatMessage,
2371
+ formatValidationErrors,
2372
+ isCloning,
2373
+ model,
2374
+ modified,
2375
+ navigate,
2376
+ params,
2377
+ rawQuery,
2378
+ resetForm,
2379
+ setErrors,
2380
+ setSubmitting,
2381
+ toggleNotification,
2382
+ update,
2383
+ validate
2384
+ ]);
2385
+ React.useEffect(() => {
2386
+ const handleKeyDown = (e) => {
2387
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2388
+ e.preventDefault();
2389
+ handleUpdate();
2390
+ }
2391
+ };
2392
+ window.addEventListener("keydown", handleKeyDown);
2393
+ return () => {
2394
+ window.removeEventListener("keydown", handleKeyDown);
2395
+ };
2396
+ }, [handleUpdate]);
2267
2397
  return {
2268
2398
  /**
2269
2399
  * Disabled when:
@@ -2276,84 +2406,11 @@ const UpdateAction = ({
2276
2406
  id: "global.save",
2277
2407
  defaultMessage: "Save"
2278
2408
  }),
2279
- onClick: async () => {
2280
- setSubmitting(true);
2281
- try {
2282
- const { errors } = await validate(true, {
2283
- status: "draft"
2284
- });
2285
- if (errors) {
2286
- toggleNotification({
2287
- type: "danger",
2288
- message: formatMessage({
2289
- id: "content-manager.validation.error",
2290
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2291
- })
2292
- });
2293
- return;
2294
- }
2295
- if (isCloning) {
2296
- const res = await clone(
2297
- {
2298
- model,
2299
- documentId: cloneMatch.params.origin,
2300
- params
2301
- },
2302
- transformData(document)
2303
- );
2304
- if ("data" in res) {
2305
- navigate(
2306
- {
2307
- pathname: `../${res.data.documentId}`,
2308
- search: rawQuery
2309
- },
2310
- { relative: "path" }
2311
- );
2312
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2313
- setErrors(formatValidationErrors(res.error));
2314
- }
2315
- } else if (documentId || collectionType === SINGLE_TYPES) {
2316
- const res = await update(
2317
- {
2318
- collectionType,
2319
- model,
2320
- documentId,
2321
- params
2322
- },
2323
- transformData(document)
2324
- );
2325
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2326
- setErrors(formatValidationErrors(res.error));
2327
- } else {
2328
- resetForm();
2329
- }
2330
- } else {
2331
- const res = await create(
2332
- {
2333
- model,
2334
- params
2335
- },
2336
- transformData(document)
2337
- );
2338
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2339
- navigate(
2340
- {
2341
- pathname: `../${res.data.documentId}`,
2342
- search: rawQuery
2343
- },
2344
- { replace: true, relative: "path" }
2345
- );
2346
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2347
- setErrors(formatValidationErrors(res.error));
2348
- }
2349
- }
2350
- } finally {
2351
- setSubmitting(false);
2352
- }
2353
- }
2409
+ onClick: handleUpdate
2354
2410
  };
2355
2411
  };
2356
2412
  UpdateAction.type = "update";
2413
+ UpdateAction.position = "panel";
2357
2414
  const UNPUBLISH_DRAFT_OPTIONS = {
2358
2415
  KEEP: "keep",
2359
2416
  DISCARD: "discard"
@@ -2476,6 +2533,7 @@ const UnpublishAction$1 = ({
2476
2533
  };
2477
2534
  };
2478
2535
  UnpublishAction$1.type = "unpublish";
2536
+ UnpublishAction$1.position = "panel";
2479
2537
  const DiscardAction = ({
2480
2538
  activeTab,
2481
2539
  documentId,
@@ -2526,6 +2584,7 @@ const DiscardAction = ({
2526
2584
  };
2527
2585
  };
2528
2586
  DiscardAction.type = "discard";
2587
+ DiscardAction.position = "panel";
2529
2588
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2530
2589
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2531
2590
  const RelativeTime = React.forwardRef(
@@ -2645,7 +2704,7 @@ const HeaderToolbar = () => {
2645
2704
  meta: isCloning ? void 0 : meta,
2646
2705
  collectionType
2647
2706
  },
2648
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2707
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2649
2708
  children: (actions2) => {
2650
2709
  const headerActions = actions2.filter((action) => {
2651
2710
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2853,6 +2912,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2853
2912
  };
2854
2913
  };
2855
2914
  ConfigureTheViewAction.type = "configure-the-view";
2915
+ ConfigureTheViewAction.position = "header";
2856
2916
  const EditTheModelAction = ({ model }) => {
2857
2917
  const navigate = useNavigate();
2858
2918
  const { formatMessage } = useIntl();
@@ -2869,6 +2929,7 @@ const EditTheModelAction = ({ model }) => {
2869
2929
  };
2870
2930
  };
2871
2931
  EditTheModelAction.type = "edit-the-model";
2932
+ EditTheModelAction.position = "header";
2872
2933
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2873
2934
  const navigate = useNavigate();
2874
2935
  const { formatMessage } = useIntl();
@@ -2942,6 +3003,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2942
3003
  };
2943
3004
  };
2944
3005
  DeleteAction$1.type = "delete";
3006
+ DeleteAction$1.position = ["header", "table-row"];
2945
3007
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2946
3008
  const Panels = () => {
2947
3009
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3004,7 +3066,7 @@ const ActionsPanelContent = () => {
3004
3066
  DescriptionComponentRenderer,
3005
3067
  {
3006
3068
  props,
3007
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3069
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3008
3070
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3009
3071
  }
3010
3072
  ),
@@ -3458,8 +3520,7 @@ const PublishAction = ({ documents, model }) => {
3458
3520
  const refetchList = () => {
3459
3521
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3460
3522
  };
3461
- if (!showPublishButton)
3462
- return null;
3523
+ if (!showPublishButton) return null;
3463
3524
  return {
3464
3525
  actionType: "publish",
3465
3526
  variant: "tertiary",
@@ -3527,8 +3588,7 @@ const DeleteAction = ({ documents, model }) => {
3527
3588
  selectRow([]);
3528
3589
  }
3529
3590
  };
3530
- if (!hasDeletePermission)
3531
- return null;
3591
+ if (!hasDeletePermission) return null;
3532
3592
  return {
3533
3593
  variant: "danger-light",
3534
3594
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3577,8 +3637,7 @@ const UnpublishAction = ({ documents, model }) => {
3577
3637
  }
3578
3638
  };
3579
3639
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3580
- if (!showUnpublishButton)
3581
- return null;
3640
+ if (!showUnpublishButton) return null;
3582
3641
  return {
3583
3642
  variant: "tertiary",
3584
3643
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3683,7 +3742,7 @@ const TableActions = ({ document }) => {
3683
3742
  DescriptionComponentRenderer,
3684
3743
  {
3685
3744
  props,
3686
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3745
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3687
3746
  children: (actions2) => {
3688
3747
  const tableRowActions = actions2.filter((action) => {
3689
3748
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3742,6 +3801,7 @@ const EditAction = ({ documentId }) => {
3742
3801
  };
3743
3802
  };
3744
3803
  EditAction.type = "edit";
3804
+ EditAction.position = "table-row";
3745
3805
  const StyledPencil = styled(Pencil)`
3746
3806
  path {
3747
3807
  fill: currentColor;
@@ -3818,6 +3878,7 @@ const CloneAction = ({ model, documentId }) => {
3818
3878
  };
3819
3879
  };
3820
3880
  CloneAction.type = "clone";
3881
+ CloneAction.position = "table-row";
3821
3882
  const StyledDuplicate = styled(Duplicate)`
3822
3883
  path {
3823
3884
  fill: currentColor;
@@ -3904,7 +3965,14 @@ class ContentManagerPlugin {
3904
3965
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3905
3966
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3906
3967
  getBulkActions: () => this.bulkActions,
3907
- getDocumentActions: () => this.documentActions,
3968
+ getDocumentActions: (position) => {
3969
+ if (position) {
3970
+ return this.documentActions.filter(
3971
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
3972
+ );
3973
+ }
3974
+ return this.documentActions;
3975
+ },
3908
3976
  getEditViewSidePanels: () => this.editViewSidePanels,
3909
3977
  getHeaderActions: () => this.headerActions
3910
3978
  }
@@ -3914,10 +3982,8 @@ class ContentManagerPlugin {
3914
3982
  const getPrintableType = (value) => {
3915
3983
  const nativeType = typeof value;
3916
3984
  if (nativeType === "object") {
3917
- if (value === null)
3918
- return "null";
3919
- if (Array.isArray(value))
3920
- return "array";
3985
+ if (value === null) return "null";
3986
+ if (Array.isArray(value)) return "array";
3921
3987
  if (value instanceof Object && value.constructor.name !== "Object") {
3922
3988
  return value.constructor.name;
3923
3989
  }
@@ -3970,6 +4036,7 @@ const HistoryAction = ({ model, document }) => {
3970
4036
  };
3971
4037
  };
3972
4038
  HistoryAction.type = "history";
4039
+ HistoryAction.position = "header";
3973
4040
  const historyAdmin = {
3974
4041
  bootstrap(app) {
3975
4042
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4032,11 +4099,18 @@ const previewApi = contentManagerApi.injectEndpoints({
4032
4099
  })
4033
4100
  });
4034
4101
  const { useGetPreviewUrlQuery } = previewApi;
4102
+ const ConditionalTooltip = ({ isShown, label, children }) => {
4103
+ if (isShown) {
4104
+ return /* @__PURE__ */ jsx(Tooltip, { label, children });
4105
+ }
4106
+ return children;
4107
+ };
4035
4108
  const PreviewSidePanel = ({ model, documentId, document }) => {
4036
4109
  const { formatMessage } = useIntl();
4037
4110
  const { trackUsage } = useTracking();
4038
4111
  const { pathname } = useLocation();
4039
4112
  const [{ query }] = useQueryParams();
4113
+ const isModified = useForm("PreviewSidePanel", (state) => state.modified);
4040
4114
  const { data, error } = useGetPreviewUrlQuery({
4041
4115
  params: {
4042
4116
  contentType: model
@@ -4056,28 +4130,37 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4056
4130
  };
4057
4131
  return {
4058
4132
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4059
- content: /* @__PURE__ */ jsx(Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsx(
4060
- Button,
4133
+ content: /* @__PURE__ */ jsx(
4134
+ ConditionalTooltip,
4061
4135
  {
4062
- variant: "tertiary",
4063
- tag: Link,
4064
- to: { pathname: "preview", search: stringify(query, { encode: false }) },
4065
- onClick: trackNavigation,
4066
- flex: "auto",
4067
- children: formatMessage({
4068
- id: "content-manager.preview.panel.button",
4069
- defaultMessage: "Open preview"
4070
- })
4136
+ label: formatMessage({
4137
+ id: "content-manager.preview.panel.button-disabled-tooltip",
4138
+ defaultMessage: "Please save to open the preview"
4139
+ }),
4140
+ isShown: isModified,
4141
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4142
+ Button,
4143
+ {
4144
+ variant: "tertiary",
4145
+ tag: Link,
4146
+ to: { pathname: "preview", search: stringify(query, { encode: false }) },
4147
+ onClick: trackNavigation,
4148
+ width: "100%",
4149
+ disabled: isModified,
4150
+ pointerEvents: isModified ? "none" : void 0,
4151
+ tabIndex: isModified ? -1 : void 0,
4152
+ children: formatMessage({
4153
+ id: "content-manager.preview.panel.button",
4154
+ defaultMessage: "Open preview"
4155
+ })
4156
+ }
4157
+ ) })
4071
4158
  }
4072
- ) })
4159
+ )
4073
4160
  };
4074
4161
  };
4075
- const FEATURE_ID = "preview";
4076
4162
  const previewAdmin = {
4077
4163
  bootstrap(app) {
4078
- if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4079
- return;
4080
- }
4081
4164
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4082
4165
  contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4083
4166
  }
@@ -4101,7 +4184,7 @@ const index = {
4101
4184
  app.router.addRoute({
4102
4185
  path: "content-manager/*",
4103
4186
  lazy: async () => {
4104
- const { Layout } = await import("./layout-DFVbgjp2.mjs");
4187
+ const { Layout } = await import("./layout-B5qsPihj.mjs");
4105
4188
  return {
4106
4189
  Component: Layout
4107
4190
  };
@@ -4121,7 +4204,7 @@ const index = {
4121
4204
  async registerTrads({ locales }) {
4122
4205
  const importedTrads = await Promise.all(
4123
4206
  locales.map((locale) => {
4124
- 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-CfIXaZf9.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`).then(({ default: data }) => {
4207
+ 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 }) => {
4125
4208
  return {
4126
4209
  data: prefixPluginTranslations(data, PLUGIN_ID),
4127
4210
  locale
@@ -4183,4 +4266,4 @@ export {
4183
4266
  capitalise as y,
4184
4267
  useUpdateContentTypeConfigurationMutation as z
4185
4268
  };
4186
- //# sourceMappingURL=index-BW-rXkjn.mjs.map
4269
+ //# sourceMappingURL=index-Dh2aGTGJ.mjs.map