@strapi/content-manager 0.0.0-experimental.cb311d9fcfbd8e441f790aea232f0a39bdd90e16 → 0.0.0-experimental.cfda358b7f27015e34e739b8742a2962ae2e7aee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js → ComponentConfigurationPage-BTR_hQow.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js.map → ComponentConfigurationPage-BTR_hQow.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs → ComponentConfigurationPage-bLQr82ce.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs.map → ComponentConfigurationPage-bLQr82ce.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs → EditConfigurationPage-BhRSnUsL.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs.map → EditConfigurationPage-BhRSnUsL.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js → EditConfigurationPage-z39Wv3E6.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js.map → EditConfigurationPage-z39Wv3E6.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-C3tIZ8F5.mjs → EditViewPage-BCjNxNlY.mjs} +63 -12
- package/dist/_chunks/EditViewPage-BCjNxNlY.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-BSVmMpRd.js → EditViewPage-wujOq90c.js} +63 -13
- package/dist/_chunks/EditViewPage-wujOq90c.js.map +1 -0
- package/dist/_chunks/{Field-DUCVth4C.js → Field-B5QXnctJ.js} +320 -169
- package/dist/_chunks/Field-B5QXnctJ.js.map +1 -0
- package/dist/_chunks/{Field-BvuT8cGL.mjs → Field-Byr3mPTl.mjs} +316 -165
- package/dist/_chunks/Field-Byr3mPTl.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-BZmDNVr9.mjs → Form-BZgvE8C8.mjs} +37 -18
- package/dist/_chunks/Form-BZgvE8C8.mjs.map +1 -0
- package/dist/_chunks/{Form-Cpl4W1ak.js → Form-D7mexvm3.js} +39 -21
- package/dist/_chunks/Form-D7mexvm3.js.map +1 -0
- package/dist/_chunks/{History-Cq_Hrzuu.mjs → History-CqNgxkqK.mjs} +43 -100
- package/dist/_chunks/History-CqNgxkqK.mjs.map +1 -0
- package/dist/_chunks/{History-D4U2YISB.js → History-DYl2A8Z_.js} +42 -100
- package/dist/_chunks/History-DYl2A8Z_.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Bny6CdWe.js → ListConfigurationPage-BXnu_OoY.js} +19 -9
- package/dist/_chunks/ListConfigurationPage-BXnu_OoY.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-W-KQHmBv.mjs → ListConfigurationPage-BbQjzKkQ.mjs} +19 -8
- package/dist/_chunks/ListConfigurationPage-BbQjzKkQ.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-O8F1pBJo.js → ListViewPage-BtSi8C1l.js} +103 -77
- package/dist/_chunks/ListViewPage-BtSi8C1l.js.map +1 -0
- package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs → ListViewPage-D4ofkbjR.mjs} +99 -72
- package/dist/_chunks/ListViewPage-D4ofkbjR.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js → NoContentTypePage-CitJeOq4.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js.map → NoContentTypePage-CitJeOq4.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs → NoContentTypePage-DyUx5mXh.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs.map → NoContentTypePage-DyUx5mXh.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs → NoPermissionsPage-DhIiyWkk.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs.map → NoPermissionsPage-DhIiyWkk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js → NoPermissionsPage-DzgWz0M-.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js.map → NoPermissionsPage-DzgWz0M-.js.map} +1 -1
- package/dist/_chunks/Preview-BaYGJ0nb.mjs +293 -0
- package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +1 -0
- package/dist/_chunks/Preview-DfNx8Ke-.js +311 -0
- package/dist/_chunks/Preview-DfNx8Ke-.js.map +1 -0
- package/dist/_chunks/{Relations-vFZ6Wasg.mjs → Relations-DM2yUTST.mjs} +76 -42
- package/dist/_chunks/Relations-DM2yUTST.mjs.map +1 -0
- package/dist/_chunks/{Relations-C4gGfZRv.js → Relations-DuKCaXrv.js} +76 -43
- package/dist/_chunks/Relations-DuKCaXrv.js.map +1 -0
- package/dist/_chunks/{en-uOUIxfcQ.js → en-BK8Xyl5I.js} +28 -15
- package/dist/_chunks/{en-uOUIxfcQ.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-BrCTWlZv.mjs → en-Dtk_ot79.mjs} +28 -15
- package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-5EMXLEM_.js → index-BUWEmX8m.js} +1320 -996
- package/dist/_chunks/index-BUWEmX8m.js.map +1 -0
- package/dist/_chunks/{index-Dpxg3ctD.mjs → index-DVAIIsOs.mjs} +1338 -1014
- package/dist/_chunks/index-DVAIIsOs.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-C0INpKap.mjs → layout-Bxsv5mP7.mjs} +9 -8
- package/dist/_chunks/layout-Bxsv5mP7.mjs.map +1 -0
- package/dist/_chunks/{layout-P3eKO1Qy.js → layout-C3fN7Ejz.js} +10 -10
- package/dist/_chunks/layout-C3fN7Ejz.js.map +1 -0
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-B1y0K6LE.js → relations-BPZKAoEY.js} +6 -7
- package/dist/_chunks/relations-BPZKAoEY.js.map +1 -0
- package/dist/_chunks/{relations-FBRRBWeO.mjs → relations-o3pPhzY4.mjs} +6 -7
- package/dist/_chunks/relations-o3pPhzY4.mjs.map +1 -0
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +19 -20
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +482 -219
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +482 -218
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +3 -3
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +17 -15
- package/dist/_chunks/EditViewPage-BSVmMpRd.js.map +0 -1
- package/dist/_chunks/EditViewPage-C3tIZ8F5.mjs.map +0 -1
- package/dist/_chunks/Field-BvuT8cGL.mjs.map +0 -1
- package/dist/_chunks/Field-DUCVth4C.js.map +0 -1
- package/dist/_chunks/Form-BZmDNVr9.mjs.map +0 -1
- package/dist/_chunks/Form-Cpl4W1ak.js.map +0 -1
- package/dist/_chunks/History-Cq_Hrzuu.mjs.map +0 -1
- package/dist/_chunks/History-D4U2YISB.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Bny6CdWe.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-W-KQHmBv.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-HBBnJa8K.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-O8F1pBJo.js.map +0 -1
- package/dist/_chunks/Relations-C4gGfZRv.js.map +0 -1
- package/dist/_chunks/Relations-vFZ6Wasg.mjs.map +0 -1
- package/dist/_chunks/index-5EMXLEM_.js.map +0 -1
- package/dist/_chunks/index-Dpxg3ctD.mjs.map +0 -1
- package/dist/_chunks/layout-C0INpKap.mjs.map +0 -1
- package/dist/_chunks/layout-P3eKO1Qy.js.map +0 -1
- package/dist/_chunks/relations-B1y0K6LE.js.map +0 -1
- package/dist/_chunks/relations-FBRRBWeO.mjs.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
@@ -2,24 +2,75 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
3
3
|
import { useState, useEffect, useCallback, memo } from "react";
|
4
4
|
import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
|
5
|
-
import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton,
|
5
|
+
import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
|
6
6
|
import pipe$1 from "lodash/fp/pipe";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC,
|
8
|
+
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, n as CLONE_PATH, d as buildValidParams, f as useDocumentRBAC, S as SINGLE_TYPES, o as useDocLayout } from "./index-DVAIIsOs.mjs";
|
9
9
|
import { generateNKeysBetween } from "fractional-indexing";
|
10
|
-
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-
|
11
|
-
import {
|
10
|
+
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-DM2yUTST.mjs";
|
11
|
+
import { CodeBlock as CodeBlock$1, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Code, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
|
12
12
|
import { styled, css, keyframes } from "styled-components";
|
13
13
|
import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
|
14
14
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
15
|
-
import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-
|
16
|
-
import { g as getIn } from "./objects-
|
15
|
+
import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DJ6jqvZN.mjs";
|
16
|
+
import { g as getIn } from "./objects-D6yBsdmx.mjs";
|
17
17
|
import { Editor as Editor$1, Transforms, Node, Element, Range, Path, Point, createEditor } from "slate";
|
18
18
|
import { withHistory } from "slate-history";
|
19
19
|
import { useFocused, useSelected, ReactEditor, Editable, useSlate, Slate, withReact } from "slate-react";
|
20
|
-
import
|
20
|
+
import * as Prism from "prismjs";
|
21
|
+
import "prismjs/themes/prism-solarizedlight.css";
|
22
|
+
import "prismjs/components/prism-asmatmel";
|
23
|
+
import "prismjs/components/prism-bash";
|
24
|
+
import "prismjs/components/prism-basic";
|
25
|
+
import "prismjs/components/prism-c";
|
26
|
+
import "prismjs/components/prism-clojure";
|
27
|
+
import "prismjs/components/prism-cobol";
|
28
|
+
import "prismjs/components/prism-cpp";
|
29
|
+
import "prismjs/components/prism-csharp";
|
30
|
+
import "prismjs/components/prism-dart";
|
31
|
+
import "prismjs/components/prism-docker";
|
32
|
+
import "prismjs/components/prism-elixir";
|
33
|
+
import "prismjs/components/prism-erlang";
|
34
|
+
import "prismjs/components/prism-fortran";
|
35
|
+
import "prismjs/components/prism-fsharp";
|
36
|
+
import "prismjs/components/prism-go";
|
37
|
+
import "prismjs/components/prism-graphql";
|
38
|
+
import "prismjs/components/prism-groovy";
|
39
|
+
import "prismjs/components/prism-haskell";
|
40
|
+
import "prismjs/components/prism-haxe";
|
41
|
+
import "prismjs/components/prism-ini";
|
42
|
+
import "prismjs/components/prism-java";
|
43
|
+
import "prismjs/components/prism-javascript";
|
44
|
+
import "prismjs/components/prism-jsx";
|
45
|
+
import "prismjs/components/prism-json";
|
46
|
+
import "prismjs/components/prism-julia";
|
47
|
+
import "prismjs/components/prism-kotlin";
|
48
|
+
import "prismjs/components/prism-latex";
|
49
|
+
import "prismjs/components/prism-lua";
|
50
|
+
import "prismjs/components/prism-markdown";
|
51
|
+
import "prismjs/components/prism-matlab";
|
52
|
+
import "prismjs/components/prism-makefile";
|
53
|
+
import "prismjs/components/prism-objectivec";
|
54
|
+
import "prismjs/components/prism-perl";
|
55
|
+
import "prismjs/components/prism-php";
|
56
|
+
import "prismjs/components/prism-powershell";
|
57
|
+
import "prismjs/components/prism-python";
|
58
|
+
import "prismjs/components/prism-r";
|
59
|
+
import "prismjs/components/prism-ruby";
|
60
|
+
import "prismjs/components/prism-rust";
|
61
|
+
import "prismjs/components/prism-sas";
|
62
|
+
import "prismjs/components/prism-scala";
|
63
|
+
import "prismjs/components/prism-scheme";
|
64
|
+
import "prismjs/components/prism-sql";
|
65
|
+
import "prismjs/components/prism-stata";
|
66
|
+
import "prismjs/components/prism-swift";
|
67
|
+
import "prismjs/components/prism-typescript";
|
68
|
+
import "prismjs/components/prism-tsx";
|
69
|
+
import "prismjs/components/prism-vbnet";
|
70
|
+
import "prismjs/components/prism-yaml";
|
71
|
+
import { p as prefixFileUrlWithBackendUrl, u as usePrev, a as useDebounce } from "./useDebounce-DmuSJIF3.mjs";
|
21
72
|
import * as Toolbar from "@radix-ui/react-toolbar";
|
22
|
-
import { useLocation } from "react-router-dom";
|
73
|
+
import { useLocation, useMatch } from "react-router-dom";
|
23
74
|
import CodeMirror from "codemirror5";
|
24
75
|
import sanitizeHtml from "sanitize-html";
|
25
76
|
import { getLanguage, highlight, highlightAuto } from "highlight.js";
|
@@ -163,7 +214,8 @@ const useLazyComponents = (componentUids = []) => {
|
|
163
214
|
const codeLanguages = [
|
164
215
|
{
|
165
216
|
value: "asm",
|
166
|
-
label: "Assembly"
|
217
|
+
label: "Assembly",
|
218
|
+
decorate: "asmatmel"
|
167
219
|
},
|
168
220
|
{
|
169
221
|
value: "bash",
|
@@ -199,7 +251,8 @@ const codeLanguages = [
|
|
199
251
|
},
|
200
252
|
{
|
201
253
|
value: "dockerfile",
|
202
|
-
label: "Dockerfile"
|
254
|
+
label: "Dockerfile",
|
255
|
+
decorate: "docker"
|
203
256
|
},
|
204
257
|
{
|
205
258
|
value: "elixir",
|
@@ -355,7 +408,8 @@ const codeLanguages = [
|
|
355
408
|
},
|
356
409
|
{
|
357
410
|
value: "typescript",
|
358
|
-
label: "TypeScript"
|
411
|
+
label: "TypeScript",
|
412
|
+
decorate: "ts"
|
359
413
|
},
|
360
414
|
{
|
361
415
|
value: "tsx",
|
@@ -371,7 +425,8 @@ const codeLanguages = [
|
|
371
425
|
},
|
372
426
|
{
|
373
427
|
value: "yaml",
|
374
|
-
label: "YAML"
|
428
|
+
label: "YAML",
|
429
|
+
decorate: "yml"
|
375
430
|
}
|
376
431
|
];
|
377
432
|
const baseHandleConvert = (editor, attributesToSet) => {
|
@@ -437,6 +492,29 @@ const pressEnterTwiceToExit = (editor) => {
|
|
437
492
|
});
|
438
493
|
}
|
439
494
|
};
|
495
|
+
const decorateCode = ([node, path]) => {
|
496
|
+
const ranges = [];
|
497
|
+
if (!Element.isElement(node) || node.type !== "code") return ranges;
|
498
|
+
const text = Node.string(node);
|
499
|
+
const language = codeLanguages.find((lang) => lang.value === node.language);
|
500
|
+
const decorateKey = language?.decorate ?? language?.value;
|
501
|
+
const selectedLanguage = Prism.languages[decorateKey || "plaintext"];
|
502
|
+
const tokens = Prism.tokenize(text, selectedLanguage);
|
503
|
+
let start = 0;
|
504
|
+
for (const token of tokens) {
|
505
|
+
const length = token.length;
|
506
|
+
const end = start + length;
|
507
|
+
if (typeof token !== "string") {
|
508
|
+
ranges.push({
|
509
|
+
anchor: { path, offset: start },
|
510
|
+
focus: { path, offset: end },
|
511
|
+
className: `token ${token.type}`
|
512
|
+
});
|
513
|
+
}
|
514
|
+
start = end;
|
515
|
+
}
|
516
|
+
return ranges;
|
517
|
+
};
|
440
518
|
const CodeBlock = styled.pre`
|
441
519
|
border-radius: ${({ theme }) => theme.borderRadius};
|
442
520
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
@@ -508,7 +586,7 @@ const CodeEditor = (props) => {
|
|
508
586
|
const codeBlocks = {
|
509
587
|
code: {
|
510
588
|
renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
|
511
|
-
icon:
|
589
|
+
icon: CodeBlock$1,
|
512
590
|
label: {
|
513
591
|
id: "components.Blocks.blocks.code",
|
514
592
|
defaultMessage: "Code block"
|
@@ -697,8 +775,7 @@ const ImageDialog = () => {
|
|
697
775
|
const [isOpen, setIsOpen] = React.useState(true);
|
698
776
|
const { editor } = useBlocksEditorContext("ImageDialog");
|
699
777
|
const components = useStrapiApp("ImageDialog", (state) => state.components);
|
700
|
-
if (!components || !isOpen)
|
701
|
-
return null;
|
778
|
+
if (!components || !isOpen) return null;
|
702
779
|
const MediaLibraryDialog = components["media-library"];
|
703
780
|
const insertImages = (images) => {
|
704
781
|
Transforms.unwrapNodes(editor, {
|
@@ -707,14 +784,12 @@ const ImageDialog = () => {
|
|
707
784
|
});
|
708
785
|
const nodeEntryBeingReplaced = Editor$1.above(editor, {
|
709
786
|
match(node) {
|
710
|
-
if (Editor$1.isEditor(node))
|
711
|
-
return false;
|
787
|
+
if (Editor$1.isEditor(node)) return false;
|
712
788
|
const isInlineNode = ["text", "link"].includes(node.type);
|
713
789
|
return !isInlineNode;
|
714
790
|
}
|
715
791
|
});
|
716
|
-
if (!nodeEntryBeingReplaced)
|
717
|
-
return;
|
792
|
+
if (!nodeEntryBeingReplaced) return;
|
718
793
|
const [, pathToInsert] = nodeEntryBeingReplaced;
|
719
794
|
Transforms.removeNodes(editor);
|
720
795
|
const nodesToInsert = images.map((image) => {
|
@@ -892,8 +967,7 @@ const LinkContent = React.forwardRef(
|
|
892
967
|
ReactEditor.focus(editor);
|
893
968
|
};
|
894
969
|
React.useEffect(() => {
|
895
|
-
if (popoverOpen)
|
896
|
-
linkInputRef.current?.focus();
|
970
|
+
if (popoverOpen) linkInputRef.current?.focus();
|
897
971
|
}, [popoverOpen]);
|
898
972
|
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
899
973
|
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
|
@@ -963,11 +1037,11 @@ const LinkContent = React.forwardRef(
|
|
963
1037
|
),
|
964
1038
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
965
1039
|
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
966
|
-
id: "
|
1040
|
+
id: "global.cancel",
|
967
1041
|
defaultMessage: "Cancel"
|
968
1042
|
}) }),
|
969
1043
|
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
970
|
-
id: "
|
1044
|
+
id: "global.save",
|
971
1045
|
defaultMessage: "Save"
|
972
1046
|
}) })
|
973
1047
|
] })
|
@@ -1048,8 +1122,7 @@ const isText$1 = (node) => {
|
|
1048
1122
|
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
|
1049
1123
|
};
|
1050
1124
|
const handleBackspaceKeyOnList = (editor, event) => {
|
1051
|
-
if (!editor.selection)
|
1052
|
-
return;
|
1125
|
+
if (!editor.selection) return;
|
1053
1126
|
const [currentListItem, currentListItemPath] = Editor$1.parent(editor, editor.selection.anchor);
|
1054
1127
|
const [currentList, currentListPath] = Editor$1.parent(editor, currentListItemPath);
|
1055
1128
|
const isListEmpty = currentList.children.length === 1 && isText$1(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
@@ -1158,8 +1231,7 @@ const handleEnterKeyOnList = (editor) => {
|
|
1158
1231
|
};
|
1159
1232
|
const handleConvertToList = (editor, format) => {
|
1160
1233
|
const convertedPath = baseHandleConvert(editor, { type: "list-item" });
|
1161
|
-
if (!convertedPath)
|
1162
|
-
return;
|
1234
|
+
if (!convertedPath) return;
|
1163
1235
|
Transforms.wrapNodes(editor, { type: "list", format, children: [] }, { at: convertedPath });
|
1164
1236
|
};
|
1165
1237
|
const handleTabOnList = (editor) => {
|
@@ -1171,8 +1243,7 @@ const handleTabOnList = (editor) => {
|
|
1171
1243
|
}
|
1172
1244
|
const [currentListItem, currentListItemPath] = currentListItemEntry;
|
1173
1245
|
const [currentList] = Editor$1.parent(editor, currentListItemPath);
|
1174
|
-
if (currentListItem === currentList.children[0])
|
1175
|
-
return;
|
1246
|
+
if (currentListItem === currentList.children[0]) return;
|
1176
1247
|
const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);
|
1177
1248
|
const previousNode = currentList.children[currentListItemIndex - 1];
|
1178
1249
|
if (previousNode.type === "list") {
|
@@ -1407,7 +1478,7 @@ const ToolbarButton = ({
|
|
1407
1478
|
width: 7,
|
1408
1479
|
height: 7,
|
1409
1480
|
hasRadius: true,
|
1410
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
1481
|
+
children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1411
1482
|
}
|
1412
1483
|
)
|
1413
1484
|
}
|
@@ -1539,8 +1610,7 @@ const isListNode = (node) => {
|
|
1539
1610
|
const ListButton = ({ block, format }) => {
|
1540
1611
|
const { editor, disabled, blocks } = useBlocksEditorContext("ListButton");
|
1541
1612
|
const isListActive = () => {
|
1542
|
-
if (!editor.selection)
|
1543
|
-
return false;
|
1613
|
+
if (!editor.selection) return false;
|
1544
1614
|
const currentListEntry = Editor$1.above(editor, {
|
1545
1615
|
match: (node) => !Editor$1.isEditor(node) && node.type === "list",
|
1546
1616
|
at: editor.selection.anchor
|
@@ -1614,8 +1684,7 @@ const LinkButton = ({ disabled }) => {
|
|
1614
1684
|
const { editor } = useBlocksEditorContext("LinkButton");
|
1615
1685
|
const isLinkActive = () => {
|
1616
1686
|
const { selection } = editor;
|
1617
|
-
if (!selection)
|
1618
|
-
return false;
|
1687
|
+
if (!selection) return false;
|
1619
1688
|
const [match] = Array.from(
|
1620
1689
|
Editor$1.nodes(editor, {
|
1621
1690
|
at: Editor$1.unhangRange(editor, selection),
|
@@ -1749,6 +1818,7 @@ const DragItem = styled(Flex)`
|
|
1749
1818
|
}
|
1750
1819
|
`;
|
1751
1820
|
const DragIconButton = styled(IconButton)`
|
1821
|
+
user-select: none;
|
1752
1822
|
display: flex;
|
1753
1823
|
align-items: center;
|
1754
1824
|
justify-content: center;
|
@@ -1820,8 +1890,7 @@ const DragAndDropElement = ({
|
|
1820
1890
|
displayedValue: children
|
1821
1891
|
},
|
1822
1892
|
onDropItem(currentIndex, newIndex) {
|
1823
|
-
if (newIndex)
|
1824
|
-
handleMoveBlock(newIndex, currentIndex);
|
1893
|
+
if (newIndex) handleMoveBlock(newIndex, currentIndex);
|
1825
1894
|
}
|
1826
1895
|
});
|
1827
1896
|
const composedBoxRefs = useComposedRefs(blockRef, dropRef);
|
@@ -1877,6 +1946,7 @@ const DragAndDropElement = ({
|
|
1877
1946
|
DragIconButton,
|
1878
1947
|
{
|
1879
1948
|
tag: "div",
|
1949
|
+
contentEditable: false,
|
1880
1950
|
role: "button",
|
1881
1951
|
tabIndex: 0,
|
1882
1952
|
withTooltip: false,
|
@@ -1926,7 +1996,7 @@ const baseRenderLeaf = (props, modifiers2) => {
|
|
1926
1996
|
}
|
1927
1997
|
return currentChildren;
|
1928
1998
|
}, props.children);
|
1929
|
-
return /* @__PURE__ */ jsx("span", { ...props.attributes, children: wrappedChildren });
|
1999
|
+
return /* @__PURE__ */ jsx("span", { ...props.attributes, className: props.leaf.className, children: wrappedChildren });
|
1930
2000
|
};
|
1931
2001
|
const baseRenderElement = ({
|
1932
2002
|
props,
|
@@ -1964,8 +2034,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
|
|
1964
2034
|
[modifiers2]
|
1965
2035
|
);
|
1966
2036
|
const handleMoveBlocks = (editor2, event) => {
|
1967
|
-
if (!editor2.selection)
|
1968
|
-
return;
|
2037
|
+
if (!editor2.selection) return;
|
1969
2038
|
const start = Range.start(editor2.selection);
|
1970
2039
|
const currentIndex = [start.path[0]];
|
1971
2040
|
let newIndexPosition = 0;
|
@@ -2102,8 +2171,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
|
|
2102
2171
|
}
|
2103
2172
|
};
|
2104
2173
|
const handleScrollSelectionIntoView = () => {
|
2105
|
-
if (!editor.selection)
|
2106
|
-
return;
|
2174
|
+
if (!editor.selection) return;
|
2107
2175
|
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
2108
2176
|
const domRect = domRange.getBoundingClientRect();
|
2109
2177
|
const blocksInput = blocksRef.current;
|
@@ -2141,6 +2209,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
|
|
2141
2209
|
readOnly: disabled,
|
2142
2210
|
placeholder,
|
2143
2211
|
isExpandedMode,
|
2212
|
+
decorate: decorateCode,
|
2144
2213
|
renderElement,
|
2145
2214
|
renderLeaf,
|
2146
2215
|
onKeyDown: handleKeyDown,
|
@@ -2297,8 +2366,7 @@ const InlineCode = styled.code`
|
|
2297
2366
|
`;
|
2298
2367
|
const baseCheckIsActive = (editor, name2) => {
|
2299
2368
|
const marks = Editor$1.marks(editor);
|
2300
|
-
if (!marks)
|
2301
|
-
return false;
|
2369
|
+
if (!marks) return false;
|
2302
2370
|
return Boolean(marks[name2]);
|
2303
2371
|
};
|
2304
2372
|
const baseHandleToggle = (editor, name2) => {
|
@@ -2622,7 +2690,7 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
|
|
2622
2690
|
Box,
|
2623
2691
|
{
|
2624
2692
|
tag: "button",
|
2625
|
-
background: "neutral100",
|
2693
|
+
background: disabled ? "neutral150" : "neutral100",
|
2626
2694
|
borderColor: field.error ? "danger600" : "neutral200",
|
2627
2695
|
hasRadius: true,
|
2628
2696
|
disabled,
|
@@ -2630,32 +2698,32 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
|
|
2630
2698
|
paddingTop: 9,
|
2631
2699
|
paddingBottom: 9,
|
2632
2700
|
type: "button",
|
2701
|
+
style: { cursor: disabled ? "not-allowed" : "pointer" },
|
2633
2702
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
2634
|
-
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(
|
2635
|
-
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2703
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", color: disabled ? "neutral500" : "primary600", children: /* @__PURE__ */ jsx(PlusCircle, { width: "3.2rem", height: "3.2rem" }) }),
|
2704
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(
|
2705
|
+
Typography,
|
2706
|
+
{
|
2707
|
+
textColor: disabled ? "neutral600" : "primary600",
|
2708
|
+
variant: "pi",
|
2709
|
+
fontWeight: "bold",
|
2710
|
+
children: formatMessage({
|
2711
|
+
id: getTranslation("components.empty-repeatable"),
|
2712
|
+
defaultMessage: "No entry yet. Click to add one."
|
2713
|
+
})
|
2714
|
+
}
|
2715
|
+
) })
|
2639
2716
|
] })
|
2640
2717
|
}
|
2641
2718
|
) });
|
2642
2719
|
};
|
2643
|
-
const CircleIcon = styled(PlusCircle)`
|
2644
|
-
width: 2.4rem;
|
2645
|
-
height: 2.4rem;
|
2646
|
-
> circle {
|
2647
|
-
fill: ${({ theme }) => theme.colors.primary200};
|
2648
|
-
}
|
2649
|
-
> path {
|
2650
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2651
|
-
}
|
2652
|
-
`;
|
2653
2720
|
const NonRepeatableComponent = ({
|
2654
2721
|
attribute,
|
2655
2722
|
name: name2,
|
2656
2723
|
children,
|
2657
2724
|
layout
|
2658
2725
|
}) => {
|
2726
|
+
const { formatMessage } = useIntl();
|
2659
2727
|
const { value } = useField(name2);
|
2660
2728
|
const level = useComponent("NonRepeatableComponent", (state) => state.level);
|
2661
2729
|
const isNested = level > 0;
|
@@ -2672,7 +2740,22 @@ const NonRepeatableComponent = ({
|
|
2672
2740
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2673
2741
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2674
2742
|
const completeFieldName = `${name2}.${field.name}`;
|
2675
|
-
|
2743
|
+
const translatedLabel = formatMessage({
|
2744
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2745
|
+
defaultMessage: field.label
|
2746
|
+
});
|
2747
|
+
return /* @__PURE__ */ jsx(
|
2748
|
+
Grid$1.Item,
|
2749
|
+
{
|
2750
|
+
col: size,
|
2751
|
+
s: 12,
|
2752
|
+
xs: 12,
|
2753
|
+
direction: "column",
|
2754
|
+
alignItems: "stretch",
|
2755
|
+
children: children({ ...field, label: translatedLabel, name: completeFieldName })
|
2756
|
+
},
|
2757
|
+
completeFieldName
|
2758
|
+
);
|
2676
2759
|
}) }, index);
|
2677
2760
|
}) })
|
2678
2761
|
}
|
@@ -2691,13 +2774,34 @@ const RepeatableComponent = ({
|
|
2691
2774
|
const { search: searchString } = useLocation();
|
2692
2775
|
const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2693
2776
|
const { components } = useDoc();
|
2694
|
-
const {
|
2777
|
+
const {
|
2778
|
+
value = [],
|
2779
|
+
error,
|
2780
|
+
rawError
|
2781
|
+
} = useField(name2);
|
2695
2782
|
const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2696
2783
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2697
2784
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2698
2785
|
const { max = Infinity } = attribute;
|
2699
2786
|
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2700
2787
|
const [liveText, setLiveText] = React.useState("");
|
2788
|
+
React.useEffect(() => {
|
2789
|
+
const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
|
2790
|
+
const hasNestedValue = value && Array.isArray(value) && value.length > 0;
|
2791
|
+
if (hasNestedErrors && hasNestedValue) {
|
2792
|
+
const errorOpenItems = rawError.map((_, idx) => {
|
2793
|
+
return value[idx] ? value[idx].__temp_key__ : null;
|
2794
|
+
}).filter((value2) => !!value2);
|
2795
|
+
if (errorOpenItems && errorOpenItems.length > 0) {
|
2796
|
+
setCollapseToOpen((collapseToOpen2) => {
|
2797
|
+
if (!errorOpenItems.includes(collapseToOpen2)) {
|
2798
|
+
return errorOpenItems[0];
|
2799
|
+
}
|
2800
|
+
return collapseToOpen2;
|
2801
|
+
});
|
2802
|
+
}
|
2803
|
+
}
|
2804
|
+
}, [rawError, value]);
|
2701
2805
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2702
2806
|
if (search.has("field")) {
|
2703
2807
|
const fieldParam = search.get("field");
|
@@ -2850,7 +2954,26 @@ const RepeatableComponent = ({
|
|
2850
2954
|
children: layout.map((row, index2) => {
|
2851
2955
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2852
2956
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2853
|
-
|
2957
|
+
const translatedLabel = formatMessage({
|
2958
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2959
|
+
defaultMessage: field.label
|
2960
|
+
});
|
2961
|
+
return /* @__PURE__ */ jsx(
|
2962
|
+
Grid$1.Item,
|
2963
|
+
{
|
2964
|
+
col: size,
|
2965
|
+
s: 12,
|
2966
|
+
xs: 12,
|
2967
|
+
direction: "column",
|
2968
|
+
alignItems: "stretch",
|
2969
|
+
children: children({
|
2970
|
+
...field,
|
2971
|
+
label: translatedLabel,
|
2972
|
+
name: completeFieldName
|
2973
|
+
})
|
2974
|
+
},
|
2975
|
+
completeFieldName
|
2976
|
+
);
|
2854
2977
|
}) }, index2);
|
2855
2978
|
})
|
2856
2979
|
}
|
@@ -2945,7 +3068,7 @@ const Component = ({
|
|
2945
3068
|
/* @__PURE__ */ jsx(
|
2946
3069
|
IconButton,
|
2947
3070
|
{
|
2948
|
-
|
3071
|
+
variant: "ghost",
|
2949
3072
|
onClick: onDeleteComponent,
|
2950
3073
|
label: formatMessage({
|
2951
3074
|
id: getTranslation("containers.Edit.delete"),
|
@@ -2958,7 +3081,7 @@ const Component = ({
|
|
2958
3081
|
IconButton,
|
2959
3082
|
{
|
2960
3083
|
ref: composedAccordionRefs,
|
2961
|
-
|
3084
|
+
variant: "ghost",
|
2962
3085
|
onClick: (e) => e.stopPropagation(),
|
2963
3086
|
"data-handler-id": handlerId,
|
2964
3087
|
label: formatMessage({
|
@@ -3028,7 +3151,7 @@ const ComponentInput = ({
|
|
3028
3151
|
id: getTranslation("components.reset-entry"),
|
3029
3152
|
defaultMessage: "Reset Entry"
|
3030
3153
|
}),
|
3031
|
-
|
3154
|
+
variant: "ghost",
|
3032
3155
|
onClick: () => {
|
3033
3156
|
field.onChange(name2, null);
|
3034
3157
|
},
|
@@ -3057,11 +3180,8 @@ const AddComponentButton = ({
|
|
3057
3180
|
onClick,
|
3058
3181
|
disabled: isDisabled,
|
3059
3182
|
background: "neutral0",
|
3060
|
-
paddingTop: 3,
|
3061
|
-
paddingBottom: 3,
|
3062
|
-
paddingLeft: 4,
|
3063
|
-
paddingRight: 4,
|
3064
3183
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
3184
|
+
variant: "tertiary",
|
3065
3185
|
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
3066
3186
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
3067
3187
|
/* @__PURE__ */ jsx(
|
@@ -3090,10 +3210,11 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
3090
3210
|
}
|
3091
3211
|
`;
|
3092
3212
|
const AddComponentTitle = styled(Typography)``;
|
3093
|
-
const StyledButton = styled(
|
3213
|
+
const StyledButton = styled(Button)`
|
3094
3214
|
border-radius: 26px;
|
3095
3215
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
3096
3216
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3217
|
+
height: 5rem;
|
3097
3218
|
|
3098
3219
|
&:hover {
|
3099
3220
|
${AddComponentTitle} {
|
@@ -3105,7 +3226,7 @@ const StyledButton = styled(BaseButton)`
|
|
3105
3226
|
fill: ${({ theme }) => theme.colors.primary600};
|
3106
3227
|
}
|
3107
3228
|
> path {
|
3108
|
-
fill: ${({ theme }) => theme.colors.
|
3229
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
3109
3230
|
}
|
3110
3231
|
}
|
3111
3232
|
}
|
@@ -3236,18 +3357,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3236
3357
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
3237
3358
|
] });
|
3238
3359
|
};
|
3239
|
-
function useDebounce(value, delay) {
|
3240
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
3241
|
-
useEffect(() => {
|
3242
|
-
const handler = setTimeout(() => {
|
3243
|
-
setDebouncedValue(value);
|
3244
|
-
}, delay);
|
3245
|
-
return () => {
|
3246
|
-
clearTimeout(handler);
|
3247
|
-
};
|
3248
|
-
}, [value, delay]);
|
3249
|
-
return debouncedValue;
|
3250
|
-
}
|
3251
3360
|
const uidApi = contentManagerApi.injectEndpoints({
|
3252
3361
|
endpoints: (builder) => ({
|
3253
3362
|
getDefaultUID: builder.query({
|
@@ -3282,7 +3391,10 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
3282
3391
|
config: {
|
3283
3392
|
params
|
3284
3393
|
}
|
3285
|
-
})
|
3394
|
+
}),
|
3395
|
+
providesTags: (_res, _error, params) => [
|
3396
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3397
|
+
]
|
3286
3398
|
})
|
3287
3399
|
})
|
3288
3400
|
});
|
@@ -3294,8 +3406,10 @@ const UIDInput = React.forwardRef(
|
|
3294
3406
|
const allFormValues = useForm("InputUID", (form) => form.values);
|
3295
3407
|
const [availability, setAvailability] = React.useState();
|
3296
3408
|
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3409
|
+
const isCloning = useMatch(CLONE_PATH) !== null;
|
3297
3410
|
const field = useField(name2);
|
3298
3411
|
const debouncedValue = useDebounce(field.value, 300);
|
3412
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3299
3413
|
const { toggleNotification } = useNotification();
|
3300
3414
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3301
3415
|
const { formatMessage } = useIntl();
|
@@ -3371,8 +3485,9 @@ const UIDInput = React.forwardRef(
|
|
3371
3485
|
params
|
3372
3486
|
},
|
3373
3487
|
{
|
3488
|
+
// Don't check availability if the value is empty or wasn't changed
|
3374
3489
|
skip: !Boolean(
|
3375
|
-
|
3490
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3376
3491
|
)
|
3377
3492
|
}
|
3378
3493
|
);
|
@@ -3401,6 +3516,7 @@ const UIDInput = React.forwardRef(
|
|
3401
3516
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3402
3517
|
const fieldRef = useFocusInputField(name2);
|
3403
3518
|
const composedRefs = useComposedRefs(ref, fieldRef);
|
3519
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3404
3520
|
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3405
3521
|
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3406
3522
|
/* @__PURE__ */ jsx(
|
@@ -3409,7 +3525,7 @@ const UIDInput = React.forwardRef(
|
|
3409
3525
|
ref: composedRefs,
|
3410
3526
|
disabled: props.disabled,
|
3411
3527
|
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3412
|
-
|
3528
|
+
shouldShowAvailability && /* @__PURE__ */ jsxs(
|
3413
3529
|
TextValidation,
|
3414
3530
|
{
|
3415
3531
|
alignItems: "center",
|
@@ -3698,8 +3814,7 @@ const Wrapper = styled.div`
|
|
3698
3814
|
`;
|
3699
3815
|
var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/;
|
3700
3816
|
function newlineAndIndentContinueMarkdownList(cm) {
|
3701
|
-
if (cm.getOption("disableInput"))
|
3702
|
-
return CodeMirror.Pass;
|
3817
|
+
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
3703
3818
|
var ranges = cm.listSelections(), replacements = [];
|
3704
3819
|
for (var i = 0; i < ranges.length; i++) {
|
3705
3820
|
var pos = ranges[i].head;
|
@@ -3733,8 +3848,7 @@ function newlineAndIndentContinueMarkdownList(cm) {
|
|
3733
3848
|
var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
|
3734
3849
|
var bullet = numbered ? parseInt(match[3], 10) + 1 + match[4] : match[2].replace("x", " ");
|
3735
3850
|
replacements[i] = "\n" + indent + bullet + after;
|
3736
|
-
if (numbered)
|
3737
|
-
incrementRemainingMarkdownListNumbers(cm, pos);
|
3851
|
+
if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
|
3738
3852
|
}
|
3739
3853
|
}
|
3740
3854
|
cm.replaceSelections(replacements);
|
@@ -3752,10 +3866,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
|
|
3752
3866
|
var newNumber = parseInt(startItem[3], 10) + lookAhead - skipCount;
|
3753
3867
|
var nextNumber = parseInt(nextItem[3], 10), itemNumber = nextNumber;
|
3754
3868
|
if (startIndent === nextIndent && !isNaN(nextNumber)) {
|
3755
|
-
if (newNumber === nextNumber)
|
3756
|
-
|
3757
|
-
if (newNumber > nextNumber)
|
3758
|
-
itemNumber = newNumber + 1;
|
3869
|
+
if (newNumber === nextNumber) itemNumber = nextNumber + 1;
|
3870
|
+
if (newNumber > nextNumber) itemNumber = newNumber + 1;
|
3759
3871
|
cm.replaceRange(
|
3760
3872
|
nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
|
3761
3873
|
{
|
@@ -3768,10 +3880,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
|
|
3768
3880
|
}
|
3769
3881
|
);
|
3770
3882
|
} else {
|
3771
|
-
if (startIndent.length > nextIndent.length)
|
3772
|
-
|
3773
|
-
if (startIndent.length < nextIndent.length && lookAhead === 1)
|
3774
|
-
return;
|
3883
|
+
if (startIndent.length > nextIndent.length) return;
|
3884
|
+
if (startIndent.length < nextIndent.length && lookAhead === 1) return;
|
3775
3885
|
skipCount += 1;
|
3776
3886
|
}
|
3777
3887
|
}
|
@@ -4243,7 +4353,7 @@ const EditorLayout = ({
|
|
4243
4353
|
justifyContent: "flex-end",
|
4244
4354
|
shrink: 0,
|
4245
4355
|
width: "100%",
|
4246
|
-
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4356
|
+
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
4247
4357
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4248
4358
|
id: "components.Wysiwyg.collapse",
|
4249
4359
|
defaultMessage: "Collapse"
|
@@ -4261,12 +4371,14 @@ const EditorLayout = ({
|
|
4261
4371
|
) }) });
|
4262
4372
|
}
|
4263
4373
|
return /* @__PURE__ */ jsx(
|
4264
|
-
|
4374
|
+
Flex,
|
4265
4375
|
{
|
4266
4376
|
borderColor: error ? "danger600" : "neutral200",
|
4267
4377
|
borderStyle: "solid",
|
4268
4378
|
borderWidth: "1px",
|
4269
4379
|
hasRadius: true,
|
4380
|
+
direction: "column",
|
4381
|
+
alignItems: "stretch",
|
4270
4382
|
children
|
4271
4383
|
}
|
4272
4384
|
);
|
@@ -4277,11 +4389,19 @@ const ExpandWrapper = styled(Flex)`
|
|
4277
4389
|
const BoxWithBorder = styled(Box)`
|
4278
4390
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4279
4391
|
`;
|
4280
|
-
const ExpandButton$1 = styled(
|
4392
|
+
const ExpandButton$1 = styled(Button)`
|
4281
4393
|
background-color: transparent;
|
4282
4394
|
border: none;
|
4283
4395
|
align-items: center;
|
4284
4396
|
|
4397
|
+
& > span {
|
4398
|
+
display: flex;
|
4399
|
+
justify-content: space-between;
|
4400
|
+
align-items: center;
|
4401
|
+
width: 100%;
|
4402
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4403
|
+
}
|
4404
|
+
|
4285
4405
|
svg {
|
4286
4406
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4287
4407
|
|
@@ -4548,40 +4668,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4548
4668
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4549
4669
|
}
|
4550
4670
|
};
|
4551
|
-
const CustomIconButton = styled(IconButton)`
|
4552
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4553
|
-
|
4554
|
-
svg {
|
4555
|
-
width: 1.8rem;
|
4556
|
-
height: 1.8rem;
|
4557
|
-
}
|
4558
|
-
`;
|
4559
|
-
const CustomLinkIconButton = styled(CustomIconButton)`
|
4560
|
-
svg {
|
4561
|
-
width: 0.8rem;
|
4562
|
-
height: 0.8rem;
|
4563
|
-
}
|
4564
|
-
`;
|
4565
4671
|
const MainButtons = styled(IconButtonGroup)`
|
4566
4672
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4567
4673
|
`;
|
4568
4674
|
const MoreButton = styled(IconButton)`
|
4569
4675
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4570
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4571
|
-
|
4572
|
-
svg {
|
4573
|
-
width: 1.8rem;
|
4574
|
-
height: 1.8rem;
|
4575
|
-
}
|
4576
4676
|
`;
|
4577
4677
|
const IconButtonGroupMargin = styled(IconButtonGroup)`
|
4578
4678
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4579
4679
|
`;
|
4580
|
-
const ExpandButton = styled(
|
4680
|
+
const ExpandButton = styled(Button)`
|
4581
4681
|
background-color: transparent;
|
4582
4682
|
border: none;
|
4583
4683
|
align-items: center;
|
4584
4684
|
|
4685
|
+
& > span {
|
4686
|
+
display: flex;
|
4687
|
+
justify-content: space-between;
|
4688
|
+
align-items: center;
|
4689
|
+
width: 100%;
|
4690
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4691
|
+
}
|
4692
|
+
|
4585
4693
|
svg {
|
4586
4694
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4587
4695
|
path {
|
@@ -4593,7 +4701,7 @@ const ExpandButton = styled(BaseButton)`
|
|
4593
4701
|
`;
|
4594
4702
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4595
4703
|
const { formatMessage } = useIntl();
|
4596
|
-
return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
|
4704
|
+
return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
|
4597
4705
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
4598
4706
|
id: "components.WysiwygBottomControls.fullscreen",
|
4599
4707
|
defaultMessage: "Expand"
|
@@ -4630,18 +4738,27 @@ const WysiwygNav = ({
|
|
4630
4738
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4631
4739
|
children: [
|
4632
4740
|
/* @__PURE__ */ jsxs(Flex, { children: [
|
4633
|
-
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4634
|
-
|
4635
|
-
|
4636
|
-
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
|
4741
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4742
|
+
SingleSelect,
|
4743
|
+
{
|
4744
|
+
disabled: true,
|
4745
|
+
placeholder: selectPlaceholder,
|
4746
|
+
"aria-label": selectPlaceholder,
|
4747
|
+
size: "S",
|
4748
|
+
children: [
|
4749
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4750
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
4751
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
|
4752
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
|
4753
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
|
4754
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4755
|
+
]
|
4756
|
+
}
|
4757
|
+
) }),
|
4641
4758
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4642
|
-
/* @__PURE__ */ jsx(
|
4643
|
-
/* @__PURE__ */ jsx(
|
4644
|
-
/* @__PURE__ */ jsx(
|
4759
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4760
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
|
4761
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
|
4645
4762
|
] }),
|
4646
4763
|
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4647
4764
|
] }),
|
@@ -4668,6 +4785,7 @@ const WysiwygNav = ({
|
|
4668
4785
|
placeholder: selectPlaceholder,
|
4669
4786
|
"aria-label": selectPlaceholder,
|
4670
4787
|
onChange: (value) => onActionClick(value, editorRef),
|
4788
|
+
size: "S",
|
4671
4789
|
children: [
|
4672
4790
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4673
4791
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4679,17 +4797,9 @@ const WysiwygNav = ({
|
|
4679
4797
|
}
|
4680
4798
|
) }),
|
4681
4799
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4800
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4682
4801
|
/* @__PURE__ */ jsx(
|
4683
|
-
|
4684
|
-
{
|
4685
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4686
|
-
label: "Bold",
|
4687
|
-
name: "Bold",
|
4688
|
-
children: /* @__PURE__ */ jsx(Bold, {})
|
4689
|
-
}
|
4690
|
-
),
|
4691
|
-
/* @__PURE__ */ jsx(
|
4692
|
-
CustomIconButton,
|
4802
|
+
IconButton,
|
4693
4803
|
{
|
4694
4804
|
onClick: () => onActionClick("Italic", editorRef),
|
4695
4805
|
label: "Italic",
|
@@ -4698,7 +4808,7 @@ const WysiwygNav = ({
|
|
4698
4808
|
}
|
4699
4809
|
),
|
4700
4810
|
/* @__PURE__ */ jsx(
|
4701
|
-
|
4811
|
+
IconButton,
|
4702
4812
|
{
|
4703
4813
|
onClick: () => onActionClick("Underline", editorRef),
|
4704
4814
|
label: "Underline",
|
@@ -4712,7 +4822,7 @@ const WysiwygNav = ({
|
|
4712
4822
|
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4713
4823
|
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4714
4824
|
/* @__PURE__ */ jsx(
|
4715
|
-
|
4825
|
+
IconButton,
|
4716
4826
|
{
|
4717
4827
|
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4718
4828
|
label: "Strikethrough",
|
@@ -4721,7 +4831,7 @@ const WysiwygNav = ({
|
|
4721
4831
|
}
|
4722
4832
|
),
|
4723
4833
|
/* @__PURE__ */ jsx(
|
4724
|
-
|
4834
|
+
IconButton,
|
4725
4835
|
{
|
4726
4836
|
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4727
4837
|
label: "BulletList",
|
@@ -4730,7 +4840,7 @@ const WysiwygNav = ({
|
|
4730
4840
|
}
|
4731
4841
|
),
|
4732
4842
|
/* @__PURE__ */ jsx(
|
4733
|
-
|
4843
|
+
IconButton,
|
4734
4844
|
{
|
4735
4845
|
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4736
4846
|
label: "NumberList",
|
@@ -4741,7 +4851,7 @@ const WysiwygNav = ({
|
|
4741
4851
|
] }),
|
4742
4852
|
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4743
4853
|
/* @__PURE__ */ jsx(
|
4744
|
-
|
4854
|
+
IconButton,
|
4745
4855
|
{
|
4746
4856
|
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4747
4857
|
label: "Code",
|
@@ -4750,7 +4860,7 @@ const WysiwygNav = ({
|
|
4750
4860
|
}
|
4751
4861
|
),
|
4752
4862
|
/* @__PURE__ */ jsx(
|
4753
|
-
|
4863
|
+
IconButton,
|
4754
4864
|
{
|
4755
4865
|
onClick: () => {
|
4756
4866
|
handleTogglePopover();
|
@@ -4762,7 +4872,7 @@ const WysiwygNav = ({
|
|
4762
4872
|
}
|
4763
4873
|
),
|
4764
4874
|
/* @__PURE__ */ jsx(
|
4765
|
-
|
4875
|
+
IconButton,
|
4766
4876
|
{
|
4767
4877
|
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4768
4878
|
label: "Link",
|
@@ -4771,7 +4881,7 @@ const WysiwygNav = ({
|
|
4771
4881
|
}
|
4772
4882
|
),
|
4773
4883
|
/* @__PURE__ */ jsx(
|
4774
|
-
|
4884
|
+
IconButton,
|
4775
4885
|
{
|
4776
4886
|
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4777
4887
|
label: "Quote",
|
@@ -4908,15 +5018,19 @@ const Wysiwyg = React.forwardRef(
|
|
4908
5018
|
);
|
4909
5019
|
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4910
5020
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4911
|
-
const { id } = useDoc();
|
5021
|
+
const { id, document: document2, collectionType } = useDoc();
|
4912
5022
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
4913
5023
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4914
5024
|
const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4915
5025
|
const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4916
5026
|
const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4917
5027
|
const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4918
|
-
|
4919
|
-
|
5028
|
+
let idToCheck = id;
|
5029
|
+
if (collectionType === SINGLE_TYPES) {
|
5030
|
+
idToCheck = document2?.documentId;
|
5031
|
+
}
|
5032
|
+
const editableFields = idToCheck ? canUpdateFields : canCreateFields;
|
5033
|
+
const readableFields = idToCheck ? canReadFields : canCreateFields;
|
4920
5034
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4921
5035
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4922
5036
|
const fields = useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4927,6 +5041,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4927
5041
|
const {
|
4928
5042
|
edit: { components }
|
4929
5043
|
} = useDocLayout();
|
5044
|
+
const field = useField(props.name);
|
4930
5045
|
if (!visible) {
|
4931
5046
|
return null;
|
4932
5047
|
}
|
@@ -4937,7 +5052,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4937
5052
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4938
5053
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4939
5054
|
if (CustomInput) {
|
4940
|
-
return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
5055
|
+
return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4941
5056
|
}
|
4942
5057
|
return /* @__PURE__ */ jsx(
|
4943
5058
|
InputRenderer$1,
|
@@ -5098,12 +5213,20 @@ const DynamicComponent = ({
|
|
5098
5213
|
React.useEffect(() => {
|
5099
5214
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
5100
5215
|
}, [dragPreviewRef, index]);
|
5216
|
+
const accordionValue = React.useId();
|
5217
|
+
const { value = [], rawError } = useField(`${name2}.${index}`);
|
5218
|
+
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
5219
|
+
React.useEffect(() => {
|
5220
|
+
if (rawError && value) {
|
5221
|
+
setCollapseToOpen(accordionValue);
|
5222
|
+
}
|
5223
|
+
}, [rawError, value, accordionValue]);
|
5101
5224
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
5102
5225
|
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
5103
5226
|
/* @__PURE__ */ jsx(
|
5104
5227
|
IconButton,
|
5105
5228
|
{
|
5106
|
-
|
5229
|
+
variant: "ghost",
|
5107
5230
|
label: formatMessage(
|
5108
5231
|
{
|
5109
5232
|
id: getTranslation("components.DynamicZone.delete-label"),
|
@@ -5118,7 +5241,7 @@ const DynamicComponent = ({
|
|
5118
5241
|
/* @__PURE__ */ jsx(
|
5119
5242
|
IconButton,
|
5120
5243
|
{
|
5121
|
-
|
5244
|
+
variant: "ghost",
|
5122
5245
|
onClick: (e) => e.stopPropagation(),
|
5123
5246
|
"data-handler-id": handlerId,
|
5124
5247
|
ref: dragRef,
|
@@ -5163,10 +5286,9 @@ const DynamicComponent = ({
|
|
5163
5286
|
] })
|
5164
5287
|
] });
|
5165
5288
|
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
5166
|
-
const accordionValue = React.useId();
|
5167
5289
|
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
5168
5290
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
5169
|
-
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
5291
|
+
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
5170
5292
|
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
5171
5293
|
/* @__PURE__ */ jsx(
|
5172
5294
|
Accordion.Trigger,
|
@@ -5177,10 +5299,39 @@ const DynamicComponent = ({
|
|
5177
5299
|
),
|
5178
5300
|
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
5179
5301
|
] }),
|
5180
|
-
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children:
|
5181
|
-
|
5182
|
-
|
5183
|
-
|
5302
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(
|
5303
|
+
Grid$1.Item,
|
5304
|
+
{
|
5305
|
+
col: 12,
|
5306
|
+
s: 12,
|
5307
|
+
xs: 12,
|
5308
|
+
direction: "column",
|
5309
|
+
alignItems: "stretch",
|
5310
|
+
children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5311
|
+
const fieldName = `${name2}.${index}.${field.name}`;
|
5312
|
+
const fieldWithTranslatedLabel = {
|
5313
|
+
...field,
|
5314
|
+
label: formatMessage({
|
5315
|
+
id: `content-manager.components.${componentUid}.${field.name}`,
|
5316
|
+
defaultMessage: field.label
|
5317
|
+
})
|
5318
|
+
};
|
5319
|
+
return /* @__PURE__ */ jsx(
|
5320
|
+
Grid$1.Item,
|
5321
|
+
{
|
5322
|
+
col: size,
|
5323
|
+
s: 12,
|
5324
|
+
xs: 12,
|
5325
|
+
direction: "column",
|
5326
|
+
alignItems: "stretch",
|
5327
|
+
children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel, name: fieldName })
|
5328
|
+
},
|
5329
|
+
fieldName
|
5330
|
+
);
|
5331
|
+
}) })
|
5332
|
+
},
|
5333
|
+
rowInd
|
5334
|
+
)) }) }) }) })
|
5184
5335
|
] }) }) })
|
5185
5336
|
] });
|
5186
5337
|
};
|
@@ -5488,4 +5639,4 @@ export {
|
|
5488
5639
|
transformDocument as t,
|
5489
5640
|
useLazyComponents as u
|
5490
5641
|
};
|
5491
|
-
//# sourceMappingURL=Field-
|
5642
|
+
//# sourceMappingURL=Field-Byr3mPTl.mjs.map
|