@strapi/content-manager 0.0.0-experimental.3c73a4c6f6073abdf1608121a200c3d4d87b1aa8 → 0.0.0-experimental.3d5794391d4c2d9eddf7bd162c02f4bb836eb7a6
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/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-BZIaEffq.js → ComponentConfigurationPage-Cjr64OS0.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-BZIaEffq.js.map → ComponentConfigurationPage-Cjr64OS0.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Cxz51Sve.mjs → ComponentConfigurationPage-DKuCF_uX.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-Cxz51Sve.mjs.map → ComponentConfigurationPage-DKuCF_uX.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CM62NN0L.js → EditConfigurationPage-BeikGxvq.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-CM62NN0L.js.map → EditConfigurationPage-BeikGxvq.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CZLbgfIp.mjs → EditConfigurationPage-CyqSP6ru.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-CZLbgfIp.mjs.map → EditConfigurationPage-CyqSP6ru.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-CzuJgWWp.mjs → EditViewPage-PrPHZN_9.mjs} +102 -51
- package/dist/_chunks/EditViewPage-PrPHZN_9.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CU7724gt.js → EditViewPage-pyqEgLgP.js} +100 -49
- package/dist/_chunks/EditViewPage-pyqEgLgP.js.map +1 -0
- package/dist/_chunks/{Field-QtUSh5mU.mjs → Field-DuAYQka5.mjs} +600 -228
- package/dist/_chunks/Field-DuAYQka5.mjs.map +1 -0
- package/dist/_chunks/{Field-Dh1yZyqy.js → Field-fKtb7rWK.js} +602 -230
- package/dist/_chunks/Field-fKtb7rWK.js.map +1 -0
- package/dist/_chunks/{Form-BOR8NOe1.js → Form-BPXw-S-J.js} +52 -34
- package/dist/_chunks/Form-BPXw-S-J.js.map +1 -0
- package/dist/_chunks/{Form-COLpvlnv.mjs → Form-Dxh71ckp.mjs} +54 -36
- package/dist/_chunks/Form-Dxh71ckp.mjs.map +1 -0
- package/dist/_chunks/{History-CW2akQ6h.js → History-BGGn9JGY.js} +171 -126
- package/dist/_chunks/History-BGGn9JGY.js.map +1 -0
- package/dist/_chunks/{History-Bu53Yfw-.mjs → History-CGblSVMc.mjs} +172 -127
- package/dist/_chunks/History-CGblSVMc.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-jzdhEk_u.js → ListConfigurationPage-D3Avyi4t.js} +58 -47
- package/dist/_chunks/ListConfigurationPage-D3Avyi4t.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-TqrmwjPN.mjs → ListConfigurationPage-TIM0JveM.mjs} +59 -49
- package/dist/_chunks/ListConfigurationPage-TIM0JveM.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BO_mOXIl.mjs → ListViewPage-C975eW-t.mjs} +128 -105
- package/dist/_chunks/ListViewPage-C975eW-t.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-B3bMOrMv.js → ListViewPage-DtAHWFMV.js} +130 -107
- package/dist/_chunks/ListViewPage-DtAHWFMV.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-D77xsNHj.js → NoContentTypePage-BFjWZX0i.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-D77xsNHj.js.map → NoContentTypePage-BFjWZX0i.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DqB0QV0k.mjs → NoContentTypePage-SgNTVGjF.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DqB0QV0k.mjs.map → NoContentTypePage-SgNTVGjF.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DTXi042N.mjs → NoPermissionsPage-D4XYRoPf.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DTXi042N.mjs.map → NoPermissionsPage-D4XYRoPf.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C6qTGogm.js → NoPermissionsPage-j7oulOpl.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C6qTGogm.js.map → NoPermissionsPage-j7oulOpl.js.map} +1 -1
- package/dist/_chunks/Preview-Bx1WfmKJ.js +256 -0
- package/dist/_chunks/Preview-Bx1WfmKJ.js.map +1 -0
- package/dist/_chunks/Preview-Cy6fuAnd.mjs +237 -0
- package/dist/_chunks/Preview-Cy6fuAnd.mjs.map +1 -0
- package/dist/_chunks/{Relations-B6fb2POW.js → Relations-CXQqwRXC.js} +72 -36
- package/dist/_chunks/Relations-CXQqwRXC.js.map +1 -0
- package/dist/_chunks/{Relations-CJ4qdkRo.mjs → Relations-DUrYWw0N.mjs} +73 -37
- package/dist/_chunks/Relations-DUrYWw0N.mjs.map +1 -0
- package/dist/_chunks/{en-9GwRW_ku.mjs → en-69jRDM9j.mjs} +31 -17
- package/dist/_chunks/{en-9GwRW_ku.mjs.map → en-69jRDM9j.mjs.map} +1 -1
- package/dist/_chunks/{en-DZXjRiWA.js → en-DAgtrRoa.js} +31 -17
- package/dist/_chunks/{en-DZXjRiWA.js.map → en-DAgtrRoa.js.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/{index-Dahjdw4h.mjs → index-Ta--2bRa.mjs} +1107 -883
- package/dist/_chunks/index-Ta--2bRa.mjs.map +1 -0
- package/dist/_chunks/{index-DcUu-_72.js → index-_j7lH3CO.js} +1099 -874
- package/dist/_chunks/index-_j7lH3CO.js.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-jcY4dyUG.js → layout-BDwU2I_y.js} +25 -12
- package/dist/_chunks/layout-BDwU2I_y.js.map +1 -0
- package/dist/_chunks/{layout-omucV6TV.mjs → layout-C8H4oKDo.mjs} +27 -14
- package/dist/_chunks/layout-C8H4oKDo.mjs.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-DGzD7ORa.js → relations-CPfMNzM6.js} +6 -7
- package/dist/_chunks/relations-CPfMNzM6.js.map +1 -0
- package/dist/_chunks/{relations-CN0-aw6p.mjs → relations-Ch70q86O.mjs} +6 -7
- package/dist/_chunks/relations-Ch70q86O.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/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +4 -3
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- 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/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -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 +6 -58
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- 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/constants.d.ts +1 -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 -17
- 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 +551 -263
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +552 -264
- 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/uid.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/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.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 +4 -4
- 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/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- 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 +15 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +30 -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 +18 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- 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/services/utils/populate.d.ts.map +1 -1
- 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 +14 -14
- package/dist/_chunks/EditViewPage-CU7724gt.js.map +0 -1
- package/dist/_chunks/EditViewPage-CzuJgWWp.mjs.map +0 -1
- package/dist/_chunks/Field-Dh1yZyqy.js.map +0 -1
- package/dist/_chunks/Field-QtUSh5mU.mjs.map +0 -1
- package/dist/_chunks/Form-BOR8NOe1.js.map +0 -1
- package/dist/_chunks/Form-COLpvlnv.mjs.map +0 -1
- package/dist/_chunks/History-Bu53Yfw-.mjs.map +0 -1
- package/dist/_chunks/History-CW2akQ6h.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-TqrmwjPN.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-jzdhEk_u.js.map +0 -1
- package/dist/_chunks/ListViewPage-B3bMOrMv.js.map +0 -1
- package/dist/_chunks/ListViewPage-BO_mOXIl.mjs.map +0 -1
- package/dist/_chunks/Relations-B6fb2POW.js.map +0 -1
- package/dist/_chunks/Relations-CJ4qdkRo.mjs.map +0 -1
- package/dist/_chunks/index-Dahjdw4h.mjs.map +0 -1
- package/dist/_chunks/index-DcUu-_72.js.map +0 -1
- package/dist/_chunks/layout-jcY4dyUG.js.map +0 -1
- package/dist/_chunks/layout-omucV6TV.mjs.map +0 -1
- package/dist/_chunks/relations-CN0-aw6p.mjs.map +0 -1
- package/dist/_chunks/relations-DGzD7ORa.js.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,24 @@ 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 { Typography, Flex,
|
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-Ta--2bRa.mjs";
|
9
9
|
import { generateNKeysBetween } from "fractional-indexing";
|
10
|
-
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-
|
10
|
+
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-DUrYWw0N.mjs";
|
11
11
|
import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, 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
15
|
import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DdHgKsqq.mjs";
|
16
|
-
import { g as getIn } from "./objects-
|
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 { p as prefixFileUrlWithBackendUrl, u as usePrev } from "./
|
20
|
+
import { p as prefixFileUrlWithBackendUrl, u as usePrev, a as useDebounce } from "./useDebounce-DmuSJIF3.mjs";
|
21
21
|
import * as Toolbar from "@radix-ui/react-toolbar";
|
22
|
-
import { useLocation } from "react-router-dom";
|
22
|
+
import { useLocation, useMatch } from "react-router-dom";
|
23
23
|
import CodeMirror from "codemirror5";
|
24
24
|
import sanitizeHtml from "sanitize-html";
|
25
25
|
import { getLanguage, highlight, highlightAuto } from "highlight.js";
|
@@ -160,6 +160,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
160
160
|
}, []);
|
161
161
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
162
162
|
};
|
163
|
+
const codeLanguages = [
|
164
|
+
{
|
165
|
+
value: "asm",
|
166
|
+
label: "Assembly"
|
167
|
+
},
|
168
|
+
{
|
169
|
+
value: "bash",
|
170
|
+
label: "Bash"
|
171
|
+
},
|
172
|
+
{
|
173
|
+
value: "c",
|
174
|
+
label: "C"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
value: "clojure",
|
178
|
+
label: "Clojure"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
value: "cobol",
|
182
|
+
label: "COBOL"
|
183
|
+
},
|
184
|
+
{
|
185
|
+
value: "cpp",
|
186
|
+
label: "C++"
|
187
|
+
},
|
188
|
+
{
|
189
|
+
value: "csharp",
|
190
|
+
label: "C#"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
value: "css",
|
194
|
+
label: "CSS"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
value: "dart",
|
198
|
+
label: "Dart"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
value: "dockerfile",
|
202
|
+
label: "Dockerfile"
|
203
|
+
},
|
204
|
+
{
|
205
|
+
value: "elixir",
|
206
|
+
label: "Elixir"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
value: "erlang",
|
210
|
+
label: "Erlang"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
value: "fortran",
|
214
|
+
label: "Fortran"
|
215
|
+
},
|
216
|
+
{
|
217
|
+
value: "fsharp",
|
218
|
+
label: "F#"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
value: "go",
|
222
|
+
label: "Go"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
value: "graphql",
|
226
|
+
label: "GraphQL"
|
227
|
+
},
|
228
|
+
{
|
229
|
+
value: "groovy",
|
230
|
+
label: "Groovy"
|
231
|
+
},
|
232
|
+
{
|
233
|
+
value: "haskell",
|
234
|
+
label: "Haskell"
|
235
|
+
},
|
236
|
+
{
|
237
|
+
value: "haxe",
|
238
|
+
label: "Haxe"
|
239
|
+
},
|
240
|
+
{
|
241
|
+
value: "html",
|
242
|
+
label: "HTML"
|
243
|
+
},
|
244
|
+
{
|
245
|
+
value: "ini",
|
246
|
+
label: "INI"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
value: "java",
|
250
|
+
label: "Java"
|
251
|
+
},
|
252
|
+
{
|
253
|
+
value: "javascript",
|
254
|
+
label: "JavaScript"
|
255
|
+
},
|
256
|
+
{
|
257
|
+
value: "jsx",
|
258
|
+
label: "JavaScript (React)"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
value: "json",
|
262
|
+
label: "JSON"
|
263
|
+
},
|
264
|
+
{
|
265
|
+
value: "julia",
|
266
|
+
label: "Julia"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
value: "kotlin",
|
270
|
+
label: "Kotlin"
|
271
|
+
},
|
272
|
+
{
|
273
|
+
value: "latex",
|
274
|
+
label: "LaTeX"
|
275
|
+
},
|
276
|
+
{
|
277
|
+
value: "lua",
|
278
|
+
label: "Lua"
|
279
|
+
},
|
280
|
+
{
|
281
|
+
value: "markdown",
|
282
|
+
label: "Markdown"
|
283
|
+
},
|
284
|
+
{
|
285
|
+
value: "matlab",
|
286
|
+
label: "MATLAB"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
value: "makefile",
|
290
|
+
label: "Makefile"
|
291
|
+
},
|
292
|
+
{
|
293
|
+
value: "objectivec",
|
294
|
+
label: "Objective-C"
|
295
|
+
},
|
296
|
+
{
|
297
|
+
value: "perl",
|
298
|
+
label: "Perl"
|
299
|
+
},
|
300
|
+
{
|
301
|
+
value: "php",
|
302
|
+
label: "PHP"
|
303
|
+
},
|
304
|
+
{
|
305
|
+
value: "plaintext",
|
306
|
+
label: "Plain text"
|
307
|
+
},
|
308
|
+
{
|
309
|
+
value: "powershell",
|
310
|
+
label: "PowerShell"
|
311
|
+
},
|
312
|
+
{
|
313
|
+
value: "python",
|
314
|
+
label: "Python"
|
315
|
+
},
|
316
|
+
{
|
317
|
+
value: "r",
|
318
|
+
label: "R"
|
319
|
+
},
|
320
|
+
{
|
321
|
+
value: "ruby",
|
322
|
+
label: "Ruby"
|
323
|
+
},
|
324
|
+
{
|
325
|
+
value: "rust",
|
326
|
+
label: "Rust"
|
327
|
+
},
|
328
|
+
{
|
329
|
+
value: "sas",
|
330
|
+
label: "SAS"
|
331
|
+
},
|
332
|
+
{
|
333
|
+
value: "scala",
|
334
|
+
label: "Scala"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
value: "scheme",
|
338
|
+
label: "Scheme"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
value: "shell",
|
342
|
+
label: "Shell"
|
343
|
+
},
|
344
|
+
{
|
345
|
+
value: "sql",
|
346
|
+
label: "SQL"
|
347
|
+
},
|
348
|
+
{
|
349
|
+
value: "stata",
|
350
|
+
label: "Stata"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
value: "swift",
|
354
|
+
label: "Swift"
|
355
|
+
},
|
356
|
+
{
|
357
|
+
value: "typescript",
|
358
|
+
label: "TypeScript"
|
359
|
+
},
|
360
|
+
{
|
361
|
+
value: "tsx",
|
362
|
+
label: "TypeScript (React)"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
value: "vbnet",
|
366
|
+
label: "VB.NET"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
value: "xml",
|
370
|
+
label: "XML"
|
371
|
+
},
|
372
|
+
{
|
373
|
+
value: "yaml",
|
374
|
+
label: "YAML"
|
375
|
+
}
|
376
|
+
];
|
163
377
|
const baseHandleConvert = (editor, attributesToSet) => {
|
164
378
|
const [_, lastNodePath] = Editor$1.last(editor, []);
|
165
379
|
Transforms.unwrapNodes(editor, {
|
@@ -230,6 +444,7 @@ const CodeBlock = styled.pre`
|
|
230
444
|
overflow: auto;
|
231
445
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
232
446
|
flex-shrink: 1;
|
447
|
+
|
233
448
|
& > code {
|
234
449
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
235
450
|
monospace;
|
@@ -238,9 +453,61 @@ const CodeBlock = styled.pre`
|
|
238
453
|
max-width: 100%;
|
239
454
|
}
|
240
455
|
`;
|
456
|
+
const CodeEditor = (props) => {
|
457
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
458
|
+
const editorIsFocused = useFocused();
|
459
|
+
const imageIsSelected = useSelected();
|
460
|
+
const { formatMessage } = useIntl();
|
461
|
+
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
462
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
463
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
|
464
|
+
/* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
|
465
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
|
466
|
+
Box,
|
467
|
+
{
|
468
|
+
position: "absolute",
|
469
|
+
background: "neutral0",
|
470
|
+
borderColor: "neutral150",
|
471
|
+
borderStyle: "solid",
|
472
|
+
borderWidth: "0.5px",
|
473
|
+
shadow: "tableShadow",
|
474
|
+
top: "100%",
|
475
|
+
marginTop: 1,
|
476
|
+
right: 0,
|
477
|
+
padding: 1,
|
478
|
+
hasRadius: true,
|
479
|
+
children: /* @__PURE__ */ jsx(
|
480
|
+
SingleSelect,
|
481
|
+
{
|
482
|
+
onChange: (open) => {
|
483
|
+
Transforms.setNodes(
|
484
|
+
editor,
|
485
|
+
{ language: open.toString() },
|
486
|
+
{ match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
|
487
|
+
);
|
488
|
+
},
|
489
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
490
|
+
onOpenChange: (open) => {
|
491
|
+
setIsSelectOpen(open);
|
492
|
+
if (!open) {
|
493
|
+
ReactEditor.focus(editor);
|
494
|
+
}
|
495
|
+
},
|
496
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
497
|
+
"aria-label": formatMessage({
|
498
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
499
|
+
defaultMessage: "Select a language"
|
500
|
+
}),
|
501
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
|
502
|
+
}
|
503
|
+
)
|
504
|
+
}
|
505
|
+
)
|
506
|
+
] });
|
507
|
+
};
|
241
508
|
const codeBlocks = {
|
242
509
|
code: {
|
243
|
-
renderElement: (props) => /* @__PURE__ */ jsx(
|
510
|
+
renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
|
244
511
|
icon: Code,
|
245
512
|
label: {
|
246
513
|
id: "components.Blocks.blocks.code",
|
@@ -249,7 +516,7 @@ const codeBlocks = {
|
|
249
516
|
matchNode: (node) => node.type === "code",
|
250
517
|
isInBlocksSelector: true,
|
251
518
|
handleConvert(editor) {
|
252
|
-
baseHandleConvert(editor, { type: "code" });
|
519
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
253
520
|
},
|
254
521
|
handleEnterKey(editor) {
|
255
522
|
pressEnterTwiceToExit(editor);
|
@@ -589,18 +856,12 @@ const LinkContent = React.forwardRef(
|
|
589
856
|
const [popoverOpen, setPopoverOpen] = React.useState(
|
590
857
|
editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
|
591
858
|
);
|
592
|
-
const linkRef = React.useRef(null);
|
593
859
|
const elementText = link.children.map((child) => child.text).join("");
|
594
860
|
const [linkText, setLinkText] = React.useState(elementText);
|
595
861
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
596
862
|
const linkInputRef = React.useRef(null);
|
597
|
-
const
|
863
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
|
598
864
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
599
|
-
const handleOpenEditPopover = (e) => {
|
600
|
-
e.preventDefault();
|
601
|
-
setPopoverOpen(true);
|
602
|
-
setShowRemoveButton(true);
|
603
|
-
};
|
604
865
|
const onLinkChange = (e) => {
|
605
866
|
setIsSaveDisabled(false);
|
606
867
|
setLinkUrl(e.target.value);
|
@@ -621,33 +882,33 @@ const LinkContent = React.forwardRef(
|
|
621
882
|
editLink(editor, { url: linkUrl, text: linkText });
|
622
883
|
setPopoverOpen(false);
|
623
884
|
editor.lastInsertedLinkPath = null;
|
885
|
+
ReactEditor.focus(editor);
|
624
886
|
};
|
625
|
-
const
|
626
|
-
setPopoverOpen(false);
|
887
|
+
const handleClose = () => {
|
627
888
|
if (link.url === "") {
|
628
889
|
removeLink(editor);
|
629
890
|
}
|
891
|
+
setPopoverOpen(false);
|
630
892
|
ReactEditor.focus(editor);
|
631
893
|
};
|
632
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
633
|
-
const composedRefs = useComposedRefs(linkRef, forwardedRef);
|
634
894
|
React.useEffect(() => {
|
635
895
|
if (popoverOpen)
|
636
896
|
linkInputRef.current?.focus();
|
637
897
|
}, [popoverOpen]);
|
638
|
-
|
639
|
-
|
898
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
899
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
|
900
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
640
901
|
StyledBaseLink,
|
641
902
|
{
|
642
903
|
...attributes,
|
643
|
-
ref:
|
904
|
+
ref: forwardedRef,
|
644
905
|
href: link.url,
|
645
|
-
onClick:
|
906
|
+
onClick: () => setPopoverOpen(true),
|
646
907
|
color: "primary600",
|
647
908
|
children
|
648
909
|
}
|
649
|
-
),
|
650
|
-
|
910
|
+
) }),
|
911
|
+
/* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
|
651
912
|
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
652
913
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
653
914
|
id: "components.Blocks.popover.text",
|
@@ -693,7 +954,7 @@ const LinkContent = React.forwardRef(
|
|
693
954
|
{
|
694
955
|
variant: "danger-light",
|
695
956
|
onClick: () => removeLink(editor),
|
696
|
-
$visible:
|
957
|
+
$visible: isLastInsertedLink,
|
697
958
|
children: formatMessage({
|
698
959
|
id: "components.Blocks.popover.remove",
|
699
960
|
defaultMessage: "Remove"
|
@@ -701,11 +962,11 @@ const LinkContent = React.forwardRef(
|
|
701
962
|
}
|
702
963
|
),
|
703
964
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
704
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
965
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
705
966
|
id: "components.Blocks.popover.cancel",
|
706
967
|
defaultMessage: "Cancel"
|
707
968
|
}) }),
|
708
|
-
/* @__PURE__ */ jsx(Button, {
|
969
|
+
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
709
970
|
id: "components.Blocks.popover.save",
|
710
971
|
defaultMessage: "Save"
|
711
972
|
}) })
|
@@ -1146,7 +1407,7 @@ const ToolbarButton = ({
|
|
1146
1407
|
width: 7,
|
1147
1408
|
height: 7,
|
1148
1409
|
hasRadius: true,
|
1149
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
1410
|
+
children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1150
1411
|
}
|
1151
1412
|
)
|
1152
1413
|
}
|
@@ -1291,6 +1552,26 @@ const ListButton = ({ block, format }) => {
|
|
1291
1552
|
}
|
1292
1553
|
return false;
|
1293
1554
|
};
|
1555
|
+
const isListDisabled = () => {
|
1556
|
+
if (disabled) {
|
1557
|
+
return true;
|
1558
|
+
}
|
1559
|
+
if (!editor.selection) {
|
1560
|
+
return false;
|
1561
|
+
}
|
1562
|
+
const anchorNodeEntry = Editor$1.above(editor, {
|
1563
|
+
at: editor.selection.anchor,
|
1564
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1565
|
+
});
|
1566
|
+
const focusNodeEntry = Editor$1.above(editor, {
|
1567
|
+
at: editor.selection.focus,
|
1568
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1569
|
+
});
|
1570
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
1571
|
+
return false;
|
1572
|
+
}
|
1573
|
+
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
1574
|
+
};
|
1294
1575
|
const toggleList = (format2) => {
|
1295
1576
|
let currentListEntry;
|
1296
1577
|
if (editor.selection) {
|
@@ -1324,7 +1605,7 @@ const ListButton = ({ block, format }) => {
|
|
1324
1605
|
name: format,
|
1325
1606
|
label: block.label,
|
1326
1607
|
isActive: isListActive(),
|
1327
|
-
disabled,
|
1608
|
+
disabled: isListDisabled(),
|
1328
1609
|
handleClick: () => toggleList(format)
|
1329
1610
|
}
|
1330
1611
|
);
|
@@ -1468,6 +1749,7 @@ const DragItem = styled(Flex)`
|
|
1468
1749
|
}
|
1469
1750
|
`;
|
1470
1751
|
const DragIconButton = styled(IconButton)`
|
1752
|
+
user-select: none;
|
1471
1753
|
display: flex;
|
1472
1754
|
align-items: center;
|
1473
1755
|
justify-content: center;
|
@@ -1491,7 +1773,7 @@ const DragIconButton = styled(IconButton)`
|
|
1491
1773
|
}
|
1492
1774
|
svg {
|
1493
1775
|
height: auto;
|
1494
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1776
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1495
1777
|
|
1496
1778
|
path {
|
1497
1779
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1596,6 +1878,7 @@ const DragAndDropElement = ({
|
|
1596
1878
|
DragIconButton,
|
1597
1879
|
{
|
1598
1880
|
tag: "div",
|
1881
|
+
contentEditable: false,
|
1599
1882
|
role: "button",
|
1600
1883
|
tabIndex: 0,
|
1601
1884
|
withTooltip: false,
|
@@ -1608,7 +1891,7 @@ const DragAndDropElement = ({
|
|
1608
1891
|
disabled,
|
1609
1892
|
draggable: true,
|
1610
1893
|
$dragHandleTopMargin: dragHandleTopMargin,
|
1611
|
-
children: /* @__PURE__ */ jsx(Drag, { color: "
|
1894
|
+
children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
|
1612
1895
|
}
|
1613
1896
|
),
|
1614
1897
|
children
|
@@ -1932,7 +2215,7 @@ const EditorLayout$1 = ({
|
|
1932
2215
|
/* @__PURE__ */ jsx(
|
1933
2216
|
CollapseIconButton,
|
1934
2217
|
{
|
1935
|
-
|
2218
|
+
label: formatMessage({
|
1936
2219
|
id: getTranslation("components.Blocks.collapse"),
|
1937
2220
|
defaultMessage: "Collapse"
|
1938
2221
|
}),
|
@@ -2271,7 +2554,7 @@ const BlocksEditor = React.forwardRef(
|
|
2271
2554
|
!isExpandedMode && /* @__PURE__ */ jsx(
|
2272
2555
|
ExpandIconButton,
|
2273
2556
|
{
|
2274
|
-
|
2557
|
+
label: formatMessage({
|
2275
2558
|
id: getTranslation("components.Blocks.expand"),
|
2276
2559
|
defaultMessage: "Expand"
|
2277
2560
|
}),
|
@@ -2337,30 +2620,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2337
2620
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2338
2621
|
const { formatMessage } = useIntl();
|
2339
2622
|
const field = useField(name2);
|
2340
|
-
return /* @__PURE__ */
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
),
|
2362
|
-
field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2363
|
-
] });
|
2623
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
2624
|
+
Box,
|
2625
|
+
{
|
2626
|
+
tag: "button",
|
2627
|
+
background: "neutral100",
|
2628
|
+
borderColor: field.error ? "danger600" : "neutral200",
|
2629
|
+
hasRadius: true,
|
2630
|
+
disabled,
|
2631
|
+
onClick,
|
2632
|
+
paddingTop: 9,
|
2633
|
+
paddingBottom: 9,
|
2634
|
+
type: "button",
|
2635
|
+
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
2636
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
|
2637
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
|
2638
|
+
id: getTranslation("components.empty-repeatable"),
|
2639
|
+
defaultMessage: "No entry yet. Click to add one."
|
2640
|
+
}) }) })
|
2641
|
+
] })
|
2642
|
+
}
|
2643
|
+
) });
|
2364
2644
|
};
|
2365
2645
|
const CircleIcon = styled(PlusCircle)`
|
2366
2646
|
width: 2.4rem;
|
@@ -2378,6 +2658,7 @@ const NonRepeatableComponent = ({
|
|
2378
2658
|
children,
|
2379
2659
|
layout
|
2380
2660
|
}) => {
|
2661
|
+
const { formatMessage } = useIntl();
|
2381
2662
|
const { value } = useField(name2);
|
2382
2663
|
const level = useComponent("NonRepeatableComponent", (state) => state.level);
|
2383
2664
|
const isNested = level > 0;
|
@@ -2392,9 +2673,24 @@ const NonRepeatableComponent = ({
|
|
2392
2673
|
hasRadius: isNested,
|
2393
2674
|
borderColor: isNested ? "neutral200" : void 0,
|
2394
2675
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2395
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2676
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2396
2677
|
const completeFieldName = `${name2}.${field.name}`;
|
2397
|
-
|
2678
|
+
const translatedLabel = formatMessage({
|
2679
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2680
|
+
defaultMessage: field.label
|
2681
|
+
});
|
2682
|
+
return /* @__PURE__ */ jsx(
|
2683
|
+
Grid$1.Item,
|
2684
|
+
{
|
2685
|
+
col: size,
|
2686
|
+
s: 12,
|
2687
|
+
xs: 12,
|
2688
|
+
direction: "column",
|
2689
|
+
alignItems: "stretch",
|
2690
|
+
children: children({ ...field, label: translatedLabel, name: completeFieldName })
|
2691
|
+
},
|
2692
|
+
completeFieldName
|
2693
|
+
);
|
2398
2694
|
}) }, index);
|
2399
2695
|
}) })
|
2400
2696
|
}
|
@@ -2413,13 +2709,34 @@ const RepeatableComponent = ({
|
|
2413
2709
|
const { search: searchString } = useLocation();
|
2414
2710
|
const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2415
2711
|
const { components } = useDoc();
|
2416
|
-
const {
|
2712
|
+
const {
|
2713
|
+
value = [],
|
2714
|
+
error,
|
2715
|
+
rawError
|
2716
|
+
} = useField(name2);
|
2417
2717
|
const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2418
2718
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2419
2719
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2420
2720
|
const { max = Infinity } = attribute;
|
2421
2721
|
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2422
2722
|
const [liveText, setLiveText] = React.useState("");
|
2723
|
+
React.useEffect(() => {
|
2724
|
+
const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
|
2725
|
+
const hasNestedValue = value && Array.isArray(value) && value.length > 0;
|
2726
|
+
if (hasNestedErrors && hasNestedValue) {
|
2727
|
+
const errorOpenItems = rawError.map((_, idx) => {
|
2728
|
+
return value[idx] ? value[idx].__temp_key__ : null;
|
2729
|
+
}).filter((value2) => !!value2);
|
2730
|
+
if (errorOpenItems && errorOpenItems.length > 0) {
|
2731
|
+
setCollapseToOpen((collapseToOpen2) => {
|
2732
|
+
if (!errorOpenItems.includes(collapseToOpen2)) {
|
2733
|
+
return errorOpenItems[0];
|
2734
|
+
}
|
2735
|
+
return collapseToOpen2;
|
2736
|
+
});
|
2737
|
+
}
|
2738
|
+
}
|
2739
|
+
}, [rawError, value]);
|
2423
2740
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2424
2741
|
if (search.has("field")) {
|
2425
2742
|
const fieldParam = search.get("field");
|
@@ -2570,9 +2887,28 @@ const RepeatableComponent = ({
|
|
2570
2887
|
onGrabItem: handleGrabItem,
|
2571
2888
|
__temp_key__: key,
|
2572
2889
|
children: layout.map((row, index2) => {
|
2573
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2890
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2574
2891
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2575
|
-
|
2892
|
+
const translatedLabel = formatMessage({
|
2893
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2894
|
+
defaultMessage: field.label
|
2895
|
+
});
|
2896
|
+
return /* @__PURE__ */ jsx(
|
2897
|
+
Grid$1.Item,
|
2898
|
+
{
|
2899
|
+
col: size,
|
2900
|
+
s: 12,
|
2901
|
+
xs: 12,
|
2902
|
+
direction: "column",
|
2903
|
+
alignItems: "stretch",
|
2904
|
+
children: children({
|
2905
|
+
...field,
|
2906
|
+
label: translatedLabel,
|
2907
|
+
name: completeFieldName
|
2908
|
+
})
|
2909
|
+
},
|
2910
|
+
completeFieldName
|
2911
|
+
);
|
2576
2912
|
}) }, index2);
|
2577
2913
|
})
|
2578
2914
|
}
|
@@ -2617,7 +2953,7 @@ const TextButtonCustom = styled(TextButton)`
|
|
2617
2953
|
}
|
2618
2954
|
|
2619
2955
|
@media (prefers-reduced-motion: no-preference) {
|
2620
|
-
transition: background-color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
2956
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2621
2957
|
}
|
2622
2958
|
`;
|
2623
2959
|
const Component = ({
|
@@ -2667,7 +3003,7 @@ const Component = ({
|
|
2667
3003
|
/* @__PURE__ */ jsx(
|
2668
3004
|
IconButton,
|
2669
3005
|
{
|
2670
|
-
|
3006
|
+
variant: "ghost",
|
2671
3007
|
onClick: onDeleteComponent,
|
2672
3008
|
label: formatMessage({
|
2673
3009
|
id: getTranslation("containers.Edit.delete"),
|
@@ -2680,7 +3016,7 @@ const Component = ({
|
|
2680
3016
|
IconButton,
|
2681
3017
|
{
|
2682
3018
|
ref: composedAccordionRefs,
|
2683
|
-
|
3019
|
+
variant: "ghost",
|
2684
3020
|
onClick: (e) => e.stopPropagation(),
|
2685
3021
|
"data-handler-id": handlerId,
|
2686
3022
|
label: formatMessage({
|
@@ -2750,7 +3086,7 @@ const ComponentInput = ({
|
|
2750
3086
|
id: getTranslation("components.reset-entry"),
|
2751
3087
|
defaultMessage: "Reset Entry"
|
2752
3088
|
}),
|
2753
|
-
|
3089
|
+
variant: "ghost",
|
2754
3090
|
onClick: () => {
|
2755
3091
|
field.onChange(name2, null);
|
2756
3092
|
},
|
@@ -2779,11 +3115,8 @@ const AddComponentButton = ({
|
|
2779
3115
|
onClick,
|
2780
3116
|
disabled: isDisabled,
|
2781
3117
|
background: "neutral0",
|
2782
|
-
paddingTop: 3,
|
2783
|
-
paddingBottom: 3,
|
2784
|
-
paddingLeft: 4,
|
2785
|
-
paddingRight: 4,
|
2786
3118
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
3119
|
+
variant: "tertiary",
|
2787
3120
|
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
2788
3121
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2789
3122
|
/* @__PURE__ */ jsx(
|
@@ -2812,10 +3145,11 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
2812
3145
|
}
|
2813
3146
|
`;
|
2814
3147
|
const AddComponentTitle = styled(Typography)``;
|
2815
|
-
const StyledButton = styled(
|
3148
|
+
const StyledButton = styled(Button)`
|
2816
3149
|
border-radius: 26px;
|
2817
3150
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2818
3151
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3152
|
+
height: 5rem;
|
2819
3153
|
|
2820
3154
|
&:hover {
|
2821
3155
|
${AddComponentTitle} {
|
@@ -2827,7 +3161,7 @@ const StyledButton = styled(BaseButton)`
|
|
2827
3161
|
fill: ${({ theme }) => theme.colors.primary600};
|
2828
3162
|
}
|
2829
3163
|
> path {
|
2830
|
-
fill: ${({ theme }) => theme.colors.
|
3164
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
2831
3165
|
}
|
2832
3166
|
}
|
2833
3167
|
}
|
@@ -2885,7 +3219,7 @@ const ComponentBox = styled(Flex)`
|
|
2885
3219
|
cursor: pointer;
|
2886
3220
|
|
2887
3221
|
@media (prefers-reduced-motion: no-preference) {
|
2888
|
-
transition: color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
3222
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2889
3223
|
}
|
2890
3224
|
|
2891
3225
|
&:focus,
|
@@ -2958,18 +3292,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
2958
3292
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
2959
3293
|
] });
|
2960
3294
|
};
|
2961
|
-
function useDebounce(value, delay) {
|
2962
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
2963
|
-
useEffect(() => {
|
2964
|
-
const handler = setTimeout(() => {
|
2965
|
-
setDebouncedValue(value);
|
2966
|
-
}, delay);
|
2967
|
-
return () => {
|
2968
|
-
clearTimeout(handler);
|
2969
|
-
};
|
2970
|
-
}, [value, delay]);
|
2971
|
-
return debouncedValue;
|
2972
|
-
}
|
2973
3295
|
const uidApi = contentManagerApi.injectEndpoints({
|
2974
3296
|
endpoints: (builder) => ({
|
2975
3297
|
getDefaultUID: builder.query({
|
@@ -3004,7 +3326,10 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
3004
3326
|
config: {
|
3005
3327
|
params
|
3006
3328
|
}
|
3007
|
-
})
|
3329
|
+
}),
|
3330
|
+
providesTags: (_res, _error, params) => [
|
3331
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3332
|
+
]
|
3008
3333
|
})
|
3009
3334
|
})
|
3010
3335
|
});
|
@@ -3016,8 +3341,10 @@ const UIDInput = React.forwardRef(
|
|
3016
3341
|
const allFormValues = useForm("InputUID", (form) => form.values);
|
3017
3342
|
const [availability, setAvailability] = React.useState();
|
3018
3343
|
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3344
|
+
const isCloning = useMatch(CLONE_PATH) !== null;
|
3019
3345
|
const field = useField(name2);
|
3020
3346
|
const debouncedValue = useDebounce(field.value, 300);
|
3347
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3021
3348
|
const { toggleNotification } = useNotification();
|
3022
3349
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3023
3350
|
const { formatMessage } = useIntl();
|
@@ -3093,8 +3420,9 @@ const UIDInput = React.forwardRef(
|
|
3093
3420
|
params
|
3094
3421
|
},
|
3095
3422
|
{
|
3423
|
+
// Don't check availability if the value is empty or wasn't changed
|
3096
3424
|
skip: !Boolean(
|
3097
|
-
|
3425
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3098
3426
|
)
|
3099
3427
|
}
|
3100
3428
|
);
|
@@ -3123,6 +3451,7 @@ const UIDInput = React.forwardRef(
|
|
3123
3451
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3124
3452
|
const fieldRef = useFocusInputField(name2);
|
3125
3453
|
const composedRefs = useComposedRefs(ref, fieldRef);
|
3454
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3126
3455
|
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3127
3456
|
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3128
3457
|
/* @__PURE__ */ jsx(
|
@@ -3131,7 +3460,7 @@ const UIDInput = React.forwardRef(
|
|
3131
3460
|
ref: composedRefs,
|
3132
3461
|
disabled: props.disabled,
|
3133
3462
|
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3134
|
-
|
3463
|
+
shouldShowAvailability && /* @__PURE__ */ jsxs(
|
3135
3464
|
TextValidation,
|
3136
3465
|
{
|
3137
3466
|
alignItems: "center",
|
@@ -3965,7 +4294,7 @@ const EditorLayout = ({
|
|
3965
4294
|
justifyContent: "flex-end",
|
3966
4295
|
shrink: 0,
|
3967
4296
|
width: "100%",
|
3968
|
-
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4297
|
+
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
3969
4298
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
3970
4299
|
id: "components.Wysiwyg.collapse",
|
3971
4300
|
defaultMessage: "Collapse"
|
@@ -3983,12 +4312,14 @@ const EditorLayout = ({
|
|
3983
4312
|
) }) });
|
3984
4313
|
}
|
3985
4314
|
return /* @__PURE__ */ jsx(
|
3986
|
-
|
4315
|
+
Flex,
|
3987
4316
|
{
|
3988
4317
|
borderColor: error ? "danger600" : "neutral200",
|
3989
4318
|
borderStyle: "solid",
|
3990
4319
|
borderWidth: "1px",
|
3991
4320
|
hasRadius: true,
|
4321
|
+
direction: "column",
|
4322
|
+
alignItems: "stretch",
|
3992
4323
|
children
|
3993
4324
|
}
|
3994
4325
|
);
|
@@ -3999,11 +4330,19 @@ const ExpandWrapper = styled(Flex)`
|
|
3999
4330
|
const BoxWithBorder = styled(Box)`
|
4000
4331
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4001
4332
|
`;
|
4002
|
-
const ExpandButton$1 = styled(
|
4333
|
+
const ExpandButton$1 = styled(Button)`
|
4003
4334
|
background-color: transparent;
|
4004
4335
|
border: none;
|
4005
4336
|
align-items: center;
|
4006
4337
|
|
4338
|
+
& > span {
|
4339
|
+
display: flex;
|
4340
|
+
justify-content: space-between;
|
4341
|
+
align-items: center;
|
4342
|
+
width: 100%;
|
4343
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4344
|
+
}
|
4345
|
+
|
4007
4346
|
svg {
|
4008
4347
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4009
4348
|
|
@@ -4270,42 +4609,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4270
4609
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4271
4610
|
}
|
4272
4611
|
};
|
4273
|
-
const CustomIconButton = styled(IconButton)`
|
4274
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4275
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4276
|
-
outline-offset: -2px !important;
|
4277
|
-
|
4278
|
-
svg {
|
4279
|
-
width: 1.8rem;
|
4280
|
-
height: 1.8rem;
|
4281
|
-
}
|
4282
|
-
`;
|
4283
|
-
const CustomLinkIconButton = styled(CustomIconButton)`
|
4284
|
-
svg {
|
4285
|
-
width: 0.8rem;
|
4286
|
-
height: 0.8rem;
|
4287
|
-
}
|
4288
|
-
`;
|
4289
4612
|
const MainButtons = styled(IconButtonGroup)`
|
4290
4613
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4291
4614
|
`;
|
4292
4615
|
const MoreButton = styled(IconButton)`
|
4293
4616
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4294
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4295
|
-
|
4296
|
-
svg {
|
4297
|
-
width: 1.8rem;
|
4298
|
-
height: 1.8rem;
|
4299
|
-
}
|
4300
4617
|
`;
|
4301
4618
|
const IconButtonGroupMargin = styled(IconButtonGroup)`
|
4302
4619
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4303
4620
|
`;
|
4304
|
-
const ExpandButton = styled(
|
4621
|
+
const ExpandButton = styled(Button)`
|
4305
4622
|
background-color: transparent;
|
4306
4623
|
border: none;
|
4307
4624
|
align-items: center;
|
4308
4625
|
|
4626
|
+
& > span {
|
4627
|
+
display: flex;
|
4628
|
+
justify-content: space-between;
|
4629
|
+
align-items: center;
|
4630
|
+
width: 100%;
|
4631
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4632
|
+
}
|
4633
|
+
|
4309
4634
|
svg {
|
4310
4635
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4311
4636
|
path {
|
@@ -4317,8 +4642,8 @@ const ExpandButton = styled(BaseButton)`
|
|
4317
4642
|
`;
|
4318
4643
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4319
4644
|
const { formatMessage } = useIntl();
|
4320
|
-
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: [
|
4321
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4645
|
+
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: [
|
4646
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
4322
4647
|
id: "components.WysiwygBottomControls.fullscreen",
|
4323
4648
|
defaultMessage: "Expand"
|
4324
4649
|
}) }),
|
@@ -4340,7 +4665,7 @@ const WysiwygNav = ({
|
|
4340
4665
|
id: "components.Wysiwyg.selectOptions.title",
|
4341
4666
|
defaultMessage: "Add a title"
|
4342
4667
|
});
|
4343
|
-
|
4668
|
+
React.useRef(null);
|
4344
4669
|
const handleTogglePopover = () => {
|
4345
4670
|
setVisiblePopover((prev) => !prev);
|
4346
4671
|
};
|
@@ -4354,18 +4679,27 @@ const WysiwygNav = ({
|
|
4354
4679
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4355
4680
|
children: [
|
4356
4681
|
/* @__PURE__ */ jsxs(Flex, { children: [
|
4357
|
-
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4358
|
-
|
4359
|
-
|
4360
|
-
|
4361
|
-
|
4362
|
-
|
4363
|
-
|
4364
|
-
|
4682
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4683
|
+
SingleSelect,
|
4684
|
+
{
|
4685
|
+
disabled: true,
|
4686
|
+
placeholder: selectPlaceholder,
|
4687
|
+
"aria-label": selectPlaceholder,
|
4688
|
+
size: "S",
|
4689
|
+
children: [
|
4690
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4691
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
4692
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
|
4693
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
|
4694
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
|
4695
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4696
|
+
]
|
4697
|
+
}
|
4698
|
+
) }),
|
4365
4699
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4366
|
-
/* @__PURE__ */ jsx(
|
4367
|
-
/* @__PURE__ */ jsx(
|
4368
|
-
/* @__PURE__ */ jsx(
|
4700
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4701
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
|
4702
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
|
4369
4703
|
] }),
|
4370
4704
|
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4371
4705
|
] }),
|
@@ -4392,6 +4726,7 @@ const WysiwygNav = ({
|
|
4392
4726
|
placeholder: selectPlaceholder,
|
4393
4727
|
"aria-label": selectPlaceholder,
|
4394
4728
|
onChange: (value) => onActionClick(value, editorRef),
|
4729
|
+
size: "S",
|
4395
4730
|
children: [
|
4396
4731
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4397
4732
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4403,17 +4738,9 @@ const WysiwygNav = ({
|
|
4403
4738
|
}
|
4404
4739
|
) }),
|
4405
4740
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4741
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4406
4742
|
/* @__PURE__ */ jsx(
|
4407
|
-
|
4408
|
-
{
|
4409
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4410
|
-
label: "Bold",
|
4411
|
-
name: "Bold",
|
4412
|
-
children: /* @__PURE__ */ jsx(Bold, {})
|
4413
|
-
}
|
4414
|
-
),
|
4415
|
-
/* @__PURE__ */ jsx(
|
4416
|
-
CustomIconButton,
|
4743
|
+
IconButton,
|
4417
4744
|
{
|
4418
4745
|
onClick: () => onActionClick("Italic", editorRef),
|
4419
4746
|
label: "Italic",
|
@@ -4422,7 +4749,7 @@ const WysiwygNav = ({
|
|
4422
4749
|
}
|
4423
4750
|
),
|
4424
4751
|
/* @__PURE__ */ jsx(
|
4425
|
-
|
4752
|
+
IconButton,
|
4426
4753
|
{
|
4427
4754
|
onClick: () => onActionClick("Underline", editorRef),
|
4428
4755
|
label: "Underline",
|
@@ -4431,79 +4758,81 @@ const WysiwygNav = ({
|
|
4431
4758
|
}
|
4432
4759
|
)
|
4433
4760
|
] }),
|
4434
|
-
/* @__PURE__ */
|
4435
|
-
|
4436
|
-
/* @__PURE__ */ jsxs(
|
4437
|
-
/* @__PURE__ */
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
|
4444
|
-
|
4445
|
-
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
|
4466
|
-
/* @__PURE__ */
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4494
|
-
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4761
|
+
/* @__PURE__ */ jsxs(Popover.Root, { children: [
|
4762
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsx(More, {}) }) }),
|
4763
|
+
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4764
|
+
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4765
|
+
/* @__PURE__ */ jsx(
|
4766
|
+
IconButton,
|
4767
|
+
{
|
4768
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4769
|
+
label: "Strikethrough",
|
4770
|
+
name: "Strikethrough",
|
4771
|
+
children: /* @__PURE__ */ jsx(StrikeThrough, {})
|
4772
|
+
}
|
4773
|
+
),
|
4774
|
+
/* @__PURE__ */ jsx(
|
4775
|
+
IconButton,
|
4776
|
+
{
|
4777
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4778
|
+
label: "BulletList",
|
4779
|
+
name: "BulletList",
|
4780
|
+
children: /* @__PURE__ */ jsx(BulletList, {})
|
4781
|
+
}
|
4782
|
+
),
|
4783
|
+
/* @__PURE__ */ jsx(
|
4784
|
+
IconButton,
|
4785
|
+
{
|
4786
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4787
|
+
label: "NumberList",
|
4788
|
+
name: "NumberList",
|
4789
|
+
children: /* @__PURE__ */ jsx(NumberList, {})
|
4790
|
+
}
|
4791
|
+
)
|
4792
|
+
] }),
|
4793
|
+
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4794
|
+
/* @__PURE__ */ jsx(
|
4795
|
+
IconButton,
|
4796
|
+
{
|
4797
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4798
|
+
label: "Code",
|
4799
|
+
name: "Code",
|
4800
|
+
children: /* @__PURE__ */ jsx(Code, {})
|
4801
|
+
}
|
4802
|
+
),
|
4803
|
+
/* @__PURE__ */ jsx(
|
4804
|
+
IconButton,
|
4805
|
+
{
|
4806
|
+
onClick: () => {
|
4807
|
+
handleTogglePopover();
|
4808
|
+
onToggleMediaLib();
|
4809
|
+
},
|
4810
|
+
label: "Image",
|
4811
|
+
name: "Image",
|
4812
|
+
children: /* @__PURE__ */ jsx(Image$1, {})
|
4813
|
+
}
|
4814
|
+
),
|
4815
|
+
/* @__PURE__ */ jsx(
|
4816
|
+
IconButton,
|
4817
|
+
{
|
4818
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4819
|
+
label: "Link",
|
4820
|
+
name: "Link",
|
4821
|
+
children: /* @__PURE__ */ jsx(Link$1, {})
|
4822
|
+
}
|
4823
|
+
),
|
4824
|
+
/* @__PURE__ */ jsx(
|
4825
|
+
IconButton,
|
4826
|
+
{
|
4827
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4828
|
+
label: "Quote",
|
4829
|
+
name: "Quote",
|
4830
|
+
children: /* @__PURE__ */ jsx(Quotes, {})
|
4831
|
+
}
|
4832
|
+
)
|
4833
|
+
] })
|
4834
|
+
] }) })
|
4835
|
+
] })
|
4507
4836
|
] }),
|
4508
4837
|
onTogglePreviewMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4509
4838
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4630,15 +4959,19 @@ const Wysiwyg = React.forwardRef(
|
|
4630
4959
|
);
|
4631
4960
|
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4632
4961
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4633
|
-
const { id } = useDoc();
|
4962
|
+
const { id, document: document2, collectionType } = useDoc();
|
4634
4963
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
4635
4964
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4636
4965
|
const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4637
4966
|
const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4638
4967
|
const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4639
4968
|
const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4640
|
-
|
4641
|
-
|
4969
|
+
let idToCheck = id;
|
4970
|
+
if (collectionType === SINGLE_TYPES) {
|
4971
|
+
idToCheck = document2?.documentId;
|
4972
|
+
}
|
4973
|
+
const editableFields = idToCheck ? canUpdateFields : canCreateFields;
|
4974
|
+
const readableFields = idToCheck ? canReadFields : canCreateFields;
|
4642
4975
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4643
4976
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4644
4977
|
const fields = useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4649,6 +4982,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4649
4982
|
const {
|
4650
4983
|
edit: { components }
|
4651
4984
|
} = useDocLayout();
|
4985
|
+
const field = useField(props.name);
|
4652
4986
|
if (!visible) {
|
4653
4987
|
return null;
|
4654
4988
|
}
|
@@ -4659,7 +4993,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4659
4993
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4660
4994
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4661
4995
|
if (CustomInput) {
|
4662
|
-
return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
4996
|
+
return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4663
4997
|
}
|
4664
4998
|
return /* @__PURE__ */ jsx(
|
4665
4999
|
InputRenderer$1,
|
@@ -4729,7 +5063,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4729
5063
|
if (!maximum && !minimum) {
|
4730
5064
|
return hint;
|
4731
5065
|
}
|
4732
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5066
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5067
|
+
attribute.type
|
5068
|
+
) ? formatMessage(
|
4733
5069
|
{
|
4734
5070
|
id: "content-manager.form.Input.hint.character.unit",
|
4735
5071
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4818,12 +5154,20 @@ const DynamicComponent = ({
|
|
4818
5154
|
React.useEffect(() => {
|
4819
5155
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
4820
5156
|
}, [dragPreviewRef, index]);
|
5157
|
+
const accordionValue = React.useId();
|
5158
|
+
const { value = [], rawError } = useField(`${name2}.${index}`);
|
5159
|
+
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
5160
|
+
React.useEffect(() => {
|
5161
|
+
if (rawError && value) {
|
5162
|
+
setCollapseToOpen(accordionValue);
|
5163
|
+
}
|
5164
|
+
}, [rawError, value, accordionValue]);
|
4821
5165
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
4822
5166
|
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
4823
5167
|
/* @__PURE__ */ jsx(
|
4824
5168
|
IconButton,
|
4825
5169
|
{
|
4826
|
-
|
5170
|
+
variant: "ghost",
|
4827
5171
|
label: formatMessage(
|
4828
5172
|
{
|
4829
5173
|
id: getTranslation("components.DynamicZone.delete-label"),
|
@@ -4838,7 +5182,7 @@ const DynamicComponent = ({
|
|
4838
5182
|
/* @__PURE__ */ jsx(
|
4839
5183
|
IconButton,
|
4840
5184
|
{
|
4841
|
-
|
5185
|
+
variant: "ghost",
|
4842
5186
|
onClick: (e) => e.stopPropagation(),
|
4843
5187
|
"data-handler-id": handlerId,
|
4844
5188
|
ref: dragRef,
|
@@ -4883,10 +5227,9 @@ const DynamicComponent = ({
|
|
4883
5227
|
] })
|
4884
5228
|
] });
|
4885
5229
|
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
4886
|
-
const accordionValue = React.useId();
|
4887
5230
|
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
4888
5231
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
4889
|
-
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
5232
|
+
/* @__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: [
|
4890
5233
|
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
4891
5234
|
/* @__PURE__ */ jsx(
|
4892
5235
|
Accordion.Trigger,
|
@@ -4897,10 +5240,39 @@ const DynamicComponent = ({
|
|
4897
5240
|
),
|
4898
5241
|
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
4899
5242
|
] }),
|
4900
|
-
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children:
|
4901
|
-
|
4902
|
-
|
4903
|
-
|
5243
|
+
/* @__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(
|
5244
|
+
Grid$1.Item,
|
5245
|
+
{
|
5246
|
+
col: 12,
|
5247
|
+
s: 12,
|
5248
|
+
xs: 12,
|
5249
|
+
direction: "column",
|
5250
|
+
alignItems: "stretch",
|
5251
|
+
children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5252
|
+
const fieldName = `${name2}.${index}.${field.name}`;
|
5253
|
+
const fieldWithTranslatedLabel = {
|
5254
|
+
...field,
|
5255
|
+
label: formatMessage({
|
5256
|
+
id: `content-manager.components.${componentUid}.${field.name}`,
|
5257
|
+
defaultMessage: field.label
|
5258
|
+
})
|
5259
|
+
};
|
5260
|
+
return /* @__PURE__ */ jsx(
|
5261
|
+
Grid$1.Item,
|
5262
|
+
{
|
5263
|
+
col: size,
|
5264
|
+
s: 12,
|
5265
|
+
xs: 12,
|
5266
|
+
direction: "column",
|
5267
|
+
alignItems: "stretch",
|
5268
|
+
children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel, name: fieldName })
|
5269
|
+
},
|
5270
|
+
fieldName
|
5271
|
+
);
|
5272
|
+
}) })
|
5273
|
+
},
|
5274
|
+
rowInd
|
5275
|
+
)) }) }) }) })
|
4904
5276
|
] }) }) })
|
4905
5277
|
] });
|
4906
5278
|
};
|
@@ -5092,7 +5464,7 @@ const DynamicZone = ({
|
|
5092
5464
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5093
5465
|
removeFieldRow(name22, currentIndex);
|
5094
5466
|
};
|
5095
|
-
const hasError = error !== void 0
|
5467
|
+
const hasError = error !== void 0;
|
5096
5468
|
const renderButtonLabel = () => {
|
5097
5469
|
if (addComponentIsOpen) {
|
5098
5470
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5208,4 +5580,4 @@ export {
|
|
5208
5580
|
transformDocument as t,
|
5209
5581
|
useLazyComponents as u
|
5210
5582
|
};
|
5211
|
-
//# sourceMappingURL=Field-
|
5583
|
+
//# sourceMappingURL=Field-DuAYQka5.mjs.map
|