@contentful/field-editor-rich-text 2.0.0-next.41 → 2.0.0-next.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/field-editor-rich-text.cjs.development.js +373 -103
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +378 -108
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/shared/EntityStatusIcon.d.ts +7 -0
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +10 -0
- package/package.json +2 -2
|
@@ -21,11 +21,12 @@ var slate = require('slate');
|
|
|
21
21
|
var Slate = require('slate-react');
|
|
22
22
|
var constate = _interopDefault(require('constate'));
|
|
23
23
|
var f36Components = require('@contentful/f36-components');
|
|
24
|
-
var
|
|
25
|
-
var flow = _interopDefault(require('lodash/flow'));
|
|
24
|
+
var mimetype = _interopDefault(require('@contentful/mimetype'));
|
|
26
25
|
var get = _interopDefault(require('lodash/get'));
|
|
27
26
|
var f36Icons = require('@contentful/f36-icons');
|
|
28
27
|
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
28
|
+
var find = _interopDefault(require('lodash/find'));
|
|
29
|
+
var flow = _interopDefault(require('lodash/flow'));
|
|
29
30
|
var plateList = require('@udecode/plate-list');
|
|
30
31
|
var castArray = _interopDefault(require('lodash/castArray'));
|
|
31
32
|
var plateBasicMarks = require('@udecode/plate-basic-marks');
|
|
@@ -638,24 +639,179 @@ var _constate = /*#__PURE__*/constate(useSdk),
|
|
|
638
639
|
SdkProvider = _constate[0],
|
|
639
640
|
useSdkContext = _constate[1];
|
|
640
641
|
|
|
642
|
+
var styles = {
|
|
643
|
+
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
644
|
+
marginRight: tokens.spacing2Xs
|
|
645
|
+
})
|
|
646
|
+
};
|
|
647
|
+
function EntityStatusIcon(_ref) {
|
|
648
|
+
var entity = _ref.entity,
|
|
649
|
+
entityType = _ref.entityType;
|
|
650
|
+
|
|
651
|
+
var _useEntities = fieldEditorReference.useEntities(),
|
|
652
|
+
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
|
|
653
|
+
|
|
654
|
+
return /*#__PURE__*/React.createElement(fieldEditorReference.ScheduledIconWithTooltip, {
|
|
655
|
+
getEntityScheduledActions: loadEntityScheduledActions,
|
|
656
|
+
entityType: entityType,
|
|
657
|
+
entityId: entity.sys.id
|
|
658
|
+
}, /*#__PURE__*/React.createElement(f36Icons.ClockIcon, {
|
|
659
|
+
className: styles.scheduleIcon,
|
|
660
|
+
size: "small",
|
|
661
|
+
color: "muted",
|
|
662
|
+
testId: "schedule-icon"
|
|
663
|
+
}));
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
var styles$1 = {
|
|
667
|
+
assetCard: /*#__PURE__*/emotion.css({
|
|
668
|
+
cursor: 'pointer'
|
|
669
|
+
}),
|
|
670
|
+
cardDropdown: /*#__PURE__*/emotion.css({
|
|
671
|
+
width: '300px'
|
|
672
|
+
}),
|
|
673
|
+
truncated: /*#__PURE__*/emotion.css({
|
|
674
|
+
overflow: 'hidden',
|
|
675
|
+
whiteSpace: 'nowrap',
|
|
676
|
+
textOverflow: 'ellipsis'
|
|
677
|
+
})
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
function downloadAsset(url, fileName) {
|
|
681
|
+
// This method won't work if we have CORS disabled(asset not on the contentful server)
|
|
682
|
+
fetch(url, {
|
|
683
|
+
method: 'GET',
|
|
684
|
+
headers: {}
|
|
685
|
+
}).then(function (response) {
|
|
686
|
+
response.arrayBuffer().then(function (buffer) {
|
|
687
|
+
var url = window.URL.createObjectURL(new Blob([buffer]));
|
|
688
|
+
var link = document.createElement('a');
|
|
689
|
+
link.href = url;
|
|
690
|
+
link.setAttribute('download', fileName); //or any other extension
|
|
691
|
+
|
|
692
|
+
document.body.appendChild(link);
|
|
693
|
+
link.click();
|
|
694
|
+
document.body.removeChild(link);
|
|
695
|
+
});
|
|
696
|
+
})["catch"](function (err) {
|
|
697
|
+
f36Components.Notification.error('Failed to download asset');
|
|
698
|
+
console.log(err);
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function renderAssetInfo(props) {
|
|
703
|
+
var entityFile = props.entityFile;
|
|
704
|
+
var fileName = get(entityFile, 'fileName');
|
|
705
|
+
var mimeType = get(entityFile, 'contentType');
|
|
706
|
+
var fileSize = get(entityFile, 'details.size');
|
|
707
|
+
var image = get(entityFile, 'details.image');
|
|
708
|
+
return [/*#__PURE__*/React.createElement(f36Components.Menu.SectionTitle, {
|
|
709
|
+
key: "file-section"
|
|
710
|
+
}, "File info"), fileName && /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
711
|
+
key: "file-name"
|
|
712
|
+
}, /*#__PURE__*/React.createElement(f36Components.Text, {
|
|
713
|
+
isTruncated: true
|
|
714
|
+
}, fileName)), mimeType && /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
715
|
+
key: "file-type"
|
|
716
|
+
}, /*#__PURE__*/React.createElement(f36Components.Text, {
|
|
717
|
+
isTruncated: true
|
|
718
|
+
}, mimeType)), fileSize && /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
719
|
+
key: "file-size"
|
|
720
|
+
}, fieldEditorShared.shortenStorageUnit(fileSize, 'B')), image && /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
721
|
+
key: "file-dimentions"
|
|
722
|
+
}, image.width + " \xD7 " + image.height)].filter(function (item) {
|
|
723
|
+
return item;
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
function renderActions(props) {
|
|
727
|
+
var entityFile = props.entityFile,
|
|
728
|
+
isDisabled = props.isDisabled,
|
|
729
|
+
onEdit = props.onEdit,
|
|
730
|
+
onRemove = props.onRemove;
|
|
731
|
+
return [/*#__PURE__*/React.createElement(f36Components.Menu.SectionTitle, {
|
|
732
|
+
key: "section-title"
|
|
733
|
+
}, "Actions"), onEdit ? /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
734
|
+
key: "edit",
|
|
735
|
+
onClick: onEdit,
|
|
736
|
+
testId: "card-action-edit"
|
|
737
|
+
}, "Edit") : null, entityFile ? /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
738
|
+
key: "download",
|
|
739
|
+
onClick: function onClick() {
|
|
740
|
+
if (typeof entityFile.url === 'string') {
|
|
741
|
+
downloadAsset(entityFile.url, get(entityFile, 'fileName'));
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
testId: "card-action-download"
|
|
745
|
+
}, "Download") : null, onRemove ? /*#__PURE__*/React.createElement(f36Components.Menu.Item, {
|
|
746
|
+
key: "remove",
|
|
747
|
+
disabled: isDisabled,
|
|
748
|
+
onClick: onRemove,
|
|
749
|
+
testId: "card-action-remove"
|
|
750
|
+
}, "Remove") : null].filter(function (item) {
|
|
751
|
+
return item;
|
|
752
|
+
});
|
|
753
|
+
}
|
|
641
754
|
function FetchingWrappedAssetCard(props) {
|
|
642
|
-
var
|
|
643
|
-
assetId = props.assetId;
|
|
755
|
+
var _asset$fields;
|
|
644
756
|
|
|
645
757
|
var _useEntities = fieldEditorReference.useEntities(),
|
|
646
758
|
getOrLoadAsset = _useEntities.getOrLoadAsset,
|
|
647
|
-
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
|
|
648
759
|
assets = _useEntities.assets;
|
|
649
760
|
|
|
761
|
+
var asset = assets[props.assetId];
|
|
762
|
+
var defaultLocaleCode = props.sdk.locales["default"];
|
|
763
|
+
var entityFile = asset != null && (_asset$fields = asset.fields) != null && _asset$fields.file ? asset.fields.file[props.locale] || asset.fields.file[defaultLocaleCode] : undefined;
|
|
764
|
+
var onEntityFetchComplete = props.onEntityFetchComplete;
|
|
650
765
|
React.useEffect(function () {
|
|
651
|
-
getOrLoadAsset(assetId);
|
|
652
|
-
}, [
|
|
653
|
-
|
|
766
|
+
getOrLoadAsset(props.assetId);
|
|
767
|
+
}, [props.assetId]); // eslint-disable-line
|
|
768
|
+
|
|
654
769
|
React.useEffect(function () {
|
|
655
|
-
if (asset) {
|
|
656
|
-
|
|
770
|
+
if (!asset) {
|
|
771
|
+
return;
|
|
657
772
|
}
|
|
658
|
-
|
|
773
|
+
|
|
774
|
+
onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
|
|
775
|
+
}, [asset, onEntityFetchComplete]);
|
|
776
|
+
|
|
777
|
+
function getAssetSrc() {
|
|
778
|
+
if (!(entityFile != null && entityFile.url)) return '';
|
|
779
|
+
return entityFile.url + "?h=300";
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function getFileType() {
|
|
783
|
+
var groupToIconMap = {
|
|
784
|
+
image: 'image',
|
|
785
|
+
video: 'video',
|
|
786
|
+
audio: 'audio',
|
|
787
|
+
richtext: 'richtext',
|
|
788
|
+
presentation: 'presentation',
|
|
789
|
+
spreadsheet: 'spreadsheet',
|
|
790
|
+
pdfdocument: 'pdf',
|
|
791
|
+
archive: 'archive',
|
|
792
|
+
plaintext: 'plaintext',
|
|
793
|
+
code: 'code',
|
|
794
|
+
markup: 'markup'
|
|
795
|
+
};
|
|
796
|
+
var archive = groupToIconMap['archive'];
|
|
797
|
+
|
|
798
|
+
if (!entityFile) {
|
|
799
|
+
return archive;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
var groupName = mimetype.getGroupLabel({
|
|
803
|
+
type: entityFile.contentType,
|
|
804
|
+
fallbackFileName: entityFile.fileName
|
|
805
|
+
});
|
|
806
|
+
return groupToIconMap[groupName] || archive;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (asset === undefined) {
|
|
810
|
+
return /*#__PURE__*/React.createElement(f36Components.AssetCard, {
|
|
811
|
+
size: "small",
|
|
812
|
+
isLoading: true
|
|
813
|
+
});
|
|
814
|
+
}
|
|
659
815
|
|
|
660
816
|
if (asset === 'failed') {
|
|
661
817
|
return /*#__PURE__*/React.createElement(fieldEditorReference.MissingEntityCard, {
|
|
@@ -665,48 +821,138 @@ function FetchingWrappedAssetCard(props) {
|
|
|
665
821
|
});
|
|
666
822
|
}
|
|
667
823
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
824
|
+
var status = asset ? fieldEditorShared.entityHelpers.getEntryStatus(asset.sys) : undefined;
|
|
825
|
+
|
|
826
|
+
if (status === 'deleted') {
|
|
827
|
+
return /*#__PURE__*/React.createElement(fieldEditorReference.MissingEntityCard, {
|
|
828
|
+
entityType: "Asset",
|
|
829
|
+
asSquare: true,
|
|
830
|
+
isDisabled: props.isDisabled,
|
|
831
|
+
onRemove: props.onRemove
|
|
672
832
|
});
|
|
673
833
|
}
|
|
674
834
|
|
|
675
|
-
|
|
676
|
-
getEntityScheduledActions: loadEntityScheduledActions,
|
|
677
|
-
size: "small",
|
|
678
|
-
isSelected: props.isSelected,
|
|
679
|
-
isDisabled: props.isDisabled,
|
|
680
|
-
localeCode: props.locale,
|
|
681
|
-
defaultLocaleCode: props.sdk.locales["default"],
|
|
835
|
+
var entityTitle = fieldEditorShared.entityHelpers.getAssetTitle({
|
|
682
836
|
asset: asset,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
837
|
+
localeCode: props.locale,
|
|
838
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
839
|
+
defaultTitle: 'Untitled'
|
|
840
|
+
});
|
|
841
|
+
return /*#__PURE__*/React.createElement(f36Components.AssetCard, {
|
|
842
|
+
title: entityTitle,
|
|
843
|
+
isSelected: props.isSelected,
|
|
844
|
+
size: "small",
|
|
845
|
+
src: getAssetSrc(),
|
|
846
|
+
type: getFileType(),
|
|
847
|
+
status: status,
|
|
848
|
+
icon: /*#__PURE__*/React.createElement(EntityStatusIcon, {
|
|
849
|
+
entityType: "Asset",
|
|
850
|
+
entity: asset
|
|
851
|
+
}),
|
|
852
|
+
className: styles$1.assetCard,
|
|
853
|
+
actions: [renderActions({
|
|
854
|
+
entityFile: entityFile,
|
|
855
|
+
isDisabled: props.isDisabled,
|
|
856
|
+
onEdit: props.onEdit,
|
|
857
|
+
onRemove: props.onRemove
|
|
858
|
+
}), entityFile ? renderAssetInfo({
|
|
859
|
+
entityFile: entityFile
|
|
860
|
+
}) : null].filter(function (item) {
|
|
861
|
+
return item;
|
|
862
|
+
})
|
|
686
863
|
});
|
|
687
864
|
}
|
|
688
865
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
866
|
+
var styles$2 = {
|
|
867
|
+
entryCard: /*#__PURE__*/emotion.css({
|
|
868
|
+
cursor: 'pointer'
|
|
869
|
+
})
|
|
870
|
+
};
|
|
692
871
|
|
|
872
|
+
function EntryThumbnail(_ref) {
|
|
873
|
+
var file = _ref.file;
|
|
874
|
+
if (!fieldEditorShared.isValidImage(file)) return null;
|
|
875
|
+
return /*#__PURE__*/React.createElement(fieldEditorReference.AssetThumbnail, {
|
|
876
|
+
file: file
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function FetchingWrappedEntryCard(props) {
|
|
693
881
|
var _useEntities = fieldEditorReference.useEntities(),
|
|
694
882
|
getOrLoadEntry = _useEntities.getOrLoadEntry,
|
|
695
|
-
|
|
696
|
-
|
|
883
|
+
entries = _useEntities.entries,
|
|
884
|
+
getOrLoadAsset = _useEntities.getOrLoadAsset;
|
|
697
885
|
|
|
886
|
+
var _React$useState = React.useState(null),
|
|
887
|
+
file = _React$useState[0],
|
|
888
|
+
setFile = _React$useState[1];
|
|
889
|
+
|
|
890
|
+
var entry = entries[props.entryId];
|
|
891
|
+
var contentType = React.useMemo(function () {
|
|
892
|
+
if (!entry || entry === 'failed') {
|
|
893
|
+
return undefined;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
return props.sdk.space.getCachedContentTypes().find(function (contentType) {
|
|
897
|
+
return contentType.sys.id === entry.sys.contentType.sys.id;
|
|
898
|
+
});
|
|
899
|
+
}, [props.sdk, entry]);
|
|
900
|
+
var defaultLocaleCode = props.sdk.locales["default"];
|
|
901
|
+
var onEntityFetchComplete = props.onEntityFetchComplete;
|
|
902
|
+
React.useEffect(function () {
|
|
903
|
+
if (!entry || entry === 'failed') return;
|
|
904
|
+
var subscribed = true;
|
|
905
|
+
fieldEditorShared.entityHelpers.getEntryImage({
|
|
906
|
+
entry: entry,
|
|
907
|
+
contentType: contentType,
|
|
908
|
+
localeCode: props.locale,
|
|
909
|
+
defaultLocaleCode: defaultLocaleCode
|
|
910
|
+
}, getOrLoadAsset)["catch"](function () {
|
|
911
|
+
return null;
|
|
912
|
+
}).then(function (file) {
|
|
913
|
+
if (subscribed) {
|
|
914
|
+
setFile(file);
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
return function () {
|
|
918
|
+
subscribed = false;
|
|
919
|
+
};
|
|
920
|
+
}, [entry, contentType, props.locale, defaultLocaleCode, props.sdk, file, getOrLoadAsset]);
|
|
698
921
|
React.useEffect(function () {
|
|
699
|
-
getOrLoadEntry(entryId);
|
|
700
|
-
}, [
|
|
701
|
-
|
|
922
|
+
getOrLoadEntry(props.entryId);
|
|
923
|
+
}, [props.entryId]); // eslint-disable-line
|
|
924
|
+
|
|
702
925
|
React.useEffect(function () {
|
|
703
|
-
if (entry) {
|
|
704
|
-
|
|
926
|
+
if (!entry) {
|
|
927
|
+
return;
|
|
705
928
|
}
|
|
706
|
-
|
|
929
|
+
|
|
930
|
+
onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
|
|
931
|
+
}, [entry, onEntityFetchComplete]);
|
|
932
|
+
|
|
933
|
+
function renderDropdown() {
|
|
934
|
+
if (!props.onEdit || !props.onRemove) return undefined;
|
|
935
|
+
return [props.onEdit ? /*#__PURE__*/React.createElement(f36Components.MenuItem, {
|
|
936
|
+
key: "edit",
|
|
937
|
+
testId: "card-action-edit",
|
|
938
|
+
onClick: function onClick() {
|
|
939
|
+
props.onEdit && props.onEdit();
|
|
940
|
+
}
|
|
941
|
+
}, "Edit") : null, props.onRemove ? /*#__PURE__*/React.createElement(f36Components.MenuItem, {
|
|
942
|
+
key: "delete",
|
|
943
|
+
disabled: props.isDisabled,
|
|
944
|
+
testId: "card-action-remove",
|
|
945
|
+
onClick: function onClick() {
|
|
946
|
+
props.onRemove && props.onRemove();
|
|
947
|
+
}
|
|
948
|
+
}, "Remove") : null].filter(function (item) {
|
|
949
|
+
return item;
|
|
950
|
+
});
|
|
951
|
+
}
|
|
707
952
|
|
|
708
953
|
if (entry === undefined) {
|
|
709
954
|
return /*#__PURE__*/React.createElement(f36Components.EntryCard, {
|
|
955
|
+
size: "default",
|
|
710
956
|
isLoading: true
|
|
711
957
|
});
|
|
712
958
|
}
|
|
@@ -719,26 +965,50 @@ function FetchingWrappedEntryCard(props) {
|
|
|
719
965
|
});
|
|
720
966
|
}
|
|
721
967
|
|
|
722
|
-
var
|
|
723
|
-
|
|
968
|
+
var entryStatus = entry ? fieldEditorShared.entityHelpers.getEntryStatus(entry.sys) : undefined;
|
|
969
|
+
|
|
970
|
+
if (entryStatus === 'deleted') {
|
|
971
|
+
return /*#__PURE__*/React.createElement(fieldEditorReference.MissingEntityCard, {
|
|
972
|
+
entityType: "Entry",
|
|
973
|
+
isDisabled: props.isDisabled,
|
|
974
|
+
onRemove: props.onRemove
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
var title = fieldEditorShared.entityHelpers.getEntryTitle({
|
|
979
|
+
entry: entry,
|
|
980
|
+
contentType: contentType,
|
|
981
|
+
localeCode: props.locale,
|
|
982
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
983
|
+
defaultTitle: 'Untitled'
|
|
724
984
|
});
|
|
725
|
-
|
|
985
|
+
var description = fieldEditorShared.entityHelpers.getEntityDescription({
|
|
986
|
+
entity: entry,
|
|
987
|
+
contentType: contentType,
|
|
988
|
+
localeCode: props.locale,
|
|
989
|
+
defaultLocaleCode: defaultLocaleCode
|
|
990
|
+
});
|
|
991
|
+
return /*#__PURE__*/React.createElement(f36Components.EntryCard, {
|
|
992
|
+
contentType: contentType == null ? void 0 : contentType.name,
|
|
993
|
+
title: title,
|
|
994
|
+
description: description,
|
|
726
995
|
size: "default",
|
|
727
|
-
getAsset: props.sdk.space.getAsset,
|
|
728
|
-
getEntityScheduledActions: loadEntityScheduledActions,
|
|
729
996
|
isSelected: props.isSelected,
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
997
|
+
status: entryStatus,
|
|
998
|
+
className: styles$2.entryCard,
|
|
999
|
+
thumbnailElement: file ? /*#__PURE__*/React.createElement(EntryThumbnail, {
|
|
1000
|
+
file: file
|
|
1001
|
+
}) : undefined,
|
|
1002
|
+
icon: /*#__PURE__*/React.createElement(EntityStatusIcon, {
|
|
1003
|
+
entityType: "Entry",
|
|
1004
|
+
entity: entry
|
|
1005
|
+
}),
|
|
1006
|
+
withDragHandle: false,
|
|
1007
|
+
actions: renderDropdown()
|
|
738
1008
|
});
|
|
739
1009
|
}
|
|
740
1010
|
|
|
741
|
-
var styles = {
|
|
1011
|
+
var styles$3 = {
|
|
742
1012
|
root: /*#__PURE__*/emotion.css({
|
|
743
1013
|
marginBottom: '1.25rem !important',
|
|
744
1014
|
display: 'block'
|
|
@@ -780,7 +1050,7 @@ function LinkedEntityBlock(props) {
|
|
|
780
1050
|
};
|
|
781
1051
|
|
|
782
1052
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
|
783
|
-
className: styles.root,
|
|
1053
|
+
className: styles$3.root,
|
|
784
1054
|
"data-entity-type": entityType,
|
|
785
1055
|
"data-entity-id": entityId,
|
|
786
1056
|
// COMPAT: This makes copy & paste work for Firefox
|
|
@@ -790,7 +1060,7 @@ function LinkedEntityBlock(props) {
|
|
|
790
1060
|
// COMPAT: This makes copy & paste work for Chromium/Blink browsers and Safari
|
|
791
1061
|
contentEditable: HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
|
|
792
1062
|
draggable: HAS_BEFORE_INPUT_SUPPORT ? true : undefined,
|
|
793
|
-
className: styles.container
|
|
1063
|
+
className: styles$3.container
|
|
794
1064
|
}, entityType === 'Entry' && /*#__PURE__*/React__default.createElement(FetchingWrappedEntryCard, {
|
|
795
1065
|
sdk: sdk,
|
|
796
1066
|
entryId: entityId,
|
|
@@ -1738,7 +2008,7 @@ function insertBlock(editor, nodeType, entity) {
|
|
|
1738
2008
|
focus(editor);
|
|
1739
2009
|
}
|
|
1740
2010
|
|
|
1741
|
-
var styles$
|
|
2011
|
+
var styles$4 = {
|
|
1742
2012
|
icon: /*#__PURE__*/emotion.css({
|
|
1743
2013
|
marginRight: '10px'
|
|
1744
2014
|
})
|
|
@@ -1786,7 +2056,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
|
|
|
1786
2056
|
flexDirection: "row"
|
|
1787
2057
|
}, /*#__PURE__*/React__default.createElement(f36Components.Icon, {
|
|
1788
2058
|
as: type === 'Asset' ? f36Icons.AssetIcon : f36Icons.EmbeddedEntryBlockIcon,
|
|
1789
|
-
className: "rich-text__embedded-entry-list-icon " + styles$
|
|
2059
|
+
className: "rich-text__embedded-entry-list-icon " + styles$4.icon,
|
|
1790
2060
|
variant: "secondary"
|
|
1791
2061
|
}), /*#__PURE__*/React__default.createElement("span", null, type)));
|
|
1792
2062
|
}
|
|
@@ -1885,7 +2155,7 @@ var createEmbeddedAssetBlockPlugin = /*#__PURE__*/createEmbeddedEntityPlugin(Con
|
|
|
1885
2155
|
|
|
1886
2156
|
var getEntryTitle = fieldEditorShared.entityHelpers.getEntryTitle,
|
|
1887
2157
|
getEntryStatus = fieldEditorShared.entityHelpers.getEntryStatus;
|
|
1888
|
-
var styles$
|
|
2158
|
+
var styles$5 = {
|
|
1889
2159
|
scheduledIcon: /*#__PURE__*/emotion.css({
|
|
1890
2160
|
verticalAlign: 'text-bottom',
|
|
1891
2161
|
marginRight: tokens.spacing2Xs
|
|
@@ -1956,7 +2226,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
1956
2226
|
actions: [/*#__PURE__*/React__default.createElement(f36Components.MenuItem, {
|
|
1957
2227
|
key: "remove",
|
|
1958
2228
|
onClick: props.onRemove,
|
|
1959
|
-
testId: "
|
|
2229
|
+
testId: "card-action-remove"
|
|
1960
2230
|
}, "Remove")]
|
|
1961
2231
|
});
|
|
1962
2232
|
}
|
|
@@ -1973,14 +2243,14 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
1973
2243
|
key: "remove",
|
|
1974
2244
|
onClick: props.onRemove,
|
|
1975
2245
|
disabled: props.isDisabled,
|
|
1976
|
-
testId: "
|
|
2246
|
+
testId: "card-action-remove"
|
|
1977
2247
|
}, "Remove")]
|
|
1978
2248
|
}, /*#__PURE__*/React__default.createElement(fieldEditorReference.ScheduledIconWithTooltip, {
|
|
1979
2249
|
getEntityScheduledActions: loadEntityScheduledActions,
|
|
1980
2250
|
entityType: "Entry",
|
|
1981
2251
|
entityId: entry.sys.id
|
|
1982
2252
|
}, /*#__PURE__*/React__default.createElement(f36Icons.ClockIcon, {
|
|
1983
|
-
className: styles$
|
|
2253
|
+
className: styles$5.scheduledIcon,
|
|
1984
2254
|
variant: "muted",
|
|
1985
2255
|
testId: "scheduled-icon"
|
|
1986
2256
|
})), /*#__PURE__*/React__default.createElement(f36Components.Text, null, title));
|
|
@@ -2004,7 +2274,7 @@ function createInlineEntryNode(id) {
|
|
|
2004
2274
|
};
|
|
2005
2275
|
}
|
|
2006
2276
|
|
|
2007
|
-
var styles$
|
|
2277
|
+
var styles$6 = {
|
|
2008
2278
|
icon: /*#__PURE__*/emotion.css({
|
|
2009
2279
|
marginRight: '10px'
|
|
2010
2280
|
}),
|
|
@@ -2040,7 +2310,7 @@ function EmbeddedEntityInline(props) {
|
|
|
2040
2310
|
}
|
|
2041
2311
|
|
|
2042
2312
|
return /*#__PURE__*/React.createElement("span", Object.assign({}, props.attributes, {
|
|
2043
|
-
className: styles$
|
|
2313
|
+
className: styles$6.root,
|
|
2044
2314
|
"data-embedded-entity-inline-id": entryId,
|
|
2045
2315
|
// COMPAT: This makes copy & paste work for Firefox
|
|
2046
2316
|
contentEditable: !HAS_BEFORE_INPUT_SUPPORT ? false : undefined,
|
|
@@ -2170,7 +2440,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
|
|
|
2170
2440
|
flexDirection: "row"
|
|
2171
2441
|
}, /*#__PURE__*/React.createElement(f36Icons.EmbeddedEntryInlineIcon, {
|
|
2172
2442
|
variant: "secondary",
|
|
2173
|
-
className: "rich-text__embedded-entry-list-icon " + styles$
|
|
2443
|
+
className: "rich-text__embedded-entry-list-icon " + styles$6.icon
|
|
2174
2444
|
}), /*#__PURE__*/React.createElement("span", null, "Inline entry")));
|
|
2175
2445
|
}
|
|
2176
2446
|
function createEmbeddedEntityInlinePlugin(sdk) {
|
|
@@ -2246,7 +2516,7 @@ var isMarkEnabled = function isMarkEnabled(field, mark) {
|
|
|
2246
2516
|
};
|
|
2247
2517
|
|
|
2248
2518
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _dropdown, _LABELS;
|
|
2249
|
-
var styles$
|
|
2519
|
+
var styles$7 = {
|
|
2250
2520
|
dropdown: (_dropdown = {
|
|
2251
2521
|
root: /*#__PURE__*/emotion.css(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
|
|
2252
2522
|
}, _dropdown[Contentful.BLOCKS.PARAGRAPH] = /*#__PURE__*/emotion.css(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: ", ";\n "])), tokens.fontSizeL), _dropdown[Contentful.BLOCKS.HEADING_1] = /*#__PURE__*/emotion.css(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.625rem;\n "]))), _dropdown[Contentful.BLOCKS.HEADING_2] = /*#__PURE__*/emotion.css(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.4375rem;\n "]))), _dropdown[Contentful.BLOCKS.HEADING_3] = /*#__PURE__*/emotion.css(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.25rem;\n "]))), _dropdown[Contentful.BLOCKS.HEADING_4] = /*#__PURE__*/emotion.css(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.125rem;\n "]))), _dropdown[Contentful.BLOCKS.HEADING_5] = /*#__PURE__*/emotion.css(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1rem;\n "]))), _dropdown[Contentful.BLOCKS.HEADING_6] = /*#__PURE__*/emotion.css(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n "]))), _dropdown)
|
|
@@ -2341,7 +2611,7 @@ function ToolbarHeadingButton(props) {
|
|
|
2341
2611
|
testId: "dropdown-option-" + nodeType,
|
|
2342
2612
|
disabled: props.isDisabled
|
|
2343
2613
|
}, /*#__PURE__*/React.createElement("span", {
|
|
2344
|
-
className: emotion.cx(styles$
|
|
2614
|
+
className: emotion.cx(styles$7.dropdown.root, styles$7.dropdown[nodeType])
|
|
2345
2615
|
}, LABELS[nodeType]));
|
|
2346
2616
|
}).filter(Boolean)));
|
|
2347
2617
|
}
|
|
@@ -2411,7 +2681,7 @@ var transformLift = function transformLift(editor, _ref4) {
|
|
|
2411
2681
|
};
|
|
2412
2682
|
|
|
2413
2683
|
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;
|
|
2414
|
-
var styles$
|
|
2684
|
+
var styles$8 = {
|
|
2415
2685
|
dropdown: (_dropdown$1 = {
|
|
2416
2686
|
root: /*#__PURE__*/emotion.css(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
|
|
2417
2687
|
}, _dropdown$1[Contentful.BLOCKS.PARAGRAPH] = /*#__PURE__*/emotion.css(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: ", ";\n "])), tokens.fontSizeL), _dropdown$1[Contentful.BLOCKS.HEADING_1] = /*#__PURE__*/emotion.css(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.625rem;\n "]))), _dropdown$1[Contentful.BLOCKS.HEADING_2] = /*#__PURE__*/emotion.css(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.4375rem;\n "]))), _dropdown$1[Contentful.BLOCKS.HEADING_3] = /*#__PURE__*/emotion.css(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.25rem;\n "]))), _dropdown$1[Contentful.BLOCKS.HEADING_4] = /*#__PURE__*/emotion.css(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1.125rem;\n "]))), _dropdown$1[Contentful.BLOCKS.HEADING_5] = /*#__PURE__*/emotion.css(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 1rem;\n "]))), _dropdown$1[Contentful.BLOCKS.HEADING_6] = /*#__PURE__*/emotion.css(_templateObject8$1 || (_templateObject8$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n "]))), _dropdown$1),
|
|
@@ -2423,7 +2693,7 @@ var styles$5 = {
|
|
|
2423
2693
|
function createHeading(Tag, block) {
|
|
2424
2694
|
return function Heading(props) {
|
|
2425
2695
|
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, props.attributes, {
|
|
2426
|
-
className: emotion.cx(styles$
|
|
2696
|
+
className: emotion.cx(styles$8.headings.root, styles$8.headings[block])
|
|
2427
2697
|
}), props.children);
|
|
2428
2698
|
};
|
|
2429
2699
|
}
|
|
@@ -2519,7 +2789,7 @@ var createHeadingPlugin = function createHeadingPlugin() {
|
|
|
2519
2789
|
};
|
|
2520
2790
|
};
|
|
2521
2791
|
|
|
2522
|
-
var styles$
|
|
2792
|
+
var styles$9 = {
|
|
2523
2793
|
button: /*#__PURE__*/emotion.css({
|
|
2524
2794
|
height: '30px',
|
|
2525
2795
|
width: '30px',
|
|
@@ -2545,7 +2815,7 @@ function ToolbarButton(props) {
|
|
|
2545
2815
|
};
|
|
2546
2816
|
|
|
2547
2817
|
var button = /*#__PURE__*/React__default.createElement(f36Components.Button, {
|
|
2548
|
-
className: emotion.cx(styles$
|
|
2818
|
+
className: emotion.cx(styles$9.button, className),
|
|
2549
2819
|
isDisabled: isDisabled,
|
|
2550
2820
|
startIcon: children,
|
|
2551
2821
|
onClick: handleClick,
|
|
@@ -2556,7 +2826,7 @@ function ToolbarButton(props) {
|
|
|
2556
2826
|
|
|
2557
2827
|
if (title) {
|
|
2558
2828
|
return /*#__PURE__*/React__default.createElement(f36Components.Tooltip, {
|
|
2559
|
-
className: styles$
|
|
2829
|
+
className: styles$9.tooltip,
|
|
2560
2830
|
placement: "bottom",
|
|
2561
2831
|
content: title
|
|
2562
2832
|
}, button);
|
|
@@ -2566,7 +2836,7 @@ function ToolbarButton(props) {
|
|
|
2566
2836
|
}
|
|
2567
2837
|
|
|
2568
2838
|
var _templateObject$2, _templateObject2$2, _templateObject3$2;
|
|
2569
|
-
var styles$
|
|
2839
|
+
var styles$a = {
|
|
2570
2840
|
container: /*#__PURE__*/emotion.css(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0 0 ", ";\n "])), tokens.spacingL),
|
|
2571
2841
|
hr: /*#__PURE__*/emotion.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),
|
|
2572
2842
|
hrSelected: /*#__PURE__*/emotion.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)
|
|
@@ -2624,14 +2894,14 @@ function Hr(props) {
|
|
|
2624
2894
|
var isSelected = Slate.useSelected();
|
|
2625
2895
|
var isFocused = Slate.useFocused();
|
|
2626
2896
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, props.attributes, {
|
|
2627
|
-
className: styles$
|
|
2897
|
+
className: styles$a.container,
|
|
2628
2898
|
"data-void-element": Contentful.BLOCKS.HR
|
|
2629
2899
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2630
2900
|
draggable: true,
|
|
2631
2901
|
// Moving `contentEditable` to this div makes it to be selectable when being the first void element, e.g pressing ctrl + a to select everything
|
|
2632
2902
|
contentEditable: false
|
|
2633
2903
|
}, /*#__PURE__*/React.createElement("hr", {
|
|
2634
|
-
className: emotion.cx(styles$
|
|
2904
|
+
className: emotion.cx(styles$a.hr, isSelected && isFocused ? styles$a.hrSelected : undefined)
|
|
2635
2905
|
})), props.children);
|
|
2636
2906
|
}
|
|
2637
2907
|
var createHrPlugin = function createHrPlugin() {
|
|
@@ -2658,7 +2928,7 @@ var createHrPlugin = function createHrPlugin() {
|
|
|
2658
2928
|
};
|
|
2659
2929
|
|
|
2660
2930
|
var _templateObject$3, _SYS_LINK_TYPES, _LINK_TYPE_SELECTION_;
|
|
2661
|
-
var styles$
|
|
2931
|
+
var styles$b = {
|
|
2662
2932
|
removeSelectionLabel: /*#__PURE__*/emotion.css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-left: ", ";\n "])), tokens.spacingS)
|
|
2663
2933
|
};
|
|
2664
2934
|
var SYS_LINK_TYPES = (_SYS_LINK_TYPES = {}, _SYS_LINK_TYPES[Contentful.INLINES.ENTRY_HYPERLINK] = 'Entry', _SYS_LINK_TYPES[Contentful.INLINES.ASSET_HYPERLINK] = 'Asset', _SYS_LINK_TYPES);
|
|
@@ -2841,7 +3111,7 @@ function HyperlinkModal(props) {
|
|
|
2841
3111
|
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/React.createElement(React.Fragment, null, !props.readonly && /*#__PURE__*/React.createElement(f36Components.TextLink, {
|
|
2842
3112
|
testId: "entity-selection-link",
|
|
2843
3113
|
onClick: resetLinkEntity,
|
|
2844
|
-
className: styles$
|
|
3114
|
+
className: styles$b.removeSelectionLabel
|
|
2845
3115
|
}, "Remove selection"), /*#__PURE__*/React.createElement("div", null, linkType === Contentful.INLINES.ENTRY_HYPERLINK && /*#__PURE__*/React.createElement(FetchingWrappedEntryCard, {
|
|
2846
3116
|
sdk: props.sdk,
|
|
2847
3117
|
locale: props.sdk.field.locale,
|
|
@@ -3182,7 +3452,7 @@ function useEntityInfo(props) {
|
|
|
3182
3452
|
return getEntityInfo(status.data);
|
|
3183
3453
|
}
|
|
3184
3454
|
|
|
3185
|
-
var styles$
|
|
3455
|
+
var styles$c = {
|
|
3186
3456
|
hyperlinkWrapper: /*#__PURE__*/emotion.css({
|
|
3187
3457
|
display: 'inline',
|
|
3188
3458
|
position: 'static',
|
|
@@ -3227,13 +3497,13 @@ function EntityHyperlink(props) {
|
|
|
3227
3497
|
|
|
3228
3498
|
return /*#__PURE__*/React.createElement(f36Components.Tooltip, {
|
|
3229
3499
|
content: tooltipContent,
|
|
3230
|
-
targetWrapperClassName: styles$
|
|
3500
|
+
targetWrapperClassName: styles$c.hyperlinkWrapper,
|
|
3231
3501
|
placement: "bottom",
|
|
3232
3502
|
maxWidth: "auto"
|
|
3233
3503
|
}, /*#__PURE__*/React.createElement(f36Components.TextLink, {
|
|
3234
3504
|
as: "a",
|
|
3235
3505
|
onClick: handleClick,
|
|
3236
|
-
className: styles$
|
|
3506
|
+
className: styles$c.hyperlink,
|
|
3237
3507
|
"data-link-type": target.sys.linkType,
|
|
3238
3508
|
"data-link-id": target.sys.id
|
|
3239
3509
|
}, props.children));
|
|
@@ -3257,7 +3527,7 @@ function UrlHyperlink(props) {
|
|
|
3257
3527
|
|
|
3258
3528
|
return /*#__PURE__*/React.createElement(f36Components.Tooltip, {
|
|
3259
3529
|
content: uri,
|
|
3260
|
-
targetWrapperClassName: styles$
|
|
3530
|
+
targetWrapperClassName: styles$c.hyperlinkWrapper,
|
|
3261
3531
|
placement: "bottom",
|
|
3262
3532
|
maxWidth: "auto"
|
|
3263
3533
|
}, /*#__PURE__*/React.createElement(f36Components.TextLink, {
|
|
@@ -3265,7 +3535,7 @@ function UrlHyperlink(props) {
|
|
|
3265
3535
|
href: uri,
|
|
3266
3536
|
rel: "noopener noreferrer",
|
|
3267
3537
|
onClick: handleClick,
|
|
3268
|
-
className: styles$
|
|
3538
|
+
className: styles$c.hyperlink
|
|
3269
3539
|
}, props.children));
|
|
3270
3540
|
}
|
|
3271
3541
|
|
|
@@ -3391,12 +3661,12 @@ var createHyperlinkPlugin = function createHyperlinkPlugin(sdk) {
|
|
|
3391
3661
|
|
|
3392
3662
|
var _templateObject$4, _templateObject2$3, _templateObject3$3, _styles;
|
|
3393
3663
|
var baseStyle = /*#__PURE__*/emotion.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);
|
|
3394
|
-
var styles$
|
|
3664
|
+
var styles$d = (_styles = {}, _styles[Contentful.BLOCKS.UL_LIST] = /*#__PURE__*/emotion.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[Contentful.BLOCKS.OL_LIST] = /*#__PURE__*/emotion.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);
|
|
3395
3665
|
|
|
3396
3666
|
function createList(Tag, block) {
|
|
3397
3667
|
return function List(props) {
|
|
3398
3668
|
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, props.attributes, {
|
|
3399
|
-
className: emotion.cx(baseStyle, styles$
|
|
3669
|
+
className: emotion.cx(baseStyle, styles$d[block])
|
|
3400
3670
|
}), props.children);
|
|
3401
3671
|
};
|
|
3402
3672
|
}
|
|
@@ -4377,14 +4647,14 @@ var ToolbarBoldButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4377
4647
|
mark: Contentful.MARKS.BOLD,
|
|
4378
4648
|
icon: /*#__PURE__*/React.createElement(f36Icons.FormatBoldIcon, null)
|
|
4379
4649
|
});
|
|
4380
|
-
var styles$
|
|
4650
|
+
var styles$e = {
|
|
4381
4651
|
bold: /*#__PURE__*/emotion.css({
|
|
4382
4652
|
fontWeight: 600
|
|
4383
4653
|
})
|
|
4384
4654
|
};
|
|
4385
4655
|
function Bold(props) {
|
|
4386
4656
|
return /*#__PURE__*/React.createElement("strong", Object.assign({}, props.attributes, {
|
|
4387
|
-
className: styles$
|
|
4657
|
+
className: styles$e.bold
|
|
4388
4658
|
}), props.children);
|
|
4389
4659
|
}
|
|
4390
4660
|
|
|
@@ -4424,7 +4694,7 @@ var ToolbarCodeButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4424
4694
|
mark: Contentful.MARKS.CODE,
|
|
4425
4695
|
icon: /*#__PURE__*/React.createElement(f36Icons.CodeIcon, null)
|
|
4426
4696
|
});
|
|
4427
|
-
var styles$
|
|
4697
|
+
var styles$f = {
|
|
4428
4698
|
code: /*#__PURE__*/emotion.css({
|
|
4429
4699
|
fontFamily: 'monospace',
|
|
4430
4700
|
fontSize: '.9em'
|
|
@@ -4432,7 +4702,7 @@ var styles$c = {
|
|
|
4432
4702
|
};
|
|
4433
4703
|
function Code(props) {
|
|
4434
4704
|
return /*#__PURE__*/React.createElement("code", Object.assign({}, props.attributes, {
|
|
4435
|
-
className: styles$
|
|
4705
|
+
className: styles$f.code
|
|
4436
4706
|
}), props.children);
|
|
4437
4707
|
}
|
|
4438
4708
|
var createCodePlugin = function createCodePlugin() {
|
|
@@ -4462,14 +4732,14 @@ var ToolbarItalicButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4462
4732
|
mark: Contentful.MARKS.ITALIC,
|
|
4463
4733
|
icon: /*#__PURE__*/React.createElement(f36Icons.FormatItalicIcon, null)
|
|
4464
4734
|
});
|
|
4465
|
-
var styles$
|
|
4735
|
+
var styles$g = {
|
|
4466
4736
|
italic: /*#__PURE__*/emotion.css({
|
|
4467
4737
|
fontStyle: 'italic'
|
|
4468
4738
|
})
|
|
4469
4739
|
};
|
|
4470
4740
|
function Italic(props) {
|
|
4471
4741
|
return /*#__PURE__*/React.createElement("em", Object.assign({}, props.attributes, {
|
|
4472
|
-
className: styles$
|
|
4742
|
+
className: styles$g.italic
|
|
4473
4743
|
}), props.children);
|
|
4474
4744
|
}
|
|
4475
4745
|
var createItalicPlugin = function createItalicPlugin() {
|
|
@@ -4745,10 +5015,10 @@ var createNormalizerPlugin = function createNormalizerPlugin() {
|
|
|
4745
5015
|
};
|
|
4746
5016
|
|
|
4747
5017
|
var _templateObject$6, _styles$1;
|
|
4748
|
-
var styles$
|
|
5018
|
+
var styles$h = (_styles$1 = {}, _styles$1[Contentful.BLOCKS.PARAGRAPH] = /*#__PURE__*/emotion.css(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n line-height: ", ";\n margin-bottom: 1.5em;\n "])), tokens.lineHeightDefault), _styles$1);
|
|
4749
5019
|
function Paragraph(props) {
|
|
4750
5020
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, props.attributes, {
|
|
4751
|
-
className: styles$
|
|
5021
|
+
className: styles$h[Contentful.BLOCKS.PARAGRAPH]
|
|
4752
5022
|
}), props.children);
|
|
4753
5023
|
}
|
|
4754
5024
|
|
|
@@ -5569,7 +5839,7 @@ var isTable = function isTable(node) {
|
|
|
5569
5839
|
return slate.Element.isElement(node) && node.type === Contentful.BLOCKS.TABLE;
|
|
5570
5840
|
};
|
|
5571
5841
|
|
|
5572
|
-
var styles$
|
|
5842
|
+
var styles$i = {
|
|
5573
5843
|
topRight: /*#__PURE__*/emotion.css({
|
|
5574
5844
|
position: 'absolute',
|
|
5575
5845
|
top: '6px',
|
|
@@ -5658,7 +5928,7 @@ var TableActions = function TableActions() {
|
|
|
5658
5928
|
size: "small",
|
|
5659
5929
|
variant: "transparent",
|
|
5660
5930
|
tabIndex: -1,
|
|
5661
|
-
className: styles$
|
|
5931
|
+
className: styles$i.topRight,
|
|
5662
5932
|
icon: /*#__PURE__*/React__default.createElement(f36Icons.ChevronDownIcon, null),
|
|
5663
5933
|
"aria-label": "Open table menu",
|
|
5664
5934
|
testId: "cf-table-actions-button"
|
|
@@ -6592,7 +6862,7 @@ var normalizeEditorValue = function normalizeEditorValue(value, options) {
|
|
|
6592
6862
|
};
|
|
6593
6863
|
|
|
6594
6864
|
var STYLE_EDITOR_BORDER = "1px solid " + tokens.gray400;
|
|
6595
|
-
var styles$
|
|
6865
|
+
var styles$j = {
|
|
6596
6866
|
root: /*#__PURE__*/emotion.css({
|
|
6597
6867
|
position: 'relative'
|
|
6598
6868
|
}),
|
|
@@ -6708,7 +6978,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
6708
6978
|
}, actions);
|
|
6709
6979
|
};
|
|
6710
6980
|
|
|
6711
|
-
var styles$
|
|
6981
|
+
var styles$k = {
|
|
6712
6982
|
toolbar: /*#__PURE__*/emotion.css({
|
|
6713
6983
|
border: "1px solid " + tokens.gray400,
|
|
6714
6984
|
backgroundColor: tokens.gray100,
|
|
@@ -6753,14 +7023,14 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6753
7023
|
var shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
|
|
6754
7024
|
return /*#__PURE__*/React__default.createElement(f36Components.Flex, {
|
|
6755
7025
|
testId: "toolbar",
|
|
6756
|
-
className: styles$
|
|
7026
|
+
className: styles$k.toolbar,
|
|
6757
7027
|
alignItems: "center"
|
|
6758
7028
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
6759
|
-
className: styles$
|
|
7029
|
+
className: styles$k.formattingOptionsWrapper
|
|
6760
7030
|
}, /*#__PURE__*/React__default.createElement(ToolbarHeadingButton, {
|
|
6761
7031
|
isDisabled: isDisabled || !canInsertBlocks
|
|
6762
7032
|
}), validationInfo.isAnyMarkEnabled && /*#__PURE__*/React__default.createElement("span", {
|
|
6763
|
-
className: styles$
|
|
7033
|
+
className: styles$k.divider
|
|
6764
7034
|
}), isMarkEnabled(sdk.field, Contentful.MARKS.BOLD) && /*#__PURE__*/React__default.createElement(ToolbarBoldButton, {
|
|
6765
7035
|
isDisabled: isDisabled
|
|
6766
7036
|
}), isMarkEnabled(sdk.field, Contentful.MARKS.ITALIC) && /*#__PURE__*/React__default.createElement(ToolbarItalicButton, {
|
|
@@ -6770,11 +7040,11 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6770
7040
|
}), isMarkEnabled(sdk.field, Contentful.MARKS.CODE) && /*#__PURE__*/React__default.createElement(ToolbarCodeButton, {
|
|
6771
7041
|
isDisabled: isDisabled
|
|
6772
7042
|
}), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
6773
|
-
className: styles$
|
|
7043
|
+
className: styles$k.divider
|
|
6774
7044
|
}), /*#__PURE__*/React__default.createElement(ToolbarHyperlinkButton, {
|
|
6775
7045
|
isDisabled: isDisabled
|
|
6776
7046
|
})), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/React__default.createElement("span", {
|
|
6777
|
-
className: styles$
|
|
7047
|
+
className: styles$k.divider
|
|
6778
7048
|
}), /*#__PURE__*/React__default.createElement(ToolbarListButton, {
|
|
6779
7049
|
isDisabled: isDisabled || !canInsertBlocks
|
|
6780
7050
|
}), isNodeTypeEnabled(sdk.field, Contentful.BLOCKS.QUOTE) && /*#__PURE__*/React__default.createElement(ToolbarQuoteButton, {
|
|
@@ -6784,7 +7054,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6784
7054
|
}), isNodeTypeEnabled(sdk.field, Contentful.BLOCKS.TABLE) && /*#__PURE__*/React__default.createElement(ToolbarTableButton, {
|
|
6785
7055
|
isDisabled: shouldDisableTables
|
|
6786
7056
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
6787
|
-
className: styles$
|
|
7057
|
+
className: styles$k.embedActionsWrapper
|
|
6788
7058
|
}, /*#__PURE__*/React__default.createElement(EmbedEntityWidget, {
|
|
6789
7059
|
isDisabled: isDisabled,
|
|
6790
7060
|
canInsertBlocks: canInsertBlocks
|
|
@@ -6809,7 +7079,7 @@ function getValidationInfo(field) {
|
|
|
6809
7079
|
}
|
|
6810
7080
|
|
|
6811
7081
|
var _templateObject$b;
|
|
6812
|
-
var styles$
|
|
7082
|
+
var styles$l = {
|
|
6813
7083
|
nativeSticky: /*#__PURE__*/emotion.css(_templateObject$b || (_templateObject$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: -webkit-sticky;\n position: sticky;\n top: -1px;\n z-index: 2;\n "])))
|
|
6814
7084
|
};
|
|
6815
7085
|
|
|
@@ -6817,7 +7087,7 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
|
|
|
6817
7087
|
var isDisabled = _ref.isDisabled,
|
|
6818
7088
|
children = _ref.children;
|
|
6819
7089
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
6820
|
-
className: isDisabled ? '' : styles$
|
|
7090
|
+
className: isDisabled ? '' : styles$l.nativeSticky
|
|
6821
7091
|
}, children);
|
|
6822
7092
|
};
|
|
6823
7093
|
|
|
@@ -6912,9 +7182,9 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
6912
7182
|
setPendingExternalUpdate(true);
|
|
6913
7183
|
setEditorContent(editor, documentToEditorValue(props.value));
|
|
6914
7184
|
}, [props.value, id]);
|
|
6915
|
-
var classNames = emotion.cx(styles$
|
|
7185
|
+
var classNames = emotion.cx(styles$j.editor, props.minHeight !== undefined ? emotion.css({
|
|
6916
7186
|
minHeight: props.minHeight
|
|
6917
|
-
}) : undefined, props.isDisabled ? styles$
|
|
7187
|
+
}) : undefined, props.isDisabled ? styles$j.disabled : styles$j.enabled, props.isToolbarHidden && styles$j.hiddenToolbar);
|
|
6918
7188
|
React.useEffect(function () {
|
|
6919
7189
|
if (!isFirstRender) {
|
|
6920
7190
|
return;
|
|
@@ -6930,7 +7200,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
6930
7200
|
}, /*#__PURE__*/React__default.createElement(ContentfulEditorIdProvider, {
|
|
6931
7201
|
value: id
|
|
6932
7202
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
6933
|
-
className: styles$
|
|
7203
|
+
className: styles$j.root,
|
|
6934
7204
|
"data-test-id": "rich-text-editor"
|
|
6935
7205
|
}, /*#__PURE__*/React__default.createElement(plateCore.Plate, {
|
|
6936
7206
|
id: id,
|