@contentful/field-editor-rich-text 2.0.0-next.38 → 2.0.0-next.40

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.
@@ -1,6 +1,6 @@
1
- import React__default, { createContext, useContext, useMemo, createElement, useEffect, useState, memo, Fragment, useCallback } from 'react';
2
- import { useEntities, ScheduledIconWithTooltip, MissingEntityCard, AssetThumbnail, EntityProvider, getScheduleTooltipContent } from '@contentful/field-editor-reference';
3
- import { entityHelpers, shortenStorageUnit, isValidImage, ModalDialogLauncher, FieldConnector } from '@contentful/field-editor-shared';
1
+ import React__default, { createContext, useContext, useMemo, useEffect, createElement, useState, memo, Fragment, useCallback } from 'react';
2
+ import { useEntities, MissingEntityCard, WrappedAssetCard, WrappedEntryCard, ScheduledIconWithTooltip, EntityProvider, getScheduleTooltipContent } from '@contentful/field-editor-reference';
3
+ import { entityHelpers, ModalDialogLauncher, FieldConnector } from '@contentful/field-editor-shared';
4
4
  import { BLOCKS, INLINES, TEXT_CONTAINERS, HEADINGS, LIST_ITEM_BLOCKS, MARKS, CONTAINERS, TOP_LEVEL_BLOCKS, VOID_BLOCKS, EMPTY_DOCUMENT } from '@contentful/rich-text-types';
5
5
  import { usePlateEditorRef, usePlateEditorState, getNodes, toggleNodeType, getText, getAbove, setNodes, isAncestorEmpty, match, getLastChildPath, wrapNodes, getPluginType, unwrapNodes, isCollapsed, isRangeAcrossBlocks, ELEMENT_DEFAULT, findNode, getParent, getBlockAbove, isSelectionAtBlockStart, isSelectionAtBlockEnd, isFirstChild, insertNodes, moveChildren, isBlockAboveEmpty, mockPlugin, deleteFragment, isMarkActive, toggleMark, someHtmlElement, KEY_DESERIALIZE_HTML, hasSingleChild, isLastChild, someNode, getChildren as getChildren$1, queryNode, createDeserializeHtmlPlugin, createDeserializeAstPlugin, createPlateEditor, getPlateSelectors, getPlateActions, Plate } from '@udecode/plate-core';
6
6
  import { css, cx } from 'emotion';
@@ -13,13 +13,12 @@ import isHotkey from 'is-hotkey';
13
13
  import { Text, Element, Editor, Transforms, Range, Path, Node, Point } from 'slate';
14
14
  import { ReactEditor, useSelected, useReadOnly, useFocused } from 'slate-react';
15
15
  import constate from 'constate';
16
- import { AssetCard, Menu, Text as Text$1, Notification, EntryCard, MenuItem, Button, Flex, Icon, InlineEntryCard, Tooltip, ModalContent, Form, FormControl, TextInput, Select, FormLabel, TextLink, ModalControls, Card, IconButton } from '@contentful/f36-components';
17
- import mimetype from '@contentful/mimetype';
18
- import get from 'lodash-es/get';
19
- import { ClockIcon, AssetIcon, EmbeddedEntryBlockIcon, EmbeddedEntryInlineIcon, ChevronDownIcon, HorizontalRuleIcon, LinkIcon, ListBulletedIcon, ListNumberedIcon, FormatBoldIcon, CodeIcon, FormatItalicIcon, FormatUnderlinedIcon, QuoteIcon, TableIcon, PlusIcon } from '@contentful/f36-icons';
20
- import tokens from '@contentful/f36-tokens';
16
+ import { AssetCard, EntryCard, Menu, Flex, Icon, InlineEntryCard, MenuItem, Text as Text$1, Button, Tooltip, ModalContent, Form, FormControl, TextInput, Select, FormLabel, TextLink, ModalControls, Card, IconButton } from '@contentful/f36-components';
21
17
  import find from 'lodash-es/find';
22
18
  import flow from 'lodash-es/flow';
19
+ import get from 'lodash-es/get';
20
+ import { AssetIcon, EmbeddedEntryBlockIcon, ClockIcon, EmbeddedEntryInlineIcon, ChevronDownIcon, HorizontalRuleIcon, LinkIcon, ListBulletedIcon, ListNumberedIcon, FormatBoldIcon, CodeIcon, FormatItalicIcon, FormatUnderlinedIcon, QuoteIcon, TableIcon, PlusIcon } from '@contentful/f36-icons';
21
+ import tokens from '@contentful/f36-tokens';
23
22
  import { getListTypes, ELEMENT_LIC, getListItemEntry, isListNested, moveListItemUp, ELEMENT_LI, unwrapList as unwrapList$1, removeFirstListItem, removeListItem, deleteForwardList, deleteFragmentList, normalizeList, createListPlugin as createListPlugin$1, ELEMENT_UL, ELEMENT_OL } from '@udecode/plate-list';
24
23
  import castArray from 'lodash-es/castArray';
25
24
  import { createBoldPlugin as createBoldPlugin$1, createCodePlugin as createCodePlugin$1, createItalicPlugin as createItalicPlugin$1, createUnderlinePlugin as createUnderlinePlugin$1 } from '@udecode/plate-basic-marks';
@@ -632,180 +631,24 @@ var _constate = /*#__PURE__*/constate(useSdk),
632
631
  SdkProvider = _constate[0],
633
632
  useSdkContext = _constate[1];
634
633
 
635
- var styles = {
636
- scheduleIcon: /*#__PURE__*/css({
637
- marginRight: tokens.spacing2Xs
638
- })
639
- };
640
- function EntityStatusIcon(_ref) {
641
- var entity = _ref.entity,
642
- entityType = _ref.entityType;
643
-
644
- var _useEntities = useEntities(),
645
- loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
646
-
647
- return /*#__PURE__*/createElement(ScheduledIconWithTooltip, {
648
- getEntityScheduledActions: loadEntityScheduledActions,
649
- entityType: entityType,
650
- entityId: entity.sys.id
651
- }, /*#__PURE__*/createElement(ClockIcon, {
652
- className: styles.scheduleIcon,
653
- size: "small",
654
- color: "muted",
655
- testId: "schedule-icon"
656
- }));
657
- }
658
-
659
- var styles$1 = {
660
- assetCard: /*#__PURE__*/css({
661
- cursor: 'pointer'
662
- }),
663
- cardDropdown: /*#__PURE__*/css({
664
- width: '300px'
665
- }),
666
- truncated: /*#__PURE__*/css({
667
- overflow: 'hidden',
668
- whiteSpace: 'nowrap',
669
- textOverflow: 'ellipsis'
670
- })
671
- };
672
-
673
- function downloadAsset(url, fileName) {
674
- // This method won't work if we have CORS disabled(asset not on the contentful server)
675
- fetch(url, {
676
- method: 'GET',
677
- headers: {}
678
- }).then(function (response) {
679
- response.arrayBuffer().then(function (buffer) {
680
- var url = window.URL.createObjectURL(new Blob([buffer]));
681
- var link = document.createElement('a');
682
- link.href = url;
683
- link.setAttribute('download', fileName); //or any other extension
684
-
685
- document.body.appendChild(link);
686
- link.click();
687
- document.body.removeChild(link);
688
- });
689
- })["catch"](function (err) {
690
- Notification.error('Failed to download asset');
691
- console.log(err);
692
- });
693
- }
694
-
695
- function renderAssetInfo(props) {
696
- var entityFile = props.entityFile;
697
- var fileName = get(entityFile, 'fileName');
698
- var mimeType = get(entityFile, 'contentType');
699
- var fileSize = get(entityFile, 'details.size');
700
- var image = get(entityFile, 'details.image');
701
- return [/*#__PURE__*/createElement(Menu.SectionTitle, {
702
- key: "file-section"
703
- }, "File info"), fileName && /*#__PURE__*/createElement(Menu.Item, {
704
- key: "file-name"
705
- }, /*#__PURE__*/createElement(Text$1, {
706
- isTruncated: true
707
- }, fileName)), mimeType && /*#__PURE__*/createElement(Menu.Item, {
708
- key: "file-type"
709
- }, /*#__PURE__*/createElement(Text$1, {
710
- isTruncated: true
711
- }, mimeType)), fileSize && /*#__PURE__*/createElement(Menu.Item, {
712
- key: "file-size"
713
- }, shortenStorageUnit(fileSize, 'B')), image && /*#__PURE__*/createElement(Menu.Item, {
714
- key: "file-dimentions"
715
- }, image.width + " \xD7 " + image.height)].filter(function (item) {
716
- return item;
717
- });
718
- }
719
- function renderActions(props) {
720
- var entityFile = props.entityFile,
721
- isDisabled = props.isDisabled,
722
- onEdit = props.onEdit,
723
- onRemove = props.onRemove;
724
- return [/*#__PURE__*/createElement(Menu.SectionTitle, {
725
- key: "section-title"
726
- }, "Actions"), onEdit ? /*#__PURE__*/createElement(Menu.Item, {
727
- key: "edit",
728
- disabled: isDisabled,
729
- onClick: onEdit,
730
- testId: "card-action-edit"
731
- }, "Edit") : null, entityFile ? /*#__PURE__*/createElement(Menu.Item, {
732
- key: "download",
733
- onClick: function onClick() {
734
- if (typeof entityFile.url === 'string') {
735
- downloadAsset(entityFile.url, get(entityFile, 'fileName'));
736
- }
737
- },
738
- testId: "card-action-download"
739
- }, "Download") : null, onRemove ? /*#__PURE__*/createElement(Menu.Item, {
740
- key: "remove",
741
- disabled: isDisabled,
742
- onClick: onRemove,
743
- testId: "card-action-remove"
744
- }, "Remove") : null].filter(function (item) {
745
- return item;
746
- });
747
- }
748
634
  function FetchingWrappedAssetCard(props) {
749
- var _asset$fields;
635
+ var onEntityFetchComplete = props.onEntityFetchComplete,
636
+ assetId = props.assetId;
750
637
 
751
638
  var _useEntities = useEntities(),
752
639
  getOrLoadAsset = _useEntities.getOrLoadAsset,
640
+ loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
753
641
  assets = _useEntities.assets;
754
642
 
755
- var asset = assets[props.assetId];
756
- var defaultLocaleCode = props.sdk.locales["default"];
757
- var entityFile = asset != null && (_asset$fields = asset.fields) != null && _asset$fields.file ? asset.fields.file[props.locale] || asset.fields.file[defaultLocaleCode] : undefined;
758
- var onEntityFetchComplete = props.onEntityFetchComplete;
759
643
  useEffect(function () {
760
- getOrLoadAsset(props.assetId);
761
- }, [props.assetId]); // eslint-disable-line
762
-
644
+ getOrLoadAsset(assetId);
645
+ }, [getOrLoadAsset, assetId]);
646
+ var asset = assets[assetId];
763
647
  useEffect(function () {
764
- if (!asset) {
765
- return;
766
- }
767
-
768
- onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
769
- }, [asset, onEntityFetchComplete]);
770
-
771
- function getAssetSrc() {
772
- if (!(entityFile != null && entityFile.url)) return '';
773
- return entityFile.url + "?h=300";
774
- }
775
-
776
- function getFileType() {
777
- var groupToIconMap = {
778
- image: 'image',
779
- video: 'video',
780
- audio: 'audio',
781
- richtext: 'richtext',
782
- presentation: 'presentation',
783
- spreadsheet: 'spreadsheet',
784
- pdfdocument: 'pdf',
785
- archive: 'archive',
786
- plaintext: 'plaintext',
787
- code: 'code',
788
- markup: 'markup'
789
- };
790
- var archive = groupToIconMap['archive'];
791
-
792
- if (!entityFile) {
793
- return archive;
648
+ if (asset) {
649
+ onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
794
650
  }
795
-
796
- var groupName = mimetype.getGroupLabel({
797
- type: entityFile.contentType,
798
- fallbackFileName: entityFile.fileName
799
- });
800
- return groupToIconMap[groupName] || archive;
801
- }
802
-
803
- if (asset === undefined) {
804
- return /*#__PURE__*/createElement(AssetCard, {
805
- size: "small",
806
- isLoading: true
807
- });
808
- }
651
+ }, [onEntityFetchComplete, asset]);
809
652
 
810
653
  if (asset === 'failed') {
811
654
  return /*#__PURE__*/createElement(MissingEntityCard, {
@@ -815,139 +658,48 @@ function FetchingWrappedAssetCard(props) {
815
658
  });
816
659
  }
817
660
 
818
- var status = asset ? entityHelpers.getEntryStatus(asset.sys) : undefined;
819
-
820
- if (status === 'deleted') {
821
- return /*#__PURE__*/createElement(MissingEntityCard, {
822
- entityType: "Asset",
823
- asSquare: true,
824
- isDisabled: props.isDisabled,
825
- onRemove: props.onRemove
661
+ if (asset === undefined) {
662
+ return /*#__PURE__*/createElement(AssetCard, {
663
+ size: "default",
664
+ isLoading: true
826
665
  });
827
666
  }
828
667
 
829
- var entityTitle = entityHelpers.getAssetTitle({
830
- asset: asset,
831
- localeCode: props.locale,
832
- defaultLocaleCode: defaultLocaleCode,
833
- defaultTitle: 'Untitled'
834
- });
835
- return /*#__PURE__*/createElement(AssetCard, {
836
- title: entityTitle,
837
- isSelected: props.isSelected,
668
+ return /*#__PURE__*/createElement(WrappedAssetCard, {
669
+ getEntityScheduledActions: loadEntityScheduledActions,
838
670
  size: "small",
839
- src: getAssetSrc(),
840
- type: getFileType(),
841
- status: status,
842
- icon: /*#__PURE__*/createElement(EntityStatusIcon, {
843
- entityType: "Asset",
844
- entity: asset
845
- }),
846
- className: styles$1.assetCard,
847
- actions: [renderActions({
848
- entityFile: entityFile,
849
- isDisabled: props.isDisabled,
850
- onEdit: props.onEdit,
851
- onRemove: props.onRemove
852
- }), entityFile ? renderAssetInfo({
853
- entityFile: entityFile
854
- }) : null].filter(function (item) {
855
- return item;
856
- })
857
- });
858
- }
859
-
860
- var styles$2 = {
861
- entryCard: /*#__PURE__*/css({
862
- cursor: 'pointer'
863
- })
864
- };
865
-
866
- function EntryThumbnail(_ref) {
867
- var file = _ref.file;
868
- if (!isValidImage(file)) return null;
869
- return /*#__PURE__*/createElement(AssetThumbnail, {
870
- file: file
671
+ isSelected: props.isSelected,
672
+ isDisabled: props.isDisabled,
673
+ localeCode: props.locale,
674
+ defaultLocaleCode: props.sdk.locales["default"],
675
+ asset: asset,
676
+ onEdit: props.onEdit,
677
+ onRemove: props.isDisabled ? undefined : props.onRemove,
678
+ isClickable: false
871
679
  });
872
680
  }
873
681
 
874
682
  function FetchingWrappedEntryCard(props) {
683
+ var entryId = props.entryId,
684
+ onEntityFetchComplete = props.onEntityFetchComplete;
685
+
875
686
  var _useEntities = useEntities(),
876
687
  getOrLoadEntry = _useEntities.getOrLoadEntry,
877
- entries = _useEntities.entries,
878
- getOrLoadAsset = _useEntities.getOrLoadAsset;
879
-
880
- var _React$useState = useState(null),
881
- file = _React$useState[0],
882
- setFile = _React$useState[1];
883
-
884
- var entry = entries[props.entryId];
885
- var contentType = useMemo(function () {
886
- if (!entry || entry === 'failed') {
887
- return undefined;
888
- }
688
+ loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
689
+ entries = _useEntities.entries;
889
690
 
890
- return props.sdk.space.getCachedContentTypes().find(function (contentType) {
891
- return contentType.sys.id === entry.sys.contentType.sys.id;
892
- });
893
- }, [props.sdk, entry]);
894
- var defaultLocaleCode = props.sdk.locales["default"];
895
- var onEntityFetchComplete = props.onEntityFetchComplete;
896
691
  useEffect(function () {
897
- if (!entry || entry === 'failed') return;
898
- var subscribed = true;
899
- entityHelpers.getEntryImage({
900
- entry: entry,
901
- contentType: contentType,
902
- localeCode: props.locale,
903
- defaultLocaleCode: defaultLocaleCode
904
- }, getOrLoadAsset)["catch"](function () {
905
- return null;
906
- }).then(function (file) {
907
- if (subscribed) {
908
- setFile(file);
909
- }
910
- });
911
- return function () {
912
- subscribed = false;
913
- };
914
- }, [entry, contentType, props.locale, defaultLocaleCode, props.sdk, file, getOrLoadAsset]);
692
+ getOrLoadEntry(entryId);
693
+ }, [getOrLoadEntry, entryId]);
694
+ var entry = entries[entryId];
915
695
  useEffect(function () {
916
- getOrLoadEntry(props.entryId);
917
- }, [props.entryId]); // eslint-disable-line
918
-
919
- useEffect(function () {
920
- if (!entry) {
921
- return;
696
+ if (entry) {
697
+ onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
922
698
  }
923
-
924
- onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
925
- }, [entry, onEntityFetchComplete]);
926
-
927
- function renderDropdown() {
928
- if (!props.onEdit || !props.onRemove) return undefined;
929
- return [props.onEdit ? /*#__PURE__*/createElement(MenuItem, {
930
- key: "edit",
931
- disabled: props.isDisabled,
932
- testId: "card-action-edit",
933
- onClick: function onClick() {
934
- props.onEdit && props.onEdit();
935
- }
936
- }, "Edit") : null, props.onRemove ? /*#__PURE__*/createElement(MenuItem, {
937
- key: "delete",
938
- disabled: props.isDisabled,
939
- testId: "card-action-remove",
940
- onClick: function onClick() {
941
- props.onRemove && props.onRemove();
942
- }
943
- }, "Remove") : null].filter(function (item) {
944
- return item;
945
- });
946
- }
699
+ }, [onEntityFetchComplete, entry]);
947
700
 
948
701
  if (entry === undefined) {
949
702
  return /*#__PURE__*/createElement(EntryCard, {
950
- size: "default",
951
703
  isLoading: true
952
704
  });
953
705
  }
@@ -960,50 +712,26 @@ function FetchingWrappedEntryCard(props) {
960
712
  });
961
713
  }
962
714
 
963
- var entryStatus = entry ? entityHelpers.getEntryStatus(entry.sys) : undefined;
964
-
965
- if (entryStatus === 'deleted') {
966
- return /*#__PURE__*/createElement(MissingEntityCard, {
967
- entityType: "Entry",
968
- isDisabled: props.isDisabled,
969
- onRemove: props.onRemove
970
- });
971
- }
972
-
973
- var title = entityHelpers.getEntryTitle({
974
- entry: entry,
975
- contentType: contentType,
976
- localeCode: props.locale,
977
- defaultLocaleCode: defaultLocaleCode,
978
- defaultTitle: 'Untitled'
979
- });
980
- var description = entityHelpers.getEntityDescription({
981
- entity: entry,
982
- contentType: contentType,
983
- localeCode: props.locale,
984
- defaultLocaleCode: defaultLocaleCode
715
+ var contentType = props.sdk.space.getCachedContentTypes().find(function (contentType) {
716
+ return contentType.sys.id === entry.sys.contentType.sys.id;
985
717
  });
986
- return /*#__PURE__*/createElement(EntryCard, {
987
- contentType: contentType == null ? void 0 : contentType.name,
988
- title: title,
989
- description: description,
718
+ return /*#__PURE__*/createElement(WrappedEntryCard, {
990
719
  size: "default",
720
+ getAsset: props.sdk.space.getAsset,
721
+ getEntityScheduledActions: loadEntityScheduledActions,
991
722
  isSelected: props.isSelected,
992
- status: entryStatus,
993
- className: styles$2.entryCard,
994
- thumbnailElement: file ? /*#__PURE__*/createElement(EntryThumbnail, {
995
- file: file
996
- }) : undefined,
997
- icon: /*#__PURE__*/createElement(EntityStatusIcon, {
998
- entityType: "Entry",
999
- entity: entry
1000
- }),
1001
- withDragHandle: false,
1002
- actions: renderDropdown()
723
+ isDisabled: props.isDisabled,
724
+ localeCode: props.locale,
725
+ defaultLocaleCode: props.sdk.locales["default"],
726
+ contentType: contentType,
727
+ entry: entry,
728
+ onEdit: props.onEdit,
729
+ onRemove: props.isDisabled ? undefined : props.onRemove,
730
+ isClickable: false
1003
731
  });
1004
732
  }
1005
733
 
1006
- var styles$3 = {
734
+ var styles = {
1007
735
  root: /*#__PURE__*/css({
1008
736
  marginBottom: '1.25rem !important',
1009
737
  display: 'block'
@@ -1012,7 +740,8 @@ var styles$3 = {
1012
740
  // The next 2 properties ensure Entity card won't be aligned above
1013
741
  // a list item marker (i.e. bullet)
1014
742
  display: 'inline-block',
1015
- verticalAlign: 'text-top'
743
+ verticalAlign: 'text-top',
744
+ width: '100%'
1016
745
  })
1017
746
  };
1018
747
  function LinkedEntityBlock(props) {
@@ -1044,7 +773,7 @@ function LinkedEntityBlock(props) {
1044
773
  };
1045
774
 
1046
775
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
1047
- className: styles$3.root,
776
+ className: styles.root,
1048
777
  "data-entity-type": entityType,
1049
778
  "data-entity-id": entityId,
1050
779
  // COMPAT: This makes copy & paste work for Firefox
@@ -1054,7 +783,7 @@ function LinkedEntityBlock(props) {
1054
783
  // COMPAT: This makes copy & paste work for Chromium/Blink browsers and Safari
1055
784
  contentEditable: HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
1056
785
  draggable: HAS_BEFORE_INPUT_SUPPORT ? true : undefined,
1057
- className: styles$3.container
786
+ className: styles.container
1058
787
  }, entityType === 'Entry' && /*#__PURE__*/React__default.createElement(FetchingWrappedEntryCard, {
1059
788
  sdk: sdk,
1060
789
  entryId: entityId,
@@ -2002,14 +1731,13 @@ function insertBlock(editor, nodeType, entity) {
2002
1731
  focus(editor);
2003
1732
  }
2004
1733
 
2005
- var styles$4 = {
1734
+ var styles$1 = {
2006
1735
  icon: /*#__PURE__*/css({
2007
1736
  marginRight: '10px'
2008
1737
  })
2009
1738
  };
2010
1739
  function EmbeddedEntityBlockToolbarIcon(_ref) {
2011
- var isButton = _ref.isButton,
2012
- isDisabled = _ref.isDisabled,
1740
+ var isDisabled = _ref.isDisabled,
2013
1741
  nodeType = _ref.nodeType,
2014
1742
  onClose = _ref.onClose;
2015
1743
  var editor = useContentfulEditor();
@@ -2041,15 +1769,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
2041
1769
 
2042
1770
  var type = getEntityTypeFromNodeType(nodeType);
2043
1771
  var baseClass = "rich-text__" + nodeType;
2044
- return isButton ? /*#__PURE__*/React__default.createElement(Button, {
2045
- isDisabled: isDisabled,
2046
- className: baseClass + "-button",
2047
- size: "small",
2048
- onClick: handleClick,
2049
- startIcon: type === 'Asset' ? /*#__PURE__*/React__default.createElement(AssetIcon, null) : /*#__PURE__*/React__default.createElement(EmbeddedEntryBlockIcon, null),
2050
- variant: "secondary",
2051
- testId: "toolbar-toggle-" + nodeType
2052
- }, "Embed " + type.toLowerCase()) : /*#__PURE__*/React__default.createElement(Menu.Item, {
1772
+ return /*#__PURE__*/React__default.createElement(Menu.Item, {
2053
1773
  disabled: isDisabled,
2054
1774
  className: baseClass + "-list-item",
2055
1775
  onClick: handleClick,
@@ -2059,7 +1779,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
2059
1779
  flexDirection: "row"
2060
1780
  }, /*#__PURE__*/React__default.createElement(Icon, {
2061
1781
  as: type === 'Asset' ? AssetIcon : EmbeddedEntryBlockIcon,
2062
- className: "rich-text__embedded-entry-list-icon " + styles$4.icon,
1782
+ className: "rich-text__embedded-entry-list-icon " + styles$1.icon,
2063
1783
  variant: "secondary"
2064
1784
  }), /*#__PURE__*/React__default.createElement("span", null, type)));
2065
1785
  }
@@ -2158,7 +1878,7 @@ var createEmbeddedAssetBlockPlugin = /*#__PURE__*/createEmbeddedEntityPlugin(BLO
2158
1878
 
2159
1879
  var getEntryTitle = entityHelpers.getEntryTitle,
2160
1880
  getEntryStatus = entityHelpers.getEntryStatus;
2161
- var styles$5 = {
1881
+ var styles$2 = {
2162
1882
  scheduledIcon: /*#__PURE__*/css({
2163
1883
  verticalAlign: 'text-bottom',
2164
1884
  marginRight: tokens.spacing2Xs
@@ -2229,7 +1949,7 @@ function FetchingWrappedInlineEntryCard(props) {
2229
1949
  actions: [/*#__PURE__*/React__default.createElement(MenuItem, {
2230
1950
  key: "remove",
2231
1951
  onClick: props.onRemove,
2232
- testId: "card-action-remove"
1952
+ testId: "delete"
2233
1953
  }, "Remove")]
2234
1954
  });
2235
1955
  }
@@ -2241,20 +1961,19 @@ function FetchingWrappedInlineEntryCard(props) {
2241
1961
  status: status,
2242
1962
  actions: [/*#__PURE__*/React__default.createElement(MenuItem, {
2243
1963
  key: "edit",
2244
- onClick: props.onEdit,
2245
- disabled: props.isDisabled
1964
+ onClick: props.onEdit
2246
1965
  }, "Edit"), /*#__PURE__*/React__default.createElement(MenuItem, {
2247
1966
  key: "remove",
2248
1967
  onClick: props.onRemove,
2249
1968
  disabled: props.isDisabled,
2250
- testId: "card-action-remove"
1969
+ testId: "delete"
2251
1970
  }, "Remove")]
2252
1971
  }, /*#__PURE__*/React__default.createElement(ScheduledIconWithTooltip, {
2253
1972
  getEntityScheduledActions: loadEntityScheduledActions,
2254
1973
  entityType: "Entry",
2255
1974
  entityId: entry.sys.id
2256
1975
  }, /*#__PURE__*/React__default.createElement(ClockIcon, {
2257
- className: styles$5.scheduledIcon,
1976
+ className: styles$2.scheduledIcon,
2258
1977
  variant: "muted",
2259
1978
  testId: "scheduled-icon"
2260
1979
  })), /*#__PURE__*/React__default.createElement(Text$1, null, title));
@@ -2278,7 +1997,7 @@ function createInlineEntryNode(id) {
2278
1997
  };
2279
1998
  }
2280
1999
 
2281
- var styles$6 = {
2000
+ var styles$3 = {
2282
2001
  icon: /*#__PURE__*/css({
2283
2002
  marginRight: '10px'
2284
2003
  }),
@@ -2314,7 +2033,7 @@ function EmbeddedEntityInline(props) {
2314
2033
  }
2315
2034
 
2316
2035
  return /*#__PURE__*/createElement("span", Object.assign({}, props.attributes, {
2317
- className: styles$6.root,
2036
+ className: styles$3.root,
2318
2037
  "data-embedded-entity-inline-id": entryId,
2319
2038
  // COMPAT: This makes copy & paste work for Firefox
2320
2039
  contentEditable: !HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
@@ -2434,15 +2153,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
2434
2153
  return _handleClick.apply(this, arguments);
2435
2154
  }
2436
2155
 
2437
- return props.isButton ? /*#__PURE__*/createElement(Button, {
2438
- isDisabled: props.isDisabled,
2439
- className: INLINES.EMBEDDED_ENTRY + "-button",
2440
- size: "small",
2441
- onClick: handleClick,
2442
- startIcon: /*#__PURE__*/createElement(EmbeddedEntryInlineIcon, null),
2443
- variant: "secondary",
2444
- testId: "toolbar-toggle-" + INLINES.EMBEDDED_ENTRY
2445
- }, "Embed inline entry") : /*#__PURE__*/createElement(Menu.Item, {
2156
+ return /*#__PURE__*/createElement(Menu.Item, {
2446
2157
  disabled: props.isDisabled,
2447
2158
  className: "rich-text__entry-link-block-button",
2448
2159
  testId: "toolbar-toggle-" + INLINES.EMBEDDED_ENTRY,
@@ -2452,7 +2163,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
2452
2163
  flexDirection: "row"
2453
2164
  }, /*#__PURE__*/createElement(EmbeddedEntryInlineIcon, {
2454
2165
  variant: "secondary",
2455
- className: "rich-text__embedded-entry-list-icon " + styles$6.icon
2166
+ className: "rich-text__embedded-entry-list-icon " + styles$3.icon
2456
2167
  }), /*#__PURE__*/createElement("span", null, "Inline entry")));
2457
2168
  }
2458
2169
  function createEmbeddedEntityInlinePlugin(sdk) {
@@ -2528,7 +2239,7 @@ var isMarkEnabled = function isMarkEnabled(field, mark) {
2528
2239
  };
2529
2240
 
2530
2241
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _dropdown, _LABELS;
2531
- var styles$7 = {
2242
+ var styles$4 = {
2532
2243
  dropdown: (_dropdown = {
2533
2244
  root: /*#__PURE__*/css(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
2534
2245
  }, _dropdown[BLOCKS.PARAGRAPH] = /*#__PURE__*/css(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: ", ";\n "])), tokens.fontSizeL), _dropdown[BLOCKS.HEADING_1] = /*#__PURE__*/css(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.625rem;\n "]))), _dropdown[BLOCKS.HEADING_2] = /*#__PURE__*/css(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.4375rem;\n "]))), _dropdown[BLOCKS.HEADING_3] = /*#__PURE__*/css(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.25rem;\n "]))), _dropdown[BLOCKS.HEADING_4] = /*#__PURE__*/css(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.125rem;\n "]))), _dropdown[BLOCKS.HEADING_5] = /*#__PURE__*/css(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1rem;\n "]))), _dropdown[BLOCKS.HEADING_6] = /*#__PURE__*/css(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n "]))), _dropdown)
@@ -2623,7 +2334,7 @@ function ToolbarHeadingButton(props) {
2623
2334
  testId: "dropdown-option-" + nodeType,
2624
2335
  disabled: props.isDisabled
2625
2336
  }, /*#__PURE__*/createElement("span", {
2626
- className: cx(styles$7.dropdown.root, styles$7.dropdown[nodeType])
2337
+ className: cx(styles$4.dropdown.root, styles$4.dropdown[nodeType])
2627
2338
  }, LABELS[nodeType]));
2628
2339
  }).filter(Boolean)));
2629
2340
  }
@@ -2693,7 +2404,7 @@ var transformLift = function transformLift(editor, _ref4) {
2693
2404
  };
2694
2405
 
2695
2406
  var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _dropdown$1, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _headings, _HeadingComponents;
2696
- var styles$8 = {
2407
+ var styles$5 = {
2697
2408
  dropdown: (_dropdown$1 = {
2698
2409
  root: /*#__PURE__*/css(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
2699
2410
  }, _dropdown$1[BLOCKS.PARAGRAPH] = /*#__PURE__*/css(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: ", ";\n "])), tokens.fontSizeL), _dropdown$1[BLOCKS.HEADING_1] = /*#__PURE__*/css(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.625rem;\n "]))), _dropdown$1[BLOCKS.HEADING_2] = /*#__PURE__*/css(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.4375rem;\n "]))), _dropdown$1[BLOCKS.HEADING_3] = /*#__PURE__*/css(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.25rem;\n "]))), _dropdown$1[BLOCKS.HEADING_4] = /*#__PURE__*/css(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.125rem;\n "]))), _dropdown$1[BLOCKS.HEADING_5] = /*#__PURE__*/css(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1rem;\n "]))), _dropdown$1[BLOCKS.HEADING_6] = /*#__PURE__*/css(_templateObject8$1 || (_templateObject8$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n "]))), _dropdown$1),
@@ -2705,7 +2416,7 @@ var styles$8 = {
2705
2416
  function createHeading(Tag, block) {
2706
2417
  return function Heading(props) {
2707
2418
  return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
2708
- className: cx(styles$8.headings.root, styles$8.headings[block])
2419
+ className: cx(styles$5.headings.root, styles$5.headings[block])
2709
2420
  }), props.children);
2710
2421
  };
2711
2422
  }
@@ -2801,7 +2512,7 @@ var createHeadingPlugin = function createHeadingPlugin() {
2801
2512
  };
2802
2513
  };
2803
2514
 
2804
- var styles$9 = {
2515
+ var styles$6 = {
2805
2516
  button: /*#__PURE__*/css({
2806
2517
  height: '30px',
2807
2518
  width: '30px',
@@ -2827,7 +2538,7 @@ function ToolbarButton(props) {
2827
2538
  };
2828
2539
 
2829
2540
  var button = /*#__PURE__*/React__default.createElement(Button, {
2830
- className: cx(styles$9.button, className),
2541
+ className: cx(styles$6.button, className),
2831
2542
  isDisabled: isDisabled,
2832
2543
  startIcon: children,
2833
2544
  onClick: handleClick,
@@ -2838,7 +2549,7 @@ function ToolbarButton(props) {
2838
2549
 
2839
2550
  if (title) {
2840
2551
  return /*#__PURE__*/React__default.createElement(Tooltip, {
2841
- className: styles$9.tooltip,
2552
+ className: styles$6.tooltip,
2842
2553
  placement: "bottom",
2843
2554
  content: title
2844
2555
  }, button);
@@ -2848,7 +2559,7 @@ function ToolbarButton(props) {
2848
2559
  }
2849
2560
 
2850
2561
  var _templateObject$2, _templateObject2$2, _templateObject3$2;
2851
- var styles$a = {
2562
+ var styles$7 = {
2852
2563
  container: /*#__PURE__*/css(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0 0 ", ";\n "])), tokens.spacingL),
2853
2564
  hr: /*#__PURE__*/css(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n height: ", ";\n background: transparent;\n position: relative;\n border: 0;\n user-select: none;\n &:hover {\n cursor: pointer;\n }\n &::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 1px;\n background: ", ";\n top: 50%;\n }\n "])), tokens.spacingM, tokens.gray300),
2854
2565
  hrSelected: /*#__PURE__*/css(_templateObject3$2 || (_templateObject3$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &::after {\n background: ", ";\n -webkit-box-shadow: 0px 0px 5px ", ";\n box-shadow: 0px 0px 5px ", ";\n }\n "])), tokens.colorPrimary, tokens.colorPrimary, tokens.colorPrimary)
@@ -2906,14 +2617,14 @@ function Hr(props) {
2906
2617
  var isSelected = useSelected();
2907
2618
  var isFocused = useFocused();
2908
2619
  return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
2909
- className: styles$a.container,
2620
+ className: styles$7.container,
2910
2621
  "data-void-element": BLOCKS.HR
2911
2622
  }), /*#__PURE__*/createElement("div", {
2912
2623
  draggable: true,
2913
2624
  // Moving `contentEditable` to this div makes it to be selectable when being the first void element, e.g pressing ctrl + a to select everything
2914
2625
  contentEditable: false
2915
2626
  }, /*#__PURE__*/createElement("hr", {
2916
- className: cx(styles$a.hr, isSelected && isFocused ? styles$a.hrSelected : undefined)
2627
+ className: cx(styles$7.hr, isSelected && isFocused ? styles$7.hrSelected : undefined)
2917
2628
  })), props.children);
2918
2629
  }
2919
2630
  var createHrPlugin = function createHrPlugin() {
@@ -2940,7 +2651,7 @@ var createHrPlugin = function createHrPlugin() {
2940
2651
  };
2941
2652
 
2942
2653
  var _templateObject$3, _SYS_LINK_TYPES, _LINK_TYPE_SELECTION_;
2943
- var styles$b = {
2654
+ var styles$8 = {
2944
2655
  removeSelectionLabel: /*#__PURE__*/css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-left: ", ";\n "])), tokens.spacingS)
2945
2656
  };
2946
2657
  var SYS_LINK_TYPES = (_SYS_LINK_TYPES = {}, _SYS_LINK_TYPES[INLINES.ENTRY_HYPERLINK] = 'Entry', _SYS_LINK_TYPES[INLINES.ASSET_HYPERLINK] = 'Asset', _SYS_LINK_TYPES);
@@ -3098,7 +2809,8 @@ function HyperlinkModal(props) {
3098
2809
  onChange: function onChange(event) {
3099
2810
  return setLinkType(event.target.value);
3100
2811
  },
3101
- testId: "link-type-input"
2812
+ testId: "link-type-input",
2813
+ isDisabled: props.readonly
3102
2814
  }, enabledLinkTypes.map(function (nodeType) {
3103
2815
  return /*#__PURE__*/createElement(Select.Option, {
3104
2816
  key: nodeType,
@@ -3114,14 +2826,15 @@ function HyperlinkModal(props) {
3114
2826
  setLinkEntity(null);
3115
2827
  setLinkTarget(event.target.value);
3116
2828
  },
3117
- testId: "link-target-input"
2829
+ testId: "link-target-input",
2830
+ isDisabled: props.readonly
3118
2831
  }), /*#__PURE__*/createElement(FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== INLINES.HYPERLINK && /*#__PURE__*/createElement("div", null, /*#__PURE__*/createElement(FormLabel, {
3119
2832
  isRequired: true,
3120
2833
  htmlFor: ""
3121
- }, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(TextLink, {
2834
+ }, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/createElement(Fragment, null, !props.readonly && /*#__PURE__*/createElement(TextLink, {
3122
2835
  testId: "entity-selection-link",
3123
2836
  onClick: resetLinkEntity,
3124
- className: styles$b.removeSelectionLabel
2837
+ className: styles$8.removeSelectionLabel
3125
2838
  }, "Remove selection"), /*#__PURE__*/createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && /*#__PURE__*/createElement(FetchingWrappedEntryCard, {
3126
2839
  sdk: props.sdk,
3127
2840
  locale: props.sdk.field.locale,
@@ -3152,7 +2865,7 @@ function HyperlinkModal(props) {
3152
2865
  type: "submit",
3153
2866
  variant: "positive",
3154
2867
  size: "small",
3155
- isDisabled: !isLinkComplete(),
2868
+ isDisabled: props.readonly || !isLinkComplete(),
3156
2869
  onClick: handleOnSubmit,
3157
2870
  testId: "confirm-cta"
3158
2871
  }, props.linkType ? 'Update' : 'Insert'))));
@@ -3165,22 +2878,23 @@ function _addOrEditLink() {
3165
2878
  _addOrEditLink = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(editor, sdk, logAction, targetPath) {
3166
2879
  var _target$sys$linkType;
3167
2880
 
3168
- var selectionBeforeBlur, linkType, linkText, linkTarget, linkEntity, _getNodeEntryFromSele, node, path, selectionAfterFocus, currentLinkText, isEditing, data, text, url, type, target;
2881
+ var isReadOnly, selectionBeforeBlur, linkType, linkText, linkTarget, linkEntity, _getNodeEntryFromSele, node, path, selectionAfterFocus, currentLinkText, isEditing, data, text, url, type, target;
3169
2882
 
3170
2883
  return runtime_1.wrap(function _callee3$(_context3) {
3171
2884
  while (1) {
3172
2885
  switch (_context3.prev = _context3.next) {
3173
2886
  case 0:
2887
+ isReadOnly = ReactEditor.isReadOnly(editor);
3174
2888
  selectionBeforeBlur = editor.selection ? _extends({}, editor.selection) : undefined;
3175
2889
 
3176
2890
  if (!(!targetPath && !selectionBeforeBlur)) {
3177
- _context3.next = 3;
2891
+ _context3.next = 4;
3178
2892
  break;
3179
2893
  }
3180
2894
 
3181
2895
  return _context3.abrupt("return");
3182
2896
 
3183
- case 3:
2897
+ case 4:
3184
2898
  _getNodeEntryFromSele = getNodeEntryFromSelection(editor, LINK_TYPES, targetPath), node = _getNodeEntryFromSele[0], path = _getNodeEntryFromSele[1];
3185
2899
 
3186
2900
  if (node && path) {
@@ -3194,7 +2908,7 @@ function _addOrEditLink() {
3194
2908
  currentLinkText = linkText || (editor.selection ? Editor.string(editor, editor.selection) : '');
3195
2909
  isEditing = Boolean(node && path);
3196
2910
  logAction(isEditing ? 'openEditHyperlinkDialog' : 'openCreateHyperlinkDialog');
3197
- _context3.next = 11;
2911
+ _context3.next = 12;
3198
2912
  return ModalDialogLauncher.openDialog({
3199
2913
  title: isEditing ? 'Edit hyperlink' : 'Insert hyperlink',
3200
2914
  width: 'large',
@@ -3209,16 +2923,17 @@ function _addOrEditLink() {
3209
2923
  linkType: linkType,
3210
2924
  linkEntity: linkEntity,
3211
2925
  onClose: onClose,
3212
- sdk: sdk
2926
+ sdk: sdk,
2927
+ readonly: isReadOnly
3213
2928
  });
3214
2929
  });
3215
2930
 
3216
- case 11:
2931
+ case 12:
3217
2932
  data = _context3.sent;
3218
2933
  Transforms.select(editor, selectionAfterFocus);
3219
2934
 
3220
2935
  if (data) {
3221
- _context3.next = 17;
2936
+ _context3.next = 18;
3222
2937
  break;
3223
2938
  }
3224
2939
 
@@ -3226,7 +2941,7 @@ function _addOrEditLink() {
3226
2941
  logAction(isEditing ? 'cancelEditHyperlinkDialog' : 'cancelCreateHyperlinkDialog');
3227
2942
  return _context3.abrupt("return");
3228
2943
 
3229
- case 17:
2944
+ case 18:
3230
2945
  text = data.linkText, url = data.linkTarget, type = data.linkType, target = data.linkEntity;
3231
2946
  Editor.withoutNormalizing(editor, function () {
3232
2947
  insertLink(editor, {
@@ -3243,7 +2958,7 @@ function _addOrEditLink() {
3243
2958
  });
3244
2959
  focus(editor);
3245
2960
 
3246
- case 21:
2961
+ case 22:
3247
2962
  case "end":
3248
2963
  return _context3.stop();
3249
2964
  }
@@ -3460,7 +3175,7 @@ function useEntityInfo(props) {
3460
3175
  return getEntityInfo(status.data);
3461
3176
  }
3462
3177
 
3463
- var styles$c = {
3178
+ var styles$9 = {
3464
3179
  hyperlinkWrapper: /*#__PURE__*/css({
3465
3180
  display: 'inline',
3466
3181
  position: 'static',
@@ -3482,7 +3197,6 @@ var styles$c = {
3482
3197
 
3483
3198
  function EntityHyperlink(props) {
3484
3199
  var editor = useContentfulEditor();
3485
- var isReadOnly = useReadOnly();
3486
3200
  var sdk = useSdkContext();
3487
3201
  var target = props.element.data.target;
3488
3202
  var onEntityFetchComplete = props.onEntityFetchComplete;
@@ -3506,14 +3220,13 @@ function EntityHyperlink(props) {
3506
3220
 
3507
3221
  return /*#__PURE__*/createElement(Tooltip, {
3508
3222
  content: tooltipContent,
3509
- targetWrapperClassName: styles$c.hyperlinkWrapper,
3223
+ targetWrapperClassName: styles$9.hyperlinkWrapper,
3510
3224
  placement: "bottom",
3511
3225
  maxWidth: "auto"
3512
3226
  }, /*#__PURE__*/createElement(TextLink, {
3513
3227
  as: "a",
3514
3228
  onClick: handleClick,
3515
- isDisabled: isReadOnly,
3516
- className: styles$c.hyperlink,
3229
+ className: styles$9.hyperlink,
3517
3230
  "data-link-type": target.sys.linkType,
3518
3231
  "data-link-id": target.sys.id
3519
3232
  }, props.children));
@@ -3521,7 +3234,6 @@ function EntityHyperlink(props) {
3521
3234
 
3522
3235
  function UrlHyperlink(props) {
3523
3236
  var editor = useContentfulEditor();
3524
- var isReadOnly = useReadOnly();
3525
3237
  var sdk = useSdkContext();
3526
3238
  var uri = props.element.data.uri;
3527
3239
 
@@ -3538,7 +3250,7 @@ function UrlHyperlink(props) {
3538
3250
 
3539
3251
  return /*#__PURE__*/createElement(Tooltip, {
3540
3252
  content: uri,
3541
- targetWrapperClassName: styles$c.hyperlinkWrapper,
3253
+ targetWrapperClassName: styles$9.hyperlinkWrapper,
3542
3254
  placement: "bottom",
3543
3255
  maxWidth: "auto"
3544
3256
  }, /*#__PURE__*/createElement(TextLink, {
@@ -3546,8 +3258,7 @@ function UrlHyperlink(props) {
3546
3258
  href: uri,
3547
3259
  rel: "noopener noreferrer",
3548
3260
  onClick: handleClick,
3549
- isDisabled: isReadOnly,
3550
- className: styles$c.hyperlink
3261
+ className: styles$9.hyperlink
3551
3262
  }, props.children));
3552
3263
  }
3553
3264
 
@@ -3673,12 +3384,12 @@ var createHyperlinkPlugin = function createHyperlinkPlugin(sdk) {
3673
3384
 
3674
3385
  var _templateObject$4, _templateObject2$3, _templateObject3$3, _styles;
3675
3386
  var baseStyle = /*#__PURE__*/css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0;\n margin: 0 0 1.25rem 1.25rem;\n\n div:first-child {\n margin: 0;\n line-height: ", ";\n }\n"])), tokens.lineHeightDefault);
3676
- var styles$d = (_styles = {}, _styles[BLOCKS.UL_LIST] = /*#__PURE__*/css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n list-style-type: disc;\n ul {\n list-style-type: circle;\n ul {\n list-style-type: square;\n }\n }\n "]))), _styles[BLOCKS.OL_LIST] = /*#__PURE__*/css(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n list-style-type: decimal;\n ol {\n list-style-type: upper-alpha;\n ol {\n list-style-type: lower-roman;\n ol {\n list-style-type: lower-alpha;\n }\n }\n }\n "]))), _styles);
3387
+ var styles$a = (_styles = {}, _styles[BLOCKS.UL_LIST] = /*#__PURE__*/css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n list-style-type: disc;\n ul {\n list-style-type: circle;\n ul {\n list-style-type: square;\n }\n }\n "]))), _styles[BLOCKS.OL_LIST] = /*#__PURE__*/css(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n list-style-type: decimal;\n ol {\n list-style-type: upper-alpha;\n ol {\n list-style-type: lower-roman;\n ol {\n list-style-type: lower-alpha;\n }\n }\n }\n "]))), _styles);
3677
3388
 
3678
3389
  function createList(Tag, block) {
3679
3390
  return function List(props) {
3680
3391
  return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
3681
- className: cx(baseStyle, styles$d[block])
3392
+ className: cx(baseStyle, styles$a[block])
3682
3393
  }), props.children);
3683
3394
  };
3684
3395
  }
@@ -4659,14 +4370,14 @@ var ToolbarBoldButton = /*#__PURE__*/createMarkToolbarButton({
4659
4370
  mark: MARKS.BOLD,
4660
4371
  icon: /*#__PURE__*/createElement(FormatBoldIcon, null)
4661
4372
  });
4662
- var styles$e = {
4373
+ var styles$b = {
4663
4374
  bold: /*#__PURE__*/css({
4664
4375
  fontWeight: 600
4665
4376
  })
4666
4377
  };
4667
4378
  function Bold(props) {
4668
4379
  return /*#__PURE__*/createElement("strong", Object.assign({}, props.attributes, {
4669
- className: styles$e.bold
4380
+ className: styles$b.bold
4670
4381
  }), props.children);
4671
4382
  }
4672
4383
 
@@ -4706,7 +4417,7 @@ var ToolbarCodeButton = /*#__PURE__*/createMarkToolbarButton({
4706
4417
  mark: MARKS.CODE,
4707
4418
  icon: /*#__PURE__*/createElement(CodeIcon, null)
4708
4419
  });
4709
- var styles$f = {
4420
+ var styles$c = {
4710
4421
  code: /*#__PURE__*/css({
4711
4422
  fontFamily: 'monospace',
4712
4423
  fontSize: '.9em'
@@ -4714,7 +4425,7 @@ var styles$f = {
4714
4425
  };
4715
4426
  function Code(props) {
4716
4427
  return /*#__PURE__*/createElement("code", Object.assign({}, props.attributes, {
4717
- className: styles$f.code
4428
+ className: styles$c.code
4718
4429
  }), props.children);
4719
4430
  }
4720
4431
  var createCodePlugin = function createCodePlugin() {
@@ -4744,14 +4455,14 @@ var ToolbarItalicButton = /*#__PURE__*/createMarkToolbarButton({
4744
4455
  mark: MARKS.ITALIC,
4745
4456
  icon: /*#__PURE__*/createElement(FormatItalicIcon, null)
4746
4457
  });
4747
- var styles$g = {
4458
+ var styles$d = {
4748
4459
  italic: /*#__PURE__*/css({
4749
4460
  fontStyle: 'italic'
4750
4461
  })
4751
4462
  };
4752
4463
  function Italic(props) {
4753
4464
  return /*#__PURE__*/createElement("em", Object.assign({}, props.attributes, {
4754
- className: styles$g.italic
4465
+ className: styles$d.italic
4755
4466
  }), props.children);
4756
4467
  }
4757
4468
  var createItalicPlugin = function createItalicPlugin() {
@@ -5027,10 +4738,10 @@ var createNormalizerPlugin = function createNormalizerPlugin() {
5027
4738
  };
5028
4739
 
5029
4740
  var _templateObject$6, _styles$1;
5030
- var styles$h = (_styles$1 = {}, _styles$1[BLOCKS.PARAGRAPH] = /*#__PURE__*/css(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n line-height: ", ";\n margin-bottom: 1.5em;\n "])), tokens.lineHeightDefault), _styles$1);
4741
+ var styles$e = (_styles$1 = {}, _styles$1[BLOCKS.PARAGRAPH] = /*#__PURE__*/css(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n line-height: ", ";\n margin-bottom: 1.5em;\n "])), tokens.lineHeightDefault), _styles$1);
5031
4742
  function Paragraph(props) {
5032
4743
  return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
5033
- className: styles$h[BLOCKS.PARAGRAPH]
4744
+ className: styles$e[BLOCKS.PARAGRAPH]
5034
4745
  }), props.children);
5035
4746
  }
5036
4747
 
@@ -5851,7 +5562,7 @@ var isTable = function isTable(node) {
5851
5562
  return Element.isElement(node) && node.type === BLOCKS.TABLE;
5852
5563
  };
5853
5564
 
5854
- var styles$i = {
5565
+ var styles$f = {
5855
5566
  topRight: /*#__PURE__*/css({
5856
5567
  position: 'absolute',
5857
5568
  top: '6px',
@@ -5940,7 +5651,7 @@ var TableActions = function TableActions() {
5940
5651
  size: "small",
5941
5652
  variant: "transparent",
5942
5653
  tabIndex: -1,
5943
- className: styles$i.topRight,
5654
+ className: styles$f.topRight,
5944
5655
  icon: /*#__PURE__*/React__default.createElement(ChevronDownIcon, null),
5945
5656
  "aria-label": "Open table menu",
5946
5657
  testId: "cf-table-actions-button"
@@ -6837,7 +6548,7 @@ var normalizeEditorValue = function normalizeEditorValue(value, options) {
6837
6548
  };
6838
6549
 
6839
6550
  var STYLE_EDITOR_BORDER = "1px solid " + tokens.gray400;
6840
- var styles$j = {
6551
+ var styles$g = {
6841
6552
  root: /*#__PURE__*/css({
6842
6553
  position: 'relative'
6843
6554
  }),
@@ -6882,7 +6593,8 @@ var styles$j = {
6882
6593
  }
6883
6594
  }),
6884
6595
  disabled: /*#__PURE__*/css({
6885
- background: tokens.gray100
6596
+ background: tokens.gray100,
6597
+ cursor: 'not-allowed'
6886
6598
  })
6887
6599
  };
6888
6600
 
@@ -6932,35 +6644,18 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
6932
6644
  // TODO: refine permissions check in order to account for tags in rules and then readd access.can('read', 'Asset')
6933
6645
 
6934
6646
  var blockAssetEmbedEnabled = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
6935
- var numEnabledEmbeds = [inlineEntryEmbedEnabled, blockEntryEmbedEnabled, blockAssetEmbedEnabled].filter(Boolean).length;
6936
- var shouldDisplayDropdown = numEnabledEmbeds > 1 || isDisabled; // Avoids UI glitching when switching back and forth between
6937
- // different layouts
6938
-
6939
- React__default.useEffect(function () {
6940
- if (!shouldDisplayDropdown) {
6941
- setEmbedDropdownOpen(false);
6942
- }
6943
- }, [shouldDisplayDropdown]);
6944
6647
  var actions = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, blockEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
6945
6648
  isDisabled: !!isDisabled,
6946
6649
  nodeType: BLOCKS.EMBEDDED_ENTRY,
6947
- onClose: onCloseEntityDropdown,
6948
- isButton: !shouldDisplayDropdown
6650
+ onClose: onCloseEntityDropdown
6949
6651
  }), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
6950
6652
  isDisabled: !!isDisabled || isLinkActive(editor),
6951
- onClose: onCloseEntityDropdown,
6952
- isButton: !shouldDisplayDropdown
6653
+ onClose: onCloseEntityDropdown
6953
6654
  }), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
6954
6655
  isDisabled: !!isDisabled,
6955
6656
  nodeType: BLOCKS.EMBEDDED_ASSET,
6956
- onClose: onCloseEntityDropdown,
6957
- isButton: !shouldDisplayDropdown
6657
+ onClose: onCloseEntityDropdown
6958
6658
  }));
6959
-
6960
- if (!shouldDisplayDropdown) {
6961
- return actions;
6962
- }
6963
-
6964
6659
  return /*#__PURE__*/React__default.createElement(EmbeddedEntityDropdownButton, {
6965
6660
  isDisabled: isDisabled,
6966
6661
  onClose: onCloseEntityDropdown,
@@ -6969,7 +6664,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
6969
6664
  }, actions);
6970
6665
  };
6971
6666
 
6972
- var styles$k = {
6667
+ var styles$h = {
6973
6668
  toolbar: /*#__PURE__*/css({
6974
6669
  border: "1px solid " + tokens.gray400,
6975
6670
  backgroundColor: tokens.gray100,
@@ -7014,14 +6709,14 @@ var Toolbar = function Toolbar(_ref) {
7014
6709
  var shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
7015
6710
  return /*#__PURE__*/React__default.createElement(Flex, {
7016
6711
  testId: "toolbar",
7017
- className: styles$k.toolbar,
6712
+ className: styles$h.toolbar,
7018
6713
  alignItems: "center"
7019
6714
  }, /*#__PURE__*/React__default.createElement("div", {
7020
- className: styles$k.formattingOptionsWrapper
6715
+ className: styles$h.formattingOptionsWrapper
7021
6716
  }, /*#__PURE__*/React__default.createElement(ToolbarHeadingButton, {
7022
6717
  isDisabled: isDisabled || !canInsertBlocks
7023
6718
  }), validationInfo.isAnyMarkEnabled && /*#__PURE__*/React__default.createElement("span", {
7024
- className: styles$k.divider
6719
+ className: styles$h.divider
7025
6720
  }), isMarkEnabled(sdk.field, MARKS.BOLD) && /*#__PURE__*/React__default.createElement(ToolbarBoldButton, {
7026
6721
  isDisabled: isDisabled
7027
6722
  }), isMarkEnabled(sdk.field, MARKS.ITALIC) && /*#__PURE__*/React__default.createElement(ToolbarItalicButton, {
@@ -7031,11 +6726,11 @@ var Toolbar = function Toolbar(_ref) {
7031
6726
  }), isMarkEnabled(sdk.field, MARKS.CODE) && /*#__PURE__*/React__default.createElement(ToolbarCodeButton, {
7032
6727
  isDisabled: isDisabled
7033
6728
  }), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
7034
- className: styles$k.divider
6729
+ className: styles$h.divider
7035
6730
  }), /*#__PURE__*/React__default.createElement(ToolbarHyperlinkButton, {
7036
6731
  isDisabled: isDisabled
7037
6732
  })), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/React__default.createElement("span", {
7038
- className: styles$k.divider
6733
+ className: styles$h.divider
7039
6734
  }), /*#__PURE__*/React__default.createElement(ToolbarListButton, {
7040
6735
  isDisabled: isDisabled || !canInsertBlocks
7041
6736
  }), isNodeTypeEnabled(sdk.field, BLOCKS.QUOTE) && /*#__PURE__*/React__default.createElement(ToolbarQuoteButton, {
@@ -7045,7 +6740,7 @@ var Toolbar = function Toolbar(_ref) {
7045
6740
  }), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && /*#__PURE__*/React__default.createElement(ToolbarTableButton, {
7046
6741
  isDisabled: shouldDisableTables
7047
6742
  })), /*#__PURE__*/React__default.createElement("div", {
7048
- className: styles$k.embedActionsWrapper
6743
+ className: styles$h.embedActionsWrapper
7049
6744
  }, /*#__PURE__*/React__default.createElement(EmbedEntityWidget, {
7050
6745
  isDisabled: isDisabled,
7051
6746
  canInsertBlocks: canInsertBlocks
@@ -7070,7 +6765,7 @@ function getValidationInfo(field) {
7070
6765
  }
7071
6766
 
7072
6767
  var _templateObject$b;
7073
- var styles$l = {
6768
+ var styles$i = {
7074
6769
  nativeSticky: /*#__PURE__*/css(_templateObject$b || (_templateObject$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: -webkit-sticky;\n position: sticky;\n top: -1px;\n z-index: 2;\n "])))
7075
6770
  };
7076
6771
 
@@ -7078,7 +6773,7 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
7078
6773
  var isDisabled = _ref.isDisabled,
7079
6774
  children = _ref.children;
7080
6775
  return /*#__PURE__*/React__default.createElement("div", {
7081
- className: isDisabled ? '' : styles$l.nativeSticky
6776
+ className: isDisabled ? '' : styles$i.nativeSticky
7082
6777
  }, children);
7083
6778
  };
7084
6779
 
@@ -7173,9 +6868,9 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
7173
6868
  setPendingExternalUpdate(true);
7174
6869
  setEditorContent(editor, documentToEditorValue(props.value));
7175
6870
  }, [props.value, id]);
7176
- var classNames = cx(styles$j.editor, props.minHeight !== undefined ? css({
6871
+ var classNames = cx(styles$g.editor, props.minHeight !== undefined ? css({
7177
6872
  minHeight: props.minHeight
7178
- }) : undefined, props.isDisabled ? styles$j.disabled : styles$j.enabled, props.isToolbarHidden && styles$j.hiddenToolbar);
6873
+ }) : undefined, props.isDisabled ? styles$g.disabled : styles$g.enabled, props.isToolbarHidden && styles$g.hiddenToolbar);
7179
6874
  useEffect(function () {
7180
6875
  if (!isFirstRender) {
7181
6876
  return;
@@ -7191,7 +6886,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
7191
6886
  }, /*#__PURE__*/React__default.createElement(ContentfulEditorIdProvider, {
7192
6887
  value: id
7193
6888
  }, /*#__PURE__*/React__default.createElement("div", {
7194
- className: styles$j.root,
6889
+ className: styles$g.root,
7195
6890
  "data-test-id": "rich-text-editor"
7196
6891
  }, /*#__PURE__*/React__default.createElement(Plate, {
7197
6892
  id: id,