@strapi/content-manager 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 0.0.0-experimental.dd1d47ef78ef6cfec4ed62576108500bd9f13740
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-gdUj_t-O.mjs → ComponentConfigurationPage-BpM_Hc7r.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-BpM_Hc7r.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-CL9CAMaL.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-CL9CAMaL.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-ILWo0h1e.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-ILWo0h1e.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-_prbqpTM.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-_prbqpTM.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-BqZvBN4s.js} +30 -9
- package/dist/_chunks/EditViewPage-BqZvBN4s.js.map +1 -0
- package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-DAtscabN.mjs} +30 -9
- package/dist/_chunks/EditViewPage-DAtscabN.mjs.map +1 -0
- package/dist/_chunks/{Field-BG1xu38N.js → Field-CcoQiiz1.js} +520 -156
- package/dist/_chunks/Field-CcoQiiz1.js.map +1 -0
- package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-D-mgn1tH.mjs} +518 -154
- package/dist/_chunks/Field-D-mgn1tH.mjs.map +1 -0
- package/dist/_chunks/{Form-CPVWavB8.mjs → Form-BxyeWiXW.mjs} +40 -18
- package/dist/_chunks/Form-BxyeWiXW.mjs.map +1 -0
- package/dist/_chunks/{Form-9BnFyUjy.js → Form-CmLbZDfi.js} +40 -18
- package/dist/_chunks/Form-CmLbZDfi.js.map +1 -0
- package/dist/_chunks/{History-BVpd8LP3.mjs → History-BOhLaq_g.mjs} +78 -56
- package/dist/_chunks/History-BOhLaq_g.mjs.map +1 -0
- package/dist/_chunks/{History-BWWxLt2Z.js → History-uECUbCZB.js} +77 -55
- package/dist/_chunks/History-uECUbCZB.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-D0vQez6F.mjs} +21 -9
- package/dist/_chunks/ListConfigurationPage-D0vQez6F.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-D_bBSFNW.js} +21 -9
- package/dist/_chunks/ListConfigurationPage-D_bBSFNW.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-BkZ83b1A.js} +73 -44
- package/dist/_chunks/ListViewPage-BkZ83b1A.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-ns-bmy5C.mjs} +71 -42
- package/dist/_chunks/ListViewPage-ns-bmy5C.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-BA5ZKMDR.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-BA5ZKMDR.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-C1439s4s.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-C1439s4s.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-B0GdMw1Q.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-B0GdMw1Q.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-CPGwsVfb.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-CPGwsVfb.js.map} +1 -1
- package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-BIGPMSW4.mjs} +73 -37
- package/dist/_chunks/Relations-BIGPMSW4.mjs.map +1 -0
- package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-d-8Uef_-.js} +72 -36
- package/dist/_chunks/Relations-d-8Uef_-.js.map +1 -0
- package/dist/_chunks/{en-fbKQxLGn.js → en-Bdpa50w3.js} +22 -16
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-Bdpa50w3.js.map} +1 -1
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-CZw4xdPY.mjs} +22 -16
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-CZw4xdPY.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/{index-JNNNKUHs.mjs → index-3_WeHXYp.mjs} +1084 -663
- package/dist/_chunks/index-3_WeHXYp.mjs.map +1 -0
- package/dist/_chunks/{index-CWpLBSt0.js → index-BgaeYWIy.js} +1073 -651
- package/dist/_chunks/index-BgaeYWIy.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--iHdZzRk.js → layout-ByFyQRDH.js} +25 -12
- package/dist/_chunks/layout-ByFyQRDH.js.map +1 -0
- package/dist/_chunks/{layout-DC503LnF.mjs → layout-CrTxOnCy.mjs} +27 -14
- package/dist/_chunks/layout-CrTxOnCy.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-CTje5t-a.mjs → relations-BlpLgngh.mjs} +3 -7
- package/dist/_chunks/relations-BlpLgngh.mjs.map +1 -0
- package/dist/_chunks/{relations-BbHizA5K.js → relations-C5RSW926.js} +3 -7
- package/dist/_chunks/relations-C5RSW926.js.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 +3 -2
- package/dist/admin/src/exports.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/components/DocumentActions.d.ts +1 -0
- 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 +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- 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/services/preview.d.ts +3 -0
- 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 -266
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +552 -267
- 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 +13 -13
- package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
- package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
- package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
- package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
- package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
- package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
- package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
- package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
- package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
- package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
- package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
- package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
- package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
- package/dist/_chunks/relations-BbHizA5K.js.map +0 -1
- package/dist/_chunks/relations-CTje5t-a.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,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-3_WeHXYp.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-BIGPMSW4.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);
|
@@ -593,20 +860,8 @@ const LinkContent = React.forwardRef(
|
|
593
860
|
const [linkText, setLinkText] = React.useState(elementText);
|
594
861
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
595
862
|
const linkInputRef = React.useRef(null);
|
596
|
-
const
|
863
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
|
597
864
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
598
|
-
const handleOpenChange = (isOpen) => {
|
599
|
-
if (isOpen) {
|
600
|
-
setPopoverOpen(isOpen);
|
601
|
-
setShowRemoveButton(isOpen);
|
602
|
-
} else {
|
603
|
-
setPopoverOpen(isOpen);
|
604
|
-
if (link.url === "") {
|
605
|
-
removeLink(editor);
|
606
|
-
}
|
607
|
-
ReactEditor.focus(editor);
|
608
|
-
}
|
609
|
-
};
|
610
865
|
const onLinkChange = (e) => {
|
611
866
|
setIsSaveDisabled(false);
|
612
867
|
setLinkUrl(e.target.value);
|
@@ -627,15 +882,33 @@ const LinkContent = React.forwardRef(
|
|
627
882
|
editLink(editor, { url: linkUrl, text: linkText });
|
628
883
|
setPopoverOpen(false);
|
629
884
|
editor.lastInsertedLinkPath = null;
|
885
|
+
ReactEditor.focus(editor);
|
886
|
+
};
|
887
|
+
const handleClose = () => {
|
888
|
+
if (link.url === "") {
|
889
|
+
removeLink(editor);
|
890
|
+
}
|
891
|
+
setPopoverOpen(false);
|
892
|
+
ReactEditor.focus(editor);
|
630
893
|
};
|
631
894
|
React.useEffect(() => {
|
632
895
|
if (popoverOpen)
|
633
896
|
linkInputRef.current?.focus();
|
634
897
|
}, [popoverOpen]);
|
635
898
|
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
636
|
-
return /* @__PURE__ */ jsxs(Popover.Root, {
|
637
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
638
|
-
|
899
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
|
900
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
901
|
+
StyledBaseLink,
|
902
|
+
{
|
903
|
+
...attributes,
|
904
|
+
ref: forwardedRef,
|
905
|
+
href: link.url,
|
906
|
+
onClick: () => setPopoverOpen(true),
|
907
|
+
color: "primary600",
|
908
|
+
children
|
909
|
+
}
|
910
|
+
) }),
|
911
|
+
/* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
|
639
912
|
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
640
913
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
641
914
|
id: "components.Blocks.popover.text",
|
@@ -681,7 +954,7 @@ const LinkContent = React.forwardRef(
|
|
681
954
|
{
|
682
955
|
variant: "danger-light",
|
683
956
|
onClick: () => removeLink(editor),
|
684
|
-
$visible:
|
957
|
+
$visible: isLastInsertedLink,
|
685
958
|
children: formatMessage({
|
686
959
|
id: "components.Blocks.popover.remove",
|
687
960
|
defaultMessage: "Remove"
|
@@ -689,11 +962,11 @@ const LinkContent = React.forwardRef(
|
|
689
962
|
}
|
690
963
|
),
|
691
964
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
692
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
965
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
693
966
|
id: "components.Blocks.popover.cancel",
|
694
967
|
defaultMessage: "Cancel"
|
695
968
|
}) }),
|
696
|
-
/* @__PURE__ */ jsx(Button, {
|
969
|
+
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
697
970
|
id: "components.Blocks.popover.save",
|
698
971
|
defaultMessage: "Save"
|
699
972
|
}) })
|
@@ -1134,7 +1407,7 @@ const ToolbarButton = ({
|
|
1134
1407
|
width: 7,
|
1135
1408
|
height: 7,
|
1136
1409
|
hasRadius: true,
|
1137
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
1410
|
+
children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1138
1411
|
}
|
1139
1412
|
)
|
1140
1413
|
}
|
@@ -1279,6 +1552,26 @@ const ListButton = ({ block, format }) => {
|
|
1279
1552
|
}
|
1280
1553
|
return false;
|
1281
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
|
+
};
|
1282
1575
|
const toggleList = (format2) => {
|
1283
1576
|
let currentListEntry;
|
1284
1577
|
if (editor.selection) {
|
@@ -1312,7 +1605,7 @@ const ListButton = ({ block, format }) => {
|
|
1312
1605
|
name: format,
|
1313
1606
|
label: block.label,
|
1314
1607
|
isActive: isListActive(),
|
1315
|
-
disabled,
|
1608
|
+
disabled: isListDisabled(),
|
1316
1609
|
handleClick: () => toggleList(format)
|
1317
1610
|
}
|
1318
1611
|
);
|
@@ -1456,6 +1749,7 @@ const DragItem = styled(Flex)`
|
|
1456
1749
|
}
|
1457
1750
|
`;
|
1458
1751
|
const DragIconButton = styled(IconButton)`
|
1752
|
+
user-select: none;
|
1459
1753
|
display: flex;
|
1460
1754
|
align-items: center;
|
1461
1755
|
justify-content: center;
|
@@ -1479,7 +1773,7 @@ const DragIconButton = styled(IconButton)`
|
|
1479
1773
|
}
|
1480
1774
|
svg {
|
1481
1775
|
height: auto;
|
1482
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1776
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1483
1777
|
|
1484
1778
|
path {
|
1485
1779
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1584,6 +1878,7 @@ const DragAndDropElement = ({
|
|
1584
1878
|
DragIconButton,
|
1585
1879
|
{
|
1586
1880
|
tag: "div",
|
1881
|
+
contentEditable: false,
|
1587
1882
|
role: "button",
|
1588
1883
|
tabIndex: 0,
|
1589
1884
|
withTooltip: false,
|
@@ -1596,7 +1891,7 @@ const DragAndDropElement = ({
|
|
1596
1891
|
disabled,
|
1597
1892
|
draggable: true,
|
1598
1893
|
$dragHandleTopMargin: dragHandleTopMargin,
|
1599
|
-
children: /* @__PURE__ */ jsx(Drag, { color: "
|
1894
|
+
children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
|
1600
1895
|
}
|
1601
1896
|
),
|
1602
1897
|
children
|
@@ -1920,7 +2215,7 @@ const EditorLayout$1 = ({
|
|
1920
2215
|
/* @__PURE__ */ jsx(
|
1921
2216
|
CollapseIconButton,
|
1922
2217
|
{
|
1923
|
-
|
2218
|
+
label: formatMessage({
|
1924
2219
|
id: getTranslation("components.Blocks.collapse"),
|
1925
2220
|
defaultMessage: "Collapse"
|
1926
2221
|
}),
|
@@ -2259,7 +2554,7 @@ const BlocksEditor = React.forwardRef(
|
|
2259
2554
|
!isExpandedMode && /* @__PURE__ */ jsx(
|
2260
2555
|
ExpandIconButton,
|
2261
2556
|
{
|
2262
|
-
|
2557
|
+
label: formatMessage({
|
2263
2558
|
id: getTranslation("components.Blocks.expand"),
|
2264
2559
|
defaultMessage: "Expand"
|
2265
2560
|
}),
|
@@ -2325,30 +2620,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2325
2620
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2326
2621
|
const { formatMessage } = useIntl();
|
2327
2622
|
const field = useField(name2);
|
2328
|
-
return /* @__PURE__ */
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
),
|
2350
|
-
field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2351
|
-
] });
|
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
|
+
) });
|
2352
2644
|
};
|
2353
2645
|
const CircleIcon = styled(PlusCircle)`
|
2354
2646
|
width: 2.4rem;
|
@@ -2382,7 +2674,18 @@ const NonRepeatableComponent = ({
|
|
2382
2674
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2383
2675
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2384
2676
|
const completeFieldName = `${name2}.${field.name}`;
|
2385
|
-
return /* @__PURE__ */ jsx(
|
2677
|
+
return /* @__PURE__ */ jsx(
|
2678
|
+
Grid$1.Item,
|
2679
|
+
{
|
2680
|
+
col: size,
|
2681
|
+
s: 12,
|
2682
|
+
xs: 12,
|
2683
|
+
direction: "column",
|
2684
|
+
alignItems: "stretch",
|
2685
|
+
children: children({ ...field, name: completeFieldName })
|
2686
|
+
},
|
2687
|
+
completeFieldName
|
2688
|
+
);
|
2386
2689
|
}) }, index);
|
2387
2690
|
}) })
|
2388
2691
|
}
|
@@ -2401,13 +2704,34 @@ const RepeatableComponent = ({
|
|
2401
2704
|
const { search: searchString } = useLocation();
|
2402
2705
|
const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2403
2706
|
const { components } = useDoc();
|
2404
|
-
const {
|
2707
|
+
const {
|
2708
|
+
value = [],
|
2709
|
+
error,
|
2710
|
+
rawError
|
2711
|
+
} = useField(name2);
|
2405
2712
|
const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2406
2713
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2407
2714
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2408
2715
|
const { max = Infinity } = attribute;
|
2409
2716
|
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2410
2717
|
const [liveText, setLiveText] = React.useState("");
|
2718
|
+
React.useEffect(() => {
|
2719
|
+
const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
|
2720
|
+
const hasNestedValue = value && Array.isArray(value) && value.length > 0;
|
2721
|
+
if (hasNestedErrors && hasNestedValue) {
|
2722
|
+
const errorOpenItems = rawError.map((_, idx) => {
|
2723
|
+
return value[idx] ? value[idx].__temp_key__ : null;
|
2724
|
+
}).filter((value2) => !!value2);
|
2725
|
+
if (errorOpenItems && errorOpenItems.length > 0) {
|
2726
|
+
setCollapseToOpen((collapseToOpen2) => {
|
2727
|
+
if (!errorOpenItems.includes(collapseToOpen2)) {
|
2728
|
+
return errorOpenItems[0];
|
2729
|
+
}
|
2730
|
+
return collapseToOpen2;
|
2731
|
+
});
|
2732
|
+
}
|
2733
|
+
}
|
2734
|
+
}, [rawError, value]);
|
2411
2735
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2412
2736
|
if (search.has("field")) {
|
2413
2737
|
const fieldParam = search.get("field");
|
@@ -2560,7 +2884,18 @@ const RepeatableComponent = ({
|
|
2560
2884
|
children: layout.map((row, index2) => {
|
2561
2885
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2562
2886
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2563
|
-
return /* @__PURE__ */ jsx(
|
2887
|
+
return /* @__PURE__ */ jsx(
|
2888
|
+
Grid$1.Item,
|
2889
|
+
{
|
2890
|
+
col: size,
|
2891
|
+
s: 12,
|
2892
|
+
xs: 12,
|
2893
|
+
direction: "column",
|
2894
|
+
alignItems: "stretch",
|
2895
|
+
children: children({ ...field, name: completeFieldName })
|
2896
|
+
},
|
2897
|
+
completeFieldName
|
2898
|
+
);
|
2564
2899
|
}) }, index2);
|
2565
2900
|
})
|
2566
2901
|
}
|
@@ -2655,7 +2990,7 @@ const Component = ({
|
|
2655
2990
|
/* @__PURE__ */ jsx(
|
2656
2991
|
IconButton,
|
2657
2992
|
{
|
2658
|
-
|
2993
|
+
variant: "ghost",
|
2659
2994
|
onClick: onDeleteComponent,
|
2660
2995
|
label: formatMessage({
|
2661
2996
|
id: getTranslation("containers.Edit.delete"),
|
@@ -2668,7 +3003,7 @@ const Component = ({
|
|
2668
3003
|
IconButton,
|
2669
3004
|
{
|
2670
3005
|
ref: composedAccordionRefs,
|
2671
|
-
|
3006
|
+
variant: "ghost",
|
2672
3007
|
onClick: (e) => e.stopPropagation(),
|
2673
3008
|
"data-handler-id": handlerId,
|
2674
3009
|
label: formatMessage({
|
@@ -2738,7 +3073,7 @@ const ComponentInput = ({
|
|
2738
3073
|
id: getTranslation("components.reset-entry"),
|
2739
3074
|
defaultMessage: "Reset Entry"
|
2740
3075
|
}),
|
2741
|
-
|
3076
|
+
variant: "ghost",
|
2742
3077
|
onClick: () => {
|
2743
3078
|
field.onChange(name2, null);
|
2744
3079
|
},
|
@@ -2767,11 +3102,8 @@ const AddComponentButton = ({
|
|
2767
3102
|
onClick,
|
2768
3103
|
disabled: isDisabled,
|
2769
3104
|
background: "neutral0",
|
2770
|
-
paddingTop: 3,
|
2771
|
-
paddingBottom: 3,
|
2772
|
-
paddingLeft: 4,
|
2773
|
-
paddingRight: 4,
|
2774
3105
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
3106
|
+
variant: "tertiary",
|
2775
3107
|
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
2776
3108
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2777
3109
|
/* @__PURE__ */ jsx(
|
@@ -2800,10 +3132,11 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
2800
3132
|
}
|
2801
3133
|
`;
|
2802
3134
|
const AddComponentTitle = styled(Typography)``;
|
2803
|
-
const StyledButton = styled(
|
3135
|
+
const StyledButton = styled(Button)`
|
2804
3136
|
border-radius: 26px;
|
2805
3137
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2806
3138
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3139
|
+
height: 5rem;
|
2807
3140
|
|
2808
3141
|
&:hover {
|
2809
3142
|
${AddComponentTitle} {
|
@@ -2815,7 +3148,7 @@ const StyledButton = styled(BaseButton)`
|
|
2815
3148
|
fill: ${({ theme }) => theme.colors.primary600};
|
2816
3149
|
}
|
2817
3150
|
> path {
|
2818
|
-
fill: ${({ theme }) => theme.colors.
|
3151
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
2819
3152
|
}
|
2820
3153
|
}
|
2821
3154
|
}
|
@@ -2946,18 +3279,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
2946
3279
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
2947
3280
|
] });
|
2948
3281
|
};
|
2949
|
-
function useDebounce(value, delay) {
|
2950
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
2951
|
-
useEffect(() => {
|
2952
|
-
const handler = setTimeout(() => {
|
2953
|
-
setDebouncedValue(value);
|
2954
|
-
}, delay);
|
2955
|
-
return () => {
|
2956
|
-
clearTimeout(handler);
|
2957
|
-
};
|
2958
|
-
}, [value, delay]);
|
2959
|
-
return debouncedValue;
|
2960
|
-
}
|
2961
3282
|
const uidApi = contentManagerApi.injectEndpoints({
|
2962
3283
|
endpoints: (builder) => ({
|
2963
3284
|
getDefaultUID: builder.query({
|
@@ -2992,7 +3313,10 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
2992
3313
|
config: {
|
2993
3314
|
params
|
2994
3315
|
}
|
2995
|
-
})
|
3316
|
+
}),
|
3317
|
+
providesTags: (_res, _error, params) => [
|
3318
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3319
|
+
]
|
2996
3320
|
})
|
2997
3321
|
})
|
2998
3322
|
});
|
@@ -3004,8 +3328,10 @@ const UIDInput = React.forwardRef(
|
|
3004
3328
|
const allFormValues = useForm("InputUID", (form) => form.values);
|
3005
3329
|
const [availability, setAvailability] = React.useState();
|
3006
3330
|
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3331
|
+
const isCloning = useMatch(CLONE_PATH) !== null;
|
3007
3332
|
const field = useField(name2);
|
3008
3333
|
const debouncedValue = useDebounce(field.value, 300);
|
3334
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3009
3335
|
const { toggleNotification } = useNotification();
|
3010
3336
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3011
3337
|
const { formatMessage } = useIntl();
|
@@ -3081,8 +3407,9 @@ const UIDInput = React.forwardRef(
|
|
3081
3407
|
params
|
3082
3408
|
},
|
3083
3409
|
{
|
3410
|
+
// Don't check availability if the value is empty or wasn't changed
|
3084
3411
|
skip: !Boolean(
|
3085
|
-
|
3412
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3086
3413
|
)
|
3087
3414
|
}
|
3088
3415
|
);
|
@@ -3111,6 +3438,7 @@ const UIDInput = React.forwardRef(
|
|
3111
3438
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3112
3439
|
const fieldRef = useFocusInputField(name2);
|
3113
3440
|
const composedRefs = useComposedRefs(ref, fieldRef);
|
3441
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3114
3442
|
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3115
3443
|
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3116
3444
|
/* @__PURE__ */ jsx(
|
@@ -3119,7 +3447,7 @@ const UIDInput = React.forwardRef(
|
|
3119
3447
|
ref: composedRefs,
|
3120
3448
|
disabled: props.disabled,
|
3121
3449
|
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3122
|
-
|
3450
|
+
shouldShowAvailability && /* @__PURE__ */ jsxs(
|
3123
3451
|
TextValidation,
|
3124
3452
|
{
|
3125
3453
|
alignItems: "center",
|
@@ -3953,7 +4281,7 @@ const EditorLayout = ({
|
|
3953
4281
|
justifyContent: "flex-end",
|
3954
4282
|
shrink: 0,
|
3955
4283
|
width: "100%",
|
3956
|
-
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4284
|
+
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
3957
4285
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
3958
4286
|
id: "components.Wysiwyg.collapse",
|
3959
4287
|
defaultMessage: "Collapse"
|
@@ -3971,12 +4299,14 @@ const EditorLayout = ({
|
|
3971
4299
|
) }) });
|
3972
4300
|
}
|
3973
4301
|
return /* @__PURE__ */ jsx(
|
3974
|
-
|
4302
|
+
Flex,
|
3975
4303
|
{
|
3976
4304
|
borderColor: error ? "danger600" : "neutral200",
|
3977
4305
|
borderStyle: "solid",
|
3978
4306
|
borderWidth: "1px",
|
3979
4307
|
hasRadius: true,
|
4308
|
+
direction: "column",
|
4309
|
+
alignItems: "stretch",
|
3980
4310
|
children
|
3981
4311
|
}
|
3982
4312
|
);
|
@@ -3987,11 +4317,19 @@ const ExpandWrapper = styled(Flex)`
|
|
3987
4317
|
const BoxWithBorder = styled(Box)`
|
3988
4318
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
3989
4319
|
`;
|
3990
|
-
const ExpandButton$1 = styled(
|
4320
|
+
const ExpandButton$1 = styled(Button)`
|
3991
4321
|
background-color: transparent;
|
3992
4322
|
border: none;
|
3993
4323
|
align-items: center;
|
3994
4324
|
|
4325
|
+
& > span {
|
4326
|
+
display: flex;
|
4327
|
+
justify-content: space-between;
|
4328
|
+
align-items: center;
|
4329
|
+
width: 100%;
|
4330
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4331
|
+
}
|
4332
|
+
|
3995
4333
|
svg {
|
3996
4334
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
3997
4335
|
|
@@ -4258,40 +4596,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4258
4596
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4259
4597
|
}
|
4260
4598
|
};
|
4261
|
-
const CustomIconButton = styled(IconButton)`
|
4262
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4263
|
-
|
4264
|
-
svg {
|
4265
|
-
width: 1.8rem;
|
4266
|
-
height: 1.8rem;
|
4267
|
-
}
|
4268
|
-
`;
|
4269
|
-
const CustomLinkIconButton = styled(CustomIconButton)`
|
4270
|
-
svg {
|
4271
|
-
width: 0.8rem;
|
4272
|
-
height: 0.8rem;
|
4273
|
-
}
|
4274
|
-
`;
|
4275
4599
|
const MainButtons = styled(IconButtonGroup)`
|
4276
4600
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4277
4601
|
`;
|
4278
4602
|
const MoreButton = styled(IconButton)`
|
4279
4603
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4280
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4281
|
-
|
4282
|
-
svg {
|
4283
|
-
width: 1.8rem;
|
4284
|
-
height: 1.8rem;
|
4285
|
-
}
|
4286
4604
|
`;
|
4287
4605
|
const IconButtonGroupMargin = styled(IconButtonGroup)`
|
4288
4606
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4289
4607
|
`;
|
4290
|
-
const ExpandButton = styled(
|
4608
|
+
const ExpandButton = styled(Button)`
|
4291
4609
|
background-color: transparent;
|
4292
4610
|
border: none;
|
4293
4611
|
align-items: center;
|
4294
4612
|
|
4613
|
+
& > span {
|
4614
|
+
display: flex;
|
4615
|
+
justify-content: space-between;
|
4616
|
+
align-items: center;
|
4617
|
+
width: 100%;
|
4618
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4619
|
+
}
|
4620
|
+
|
4295
4621
|
svg {
|
4296
4622
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4297
4623
|
path {
|
@@ -4303,8 +4629,8 @@ const ExpandButton = styled(BaseButton)`
|
|
4303
4629
|
`;
|
4304
4630
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4305
4631
|
const { formatMessage } = useIntl();
|
4306
|
-
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: [
|
4307
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4632
|
+
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: [
|
4633
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
4308
4634
|
id: "components.WysiwygBottomControls.fullscreen",
|
4309
4635
|
defaultMessage: "Expand"
|
4310
4636
|
}) }),
|
@@ -4340,18 +4666,27 @@ const WysiwygNav = ({
|
|
4340
4666
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4341
4667
|
children: [
|
4342
4668
|
/* @__PURE__ */ jsxs(Flex, { children: [
|
4343
|
-
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4669
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4670
|
+
SingleSelect,
|
4671
|
+
{
|
4672
|
+
disabled: true,
|
4673
|
+
placeholder: selectPlaceholder,
|
4674
|
+
"aria-label": selectPlaceholder,
|
4675
|
+
size: "S",
|
4676
|
+
children: [
|
4677
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4678
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
4679
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
|
4680
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
|
4681
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
|
4682
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4683
|
+
]
|
4684
|
+
}
|
4685
|
+
) }),
|
4351
4686
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4352
|
-
/* @__PURE__ */ jsx(
|
4353
|
-
/* @__PURE__ */ jsx(
|
4354
|
-
/* @__PURE__ */ jsx(
|
4687
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4688
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
|
4689
|
+
/* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
|
4355
4690
|
] }),
|
4356
4691
|
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4357
4692
|
] }),
|
@@ -4378,6 +4713,7 @@ const WysiwygNav = ({
|
|
4378
4713
|
placeholder: selectPlaceholder,
|
4379
4714
|
"aria-label": selectPlaceholder,
|
4380
4715
|
onChange: (value) => onActionClick(value, editorRef),
|
4716
|
+
size: "S",
|
4381
4717
|
children: [
|
4382
4718
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4383
4719
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4389,17 +4725,9 @@ const WysiwygNav = ({
|
|
4389
4725
|
}
|
4390
4726
|
) }),
|
4391
4727
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4728
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4392
4729
|
/* @__PURE__ */ jsx(
|
4393
|
-
|
4394
|
-
{
|
4395
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4396
|
-
label: "Bold",
|
4397
|
-
name: "Bold",
|
4398
|
-
children: /* @__PURE__ */ jsx(Bold, {})
|
4399
|
-
}
|
4400
|
-
),
|
4401
|
-
/* @__PURE__ */ jsx(
|
4402
|
-
CustomIconButton,
|
4730
|
+
IconButton,
|
4403
4731
|
{
|
4404
4732
|
onClick: () => onActionClick("Italic", editorRef),
|
4405
4733
|
label: "Italic",
|
@@ -4408,7 +4736,7 @@ const WysiwygNav = ({
|
|
4408
4736
|
}
|
4409
4737
|
),
|
4410
4738
|
/* @__PURE__ */ jsx(
|
4411
|
-
|
4739
|
+
IconButton,
|
4412
4740
|
{
|
4413
4741
|
onClick: () => onActionClick("Underline", editorRef),
|
4414
4742
|
label: "Underline",
|
@@ -4422,7 +4750,7 @@ const WysiwygNav = ({
|
|
4422
4750
|
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4423
4751
|
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4424
4752
|
/* @__PURE__ */ jsx(
|
4425
|
-
|
4753
|
+
IconButton,
|
4426
4754
|
{
|
4427
4755
|
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4428
4756
|
label: "Strikethrough",
|
@@ -4431,7 +4759,7 @@ const WysiwygNav = ({
|
|
4431
4759
|
}
|
4432
4760
|
),
|
4433
4761
|
/* @__PURE__ */ jsx(
|
4434
|
-
|
4762
|
+
IconButton,
|
4435
4763
|
{
|
4436
4764
|
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4437
4765
|
label: "BulletList",
|
@@ -4440,7 +4768,7 @@ const WysiwygNav = ({
|
|
4440
4768
|
}
|
4441
4769
|
),
|
4442
4770
|
/* @__PURE__ */ jsx(
|
4443
|
-
|
4771
|
+
IconButton,
|
4444
4772
|
{
|
4445
4773
|
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4446
4774
|
label: "NumberList",
|
@@ -4451,7 +4779,7 @@ const WysiwygNav = ({
|
|
4451
4779
|
] }),
|
4452
4780
|
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4453
4781
|
/* @__PURE__ */ jsx(
|
4454
|
-
|
4782
|
+
IconButton,
|
4455
4783
|
{
|
4456
4784
|
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4457
4785
|
label: "Code",
|
@@ -4460,7 +4788,7 @@ const WysiwygNav = ({
|
|
4460
4788
|
}
|
4461
4789
|
),
|
4462
4790
|
/* @__PURE__ */ jsx(
|
4463
|
-
|
4791
|
+
IconButton,
|
4464
4792
|
{
|
4465
4793
|
onClick: () => {
|
4466
4794
|
handleTogglePopover();
|
@@ -4472,7 +4800,7 @@ const WysiwygNav = ({
|
|
4472
4800
|
}
|
4473
4801
|
),
|
4474
4802
|
/* @__PURE__ */ jsx(
|
4475
|
-
|
4803
|
+
IconButton,
|
4476
4804
|
{
|
4477
4805
|
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4478
4806
|
label: "Link",
|
@@ -4481,7 +4809,7 @@ const WysiwygNav = ({
|
|
4481
4809
|
}
|
4482
4810
|
),
|
4483
4811
|
/* @__PURE__ */ jsx(
|
4484
|
-
|
4812
|
+
IconButton,
|
4485
4813
|
{
|
4486
4814
|
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4487
4815
|
label: "Quote",
|
@@ -4618,15 +4946,19 @@ const Wysiwyg = React.forwardRef(
|
|
4618
4946
|
);
|
4619
4947
|
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4620
4948
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4621
|
-
const { id } = useDoc();
|
4949
|
+
const { id, document: document2, collectionType } = useDoc();
|
4622
4950
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
4623
4951
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4624
4952
|
const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4625
4953
|
const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4626
4954
|
const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4627
4955
|
const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4628
|
-
|
4629
|
-
|
4956
|
+
let idToCheck = id;
|
4957
|
+
if (collectionType === SINGLE_TYPES) {
|
4958
|
+
idToCheck = document2?.documentId;
|
4959
|
+
}
|
4960
|
+
const editableFields = idToCheck ? canUpdateFields : canCreateFields;
|
4961
|
+
const readableFields = idToCheck ? canReadFields : canCreateFields;
|
4630
4962
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4631
4963
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4632
4964
|
const fields = useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4637,6 +4969,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4637
4969
|
const {
|
4638
4970
|
edit: { components }
|
4639
4971
|
} = useDocLayout();
|
4972
|
+
const field = useField(props.name);
|
4640
4973
|
if (!visible) {
|
4641
4974
|
return null;
|
4642
4975
|
}
|
@@ -4647,7 +4980,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4647
4980
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4648
4981
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4649
4982
|
if (CustomInput) {
|
4650
|
-
return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
4983
|
+
return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4651
4984
|
}
|
4652
4985
|
return /* @__PURE__ */ jsx(
|
4653
4986
|
InputRenderer$1,
|
@@ -4717,7 +5050,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4717
5050
|
if (!maximum && !minimum) {
|
4718
5051
|
return hint;
|
4719
5052
|
}
|
4720
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5053
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5054
|
+
attribute.type
|
5055
|
+
) ? formatMessage(
|
4721
5056
|
{
|
4722
5057
|
id: "content-manager.form.Input.hint.character.unit",
|
4723
5058
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4806,12 +5141,20 @@ const DynamicComponent = ({
|
|
4806
5141
|
React.useEffect(() => {
|
4807
5142
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
4808
5143
|
}, [dragPreviewRef, index]);
|
5144
|
+
const accordionValue = React.useId();
|
5145
|
+
const { value = [], rawError } = useField(`${name2}.${index}`);
|
5146
|
+
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
5147
|
+
React.useEffect(() => {
|
5148
|
+
if (rawError && value) {
|
5149
|
+
setCollapseToOpen(accordionValue);
|
5150
|
+
}
|
5151
|
+
}, [rawError, value, accordionValue]);
|
4809
5152
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
4810
5153
|
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
4811
5154
|
/* @__PURE__ */ jsx(
|
4812
5155
|
IconButton,
|
4813
5156
|
{
|
4814
|
-
|
5157
|
+
variant: "ghost",
|
4815
5158
|
label: formatMessage(
|
4816
5159
|
{
|
4817
5160
|
id: getTranslation("components.DynamicZone.delete-label"),
|
@@ -4826,7 +5169,7 @@ const DynamicComponent = ({
|
|
4826
5169
|
/* @__PURE__ */ jsx(
|
4827
5170
|
IconButton,
|
4828
5171
|
{
|
4829
|
-
|
5172
|
+
variant: "ghost",
|
4830
5173
|
onClick: (e) => e.stopPropagation(),
|
4831
5174
|
"data-handler-id": handlerId,
|
4832
5175
|
ref: dragRef,
|
@@ -4871,10 +5214,9 @@ const DynamicComponent = ({
|
|
4871
5214
|
] })
|
4872
5215
|
] });
|
4873
5216
|
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
4874
|
-
const accordionValue = React.useId();
|
4875
5217
|
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
4876
5218
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
4877
|
-
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
5219
|
+
/* @__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: [
|
4878
5220
|
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
4879
5221
|
/* @__PURE__ */ jsx(
|
4880
5222
|
Accordion.Trigger,
|
@@ -4885,10 +5227,32 @@ const DynamicComponent = ({
|
|
4885
5227
|
),
|
4886
5228
|
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
4887
5229
|
] }),
|
4888
|
-
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children:
|
4889
|
-
|
4890
|
-
|
4891
|
-
|
5230
|
+
/* @__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(
|
5231
|
+
Grid$1.Item,
|
5232
|
+
{
|
5233
|
+
col: 12,
|
5234
|
+
s: 12,
|
5235
|
+
xs: 12,
|
5236
|
+
direction: "column",
|
5237
|
+
alignItems: "stretch",
|
5238
|
+
children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5239
|
+
const fieldName = `${name2}.${index}.${field.name}`;
|
5240
|
+
return /* @__PURE__ */ jsx(
|
5241
|
+
Grid$1.Item,
|
5242
|
+
{
|
5243
|
+
col: size,
|
5244
|
+
s: 12,
|
5245
|
+
xs: 12,
|
5246
|
+
direction: "column",
|
5247
|
+
alignItems: "stretch",
|
5248
|
+
children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName })
|
5249
|
+
},
|
5250
|
+
fieldName
|
5251
|
+
);
|
5252
|
+
}) })
|
5253
|
+
},
|
5254
|
+
rowInd
|
5255
|
+
)) }) }) }) })
|
4892
5256
|
] }) }) })
|
4893
5257
|
] });
|
4894
5258
|
};
|
@@ -5080,7 +5444,7 @@ const DynamicZone = ({
|
|
5080
5444
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5081
5445
|
removeFieldRow(name22, currentIndex);
|
5082
5446
|
};
|
5083
|
-
const hasError = error !== void 0
|
5447
|
+
const hasError = error !== void 0;
|
5084
5448
|
const renderButtonLabel = () => {
|
5085
5449
|
if (addComponentIsOpen) {
|
5086
5450
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5196,4 +5560,4 @@ export {
|
|
5196
5560
|
transformDocument as t,
|
5197
5561
|
useLazyComponents as u
|
5198
5562
|
};
|
5199
|
-
//# sourceMappingURL=Field-
|
5563
|
+
//# sourceMappingURL=Field-D-mgn1tH.mjs.map
|