@strapi/content-manager 0.0.0-experimental.9df68962083938acba06546a7901c68a63266aec → 0.0.0-experimental.a13c58eec89ab119f0e381fb79c0252979e9c125
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-C-49MccQ.js → ComponentConfigurationPage-CB0JNNKL.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js.map → ComponentConfigurationPage-CB0JNNKL.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs → ComponentConfigurationPage-CTCh51QS.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs.map → ComponentConfigurationPage-CTCh51QS.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js → EditConfigurationPage-BxTVjxBG.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js.map → EditConfigurationPage-BxTVjxBG.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs → EditConfigurationPage-CVyURlPG.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs.map → EditConfigurationPage-CVyURlPG.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-zT3fBr4Y.js → EditViewPage-Cg78RUyS.js} +62 -11
- package/dist/_chunks/EditViewPage-Cg78RUyS.js.map +1 -0
- package/dist/_chunks/{EditViewPage-CPj61RMh.mjs → EditViewPage-M1OkTFHV.mjs} +63 -12
- package/dist/_chunks/EditViewPage-M1OkTFHV.mjs.map +1 -0
- package/dist/_chunks/{Field-Boxf9Ajp.js → Field-BQoMs_At.js} +271 -154
- package/dist/_chunks/Field-BQoMs_At.js.map +1 -0
- package/dist/_chunks/{Field-dha5VnIQ.mjs → Field-D1UGGscZ.mjs} +269 -152
- package/dist/_chunks/Field-D1UGGscZ.mjs.map +1 -0
- package/dist/_chunks/{Form-y5g1SRsh.js → Form-2uPHazrg.js} +36 -17
- package/dist/_chunks/Form-2uPHazrg.js.map +1 -0
- package/dist/_chunks/{Form-DHrru2AV.mjs → Form-JOjqloMg.mjs} +36 -17
- package/dist/_chunks/Form-JOjqloMg.mjs.map +1 -0
- package/dist/_chunks/{History-Bru_KoeP.mjs → History-D6LWunSa.mjs} +77 -62
- package/dist/_chunks/History-D6LWunSa.mjs.map +1 -0
- package/dist/_chunks/{History-CqN6K7SX.js → History-DoIdauuE.js} +76 -61
- package/dist/_chunks/History-DoIdauuE.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-R_p-SbHZ.js → ListConfigurationPage-C1eYSCV7.js} +21 -9
- package/dist/_chunks/ListConfigurationPage-C1eYSCV7.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-D8wGABj0.mjs → ListConfigurationPage-C8J_y4eX.mjs} +21 -9
- package/dist/_chunks/ListConfigurationPage-C8J_y4eX.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-pEw_zug9.js → ListViewPage-Nd8_ZHjF.js} +86 -46
- package/dist/_chunks/ListViewPage-Nd8_ZHjF.js.map +1 -0
- package/dist/_chunks/{ListViewPage-SID6TRb9.mjs → ListViewPage-vkipJOxG.mjs} +84 -44
- package/dist/_chunks/ListViewPage-vkipJOxG.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs → NoContentTypePage-CAxkF2Vg.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs.map → NoContentTypePage-CAxkF2Vg.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C5dcQojD.js → NoContentTypePage-CsI4DiJk.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C5dcQojD.js.map → NoContentTypePage-CsI4DiJk.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js → NoPermissionsPage-D7c29n-i.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js.map → NoPermissionsPage-D7c29n-i.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs → NoPermissionsPage-DA5ACuoK.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs.map → NoPermissionsPage-DA5ACuoK.mjs.map} +1 -1
- package/dist/_chunks/Preview-Bwo9ft4j.mjs +288 -0
- package/dist/_chunks/Preview-Bwo9ft4j.mjs.map +1 -0
- package/dist/_chunks/Preview-DLxVMS5f.js +307 -0
- package/dist/_chunks/Preview-DLxVMS5f.js.map +1 -0
- package/dist/_chunks/{Relations-B9Crnhnn.mjs → Relations-Bddj_dxS.mjs} +73 -37
- package/dist/_chunks/Relations-Bddj_dxS.mjs.map +1 -0
- package/dist/_chunks/{Relations-DjTQ5kGB.js → Relations-CdFEx0mp.js} +72 -36
- package/dist/_chunks/Relations-CdFEx0mp.js.map +1 -0
- package/dist/_chunks/{en-fbKQxLGn.js → en-CHOp_xJv.js} +27 -16
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-CHOp_xJv.js.map} +1 -1
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-D_BMf0hT.mjs} +27 -16
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-D_BMf0hT.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-DVPWZkbS.js → index-CltLAahy.js} +1066 -658
- package/dist/_chunks/index-CltLAahy.js.map +1 -0
- package/dist/_chunks/{index-DJXJw9V5.mjs → index-DmNeuXH0.mjs} +1086 -679
- package/dist/_chunks/index-DmNeuXH0.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-Bau7ZfLV.mjs → layout-D63qmUOu.mjs} +25 -12
- package/dist/_chunks/layout-D63qmUOu.mjs.map +1 -0
- package/dist/_chunks/{layout-Dm6fbiQj.js → layout-DslPJR5e.js} +24 -11
- package/dist/_chunks/layout-DslPJR5e.js.map +1 -0
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-CKnpRgrN.js → relations-B2h_O2Xw.js} +6 -7
- package/dist/_chunks/relations-B2h_O2Xw.js.map +1 -0
- package/dist/_chunks/{relations-BH_kBSJ0.mjs → relations-X3M9aO-m.mjs} +6 -7
- package/dist/_chunks/relations-X3M9aO-m.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 +5 -4
- 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/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
- 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/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/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 +548 -261
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +549 -262
- 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-CPj61RMh.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-zT3fBr4Y.js.map +0 -1
- package/dist/_chunks/Field-Boxf9Ajp.js.map +0 -1
- package/dist/_chunks/Field-dha5VnIQ.mjs.map +0 -1
- package/dist/_chunks/Form-DHrru2AV.mjs.map +0 -1
- package/dist/_chunks/Form-y5g1SRsh.js.map +0 -1
- package/dist/_chunks/History-Bru_KoeP.mjs.map +0 -1
- package/dist/_chunks/History-CqN6K7SX.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-D8wGABj0.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-R_p-SbHZ.js.map +0 -1
- package/dist/_chunks/ListViewPage-SID6TRb9.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-pEw_zug9.js.map +0 -1
- package/dist/_chunks/Relations-B9Crnhnn.mjs.map +0 -1
- package/dist/_chunks/Relations-DjTQ5kGB.js.map +0 -1
- package/dist/_chunks/index-DJXJw9V5.mjs.map +0 -1
- package/dist/_chunks/index-DVPWZkbS.js.map +0 -1
- package/dist/_chunks/layout-Bau7ZfLV.mjs.map +0 -1
- package/dist/_chunks/layout-Dm6fbiQj.js.map +0 -1
- package/dist/_chunks/relations-BH_kBSJ0.mjs.map +0 -1
- package/dist/_chunks/relations-CKnpRgrN.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 { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton,
|
5
|
+
import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
|
6
6
|
import pipe$1 from "lodash/fp/pipe";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC,
|
8
|
+
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, n as CLONE_PATH, d as buildValidParams, f as useDocumentRBAC, S as SINGLE_TYPES, o as useDocLayout } from "./index-DmNeuXH0.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-Bddj_dxS.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";
|
@@ -860,20 +860,8 @@ const LinkContent = React.forwardRef(
|
|
860
860
|
const [linkText, setLinkText] = React.useState(elementText);
|
861
861
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
862
862
|
const linkInputRef = React.useRef(null);
|
863
|
-
const
|
863
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
|
864
864
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
865
|
-
const handleOpenChange = (isOpen) => {
|
866
|
-
if (isOpen) {
|
867
|
-
setPopoverOpen(isOpen);
|
868
|
-
setShowRemoveButton(isOpen);
|
869
|
-
} else {
|
870
|
-
setPopoverOpen(isOpen);
|
871
|
-
if (link.url === "") {
|
872
|
-
removeLink(editor);
|
873
|
-
}
|
874
|
-
ReactEditor.focus(editor);
|
875
|
-
}
|
876
|
-
};
|
877
865
|
const onLinkChange = (e) => {
|
878
866
|
setIsSaveDisabled(false);
|
879
867
|
setLinkUrl(e.target.value);
|
@@ -894,15 +882,33 @@ const LinkContent = React.forwardRef(
|
|
894
882
|
editLink(editor, { url: linkUrl, text: linkText });
|
895
883
|
setPopoverOpen(false);
|
896
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);
|
897
893
|
};
|
898
894
|
React.useEffect(() => {
|
899
895
|
if (popoverOpen)
|
900
896
|
linkInputRef.current?.focus();
|
901
897
|
}, [popoverOpen]);
|
902
898
|
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
903
|
-
return /* @__PURE__ */ jsxs(Popover.Root, {
|
904
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
905
|
-
|
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: [
|
906
912
|
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
907
913
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
908
914
|
id: "components.Blocks.popover.text",
|
@@ -948,7 +954,7 @@ const LinkContent = React.forwardRef(
|
|
948
954
|
{
|
949
955
|
variant: "danger-light",
|
950
956
|
onClick: () => removeLink(editor),
|
951
|
-
$visible:
|
957
|
+
$visible: isLastInsertedLink,
|
952
958
|
children: formatMessage({
|
953
959
|
id: "components.Blocks.popover.remove",
|
954
960
|
defaultMessage: "Remove"
|
@@ -956,11 +962,11 @@ const LinkContent = React.forwardRef(
|
|
956
962
|
}
|
957
963
|
),
|
958
964
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
959
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
965
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
960
966
|
id: "components.Blocks.popover.cancel",
|
961
967
|
defaultMessage: "Cancel"
|
962
968
|
}) }),
|
963
|
-
/* @__PURE__ */ jsx(Button, {
|
969
|
+
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
964
970
|
id: "components.Blocks.popover.save",
|
965
971
|
defaultMessage: "Save"
|
966
972
|
}) })
|
@@ -1401,7 +1407,7 @@ const ToolbarButton = ({
|
|
1401
1407
|
width: 7,
|
1402
1408
|
height: 7,
|
1403
1409
|
hasRadius: true,
|
1404
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
1410
|
+
children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1405
1411
|
}
|
1406
1412
|
)
|
1407
1413
|
}
|
@@ -1546,6 +1552,26 @@ const ListButton = ({ block, format }) => {
|
|
1546
1552
|
}
|
1547
1553
|
return false;
|
1548
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
|
+
};
|
1549
1575
|
const toggleList = (format2) => {
|
1550
1576
|
let currentListEntry;
|
1551
1577
|
if (editor.selection) {
|
@@ -1579,7 +1605,7 @@ const ListButton = ({ block, format }) => {
|
|
1579
1605
|
name: format,
|
1580
1606
|
label: block.label,
|
1581
1607
|
isActive: isListActive(),
|
1582
|
-
disabled,
|
1608
|
+
disabled: isListDisabled(),
|
1583
1609
|
handleClick: () => toggleList(format)
|
1584
1610
|
}
|
1585
1611
|
);
|
@@ -1723,6 +1749,7 @@ const DragItem = styled(Flex)`
|
|
1723
1749
|
}
|
1724
1750
|
`;
|
1725
1751
|
const DragIconButton = styled(IconButton)`
|
1752
|
+
user-select: none;
|
1726
1753
|
display: flex;
|
1727
1754
|
align-items: center;
|
1728
1755
|
justify-content: center;
|
@@ -1746,7 +1773,7 @@ const DragIconButton = styled(IconButton)`
|
|
1746
1773
|
}
|
1747
1774
|
svg {
|
1748
1775
|
height: auto;
|
1749
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1776
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1750
1777
|
|
1751
1778
|
path {
|
1752
1779
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1851,6 +1878,7 @@ const DragAndDropElement = ({
|
|
1851
1878
|
DragIconButton,
|
1852
1879
|
{
|
1853
1880
|
tag: "div",
|
1881
|
+
contentEditable: false,
|
1854
1882
|
role: "button",
|
1855
1883
|
tabIndex: 0,
|
1856
1884
|
withTooltip: false,
|
@@ -1863,7 +1891,7 @@ const DragAndDropElement = ({
|
|
1863
1891
|
disabled,
|
1864
1892
|
draggable: true,
|
1865
1893
|
$dragHandleTopMargin: dragHandleTopMargin,
|
1866
|
-
children: /* @__PURE__ */ jsx(Drag, { color: "
|
1894
|
+
children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
|
1867
1895
|
}
|
1868
1896
|
),
|
1869
1897
|
children
|
@@ -2187,7 +2215,7 @@ const EditorLayout$1 = ({
|
|
2187
2215
|
/* @__PURE__ */ jsx(
|
2188
2216
|
CollapseIconButton,
|
2189
2217
|
{
|
2190
|
-
|
2218
|
+
label: formatMessage({
|
2191
2219
|
id: getTranslation("components.Blocks.collapse"),
|
2192
2220
|
defaultMessage: "Collapse"
|
2193
2221
|
}),
|
@@ -2526,7 +2554,7 @@ const BlocksEditor = React.forwardRef(
|
|
2526
2554
|
!isExpandedMode && /* @__PURE__ */ jsx(
|
2527
2555
|
ExpandIconButton,
|
2528
2556
|
{
|
2529
|
-
|
2557
|
+
label: formatMessage({
|
2530
2558
|
id: getTranslation("components.Blocks.expand"),
|
2531
2559
|
defaultMessage: "Expand"
|
2532
2560
|
}),
|
@@ -2592,30 +2620,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2592
2620
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2593
2621
|
const { formatMessage } = useIntl();
|
2594
2622
|
const field = useField(name2);
|
2595
|
-
return /* @__PURE__ */
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
),
|
2617
|
-
field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2618
|
-
] });
|
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
|
+
) });
|
2619
2644
|
};
|
2620
2645
|
const CircleIcon = styled(PlusCircle)`
|
2621
2646
|
width: 2.4rem;
|
@@ -2633,6 +2658,7 @@ const NonRepeatableComponent = ({
|
|
2633
2658
|
children,
|
2634
2659
|
layout
|
2635
2660
|
}) => {
|
2661
|
+
const { formatMessage } = useIntl();
|
2636
2662
|
const { value } = useField(name2);
|
2637
2663
|
const level = useComponent("NonRepeatableComponent", (state) => state.level);
|
2638
2664
|
const isNested = level > 0;
|
@@ -2649,7 +2675,22 @@ const NonRepeatableComponent = ({
|
|
2649
2675
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2650
2676
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2651
2677
|
const completeFieldName = `${name2}.${field.name}`;
|
2652
|
-
|
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
|
+
);
|
2653
2694
|
}) }, index);
|
2654
2695
|
}) })
|
2655
2696
|
}
|
@@ -2668,13 +2709,34 @@ const RepeatableComponent = ({
|
|
2668
2709
|
const { search: searchString } = useLocation();
|
2669
2710
|
const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2670
2711
|
const { components } = useDoc();
|
2671
|
-
const {
|
2712
|
+
const {
|
2713
|
+
value = [],
|
2714
|
+
error,
|
2715
|
+
rawError
|
2716
|
+
} = useField(name2);
|
2672
2717
|
const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2673
2718
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2674
2719
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2675
2720
|
const { max = Infinity } = attribute;
|
2676
2721
|
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2677
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]);
|
2678
2740
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2679
2741
|
if (search.has("field")) {
|
2680
2742
|
const fieldParam = search.get("field");
|
@@ -2827,7 +2889,26 @@ const RepeatableComponent = ({
|
|
2827
2889
|
children: layout.map((row, index2) => {
|
2828
2890
|
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2829
2891
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2830
|
-
|
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
|
+
);
|
2831
2912
|
}) }, index2);
|
2832
2913
|
})
|
2833
2914
|
}
|
@@ -2922,7 +3003,7 @@ const Component = ({
|
|
2922
3003
|
/* @__PURE__ */ jsx(
|
2923
3004
|
IconButton,
|
2924
3005
|
{
|
2925
|
-
|
3006
|
+
variant: "ghost",
|
2926
3007
|
onClick: onDeleteComponent,
|
2927
3008
|
label: formatMessage({
|
2928
3009
|
id: getTranslation("containers.Edit.delete"),
|
@@ -2935,7 +3016,7 @@ const Component = ({
|
|
2935
3016
|
IconButton,
|
2936
3017
|
{
|
2937
3018
|
ref: composedAccordionRefs,
|
2938
|
-
|
3019
|
+
variant: "ghost",
|
2939
3020
|
onClick: (e) => e.stopPropagation(),
|
2940
3021
|
"data-handler-id": handlerId,
|
2941
3022
|
label: formatMessage({
|
@@ -3005,7 +3086,7 @@ const ComponentInput = ({
|
|
3005
3086
|
id: getTranslation("components.reset-entry"),
|
3006
3087
|
defaultMessage: "Reset Entry"
|
3007
3088
|
}),
|
3008
|
-
|
3089
|
+
variant: "ghost",
|
3009
3090
|
onClick: () => {
|
3010
3091
|
field.onChange(name2, null);
|
3011
3092
|
},
|
@@ -3034,11 +3115,8 @@ const AddComponentButton = ({
|
|
3034
3115
|
onClick,
|
3035
3116
|
disabled: isDisabled,
|
3036
3117
|
background: "neutral0",
|
3037
|
-
paddingTop: 3,
|
3038
|
-
paddingBottom: 3,
|
3039
|
-
paddingLeft: 4,
|
3040
|
-
paddingRight: 4,
|
3041
3118
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
3119
|
+
variant: "tertiary",
|
3042
3120
|
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
3043
3121
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
3044
3122
|
/* @__PURE__ */ jsx(
|
@@ -3067,10 +3145,11 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
3067
3145
|
}
|
3068
3146
|
`;
|
3069
3147
|
const AddComponentTitle = styled(Typography)``;
|
3070
|
-
const StyledButton = styled(
|
3148
|
+
const StyledButton = styled(Button)`
|
3071
3149
|
border-radius: 26px;
|
3072
3150
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
3073
3151
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3152
|
+
height: 5rem;
|
3074
3153
|
|
3075
3154
|
&:hover {
|
3076
3155
|
${AddComponentTitle} {
|
@@ -3082,7 +3161,7 @@ const StyledButton = styled(BaseButton)`
|
|
3082
3161
|
fill: ${({ theme }) => theme.colors.primary600};
|
3083
3162
|
}
|
3084
3163
|
> path {
|
3085
|
-
fill: ${({ theme }) => theme.colors.
|
3164
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
3086
3165
|
}
|
3087
3166
|
}
|
3088
3167
|
}
|
@@ -3213,18 +3292,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3213
3292
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
3214
3293
|
] });
|
3215
3294
|
};
|
3216
|
-
function useDebounce(value, delay) {
|
3217
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
3218
|
-
useEffect(() => {
|
3219
|
-
const handler = setTimeout(() => {
|
3220
|
-
setDebouncedValue(value);
|
3221
|
-
}, delay);
|
3222
|
-
return () => {
|
3223
|
-
clearTimeout(handler);
|
3224
|
-
};
|
3225
|
-
}, [value, delay]);
|
3226
|
-
return debouncedValue;
|
3227
|
-
}
|
3228
3295
|
const uidApi = contentManagerApi.injectEndpoints({
|
3229
3296
|
endpoints: (builder) => ({
|
3230
3297
|
getDefaultUID: builder.query({
|
@@ -3259,7 +3326,10 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
3259
3326
|
config: {
|
3260
3327
|
params
|
3261
3328
|
}
|
3262
|
-
})
|
3329
|
+
}),
|
3330
|
+
providesTags: (_res, _error, params) => [
|
3331
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3332
|
+
]
|
3263
3333
|
})
|
3264
3334
|
})
|
3265
3335
|
});
|
@@ -3271,8 +3341,10 @@ const UIDInput = React.forwardRef(
|
|
3271
3341
|
const allFormValues = useForm("InputUID", (form) => form.values);
|
3272
3342
|
const [availability, setAvailability] = React.useState();
|
3273
3343
|
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3344
|
+
const isCloning = useMatch(CLONE_PATH) !== null;
|
3274
3345
|
const field = useField(name2);
|
3275
3346
|
const debouncedValue = useDebounce(field.value, 300);
|
3347
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3276
3348
|
const { toggleNotification } = useNotification();
|
3277
3349
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3278
3350
|
const { formatMessage } = useIntl();
|
@@ -3348,8 +3420,9 @@ const UIDInput = React.forwardRef(
|
|
3348
3420
|
params
|
3349
3421
|
},
|
3350
3422
|
{
|
3423
|
+
// Don't check availability if the value is empty or wasn't changed
|
3351
3424
|
skip: !Boolean(
|
3352
|
-
|
3425
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3353
3426
|
)
|
3354
3427
|
}
|
3355
3428
|
);
|
@@ -3378,6 +3451,7 @@ const UIDInput = React.forwardRef(
|
|
3378
3451
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3379
3452
|
const fieldRef = useFocusInputField(name2);
|
3380
3453
|
const composedRefs = useComposedRefs(ref, fieldRef);
|
3454
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3381
3455
|
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3382
3456
|
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3383
3457
|
/* @__PURE__ */ jsx(
|
@@ -3386,7 +3460,7 @@ const UIDInput = React.forwardRef(
|
|
3386
3460
|
ref: composedRefs,
|
3387
3461
|
disabled: props.disabled,
|
3388
3462
|
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3389
|
-
|
3463
|
+
shouldShowAvailability && /* @__PURE__ */ jsxs(
|
3390
3464
|
TextValidation,
|
3391
3465
|
{
|
3392
3466
|
alignItems: "center",
|
@@ -4220,7 +4294,7 @@ const EditorLayout = ({
|
|
4220
4294
|
justifyContent: "flex-end",
|
4221
4295
|
shrink: 0,
|
4222
4296
|
width: "100%",
|
4223
|
-
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4297
|
+
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
4224
4298
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4225
4299
|
id: "components.Wysiwyg.collapse",
|
4226
4300
|
defaultMessage: "Collapse"
|
@@ -4238,12 +4312,14 @@ const EditorLayout = ({
|
|
4238
4312
|
) }) });
|
4239
4313
|
}
|
4240
4314
|
return /* @__PURE__ */ jsx(
|
4241
|
-
|
4315
|
+
Flex,
|
4242
4316
|
{
|
4243
4317
|
borderColor: error ? "danger600" : "neutral200",
|
4244
4318
|
borderStyle: "solid",
|
4245
4319
|
borderWidth: "1px",
|
4246
4320
|
hasRadius: true,
|
4321
|
+
direction: "column",
|
4322
|
+
alignItems: "stretch",
|
4247
4323
|
children
|
4248
4324
|
}
|
4249
4325
|
);
|
@@ -4254,11 +4330,19 @@ const ExpandWrapper = styled(Flex)`
|
|
4254
4330
|
const BoxWithBorder = styled(Box)`
|
4255
4331
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4256
4332
|
`;
|
4257
|
-
const ExpandButton$1 = styled(
|
4333
|
+
const ExpandButton$1 = styled(Button)`
|
4258
4334
|
background-color: transparent;
|
4259
4335
|
border: none;
|
4260
4336
|
align-items: center;
|
4261
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
|
+
|
4262
4346
|
svg {
|
4263
4347
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4264
4348
|
|
@@ -4525,40 +4609,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4525
4609
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4526
4610
|
}
|
4527
4611
|
};
|
4528
|
-
const CustomIconButton = styled(IconButton)`
|
4529
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4530
|
-
|
4531
|
-
svg {
|
4532
|
-
width: 1.8rem;
|
4533
|
-
height: 1.8rem;
|
4534
|
-
}
|
4535
|
-
`;
|
4536
|
-
const CustomLinkIconButton = styled(CustomIconButton)`
|
4537
|
-
svg {
|
4538
|
-
width: 0.8rem;
|
4539
|
-
height: 0.8rem;
|
4540
|
-
}
|
4541
|
-
`;
|
4542
4612
|
const MainButtons = styled(IconButtonGroup)`
|
4543
4613
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4544
4614
|
`;
|
4545
4615
|
const MoreButton = styled(IconButton)`
|
4546
4616
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4547
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4548
|
-
|
4549
|
-
svg {
|
4550
|
-
width: 1.8rem;
|
4551
|
-
height: 1.8rem;
|
4552
|
-
}
|
4553
4617
|
`;
|
4554
4618
|
const IconButtonGroupMargin = styled(IconButtonGroup)`
|
4555
4619
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4556
4620
|
`;
|
4557
|
-
const ExpandButton = styled(
|
4621
|
+
const ExpandButton = styled(Button)`
|
4558
4622
|
background-color: transparent;
|
4559
4623
|
border: none;
|
4560
4624
|
align-items: center;
|
4561
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
|
+
|
4562
4634
|
svg {
|
4563
4635
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4564
4636
|
path {
|
@@ -4570,8 +4642,8 @@ const ExpandButton = styled(BaseButton)`
|
|
4570
4642
|
`;
|
4571
4643
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4572
4644
|
const { formatMessage } = useIntl();
|
4573
|
-
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: [
|
4574
|
-
/* @__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({
|
4575
4647
|
id: "components.WysiwygBottomControls.fullscreen",
|
4576
4648
|
defaultMessage: "Expand"
|
4577
4649
|
}) }),
|
@@ -4607,18 +4679,27 @@ const WysiwygNav = ({
|
|
4607
4679
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4608
4680
|
children: [
|
4609
4681
|
/* @__PURE__ */ jsxs(Flex, { children: [
|
4610
|
-
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4611
|
-
|
4612
|
-
|
4613
|
-
|
4614
|
-
|
4615
|
-
|
4616
|
-
|
4617
|
-
|
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
|
+
) }),
|
4618
4699
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4619
|
-
/* @__PURE__ */ jsx(
|
4620
|
-
/* @__PURE__ */ jsx(
|
4621
|
-
/* @__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, {}) })
|
4622
4703
|
] }),
|
4623
4704
|
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4624
4705
|
] }),
|
@@ -4645,6 +4726,7 @@ const WysiwygNav = ({
|
|
4645
4726
|
placeholder: selectPlaceholder,
|
4646
4727
|
"aria-label": selectPlaceholder,
|
4647
4728
|
onChange: (value) => onActionClick(value, editorRef),
|
4729
|
+
size: "S",
|
4648
4730
|
children: [
|
4649
4731
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4650
4732
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4656,17 +4738,9 @@ const WysiwygNav = ({
|
|
4656
4738
|
}
|
4657
4739
|
) }),
|
4658
4740
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4741
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4659
4742
|
/* @__PURE__ */ jsx(
|
4660
|
-
|
4661
|
-
{
|
4662
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4663
|
-
label: "Bold",
|
4664
|
-
name: "Bold",
|
4665
|
-
children: /* @__PURE__ */ jsx(Bold, {})
|
4666
|
-
}
|
4667
|
-
),
|
4668
|
-
/* @__PURE__ */ jsx(
|
4669
|
-
CustomIconButton,
|
4743
|
+
IconButton,
|
4670
4744
|
{
|
4671
4745
|
onClick: () => onActionClick("Italic", editorRef),
|
4672
4746
|
label: "Italic",
|
@@ -4675,7 +4749,7 @@ const WysiwygNav = ({
|
|
4675
4749
|
}
|
4676
4750
|
),
|
4677
4751
|
/* @__PURE__ */ jsx(
|
4678
|
-
|
4752
|
+
IconButton,
|
4679
4753
|
{
|
4680
4754
|
onClick: () => onActionClick("Underline", editorRef),
|
4681
4755
|
label: "Underline",
|
@@ -4689,7 +4763,7 @@ const WysiwygNav = ({
|
|
4689
4763
|
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4690
4764
|
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4691
4765
|
/* @__PURE__ */ jsx(
|
4692
|
-
|
4766
|
+
IconButton,
|
4693
4767
|
{
|
4694
4768
|
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4695
4769
|
label: "Strikethrough",
|
@@ -4698,7 +4772,7 @@ const WysiwygNav = ({
|
|
4698
4772
|
}
|
4699
4773
|
),
|
4700
4774
|
/* @__PURE__ */ jsx(
|
4701
|
-
|
4775
|
+
IconButton,
|
4702
4776
|
{
|
4703
4777
|
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4704
4778
|
label: "BulletList",
|
@@ -4707,7 +4781,7 @@ const WysiwygNav = ({
|
|
4707
4781
|
}
|
4708
4782
|
),
|
4709
4783
|
/* @__PURE__ */ jsx(
|
4710
|
-
|
4784
|
+
IconButton,
|
4711
4785
|
{
|
4712
4786
|
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4713
4787
|
label: "NumberList",
|
@@ -4718,7 +4792,7 @@ const WysiwygNav = ({
|
|
4718
4792
|
] }),
|
4719
4793
|
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4720
4794
|
/* @__PURE__ */ jsx(
|
4721
|
-
|
4795
|
+
IconButton,
|
4722
4796
|
{
|
4723
4797
|
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4724
4798
|
label: "Code",
|
@@ -4727,7 +4801,7 @@ const WysiwygNav = ({
|
|
4727
4801
|
}
|
4728
4802
|
),
|
4729
4803
|
/* @__PURE__ */ jsx(
|
4730
|
-
|
4804
|
+
IconButton,
|
4731
4805
|
{
|
4732
4806
|
onClick: () => {
|
4733
4807
|
handleTogglePopover();
|
@@ -4739,7 +4813,7 @@ const WysiwygNav = ({
|
|
4739
4813
|
}
|
4740
4814
|
),
|
4741
4815
|
/* @__PURE__ */ jsx(
|
4742
|
-
|
4816
|
+
IconButton,
|
4743
4817
|
{
|
4744
4818
|
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4745
4819
|
label: "Link",
|
@@ -4748,7 +4822,7 @@ const WysiwygNav = ({
|
|
4748
4822
|
}
|
4749
4823
|
),
|
4750
4824
|
/* @__PURE__ */ jsx(
|
4751
|
-
|
4825
|
+
IconButton,
|
4752
4826
|
{
|
4753
4827
|
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4754
4828
|
label: "Quote",
|
@@ -4885,15 +4959,19 @@ const Wysiwyg = React.forwardRef(
|
|
4885
4959
|
);
|
4886
4960
|
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4887
4961
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4888
|
-
const { id } = useDoc();
|
4962
|
+
const { id, document: document2, collectionType } = useDoc();
|
4889
4963
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
4890
4964
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4891
4965
|
const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4892
4966
|
const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4893
4967
|
const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4894
4968
|
const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4895
|
-
|
4896
|
-
|
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;
|
4897
4975
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4898
4976
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4899
4977
|
const fields = useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4904,6 +4982,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4904
4982
|
const {
|
4905
4983
|
edit: { components }
|
4906
4984
|
} = useDocLayout();
|
4985
|
+
const field = useField(props.name);
|
4907
4986
|
if (!visible) {
|
4908
4987
|
return null;
|
4909
4988
|
}
|
@@ -4914,7 +4993,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4914
4993
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4915
4994
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4916
4995
|
if (CustomInput) {
|
4917
|
-
return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
4996
|
+
return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4918
4997
|
}
|
4919
4998
|
return /* @__PURE__ */ jsx(
|
4920
4999
|
InputRenderer$1,
|
@@ -4984,7 +5063,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4984
5063
|
if (!maximum && !minimum) {
|
4985
5064
|
return hint;
|
4986
5065
|
}
|
4987
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5066
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5067
|
+
attribute.type
|
5068
|
+
) ? formatMessage(
|
4988
5069
|
{
|
4989
5070
|
id: "content-manager.form.Input.hint.character.unit",
|
4990
5071
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -5073,12 +5154,20 @@ const DynamicComponent = ({
|
|
5073
5154
|
React.useEffect(() => {
|
5074
5155
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
5075
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]);
|
5076
5165
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
5077
5166
|
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
5078
5167
|
/* @__PURE__ */ jsx(
|
5079
5168
|
IconButton,
|
5080
5169
|
{
|
5081
|
-
|
5170
|
+
variant: "ghost",
|
5082
5171
|
label: formatMessage(
|
5083
5172
|
{
|
5084
5173
|
id: getTranslation("components.DynamicZone.delete-label"),
|
@@ -5093,7 +5182,7 @@ const DynamicComponent = ({
|
|
5093
5182
|
/* @__PURE__ */ jsx(
|
5094
5183
|
IconButton,
|
5095
5184
|
{
|
5096
|
-
|
5185
|
+
variant: "ghost",
|
5097
5186
|
onClick: (e) => e.stopPropagation(),
|
5098
5187
|
"data-handler-id": handlerId,
|
5099
5188
|
ref: dragRef,
|
@@ -5138,10 +5227,9 @@ const DynamicComponent = ({
|
|
5138
5227
|
] })
|
5139
5228
|
] });
|
5140
5229
|
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
5141
|
-
const accordionValue = React.useId();
|
5142
5230
|
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
5143
5231
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
5144
|
-
/* @__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: [
|
5145
5233
|
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
5146
5234
|
/* @__PURE__ */ jsx(
|
5147
5235
|
Accordion.Trigger,
|
@@ -5152,10 +5240,39 @@ const DynamicComponent = ({
|
|
5152
5240
|
),
|
5153
5241
|
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
5154
5242
|
] }),
|
5155
|
-
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children:
|
5156
|
-
|
5157
|
-
|
5158
|
-
|
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
|
+
)) }) }) }) })
|
5159
5276
|
] }) }) })
|
5160
5277
|
] });
|
5161
5278
|
};
|
@@ -5347,7 +5464,7 @@ const DynamicZone = ({
|
|
5347
5464
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5348
5465
|
removeFieldRow(name22, currentIndex);
|
5349
5466
|
};
|
5350
|
-
const hasError = error !== void 0
|
5467
|
+
const hasError = error !== void 0;
|
5351
5468
|
const renderButtonLabel = () => {
|
5352
5469
|
if (addComponentIsOpen) {
|
5353
5470
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5463,4 +5580,4 @@ export {
|
|
5463
5580
|
transformDocument as t,
|
5464
5581
|
useLazyComponents as u
|
5465
5582
|
};
|
5466
|
-
//# sourceMappingURL=Field-
|
5583
|
+
//# sourceMappingURL=Field-D1UGGscZ.mjs.map
|