@contentful/field-editor-rich-text 2.0.0-next.39 → 2.0.0-next.41

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,179 +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
- onClick: onEdit,
729
- testId: "card-action-edit"
730
- }, "Edit") : null, entityFile ? /*#__PURE__*/createElement(Menu.Item, {
731
- key: "download",
732
- onClick: function onClick() {
733
- if (typeof entityFile.url === 'string') {
734
- downloadAsset(entityFile.url, get(entityFile, 'fileName'));
735
- }
736
- },
737
- testId: "card-action-download"
738
- }, "Download") : null, onRemove ? /*#__PURE__*/createElement(Menu.Item, {
739
- key: "remove",
740
- disabled: isDisabled,
741
- onClick: onRemove,
742
- testId: "card-action-remove"
743
- }, "Remove") : null].filter(function (item) {
744
- return item;
745
- });
746
- }
747
634
  function FetchingWrappedAssetCard(props) {
748
- var _asset$fields;
635
+ var onEntityFetchComplete = props.onEntityFetchComplete,
636
+ assetId = props.assetId;
749
637
 
750
638
  var _useEntities = useEntities(),
751
639
  getOrLoadAsset = _useEntities.getOrLoadAsset,
640
+ loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
752
641
  assets = _useEntities.assets;
753
642
 
754
- var asset = assets[props.assetId];
755
- var defaultLocaleCode = props.sdk.locales["default"];
756
- var entityFile = asset != null && (_asset$fields = asset.fields) != null && _asset$fields.file ? asset.fields.file[props.locale] || asset.fields.file[defaultLocaleCode] : undefined;
757
- var onEntityFetchComplete = props.onEntityFetchComplete;
758
643
  useEffect(function () {
759
- getOrLoadAsset(props.assetId);
760
- }, [props.assetId]); // eslint-disable-line
761
-
644
+ getOrLoadAsset(assetId);
645
+ }, [getOrLoadAsset, assetId]);
646
+ var asset = assets[assetId];
762
647
  useEffect(function () {
763
- if (!asset) {
764
- return;
765
- }
766
-
767
- onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
768
- }, [asset, onEntityFetchComplete]);
769
-
770
- function getAssetSrc() {
771
- if (!(entityFile != null && entityFile.url)) return '';
772
- return entityFile.url + "?h=300";
773
- }
774
-
775
- function getFileType() {
776
- var groupToIconMap = {
777
- image: 'image',
778
- video: 'video',
779
- audio: 'audio',
780
- richtext: 'richtext',
781
- presentation: 'presentation',
782
- spreadsheet: 'spreadsheet',
783
- pdfdocument: 'pdf',
784
- archive: 'archive',
785
- plaintext: 'plaintext',
786
- code: 'code',
787
- markup: 'markup'
788
- };
789
- var archive = groupToIconMap['archive'];
790
-
791
- if (!entityFile) {
792
- return archive;
648
+ if (asset) {
649
+ onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
793
650
  }
794
-
795
- var groupName = mimetype.getGroupLabel({
796
- type: entityFile.contentType,
797
- fallbackFileName: entityFile.fileName
798
- });
799
- return groupToIconMap[groupName] || archive;
800
- }
801
-
802
- if (asset === undefined) {
803
- return /*#__PURE__*/createElement(AssetCard, {
804
- size: "small",
805
- isLoading: true
806
- });
807
- }
651
+ }, [onEntityFetchComplete, asset]);
808
652
 
809
653
  if (asset === 'failed') {
810
654
  return /*#__PURE__*/createElement(MissingEntityCard, {
@@ -814,138 +658,48 @@ function FetchingWrappedAssetCard(props) {
814
658
  });
815
659
  }
816
660
 
817
- var status = asset ? entityHelpers.getEntryStatus(asset.sys) : undefined;
818
-
819
- if (status === 'deleted') {
820
- return /*#__PURE__*/createElement(MissingEntityCard, {
821
- entityType: "Asset",
822
- asSquare: true,
823
- isDisabled: props.isDisabled,
824
- onRemove: props.onRemove
661
+ if (asset === undefined) {
662
+ return /*#__PURE__*/createElement(AssetCard, {
663
+ size: "default",
664
+ isLoading: true
825
665
  });
826
666
  }
827
667
 
828
- var entityTitle = entityHelpers.getAssetTitle({
829
- asset: asset,
830
- localeCode: props.locale,
831
- defaultLocaleCode: defaultLocaleCode,
832
- defaultTitle: 'Untitled'
833
- });
834
- return /*#__PURE__*/createElement(AssetCard, {
835
- title: entityTitle,
836
- isSelected: props.isSelected,
668
+ return /*#__PURE__*/createElement(WrappedAssetCard, {
669
+ getEntityScheduledActions: loadEntityScheduledActions,
837
670
  size: "small",
838
- src: getAssetSrc(),
839
- type: getFileType(),
840
- status: status,
841
- icon: /*#__PURE__*/createElement(EntityStatusIcon, {
842
- entityType: "Asset",
843
- entity: asset
844
- }),
845
- className: styles$1.assetCard,
846
- actions: [renderActions({
847
- entityFile: entityFile,
848
- isDisabled: props.isDisabled,
849
- onEdit: props.onEdit,
850
- onRemove: props.onRemove
851
- }), entityFile ? renderAssetInfo({
852
- entityFile: entityFile
853
- }) : null].filter(function (item) {
854
- return item;
855
- })
856
- });
857
- }
858
-
859
- var styles$2 = {
860
- entryCard: /*#__PURE__*/css({
861
- cursor: 'pointer'
862
- })
863
- };
864
-
865
- function EntryThumbnail(_ref) {
866
- var file = _ref.file;
867
- if (!isValidImage(file)) return null;
868
- return /*#__PURE__*/createElement(AssetThumbnail, {
869
- 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
870
679
  });
871
680
  }
872
681
 
873
682
  function FetchingWrappedEntryCard(props) {
683
+ var entryId = props.entryId,
684
+ onEntityFetchComplete = props.onEntityFetchComplete;
685
+
874
686
  var _useEntities = useEntities(),
875
687
  getOrLoadEntry = _useEntities.getOrLoadEntry,
876
- entries = _useEntities.entries,
877
- getOrLoadAsset = _useEntities.getOrLoadAsset;
878
-
879
- var _React$useState = useState(null),
880
- file = _React$useState[0],
881
- setFile = _React$useState[1];
882
-
883
- var entry = entries[props.entryId];
884
- var contentType = useMemo(function () {
885
- if (!entry || entry === 'failed') {
886
- return undefined;
887
- }
688
+ loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
689
+ entries = _useEntities.entries;
888
690
 
889
- return props.sdk.space.getCachedContentTypes().find(function (contentType) {
890
- return contentType.sys.id === entry.sys.contentType.sys.id;
891
- });
892
- }, [props.sdk, entry]);
893
- var defaultLocaleCode = props.sdk.locales["default"];
894
- var onEntityFetchComplete = props.onEntityFetchComplete;
895
691
  useEffect(function () {
896
- if (!entry || entry === 'failed') return;
897
- var subscribed = true;
898
- entityHelpers.getEntryImage({
899
- entry: entry,
900
- contentType: contentType,
901
- localeCode: props.locale,
902
- defaultLocaleCode: defaultLocaleCode
903
- }, getOrLoadAsset)["catch"](function () {
904
- return null;
905
- }).then(function (file) {
906
- if (subscribed) {
907
- setFile(file);
908
- }
909
- });
910
- return function () {
911
- subscribed = false;
912
- };
913
- }, [entry, contentType, props.locale, defaultLocaleCode, props.sdk, file, getOrLoadAsset]);
914
- useEffect(function () {
915
- getOrLoadEntry(props.entryId);
916
- }, [props.entryId]); // eslint-disable-line
917
-
692
+ getOrLoadEntry(entryId);
693
+ }, [getOrLoadEntry, entryId]);
694
+ var entry = entries[entryId];
918
695
  useEffect(function () {
919
- if (!entry) {
920
- return;
696
+ if (entry) {
697
+ onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
921
698
  }
922
-
923
- onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
924
- }, [entry, onEntityFetchComplete]);
925
-
926
- function renderDropdown() {
927
- if (!props.onEdit || !props.onRemove) return undefined;
928
- return [props.onEdit ? /*#__PURE__*/createElement(MenuItem, {
929
- key: "edit",
930
- testId: "card-action-edit",
931
- onClick: function onClick() {
932
- props.onEdit && props.onEdit();
933
- }
934
- }, "Edit") : null, props.onRemove ? /*#__PURE__*/createElement(MenuItem, {
935
- key: "delete",
936
- disabled: props.isDisabled,
937
- testId: "card-action-remove",
938
- onClick: function onClick() {
939
- props.onRemove && props.onRemove();
940
- }
941
- }, "Remove") : null].filter(function (item) {
942
- return item;
943
- });
944
- }
699
+ }, [onEntityFetchComplete, entry]);
945
700
 
946
701
  if (entry === undefined) {
947
702
  return /*#__PURE__*/createElement(EntryCard, {
948
- size: "default",
949
703
  isLoading: true
950
704
  });
951
705
  }
@@ -958,50 +712,26 @@ function FetchingWrappedEntryCard(props) {
958
712
  });
959
713
  }
960
714
 
961
- var entryStatus = entry ? entityHelpers.getEntryStatus(entry.sys) : undefined;
962
-
963
- if (entryStatus === 'deleted') {
964
- return /*#__PURE__*/createElement(MissingEntityCard, {
965
- entityType: "Entry",
966
- isDisabled: props.isDisabled,
967
- onRemove: props.onRemove
968
- });
969
- }
970
-
971
- var title = entityHelpers.getEntryTitle({
972
- entry: entry,
973
- contentType: contentType,
974
- localeCode: props.locale,
975
- defaultLocaleCode: defaultLocaleCode,
976
- defaultTitle: 'Untitled'
715
+ var contentType = props.sdk.space.getCachedContentTypes().find(function (contentType) {
716
+ return contentType.sys.id === entry.sys.contentType.sys.id;
977
717
  });
978
- var description = entityHelpers.getEntityDescription({
979
- entity: entry,
980
- contentType: contentType,
981
- localeCode: props.locale,
982
- defaultLocaleCode: defaultLocaleCode
983
- });
984
- return /*#__PURE__*/createElement(EntryCard, {
985
- contentType: contentType == null ? void 0 : contentType.name,
986
- title: title,
987
- description: description,
718
+ return /*#__PURE__*/createElement(WrappedEntryCard, {
988
719
  size: "default",
720
+ getAsset: props.sdk.space.getAsset,
721
+ getEntityScheduledActions: loadEntityScheduledActions,
989
722
  isSelected: props.isSelected,
990
- status: entryStatus,
991
- className: styles$2.entryCard,
992
- thumbnailElement: file ? /*#__PURE__*/createElement(EntryThumbnail, {
993
- file: file
994
- }) : undefined,
995
- icon: /*#__PURE__*/createElement(EntityStatusIcon, {
996
- entityType: "Entry",
997
- entity: entry
998
- }),
999
- withDragHandle: false,
1000
- 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
1001
731
  });
1002
732
  }
1003
733
 
1004
- var styles$3 = {
734
+ var styles = {
1005
735
  root: /*#__PURE__*/css({
1006
736
  marginBottom: '1.25rem !important',
1007
737
  display: 'block'
@@ -1043,7 +773,7 @@ function LinkedEntityBlock(props) {
1043
773
  };
1044
774
 
1045
775
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
1046
- className: styles$3.root,
776
+ className: styles.root,
1047
777
  "data-entity-type": entityType,
1048
778
  "data-entity-id": entityId,
1049
779
  // COMPAT: This makes copy & paste work for Firefox
@@ -1053,7 +783,7 @@ function LinkedEntityBlock(props) {
1053
783
  // COMPAT: This makes copy & paste work for Chromium/Blink browsers and Safari
1054
784
  contentEditable: HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
1055
785
  draggable: HAS_BEFORE_INPUT_SUPPORT ? true : undefined,
1056
- className: styles$3.container
786
+ className: styles.container
1057
787
  }, entityType === 'Entry' && /*#__PURE__*/React__default.createElement(FetchingWrappedEntryCard, {
1058
788
  sdk: sdk,
1059
789
  entryId: entityId,
@@ -2001,14 +1731,13 @@ function insertBlock(editor, nodeType, entity) {
2001
1731
  focus(editor);
2002
1732
  }
2003
1733
 
2004
- var styles$4 = {
1734
+ var styles$1 = {
2005
1735
  icon: /*#__PURE__*/css({
2006
1736
  marginRight: '10px'
2007
1737
  })
2008
1738
  };
2009
1739
  function EmbeddedEntityBlockToolbarIcon(_ref) {
2010
- var isButton = _ref.isButton,
2011
- isDisabled = _ref.isDisabled,
1740
+ var isDisabled = _ref.isDisabled,
2012
1741
  nodeType = _ref.nodeType,
2013
1742
  onClose = _ref.onClose;
2014
1743
  var editor = useContentfulEditor();
@@ -2040,15 +1769,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
2040
1769
 
2041
1770
  var type = getEntityTypeFromNodeType(nodeType);
2042
1771
  var baseClass = "rich-text__" + nodeType;
2043
- return isButton ? /*#__PURE__*/React__default.createElement(Button, {
2044
- isDisabled: isDisabled,
2045
- className: baseClass + "-button",
2046
- size: "small",
2047
- onClick: handleClick,
2048
- startIcon: type === 'Asset' ? /*#__PURE__*/React__default.createElement(AssetIcon, null) : /*#__PURE__*/React__default.createElement(EmbeddedEntryBlockIcon, null),
2049
- variant: "secondary",
2050
- testId: "toolbar-toggle-" + nodeType
2051
- }, "Embed " + type.toLowerCase()) : /*#__PURE__*/React__default.createElement(Menu.Item, {
1772
+ return /*#__PURE__*/React__default.createElement(Menu.Item, {
2052
1773
  disabled: isDisabled,
2053
1774
  className: baseClass + "-list-item",
2054
1775
  onClick: handleClick,
@@ -2058,7 +1779,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
2058
1779
  flexDirection: "row"
2059
1780
  }, /*#__PURE__*/React__default.createElement(Icon, {
2060
1781
  as: type === 'Asset' ? AssetIcon : EmbeddedEntryBlockIcon,
2061
- className: "rich-text__embedded-entry-list-icon " + styles$4.icon,
1782
+ className: "rich-text__embedded-entry-list-icon " + styles$1.icon,
2062
1783
  variant: "secondary"
2063
1784
  }), /*#__PURE__*/React__default.createElement("span", null, type)));
2064
1785
  }
@@ -2157,7 +1878,7 @@ var createEmbeddedAssetBlockPlugin = /*#__PURE__*/createEmbeddedEntityPlugin(BLO
2157
1878
 
2158
1879
  var getEntryTitle = entityHelpers.getEntryTitle,
2159
1880
  getEntryStatus = entityHelpers.getEntryStatus;
2160
- var styles$5 = {
1881
+ var styles$2 = {
2161
1882
  scheduledIcon: /*#__PURE__*/css({
2162
1883
  verticalAlign: 'text-bottom',
2163
1884
  marginRight: tokens.spacing2Xs
@@ -2228,7 +1949,7 @@ function FetchingWrappedInlineEntryCard(props) {
2228
1949
  actions: [/*#__PURE__*/React__default.createElement(MenuItem, {
2229
1950
  key: "remove",
2230
1951
  onClick: props.onRemove,
2231
- testId: "card-action-remove"
1952
+ testId: "delete"
2232
1953
  }, "Remove")]
2233
1954
  });
2234
1955
  }
@@ -2245,14 +1966,14 @@ function FetchingWrappedInlineEntryCard(props) {
2245
1966
  key: "remove",
2246
1967
  onClick: props.onRemove,
2247
1968
  disabled: props.isDisabled,
2248
- testId: "card-action-remove"
1969
+ testId: "delete"
2249
1970
  }, "Remove")]
2250
1971
  }, /*#__PURE__*/React__default.createElement(ScheduledIconWithTooltip, {
2251
1972
  getEntityScheduledActions: loadEntityScheduledActions,
2252
1973
  entityType: "Entry",
2253
1974
  entityId: entry.sys.id
2254
1975
  }, /*#__PURE__*/React__default.createElement(ClockIcon, {
2255
- className: styles$5.scheduledIcon,
1976
+ className: styles$2.scheduledIcon,
2256
1977
  variant: "muted",
2257
1978
  testId: "scheduled-icon"
2258
1979
  })), /*#__PURE__*/React__default.createElement(Text$1, null, title));
@@ -2276,7 +1997,7 @@ function createInlineEntryNode(id) {
2276
1997
  };
2277
1998
  }
2278
1999
 
2279
- var styles$6 = {
2000
+ var styles$3 = {
2280
2001
  icon: /*#__PURE__*/css({
2281
2002
  marginRight: '10px'
2282
2003
  }),
@@ -2312,7 +2033,7 @@ function EmbeddedEntityInline(props) {
2312
2033
  }
2313
2034
 
2314
2035
  return /*#__PURE__*/createElement("span", Object.assign({}, props.attributes, {
2315
- className: styles$6.root,
2036
+ className: styles$3.root,
2316
2037
  "data-embedded-entity-inline-id": entryId,
2317
2038
  // COMPAT: This makes copy & paste work for Firefox
2318
2039
  contentEditable: !HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
@@ -2432,15 +2153,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
2432
2153
  return _handleClick.apply(this, arguments);
2433
2154
  }
2434
2155
 
2435
- return props.isButton ? /*#__PURE__*/createElement(Button, {
2436
- isDisabled: props.isDisabled,
2437
- className: INLINES.EMBEDDED_ENTRY + "-button",
2438
- size: "small",
2439
- onClick: handleClick,
2440
- startIcon: /*#__PURE__*/createElement(EmbeddedEntryInlineIcon, null),
2441
- variant: "secondary",
2442
- testId: "toolbar-toggle-" + INLINES.EMBEDDED_ENTRY
2443
- }, "Embed inline entry") : /*#__PURE__*/createElement(Menu.Item, {
2156
+ return /*#__PURE__*/createElement(Menu.Item, {
2444
2157
  disabled: props.isDisabled,
2445
2158
  className: "rich-text__entry-link-block-button",
2446
2159
  testId: "toolbar-toggle-" + INLINES.EMBEDDED_ENTRY,
@@ -2450,7 +2163,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
2450
2163
  flexDirection: "row"
2451
2164
  }, /*#__PURE__*/createElement(EmbeddedEntryInlineIcon, {
2452
2165
  variant: "secondary",
2453
- className: "rich-text__embedded-entry-list-icon " + styles$6.icon
2166
+ className: "rich-text__embedded-entry-list-icon " + styles$3.icon
2454
2167
  }), /*#__PURE__*/createElement("span", null, "Inline entry")));
2455
2168
  }
2456
2169
  function createEmbeddedEntityInlinePlugin(sdk) {
@@ -2526,7 +2239,7 @@ var isMarkEnabled = function isMarkEnabled(field, mark) {
2526
2239
  };
2527
2240
 
2528
2241
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _dropdown, _LABELS;
2529
- var styles$7 = {
2242
+ var styles$4 = {
2530
2243
  dropdown: (_dropdown = {
2531
2244
  root: /*#__PURE__*/css(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
2532
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)
@@ -2621,7 +2334,7 @@ function ToolbarHeadingButton(props) {
2621
2334
  testId: "dropdown-option-" + nodeType,
2622
2335
  disabled: props.isDisabled
2623
2336
  }, /*#__PURE__*/createElement("span", {
2624
- className: cx(styles$7.dropdown.root, styles$7.dropdown[nodeType])
2337
+ className: cx(styles$4.dropdown.root, styles$4.dropdown[nodeType])
2625
2338
  }, LABELS[nodeType]));
2626
2339
  }).filter(Boolean)));
2627
2340
  }
@@ -2691,7 +2404,7 @@ var transformLift = function transformLift(editor, _ref4) {
2691
2404
  };
2692
2405
 
2693
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;
2694
- var styles$8 = {
2407
+ var styles$5 = {
2695
2408
  dropdown: (_dropdown$1 = {
2696
2409
  root: /*#__PURE__*/css(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
2697
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),
@@ -2703,7 +2416,7 @@ var styles$8 = {
2703
2416
  function createHeading(Tag, block) {
2704
2417
  return function Heading(props) {
2705
2418
  return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
2706
- className: cx(styles$8.headings.root, styles$8.headings[block])
2419
+ className: cx(styles$5.headings.root, styles$5.headings[block])
2707
2420
  }), props.children);
2708
2421
  };
2709
2422
  }
@@ -2799,7 +2512,7 @@ var createHeadingPlugin = function createHeadingPlugin() {
2799
2512
  };
2800
2513
  };
2801
2514
 
2802
- var styles$9 = {
2515
+ var styles$6 = {
2803
2516
  button: /*#__PURE__*/css({
2804
2517
  height: '30px',
2805
2518
  width: '30px',
@@ -2825,7 +2538,7 @@ function ToolbarButton(props) {
2825
2538
  };
2826
2539
 
2827
2540
  var button = /*#__PURE__*/React__default.createElement(Button, {
2828
- className: cx(styles$9.button, className),
2541
+ className: cx(styles$6.button, className),
2829
2542
  isDisabled: isDisabled,
2830
2543
  startIcon: children,
2831
2544
  onClick: handleClick,
@@ -2836,7 +2549,7 @@ function ToolbarButton(props) {
2836
2549
 
2837
2550
  if (title) {
2838
2551
  return /*#__PURE__*/React__default.createElement(Tooltip, {
2839
- className: styles$9.tooltip,
2552
+ className: styles$6.tooltip,
2840
2553
  placement: "bottom",
2841
2554
  content: title
2842
2555
  }, button);
@@ -2846,7 +2559,7 @@ function ToolbarButton(props) {
2846
2559
  }
2847
2560
 
2848
2561
  var _templateObject$2, _templateObject2$2, _templateObject3$2;
2849
- var styles$a = {
2562
+ var styles$7 = {
2850
2563
  container: /*#__PURE__*/css(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0 0 ", ";\n "])), tokens.spacingL),
2851
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),
2852
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)
@@ -2904,14 +2617,14 @@ function Hr(props) {
2904
2617
  var isSelected = useSelected();
2905
2618
  var isFocused = useFocused();
2906
2619
  return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
2907
- className: styles$a.container,
2620
+ className: styles$7.container,
2908
2621
  "data-void-element": BLOCKS.HR
2909
2622
  }), /*#__PURE__*/createElement("div", {
2910
2623
  draggable: true,
2911
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
2912
2625
  contentEditable: false
2913
2626
  }, /*#__PURE__*/createElement("hr", {
2914
- className: cx(styles$a.hr, isSelected && isFocused ? styles$a.hrSelected : undefined)
2627
+ className: cx(styles$7.hr, isSelected && isFocused ? styles$7.hrSelected : undefined)
2915
2628
  })), props.children);
2916
2629
  }
2917
2630
  var createHrPlugin = function createHrPlugin() {
@@ -2938,7 +2651,7 @@ var createHrPlugin = function createHrPlugin() {
2938
2651
  };
2939
2652
 
2940
2653
  var _templateObject$3, _SYS_LINK_TYPES, _LINK_TYPE_SELECTION_;
2941
- var styles$b = {
2654
+ var styles$8 = {
2942
2655
  removeSelectionLabel: /*#__PURE__*/css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-left: ", ";\n "])), tokens.spacingS)
2943
2656
  };
2944
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);
@@ -3121,7 +2834,7 @@ function HyperlinkModal(props) {
3121
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,
@@ -3462,7 +3175,7 @@ function useEntityInfo(props) {
3462
3175
  return getEntityInfo(status.data);
3463
3176
  }
3464
3177
 
3465
- var styles$c = {
3178
+ var styles$9 = {
3466
3179
  hyperlinkWrapper: /*#__PURE__*/css({
3467
3180
  display: 'inline',
3468
3181
  position: 'static',
@@ -3507,13 +3220,13 @@ function EntityHyperlink(props) {
3507
3220
 
3508
3221
  return /*#__PURE__*/createElement(Tooltip, {
3509
3222
  content: tooltipContent,
3510
- targetWrapperClassName: styles$c.hyperlinkWrapper,
3223
+ targetWrapperClassName: styles$9.hyperlinkWrapper,
3511
3224
  placement: "bottom",
3512
3225
  maxWidth: "auto"
3513
3226
  }, /*#__PURE__*/createElement(TextLink, {
3514
3227
  as: "a",
3515
3228
  onClick: handleClick,
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));
@@ -3537,7 +3250,7 @@ function UrlHyperlink(props) {
3537
3250
 
3538
3251
  return /*#__PURE__*/createElement(Tooltip, {
3539
3252
  content: uri,
3540
- targetWrapperClassName: styles$c.hyperlinkWrapper,
3253
+ targetWrapperClassName: styles$9.hyperlinkWrapper,
3541
3254
  placement: "bottom",
3542
3255
  maxWidth: "auto"
3543
3256
  }, /*#__PURE__*/createElement(TextLink, {
@@ -3545,7 +3258,7 @@ function UrlHyperlink(props) {
3545
3258
  href: uri,
3546
3259
  rel: "noopener noreferrer",
3547
3260
  onClick: handleClick,
3548
- className: styles$c.hyperlink
3261
+ className: styles$9.hyperlink
3549
3262
  }, props.children));
3550
3263
  }
3551
3264
 
@@ -3671,12 +3384,12 @@ var createHyperlinkPlugin = function createHyperlinkPlugin(sdk) {
3671
3384
 
3672
3385
  var _templateObject$4, _templateObject2$3, _templateObject3$3, _styles;
3673
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);
3674
- 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);
3675
3388
 
3676
3389
  function createList(Tag, block) {
3677
3390
  return function List(props) {
3678
3391
  return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
3679
- className: cx(baseStyle, styles$d[block])
3392
+ className: cx(baseStyle, styles$a[block])
3680
3393
  }), props.children);
3681
3394
  };
3682
3395
  }
@@ -4657,14 +4370,14 @@ var ToolbarBoldButton = /*#__PURE__*/createMarkToolbarButton({
4657
4370
  mark: MARKS.BOLD,
4658
4371
  icon: /*#__PURE__*/createElement(FormatBoldIcon, null)
4659
4372
  });
4660
- var styles$e = {
4373
+ var styles$b = {
4661
4374
  bold: /*#__PURE__*/css({
4662
4375
  fontWeight: 600
4663
4376
  })
4664
4377
  };
4665
4378
  function Bold(props) {
4666
4379
  return /*#__PURE__*/createElement("strong", Object.assign({}, props.attributes, {
4667
- className: styles$e.bold
4380
+ className: styles$b.bold
4668
4381
  }), props.children);
4669
4382
  }
4670
4383
 
@@ -4704,7 +4417,7 @@ var ToolbarCodeButton = /*#__PURE__*/createMarkToolbarButton({
4704
4417
  mark: MARKS.CODE,
4705
4418
  icon: /*#__PURE__*/createElement(CodeIcon, null)
4706
4419
  });
4707
- var styles$f = {
4420
+ var styles$c = {
4708
4421
  code: /*#__PURE__*/css({
4709
4422
  fontFamily: 'monospace',
4710
4423
  fontSize: '.9em'
@@ -4712,7 +4425,7 @@ var styles$f = {
4712
4425
  };
4713
4426
  function Code(props) {
4714
4427
  return /*#__PURE__*/createElement("code", Object.assign({}, props.attributes, {
4715
- className: styles$f.code
4428
+ className: styles$c.code
4716
4429
  }), props.children);
4717
4430
  }
4718
4431
  var createCodePlugin = function createCodePlugin() {
@@ -4742,14 +4455,14 @@ var ToolbarItalicButton = /*#__PURE__*/createMarkToolbarButton({
4742
4455
  mark: MARKS.ITALIC,
4743
4456
  icon: /*#__PURE__*/createElement(FormatItalicIcon, null)
4744
4457
  });
4745
- var styles$g = {
4458
+ var styles$d = {
4746
4459
  italic: /*#__PURE__*/css({
4747
4460
  fontStyle: 'italic'
4748
4461
  })
4749
4462
  };
4750
4463
  function Italic(props) {
4751
4464
  return /*#__PURE__*/createElement("em", Object.assign({}, props.attributes, {
4752
- className: styles$g.italic
4465
+ className: styles$d.italic
4753
4466
  }), props.children);
4754
4467
  }
4755
4468
  var createItalicPlugin = function createItalicPlugin() {
@@ -5025,10 +4738,10 @@ var createNormalizerPlugin = function createNormalizerPlugin() {
5025
4738
  };
5026
4739
 
5027
4740
  var _templateObject$6, _styles$1;
5028
- 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);
5029
4742
  function Paragraph(props) {
5030
4743
  return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
5031
- className: styles$h[BLOCKS.PARAGRAPH]
4744
+ className: styles$e[BLOCKS.PARAGRAPH]
5032
4745
  }), props.children);
5033
4746
  }
5034
4747
 
@@ -5849,7 +5562,7 @@ var isTable = function isTable(node) {
5849
5562
  return Element.isElement(node) && node.type === BLOCKS.TABLE;
5850
5563
  };
5851
5564
 
5852
- var styles$i = {
5565
+ var styles$f = {
5853
5566
  topRight: /*#__PURE__*/css({
5854
5567
  position: 'absolute',
5855
5568
  top: '6px',
@@ -5938,7 +5651,7 @@ var TableActions = function TableActions() {
5938
5651
  size: "small",
5939
5652
  variant: "transparent",
5940
5653
  tabIndex: -1,
5941
- className: styles$i.topRight,
5654
+ className: styles$f.topRight,
5942
5655
  icon: /*#__PURE__*/React__default.createElement(ChevronDownIcon, null),
5943
5656
  "aria-label": "Open table menu",
5944
5657
  testId: "cf-table-actions-button"
@@ -6760,6 +6473,42 @@ var disableCorePlugins = {
6760
6473
  eventEditor: true
6761
6474
  };
6762
6475
 
6476
+ var isTextElement = function isTextElement(node) {
6477
+ return 'text' in node;
6478
+ };
6479
+ /**
6480
+ * Ensures all nodes have a child leaf text element. This should be handled by
6481
+ * Slate but its behavior has proven to be buggy and unpredictable.
6482
+ */
6483
+
6484
+
6485
+ function sanitizeIncomingSlateDoc(nodes) {
6486
+ if (nodes === void 0) {
6487
+ nodes = [];
6488
+ }
6489
+
6490
+ return nodes.map(function (node) {
6491
+ var _node$children;
6492
+
6493
+ if (isTextElement(node)) {
6494
+ return node;
6495
+ }
6496
+
6497
+ if (((_node$children = node.children) == null ? void 0 : _node$children.length) === 0) {
6498
+ return _extends({}, node, {
6499
+ children: [{
6500
+ text: '',
6501
+ data: {}
6502
+ }]
6503
+ });
6504
+ }
6505
+
6506
+ return _extends({}, node, {
6507
+ children: sanitizeIncomingSlateDoc(node.children)
6508
+ });
6509
+ });
6510
+ }
6511
+
6763
6512
  /**
6764
6513
  * For legacy reasons, a document may not have any content at all
6765
6514
  * e.g:
@@ -6814,16 +6563,17 @@ var setEditorContent = function setEditorContent(editor, nodes) {
6814
6563
  });
6815
6564
  };
6816
6565
  /**
6817
- * Converts a contenful rich text document to the corresponding slate editor
6566
+ * Converts a Contentful rich text document to the corresponding slate editor
6818
6567
  * value
6819
6568
  */
6820
6569
 
6821
6570
  var documentToEditorValue = function documentToEditorValue(doc) {
6822
- return toSlatejsDocument({
6571
+ var slateDoc = toSlatejsDocument({
6823
6572
  document: hasContent(doc) ? doc : EMPTY_DOCUMENT,
6824
6573
  // TODO: get rid of schema, https://github.com/contentful/field-editors/pull/1065#discussion_r826723248
6825
6574
  schema: schema
6826
6575
  });
6576
+ return sanitizeIncomingSlateDoc(slateDoc);
6827
6577
  };
6828
6578
  var normalizeEditorValue = function normalizeEditorValue(value, options) {
6829
6579
  var editor = createPlateEditor(options);
@@ -6835,7 +6585,7 @@ var normalizeEditorValue = function normalizeEditorValue(value, options) {
6835
6585
  };
6836
6586
 
6837
6587
  var STYLE_EDITOR_BORDER = "1px solid " + tokens.gray400;
6838
- var styles$j = {
6588
+ var styles$g = {
6839
6589
  root: /*#__PURE__*/css({
6840
6590
  position: 'relative'
6841
6591
  }),
@@ -6931,35 +6681,18 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
6931
6681
  // TODO: refine permissions check in order to account for tags in rules and then readd access.can('read', 'Asset')
6932
6682
 
6933
6683
  var blockAssetEmbedEnabled = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
6934
- var numEnabledEmbeds = [inlineEntryEmbedEnabled, blockEntryEmbedEnabled, blockAssetEmbedEnabled].filter(Boolean).length;
6935
- var shouldDisplayDropdown = numEnabledEmbeds > 1 || isDisabled; // Avoids UI glitching when switching back and forth between
6936
- // different layouts
6937
-
6938
- React__default.useEffect(function () {
6939
- if (!shouldDisplayDropdown) {
6940
- setEmbedDropdownOpen(false);
6941
- }
6942
- }, [shouldDisplayDropdown]);
6943
6684
  var actions = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, blockEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
6944
6685
  isDisabled: !!isDisabled,
6945
6686
  nodeType: BLOCKS.EMBEDDED_ENTRY,
6946
- onClose: onCloseEntityDropdown,
6947
- isButton: !shouldDisplayDropdown
6687
+ onClose: onCloseEntityDropdown
6948
6688
  }), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
6949
6689
  isDisabled: !!isDisabled || isLinkActive(editor),
6950
- onClose: onCloseEntityDropdown,
6951
- isButton: !shouldDisplayDropdown
6690
+ onClose: onCloseEntityDropdown
6952
6691
  }), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
6953
6692
  isDisabled: !!isDisabled,
6954
6693
  nodeType: BLOCKS.EMBEDDED_ASSET,
6955
- onClose: onCloseEntityDropdown,
6956
- isButton: !shouldDisplayDropdown
6694
+ onClose: onCloseEntityDropdown
6957
6695
  }));
6958
-
6959
- if (!shouldDisplayDropdown) {
6960
- return actions;
6961
- }
6962
-
6963
6696
  return /*#__PURE__*/React__default.createElement(EmbeddedEntityDropdownButton, {
6964
6697
  isDisabled: isDisabled,
6965
6698
  onClose: onCloseEntityDropdown,
@@ -6968,7 +6701,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
6968
6701
  }, actions);
6969
6702
  };
6970
6703
 
6971
- var styles$k = {
6704
+ var styles$h = {
6972
6705
  toolbar: /*#__PURE__*/css({
6973
6706
  border: "1px solid " + tokens.gray400,
6974
6707
  backgroundColor: tokens.gray100,
@@ -7013,14 +6746,14 @@ var Toolbar = function Toolbar(_ref) {
7013
6746
  var shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
7014
6747
  return /*#__PURE__*/React__default.createElement(Flex, {
7015
6748
  testId: "toolbar",
7016
- className: styles$k.toolbar,
6749
+ className: styles$h.toolbar,
7017
6750
  alignItems: "center"
7018
6751
  }, /*#__PURE__*/React__default.createElement("div", {
7019
- className: styles$k.formattingOptionsWrapper
6752
+ className: styles$h.formattingOptionsWrapper
7020
6753
  }, /*#__PURE__*/React__default.createElement(ToolbarHeadingButton, {
7021
6754
  isDisabled: isDisabled || !canInsertBlocks
7022
6755
  }), validationInfo.isAnyMarkEnabled && /*#__PURE__*/React__default.createElement("span", {
7023
- className: styles$k.divider
6756
+ className: styles$h.divider
7024
6757
  }), isMarkEnabled(sdk.field, MARKS.BOLD) && /*#__PURE__*/React__default.createElement(ToolbarBoldButton, {
7025
6758
  isDisabled: isDisabled
7026
6759
  }), isMarkEnabled(sdk.field, MARKS.ITALIC) && /*#__PURE__*/React__default.createElement(ToolbarItalicButton, {
@@ -7030,11 +6763,11 @@ var Toolbar = function Toolbar(_ref) {
7030
6763
  }), isMarkEnabled(sdk.field, MARKS.CODE) && /*#__PURE__*/React__default.createElement(ToolbarCodeButton, {
7031
6764
  isDisabled: isDisabled
7032
6765
  }), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
7033
- className: styles$k.divider
6766
+ className: styles$h.divider
7034
6767
  }), /*#__PURE__*/React__default.createElement(ToolbarHyperlinkButton, {
7035
6768
  isDisabled: isDisabled
7036
6769
  })), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/React__default.createElement("span", {
7037
- className: styles$k.divider
6770
+ className: styles$h.divider
7038
6771
  }), /*#__PURE__*/React__default.createElement(ToolbarListButton, {
7039
6772
  isDisabled: isDisabled || !canInsertBlocks
7040
6773
  }), isNodeTypeEnabled(sdk.field, BLOCKS.QUOTE) && /*#__PURE__*/React__default.createElement(ToolbarQuoteButton, {
@@ -7044,7 +6777,7 @@ var Toolbar = function Toolbar(_ref) {
7044
6777
  }), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && /*#__PURE__*/React__default.createElement(ToolbarTableButton, {
7045
6778
  isDisabled: shouldDisableTables
7046
6779
  })), /*#__PURE__*/React__default.createElement("div", {
7047
- className: styles$k.embedActionsWrapper
6780
+ className: styles$h.embedActionsWrapper
7048
6781
  }, /*#__PURE__*/React__default.createElement(EmbedEntityWidget, {
7049
6782
  isDisabled: isDisabled,
7050
6783
  canInsertBlocks: canInsertBlocks
@@ -7069,7 +6802,7 @@ function getValidationInfo(field) {
7069
6802
  }
7070
6803
 
7071
6804
  var _templateObject$b;
7072
- var styles$l = {
6805
+ var styles$i = {
7073
6806
  nativeSticky: /*#__PURE__*/css(_templateObject$b || (_templateObject$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: -webkit-sticky;\n position: sticky;\n top: -1px;\n z-index: 2;\n "])))
7074
6807
  };
7075
6808
 
@@ -7077,7 +6810,7 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
7077
6810
  var isDisabled = _ref.isDisabled,
7078
6811
  children = _ref.children;
7079
6812
  return /*#__PURE__*/React__default.createElement("div", {
7080
- className: isDisabled ? '' : styles$l.nativeSticky
6813
+ className: isDisabled ? '' : styles$i.nativeSticky
7081
6814
  }, children);
7082
6815
  };
7083
6816
 
@@ -7172,9 +6905,9 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
7172
6905
  setPendingExternalUpdate(true);
7173
6906
  setEditorContent(editor, documentToEditorValue(props.value));
7174
6907
  }, [props.value, id]);
7175
- var classNames = cx(styles$j.editor, props.minHeight !== undefined ? css({
6908
+ var classNames = cx(styles$g.editor, props.minHeight !== undefined ? css({
7176
6909
  minHeight: props.minHeight
7177
- }) : undefined, props.isDisabled ? styles$j.disabled : styles$j.enabled, props.isToolbarHidden && styles$j.hiddenToolbar);
6910
+ }) : undefined, props.isDisabled ? styles$g.disabled : styles$g.enabled, props.isToolbarHidden && styles$g.hiddenToolbar);
7178
6911
  useEffect(function () {
7179
6912
  if (!isFirstRender) {
7180
6913
  return;
@@ -7190,7 +6923,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
7190
6923
  }, /*#__PURE__*/React__default.createElement(ContentfulEditorIdProvider, {
7191
6924
  value: id
7192
6925
  }, /*#__PURE__*/React__default.createElement("div", {
7193
- className: styles$j.root,
6926
+ className: styles$g.root,
7194
6927
  "data-test-id": "rich-text-editor"
7195
6928
  }, /*#__PURE__*/React__default.createElement(Plate, {
7196
6929
  id: id,