@contentful/field-editor-rich-text 2.0.0-next.42 → 2.0.0-next.45
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/CHANGELOG.md +114 -0
- package/README.md +22 -4
- package/dist/field-editor-rich-text.cjs.development.js +194 -420
- 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 +199 -425
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/environment.d.ts +1 -1
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +0 -10
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +1 -1
- package/dist/plugins/shared/useFetchedEntity.d.ts +8 -0
- package/dist/prepareDocument.d.ts +1 -1
- package/dist/test-utils/jsx.d.ts +1 -1
- package/package.json +8 -7
- package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React__default, { createContext, useContext, useMemo,
|
|
2
|
-
import { useEntities,
|
|
3
|
-
import { entityHelpers,
|
|
1
|
+
import React__default, { createContext, useContext, useMemo, useState, useEffect, memo, createElement, 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';
|
|
7
|
-
import
|
|
7
|
+
import areEqual from 'fast-deep-equal';
|
|
8
8
|
import noop from 'lodash-es/noop';
|
|
9
9
|
import { createDeserializeDocxPlugin } from '@udecode/plate-serializer-docx';
|
|
10
10
|
import { createSoftBreakPlugin as createSoftBreakPlugin$1, createExitBreakPlugin as createExitBreakPlugin$1 } from '@udecode/plate-break';
|
|
@@ -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,
|
|
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';
|
|
@@ -394,17 +393,8 @@ function getParents(el) {
|
|
|
394
393
|
return parents;
|
|
395
394
|
}
|
|
396
395
|
|
|
397
|
-
// "modern" Edge was released at 79.x
|
|
398
|
-
var IS_EDGE_LEGACY = typeof navigator !== 'undefined' && /*#__PURE__*/ /Edge?\/(?:[0-6][0-9]|[0-7][0-8])/i.test(navigator.userAgent); // Native `beforeInput` events don't work well with react on Chrome 75
|
|
399
|
-
// and older, Chrome 76+ can use `beforeInput` though.
|
|
400
|
-
|
|
401
|
-
var IS_CHROME_LEGACY = typeof navigator !== 'undefined' && /*#__PURE__*/ /Chrome?\/(?:[0-7][0-5]|[0-6][0-9])/i.test(navigator.userAgent); // COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
|
|
402
|
-
// Chrome Legacy doesn't support `beforeinput` correctly
|
|
403
|
-
|
|
404
|
-
var HAS_BEFORE_INPUT_SUPPORT = !IS_CHROME_LEGACY && !IS_EDGE_LEGACY && // globalThis is undefined in older browsers
|
|
405
|
-
typeof globalThis !== 'undefined' && globalThis.InputEvent && typeof globalThis.InputEvent.prototype.getTargetRanges === 'function'; // The `getTargetRanges` property isn't recognized.
|
|
406
|
-
|
|
407
396
|
var IS_SAFARI = typeof navigator !== 'undefined' && /*#__PURE__*/ /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
|
397
|
+
var IS_CHROME = /*#__PURE__*/ /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/.test(navigator.userAgent);
|
|
408
398
|
|
|
409
399
|
var LINK_TYPES = [INLINES.HYPERLINK, INLINES.ENTRY_HYPERLINK, INLINES.ASSET_HYPERLINK];
|
|
410
400
|
function isBlockSelected(editor, type) {
|
|
@@ -632,181 +622,56 @@ var _constate = /*#__PURE__*/constate(useSdk),
|
|
|
632
622
|
SdkProvider = _constate[0],
|
|
633
623
|
useSdkContext = _constate[1];
|
|
634
624
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
};
|
|
640
|
-
function EntityStatusIcon(_ref) {
|
|
641
|
-
var entity = _ref.entity,
|
|
642
|
-
entityType = _ref.entityType;
|
|
625
|
+
function useFetchedEntity(_ref) {
|
|
626
|
+
var type = _ref.type,
|
|
627
|
+
id = _ref.id,
|
|
628
|
+
onEntityFetchComplete = _ref.onEntityFetchComplete;
|
|
643
629
|
|
|
644
630
|
var _useEntities = useEntities(),
|
|
645
|
-
|
|
631
|
+
entries = _useEntities.entries,
|
|
632
|
+
assets = _useEntities.assets,
|
|
633
|
+
getOrLoadEntry = _useEntities.getOrLoadEntry,
|
|
634
|
+
getOrLoadAsset = _useEntities.getOrLoadAsset;
|
|
646
635
|
|
|
647
|
-
|
|
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
|
-
}
|
|
636
|
+
var store = type === 'Entry' ? entries : assets;
|
|
658
637
|
|
|
659
|
-
var
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}),
|
|
663
|
-
cardDropdown: /*#__PURE__*/css({
|
|
664
|
-
width: '300px'
|
|
665
|
-
}),
|
|
666
|
-
truncated: /*#__PURE__*/css({
|
|
667
|
-
overflow: 'hidden',
|
|
668
|
-
whiteSpace: 'nowrap',
|
|
669
|
-
textOverflow: 'ellipsis'
|
|
670
|
-
})
|
|
671
|
-
};
|
|
638
|
+
var _useState = useState(store[id]),
|
|
639
|
+
entity = _useState[0],
|
|
640
|
+
setEntity = _useState[1]; // Deep compare the entity value to keep re-rendering to minimal
|
|
672
641
|
|
|
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
|
-
function FetchingWrappedAssetCard(props) {
|
|
748
|
-
var _asset$fields;
|
|
749
|
-
|
|
750
|
-
var _useEntities = useEntities(),
|
|
751
|
-
getOrLoadAsset = _useEntities.getOrLoadAsset,
|
|
752
|
-
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
|
-
|
|
760
|
-
}, [props.assetId]); // eslint-disable-line
|
|
644
|
+
var newValue = store[id];
|
|
761
645
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
return;
|
|
646
|
+
if (!areEqual(entity, newValue)) {
|
|
647
|
+
setEntity(newValue);
|
|
765
648
|
}
|
|
649
|
+
}, [store, entity, id]); // Fetch the entity if needed
|
|
766
650
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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;
|
|
651
|
+
useEffect(function () {
|
|
652
|
+
(type === 'Entry' ? getOrLoadEntry : getOrLoadAsset)(id); // "getOrLoadEntry" and "getOrLoadAsset" instances change with every
|
|
653
|
+
// entity store update causing page lag on initial load
|
|
654
|
+
// TODO: consider rewriting useEntities() hook to avoid that happening in
|
|
655
|
+
// first place.
|
|
656
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
657
|
+
}, [type, id]);
|
|
658
|
+
useEffect(function () {
|
|
659
|
+
if (entity) {
|
|
660
|
+
onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
|
|
793
661
|
}
|
|
662
|
+
}, [onEntityFetchComplete, entity]);
|
|
663
|
+
return entity;
|
|
664
|
+
}
|
|
794
665
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
fallbackFileName: entityFile.fileName
|
|
798
|
-
});
|
|
799
|
-
return groupToIconMap[groupName] || archive;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
if (asset === undefined) {
|
|
666
|
+
var InternalAssetCard = /*#__PURE__*/memo(function (props) {
|
|
667
|
+
if (props.asset === undefined) {
|
|
803
668
|
return /*#__PURE__*/createElement(AssetCard, {
|
|
804
|
-
size: "
|
|
669
|
+
size: "default",
|
|
805
670
|
isLoading: true
|
|
806
671
|
});
|
|
807
672
|
}
|
|
808
673
|
|
|
809
|
-
if (asset === 'failed') {
|
|
674
|
+
if (props.asset === 'failed') {
|
|
810
675
|
return /*#__PURE__*/createElement(MissingEntityCard, {
|
|
811
676
|
entityType: "Asset",
|
|
812
677
|
isDisabled: props.isDisabled,
|
|
@@ -814,138 +679,51 @@ function FetchingWrappedAssetCard(props) {
|
|
|
814
679
|
});
|
|
815
680
|
}
|
|
816
681
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (status === 'deleted') {
|
|
820
|
-
return /*#__PURE__*/createElement(MissingEntityCard, {
|
|
821
|
-
entityType: "Asset",
|
|
822
|
-
asSquare: true,
|
|
823
|
-
isDisabled: props.isDisabled,
|
|
824
|
-
onRemove: props.onRemove
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
|
|
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,
|
|
682
|
+
return /*#__PURE__*/createElement(WrappedAssetCard, {
|
|
683
|
+
getEntityScheduledActions: props.loadEntityScheduledActions,
|
|
837
684
|
size: "small",
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
})
|
|
685
|
+
isSelected: props.isSelected,
|
|
686
|
+
isDisabled: props.isDisabled,
|
|
687
|
+
localeCode: props.locale,
|
|
688
|
+
defaultLocaleCode: props.sdk.locales["default"],
|
|
689
|
+
asset: props.asset,
|
|
690
|
+
onEdit: props.onEdit,
|
|
691
|
+
onRemove: props.isDisabled ? undefined : props.onRemove,
|
|
692
|
+
isClickable: false
|
|
856
693
|
});
|
|
857
|
-
}
|
|
694
|
+
}, areEqual);
|
|
695
|
+
InternalAssetCard.displayName = 'InternalAssetCard';
|
|
696
|
+
function FetchingWrappedAssetCard(props) {
|
|
697
|
+
var onEntityFetchComplete = props.onEntityFetchComplete,
|
|
698
|
+
assetId = props.assetId;
|
|
858
699
|
|
|
859
|
-
var
|
|
860
|
-
|
|
861
|
-
cursor: 'pointer'
|
|
862
|
-
})
|
|
863
|
-
};
|
|
700
|
+
var _useEntities = useEntities(),
|
|
701
|
+
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
|
|
864
702
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
703
|
+
var asset = useFetchedEntity({
|
|
704
|
+
type: 'Asset',
|
|
705
|
+
id: assetId,
|
|
706
|
+
onEntityFetchComplete: onEntityFetchComplete
|
|
707
|
+
});
|
|
708
|
+
return /*#__PURE__*/createElement(InternalAssetCard, {
|
|
709
|
+
asset: asset,
|
|
710
|
+
sdk: props.sdk,
|
|
711
|
+
isDisabled: props.isDisabled,
|
|
712
|
+
isSelected: props.isSelected,
|
|
713
|
+
loadEntityScheduledActions: loadEntityScheduledActions,
|
|
714
|
+
locale: props.locale,
|
|
715
|
+
onEdit: props.onEdit,
|
|
716
|
+
onRemove: props.onRemove
|
|
870
717
|
});
|
|
871
718
|
}
|
|
872
719
|
|
|
873
|
-
function
|
|
874
|
-
var
|
|
875
|
-
|
|
876
|
-
|
|
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
|
-
}
|
|
888
|
-
|
|
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
|
-
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
|
-
|
|
918
|
-
useEffect(function () {
|
|
919
|
-
if (!entry) {
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
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
|
-
}
|
|
720
|
+
var InternalEntryCard = /*#__PURE__*/memo(function (props) {
|
|
721
|
+
var entry = props.entry,
|
|
722
|
+
sdk = props.sdk,
|
|
723
|
+
loadEntityScheduledActions = props.loadEntityScheduledActions;
|
|
945
724
|
|
|
946
725
|
if (entry === undefined) {
|
|
947
726
|
return /*#__PURE__*/createElement(EntryCard, {
|
|
948
|
-
size: "default",
|
|
949
727
|
isLoading: true
|
|
950
728
|
});
|
|
951
729
|
}
|
|
@@ -958,50 +736,50 @@ function FetchingWrappedEntryCard(props) {
|
|
|
958
736
|
});
|
|
959
737
|
}
|
|
960
738
|
|
|
961
|
-
var
|
|
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'
|
|
739
|
+
var contentType = sdk.space.getCachedContentTypes().find(function (contentType) {
|
|
740
|
+
return contentType.sys.id === entry.sys.contentType.sys.id;
|
|
977
741
|
});
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
742
|
+
return /*#__PURE__*/createElement(WrappedEntryCard, {
|
|
743
|
+
size: "default",
|
|
744
|
+
getAsset: props.sdk.space.getAsset,
|
|
745
|
+
getEntityScheduledActions: loadEntityScheduledActions,
|
|
746
|
+
isSelected: props.isSelected,
|
|
747
|
+
isDisabled: props.isDisabled,
|
|
981
748
|
localeCode: props.locale,
|
|
982
|
-
defaultLocaleCode:
|
|
749
|
+
defaultLocaleCode: props.sdk.locales["default"],
|
|
750
|
+
contentType: contentType,
|
|
751
|
+
entry: entry,
|
|
752
|
+
onEdit: props.onEdit,
|
|
753
|
+
onRemove: props.isDisabled ? undefined : props.onRemove,
|
|
754
|
+
isClickable: false
|
|
983
755
|
});
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
756
|
+
}, areEqual);
|
|
757
|
+
InternalEntryCard.displayName = 'ReferenceCard';
|
|
758
|
+
var FetchingWrappedEntryCard = function FetchingWrappedEntryCard(props) {
|
|
759
|
+
var entryId = props.entryId,
|
|
760
|
+
onEntityFetchComplete = props.onEntityFetchComplete;
|
|
761
|
+
|
|
762
|
+
var _useEntities = useEntities(),
|
|
763
|
+
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
|
|
764
|
+
|
|
765
|
+
var entry = useFetchedEntity({
|
|
766
|
+
type: 'Entry',
|
|
767
|
+
id: entryId,
|
|
768
|
+
onEntityFetchComplete: onEntityFetchComplete
|
|
769
|
+
});
|
|
770
|
+
return /*#__PURE__*/createElement(InternalEntryCard, {
|
|
771
|
+
entry: entry,
|
|
772
|
+
sdk: props.sdk,
|
|
773
|
+
locale: props.locale,
|
|
774
|
+
isDisabled: props.isDisabled,
|
|
989
775
|
isSelected: props.isSelected,
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
file: file
|
|
994
|
-
}) : undefined,
|
|
995
|
-
icon: /*#__PURE__*/createElement(EntityStatusIcon, {
|
|
996
|
-
entityType: "Entry",
|
|
997
|
-
entity: entry
|
|
998
|
-
}),
|
|
999
|
-
withDragHandle: false,
|
|
1000
|
-
actions: renderDropdown()
|
|
776
|
+
onEdit: props.onEdit,
|
|
777
|
+
onRemove: props.onRemove,
|
|
778
|
+
loadEntityScheduledActions: loadEntityScheduledActions
|
|
1001
779
|
});
|
|
1002
|
-
}
|
|
780
|
+
};
|
|
1003
781
|
|
|
1004
|
-
var styles
|
|
782
|
+
var styles = {
|
|
1005
783
|
root: /*#__PURE__*/css({
|
|
1006
784
|
marginBottom: '1.25rem !important',
|
|
1007
785
|
display: 'block'
|
|
@@ -1026,34 +804,31 @@ function LinkedEntityBlock(props) {
|
|
|
1026
804
|
var _element$data$target$ = element.data.target.sys,
|
|
1027
805
|
entityId = _element$data$target$.id,
|
|
1028
806
|
entityType = _element$data$target$.linkType;
|
|
1029
|
-
|
|
1030
|
-
var handleEditClick = function handleEditClick() {
|
|
807
|
+
var handleEditClick = React__default.useCallback(function () {
|
|
1031
808
|
var openEntity = entityType === 'Asset' ? sdk.navigator.openAsset : sdk.navigator.openEntry;
|
|
1032
809
|
return openEntity(entityId, {
|
|
1033
810
|
slideIn: true
|
|
1034
811
|
});
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
var handleRemoveClick = function handleRemoveClick() {
|
|
812
|
+
}, [sdk, entityId, entityType]);
|
|
813
|
+
var handleRemoveClick = React__default.useCallback(function () {
|
|
1038
814
|
if (!editor) return;
|
|
1039
815
|
var pathToElement = ReactEditor.findPath(editor, element);
|
|
1040
816
|
Transforms.removeNodes(editor, {
|
|
1041
817
|
at: pathToElement
|
|
1042
818
|
});
|
|
1043
|
-
};
|
|
1044
|
-
|
|
819
|
+
}, [editor, element]);
|
|
1045
820
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
|
1046
|
-
className: styles
|
|
821
|
+
className: styles.root,
|
|
1047
822
|
"data-entity-type": entityType,
|
|
1048
823
|
"data-entity-id": entityId,
|
|
1049
824
|
// COMPAT: This makes copy & paste work for Firefox
|
|
1050
|
-
contentEditable:
|
|
1051
|
-
draggable:
|
|
825
|
+
contentEditable: IS_CHROME ? undefined : false,
|
|
826
|
+
draggable: IS_CHROME ? true : undefined
|
|
1052
827
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1053
828
|
// COMPAT: This makes copy & paste work for Chromium/Blink browsers and Safari
|
|
1054
|
-
contentEditable:
|
|
1055
|
-
draggable:
|
|
1056
|
-
className: styles
|
|
829
|
+
contentEditable: IS_CHROME ? false : undefined,
|
|
830
|
+
draggable: IS_CHROME ? true : undefined,
|
|
831
|
+
className: styles.container
|
|
1057
832
|
}, entityType === 'Entry' && /*#__PURE__*/React__default.createElement(FetchingWrappedEntryCard, {
|
|
1058
833
|
sdk: sdk,
|
|
1059
834
|
entryId: entityId,
|
|
@@ -1172,9 +947,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1172
947
|
|
|
1173
948
|
|
|
1174
949
|
var IteratorPrototype = {};
|
|
1175
|
-
|
|
950
|
+
|
|
951
|
+
IteratorPrototype[iteratorSymbol] = function () {
|
|
1176
952
|
return this;
|
|
1177
|
-
}
|
|
953
|
+
};
|
|
954
|
+
|
|
1178
955
|
var getProto = Object.getPrototypeOf;
|
|
1179
956
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1180
957
|
|
|
@@ -1185,9 +962,8 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1185
962
|
}
|
|
1186
963
|
|
|
1187
964
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1188
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
1189
|
-
|
|
1190
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
965
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
966
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
1191
967
|
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
1192
968
|
// Iterator interface in terms of a single ._invoke method.
|
|
1193
969
|
|
|
@@ -1292,9 +1068,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1292
1068
|
}
|
|
1293
1069
|
|
|
1294
1070
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
1295
|
-
|
|
1071
|
+
|
|
1072
|
+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
1296
1073
|
return this;
|
|
1297
|
-
}
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1298
1076
|
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
1299
1077
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
1300
1078
|
// the final result produced by the iterator.
|
|
@@ -1471,12 +1249,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1471
1249
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
1472
1250
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
1473
1251
|
|
|
1474
|
-
|
|
1252
|
+
Gp[iteratorSymbol] = function () {
|
|
1475
1253
|
return this;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
Gp.toString = function () {
|
|
1478
1257
|
return "[object Generator]";
|
|
1479
|
-
}
|
|
1258
|
+
};
|
|
1480
1259
|
|
|
1481
1260
|
function pushTryEntry(locs) {
|
|
1482
1261
|
var entry = {
|
|
@@ -1788,19 +1567,14 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1788
1567
|
} catch (accidentalStrictMode) {
|
|
1789
1568
|
// This module should not be running in strict mode, so the above
|
|
1790
1569
|
// assignment should always work unless something is misconfigured. Just
|
|
1791
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
1792
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
1570
|
+
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
1793
1571
|
// strict mode using a global Function call. This could conceivably fail
|
|
1794
1572
|
// if a Content Security Policy forbids using Function, but in that case
|
|
1795
1573
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
1796
1574
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
1797
1575
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1798
1576
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
1799
|
-
|
|
1800
|
-
globalThis.regeneratorRuntime = runtime;
|
|
1801
|
-
} else {
|
|
1802
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1803
|
-
}
|
|
1577
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1804
1578
|
}
|
|
1805
1579
|
});
|
|
1806
1580
|
|
|
@@ -2001,7 +1775,7 @@ function insertBlock(editor, nodeType, entity) {
|
|
|
2001
1775
|
focus(editor);
|
|
2002
1776
|
}
|
|
2003
1777
|
|
|
2004
|
-
var styles$
|
|
1778
|
+
var styles$1 = {
|
|
2005
1779
|
icon: /*#__PURE__*/css({
|
|
2006
1780
|
marginRight: '10px'
|
|
2007
1781
|
})
|
|
@@ -2049,7 +1823,7 @@ function EmbeddedEntityBlockToolbarIcon(_ref) {
|
|
|
2049
1823
|
flexDirection: "row"
|
|
2050
1824
|
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
2051
1825
|
as: type === 'Asset' ? AssetIcon : EmbeddedEntryBlockIcon,
|
|
2052
|
-
className: "rich-text__embedded-entry-list-icon " + styles$
|
|
1826
|
+
className: "rich-text__embedded-entry-list-icon " + styles$1.icon,
|
|
2053
1827
|
variant: "secondary"
|
|
2054
1828
|
}), /*#__PURE__*/React__default.createElement("span", null, type)));
|
|
2055
1829
|
}
|
|
@@ -2148,7 +1922,7 @@ var createEmbeddedAssetBlockPlugin = /*#__PURE__*/createEmbeddedEntityPlugin(BLO
|
|
|
2148
1922
|
|
|
2149
1923
|
var getEntryTitle = entityHelpers.getEntryTitle,
|
|
2150
1924
|
getEntryStatus = entityHelpers.getEntryStatus;
|
|
2151
|
-
var styles$
|
|
1925
|
+
var styles$2 = {
|
|
2152
1926
|
scheduledIcon: /*#__PURE__*/css({
|
|
2153
1927
|
verticalAlign: 'text-bottom',
|
|
2154
1928
|
marginRight: tokens.spacing2Xs
|
|
@@ -2219,7 +1993,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
2219
1993
|
actions: [/*#__PURE__*/React__default.createElement(MenuItem, {
|
|
2220
1994
|
key: "remove",
|
|
2221
1995
|
onClick: props.onRemove,
|
|
2222
|
-
testId: "
|
|
1996
|
+
testId: "delete"
|
|
2223
1997
|
}, "Remove")]
|
|
2224
1998
|
});
|
|
2225
1999
|
}
|
|
@@ -2236,14 +2010,14 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
2236
2010
|
key: "remove",
|
|
2237
2011
|
onClick: props.onRemove,
|
|
2238
2012
|
disabled: props.isDisabled,
|
|
2239
|
-
testId: "
|
|
2013
|
+
testId: "delete"
|
|
2240
2014
|
}, "Remove")]
|
|
2241
2015
|
}, /*#__PURE__*/React__default.createElement(ScheduledIconWithTooltip, {
|
|
2242
2016
|
getEntityScheduledActions: loadEntityScheduledActions,
|
|
2243
2017
|
entityType: "Entry",
|
|
2244
2018
|
entityId: entry.sys.id
|
|
2245
2019
|
}, /*#__PURE__*/React__default.createElement(ClockIcon, {
|
|
2246
|
-
className: styles$
|
|
2020
|
+
className: styles$2.scheduledIcon,
|
|
2247
2021
|
variant: "muted",
|
|
2248
2022
|
testId: "scheduled-icon"
|
|
2249
2023
|
})), /*#__PURE__*/React__default.createElement(Text$1, null, title));
|
|
@@ -2267,7 +2041,7 @@ function createInlineEntryNode(id) {
|
|
|
2267
2041
|
};
|
|
2268
2042
|
}
|
|
2269
2043
|
|
|
2270
|
-
var styles$
|
|
2044
|
+
var styles$3 = {
|
|
2271
2045
|
icon: /*#__PURE__*/css({
|
|
2272
2046
|
marginRight: '10px'
|
|
2273
2047
|
}),
|
|
@@ -2303,15 +2077,15 @@ function EmbeddedEntityInline(props) {
|
|
|
2303
2077
|
}
|
|
2304
2078
|
|
|
2305
2079
|
return /*#__PURE__*/createElement("span", Object.assign({}, props.attributes, {
|
|
2306
|
-
className: styles$
|
|
2080
|
+
className: styles$3.root,
|
|
2307
2081
|
"data-embedded-entity-inline-id": entryId,
|
|
2308
2082
|
// COMPAT: This makes copy & paste work for Firefox
|
|
2309
|
-
contentEditable:
|
|
2310
|
-
draggable:
|
|
2083
|
+
contentEditable: IS_CHROME ? undefined : false,
|
|
2084
|
+
draggable: IS_CHROME ? true : undefined
|
|
2311
2085
|
}), /*#__PURE__*/createElement("span", {
|
|
2312
2086
|
// COMPAT: This makes copy & paste work for Chromium/Blink browsers and Safari
|
|
2313
|
-
contentEditable:
|
|
2314
|
-
draggable:
|
|
2087
|
+
contentEditable: IS_CHROME ? false : undefined,
|
|
2088
|
+
draggable: IS_CHROME ? true : undefined
|
|
2315
2089
|
}, /*#__PURE__*/createElement(FetchingWrappedInlineEntryCard, {
|
|
2316
2090
|
sdk: sdk,
|
|
2317
2091
|
entryId: entryId,
|
|
@@ -2433,7 +2207,7 @@ function ToolbarEmbeddedEntityInlineButton(props) {
|
|
|
2433
2207
|
flexDirection: "row"
|
|
2434
2208
|
}, /*#__PURE__*/createElement(EmbeddedEntryInlineIcon, {
|
|
2435
2209
|
variant: "secondary",
|
|
2436
|
-
className: "rich-text__embedded-entry-list-icon " + styles$
|
|
2210
|
+
className: "rich-text__embedded-entry-list-icon " + styles$3.icon
|
|
2437
2211
|
}), /*#__PURE__*/createElement("span", null, "Inline entry")));
|
|
2438
2212
|
}
|
|
2439
2213
|
function createEmbeddedEntityInlinePlugin(sdk) {
|
|
@@ -2509,7 +2283,7 @@ var isMarkEnabled = function isMarkEnabled(field, mark) {
|
|
|
2509
2283
|
};
|
|
2510
2284
|
|
|
2511
2285
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _dropdown, _LABELS;
|
|
2512
|
-
var styles$
|
|
2286
|
+
var styles$4 = {
|
|
2513
2287
|
dropdown: (_dropdown = {
|
|
2514
2288
|
root: /*#__PURE__*/css(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
|
|
2515
2289
|
}, _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)
|
|
@@ -2604,7 +2378,7 @@ function ToolbarHeadingButton(props) {
|
|
|
2604
2378
|
testId: "dropdown-option-" + nodeType,
|
|
2605
2379
|
disabled: props.isDisabled
|
|
2606
2380
|
}, /*#__PURE__*/createElement("span", {
|
|
2607
|
-
className: cx(styles$
|
|
2381
|
+
className: cx(styles$4.dropdown.root, styles$4.dropdown[nodeType])
|
|
2608
2382
|
}, LABELS[nodeType]));
|
|
2609
2383
|
}).filter(Boolean)));
|
|
2610
2384
|
}
|
|
@@ -2674,7 +2448,7 @@ var transformLift = function transformLift(editor, _ref4) {
|
|
|
2674
2448
|
};
|
|
2675
2449
|
|
|
2676
2450
|
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;
|
|
2677
|
-
var styles$
|
|
2451
|
+
var styles$5 = {
|
|
2678
2452
|
dropdown: (_dropdown$1 = {
|
|
2679
2453
|
root: /*#__PURE__*/css(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-weight: ", ";\n "])), tokens.fontWeightDemiBold)
|
|
2680
2454
|
}, _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),
|
|
@@ -2686,7 +2460,7 @@ var styles$8 = {
|
|
|
2686
2460
|
function createHeading(Tag, block) {
|
|
2687
2461
|
return function Heading(props) {
|
|
2688
2462
|
return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
|
|
2689
|
-
className: cx(styles$
|
|
2463
|
+
className: cx(styles$5.headings.root, styles$5.headings[block])
|
|
2690
2464
|
}), props.children);
|
|
2691
2465
|
};
|
|
2692
2466
|
}
|
|
@@ -2782,7 +2556,7 @@ var createHeadingPlugin = function createHeadingPlugin() {
|
|
|
2782
2556
|
};
|
|
2783
2557
|
};
|
|
2784
2558
|
|
|
2785
|
-
var styles$
|
|
2559
|
+
var styles$6 = {
|
|
2786
2560
|
button: /*#__PURE__*/css({
|
|
2787
2561
|
height: '30px',
|
|
2788
2562
|
width: '30px',
|
|
@@ -2808,7 +2582,7 @@ function ToolbarButton(props) {
|
|
|
2808
2582
|
};
|
|
2809
2583
|
|
|
2810
2584
|
var button = /*#__PURE__*/React__default.createElement(Button, {
|
|
2811
|
-
className: cx(styles$
|
|
2585
|
+
className: cx(styles$6.button, className),
|
|
2812
2586
|
isDisabled: isDisabled,
|
|
2813
2587
|
startIcon: children,
|
|
2814
2588
|
onClick: handleClick,
|
|
@@ -2819,7 +2593,7 @@ function ToolbarButton(props) {
|
|
|
2819
2593
|
|
|
2820
2594
|
if (title) {
|
|
2821
2595
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
2822
|
-
className: styles$
|
|
2596
|
+
className: styles$6.tooltip,
|
|
2823
2597
|
placement: "bottom",
|
|
2824
2598
|
content: title
|
|
2825
2599
|
}, button);
|
|
@@ -2829,7 +2603,7 @@ function ToolbarButton(props) {
|
|
|
2829
2603
|
}
|
|
2830
2604
|
|
|
2831
2605
|
var _templateObject$2, _templateObject2$2, _templateObject3$2;
|
|
2832
|
-
var styles$
|
|
2606
|
+
var styles$7 = {
|
|
2833
2607
|
container: /*#__PURE__*/css(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0 0 ", ";\n "])), tokens.spacingL),
|
|
2834
2608
|
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),
|
|
2835
2609
|
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)
|
|
@@ -2887,14 +2661,14 @@ function Hr(props) {
|
|
|
2887
2661
|
var isSelected = useSelected();
|
|
2888
2662
|
var isFocused = useFocused();
|
|
2889
2663
|
return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
|
|
2890
|
-
className: styles$
|
|
2664
|
+
className: styles$7.container,
|
|
2891
2665
|
"data-void-element": BLOCKS.HR
|
|
2892
2666
|
}), /*#__PURE__*/createElement("div", {
|
|
2893
2667
|
draggable: true,
|
|
2894
2668
|
// Moving `contentEditable` to this div makes it to be selectable when being the first void element, e.g pressing ctrl + a to select everything
|
|
2895
2669
|
contentEditable: false
|
|
2896
2670
|
}, /*#__PURE__*/createElement("hr", {
|
|
2897
|
-
className: cx(styles$
|
|
2671
|
+
className: cx(styles$7.hr, isSelected && isFocused ? styles$7.hrSelected : undefined)
|
|
2898
2672
|
})), props.children);
|
|
2899
2673
|
}
|
|
2900
2674
|
var createHrPlugin = function createHrPlugin() {
|
|
@@ -2921,7 +2695,7 @@ var createHrPlugin = function createHrPlugin() {
|
|
|
2921
2695
|
};
|
|
2922
2696
|
|
|
2923
2697
|
var _templateObject$3, _SYS_LINK_TYPES, _LINK_TYPE_SELECTION_;
|
|
2924
|
-
var styles$
|
|
2698
|
+
var styles$8 = {
|
|
2925
2699
|
removeSelectionLabel: /*#__PURE__*/css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-left: ", ";\n "])), tokens.spacingS)
|
|
2926
2700
|
};
|
|
2927
2701
|
var SYS_LINK_TYPES = (_SYS_LINK_TYPES = {}, _SYS_LINK_TYPES[INLINES.ENTRY_HYPERLINK] = 'Entry', _SYS_LINK_TYPES[INLINES.ASSET_HYPERLINK] = 'Asset', _SYS_LINK_TYPES);
|
|
@@ -3104,7 +2878,7 @@ function HyperlinkModal(props) {
|
|
|
3104
2878
|
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/createElement(Fragment, null, !props.readonly && /*#__PURE__*/createElement(TextLink, {
|
|
3105
2879
|
testId: "entity-selection-link",
|
|
3106
2880
|
onClick: resetLinkEntity,
|
|
3107
|
-
className: styles$
|
|
2881
|
+
className: styles$8.removeSelectionLabel
|
|
3108
2882
|
}, "Remove selection"), /*#__PURE__*/createElement("div", null, linkType === INLINES.ENTRY_HYPERLINK && /*#__PURE__*/createElement(FetchingWrappedEntryCard, {
|
|
3109
2883
|
sdk: props.sdk,
|
|
3110
2884
|
locale: props.sdk.field.locale,
|
|
@@ -3445,7 +3219,7 @@ function useEntityInfo(props) {
|
|
|
3445
3219
|
return getEntityInfo(status.data);
|
|
3446
3220
|
}
|
|
3447
3221
|
|
|
3448
|
-
var styles$
|
|
3222
|
+
var styles$9 = {
|
|
3449
3223
|
hyperlinkWrapper: /*#__PURE__*/css({
|
|
3450
3224
|
display: 'inline',
|
|
3451
3225
|
position: 'static',
|
|
@@ -3490,13 +3264,13 @@ function EntityHyperlink(props) {
|
|
|
3490
3264
|
|
|
3491
3265
|
return /*#__PURE__*/createElement(Tooltip, {
|
|
3492
3266
|
content: tooltipContent,
|
|
3493
|
-
targetWrapperClassName: styles$
|
|
3267
|
+
targetWrapperClassName: styles$9.hyperlinkWrapper,
|
|
3494
3268
|
placement: "bottom",
|
|
3495
3269
|
maxWidth: "auto"
|
|
3496
3270
|
}, /*#__PURE__*/createElement(TextLink, {
|
|
3497
3271
|
as: "a",
|
|
3498
3272
|
onClick: handleClick,
|
|
3499
|
-
className: styles$
|
|
3273
|
+
className: styles$9.hyperlink,
|
|
3500
3274
|
"data-link-type": target.sys.linkType,
|
|
3501
3275
|
"data-link-id": target.sys.id
|
|
3502
3276
|
}, props.children));
|
|
@@ -3520,7 +3294,7 @@ function UrlHyperlink(props) {
|
|
|
3520
3294
|
|
|
3521
3295
|
return /*#__PURE__*/createElement(Tooltip, {
|
|
3522
3296
|
content: uri,
|
|
3523
|
-
targetWrapperClassName: styles$
|
|
3297
|
+
targetWrapperClassName: styles$9.hyperlinkWrapper,
|
|
3524
3298
|
placement: "bottom",
|
|
3525
3299
|
maxWidth: "auto"
|
|
3526
3300
|
}, /*#__PURE__*/createElement(TextLink, {
|
|
@@ -3528,7 +3302,7 @@ function UrlHyperlink(props) {
|
|
|
3528
3302
|
href: uri,
|
|
3529
3303
|
rel: "noopener noreferrer",
|
|
3530
3304
|
onClick: handleClick,
|
|
3531
|
-
className: styles$
|
|
3305
|
+
className: styles$9.hyperlink
|
|
3532
3306
|
}, props.children));
|
|
3533
3307
|
}
|
|
3534
3308
|
|
|
@@ -3654,12 +3428,12 @@ var createHyperlinkPlugin = function createHyperlinkPlugin(sdk) {
|
|
|
3654
3428
|
|
|
3655
3429
|
var _templateObject$4, _templateObject2$3, _templateObject3$3, _styles;
|
|
3656
3430
|
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);
|
|
3657
|
-
var styles$
|
|
3431
|
+
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);
|
|
3658
3432
|
|
|
3659
3433
|
function createList(Tag, block) {
|
|
3660
3434
|
return function List(props) {
|
|
3661
3435
|
return /*#__PURE__*/createElement(Tag, Object.assign({}, props.attributes, {
|
|
3662
|
-
className: cx(baseStyle, styles$
|
|
3436
|
+
className: cx(baseStyle, styles$a[block])
|
|
3663
3437
|
}), props.children);
|
|
3664
3438
|
};
|
|
3665
3439
|
}
|
|
@@ -4640,14 +4414,14 @@ var ToolbarBoldButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4640
4414
|
mark: MARKS.BOLD,
|
|
4641
4415
|
icon: /*#__PURE__*/createElement(FormatBoldIcon, null)
|
|
4642
4416
|
});
|
|
4643
|
-
var styles$
|
|
4417
|
+
var styles$b = {
|
|
4644
4418
|
bold: /*#__PURE__*/css({
|
|
4645
4419
|
fontWeight: 600
|
|
4646
4420
|
})
|
|
4647
4421
|
};
|
|
4648
4422
|
function Bold(props) {
|
|
4649
4423
|
return /*#__PURE__*/createElement("strong", Object.assign({}, props.attributes, {
|
|
4650
|
-
className: styles$
|
|
4424
|
+
className: styles$b.bold
|
|
4651
4425
|
}), props.children);
|
|
4652
4426
|
}
|
|
4653
4427
|
|
|
@@ -4687,7 +4461,7 @@ var ToolbarCodeButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4687
4461
|
mark: MARKS.CODE,
|
|
4688
4462
|
icon: /*#__PURE__*/createElement(CodeIcon, null)
|
|
4689
4463
|
});
|
|
4690
|
-
var styles$
|
|
4464
|
+
var styles$c = {
|
|
4691
4465
|
code: /*#__PURE__*/css({
|
|
4692
4466
|
fontFamily: 'monospace',
|
|
4693
4467
|
fontSize: '.9em'
|
|
@@ -4695,7 +4469,7 @@ var styles$f = {
|
|
|
4695
4469
|
};
|
|
4696
4470
|
function Code(props) {
|
|
4697
4471
|
return /*#__PURE__*/createElement("code", Object.assign({}, props.attributes, {
|
|
4698
|
-
className: styles$
|
|
4472
|
+
className: styles$c.code
|
|
4699
4473
|
}), props.children);
|
|
4700
4474
|
}
|
|
4701
4475
|
var createCodePlugin = function createCodePlugin() {
|
|
@@ -4725,14 +4499,14 @@ var ToolbarItalicButton = /*#__PURE__*/createMarkToolbarButton({
|
|
|
4725
4499
|
mark: MARKS.ITALIC,
|
|
4726
4500
|
icon: /*#__PURE__*/createElement(FormatItalicIcon, null)
|
|
4727
4501
|
});
|
|
4728
|
-
var styles$
|
|
4502
|
+
var styles$d = {
|
|
4729
4503
|
italic: /*#__PURE__*/css({
|
|
4730
4504
|
fontStyle: 'italic'
|
|
4731
4505
|
})
|
|
4732
4506
|
};
|
|
4733
4507
|
function Italic(props) {
|
|
4734
4508
|
return /*#__PURE__*/createElement("em", Object.assign({}, props.attributes, {
|
|
4735
|
-
className: styles$
|
|
4509
|
+
className: styles$d.italic
|
|
4736
4510
|
}), props.children);
|
|
4737
4511
|
}
|
|
4738
4512
|
var createItalicPlugin = function createItalicPlugin() {
|
|
@@ -5008,10 +4782,10 @@ var createNormalizerPlugin = function createNormalizerPlugin() {
|
|
|
5008
4782
|
};
|
|
5009
4783
|
|
|
5010
4784
|
var _templateObject$6, _styles$1;
|
|
5011
|
-
var styles$
|
|
4785
|
+
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);
|
|
5012
4786
|
function Paragraph(props) {
|
|
5013
4787
|
return /*#__PURE__*/createElement("div", Object.assign({}, props.attributes, {
|
|
5014
|
-
className: styles$
|
|
4788
|
+
className: styles$e[BLOCKS.PARAGRAPH]
|
|
5015
4789
|
}), props.children);
|
|
5016
4790
|
}
|
|
5017
4791
|
|
|
@@ -5832,7 +5606,7 @@ var isTable = function isTable(node) {
|
|
|
5832
5606
|
return Element.isElement(node) && node.type === BLOCKS.TABLE;
|
|
5833
5607
|
};
|
|
5834
5608
|
|
|
5835
|
-
var styles$
|
|
5609
|
+
var styles$f = {
|
|
5836
5610
|
topRight: /*#__PURE__*/css({
|
|
5837
5611
|
position: 'absolute',
|
|
5838
5612
|
top: '6px',
|
|
@@ -5921,7 +5695,7 @@ var TableActions = function TableActions() {
|
|
|
5921
5695
|
size: "small",
|
|
5922
5696
|
variant: "transparent",
|
|
5923
5697
|
tabIndex: -1,
|
|
5924
|
-
className: styles$
|
|
5698
|
+
className: styles$f.topRight,
|
|
5925
5699
|
icon: /*#__PURE__*/React__default.createElement(ChevronDownIcon, null),
|
|
5926
5700
|
"aria-label": "Open table menu",
|
|
5927
5701
|
testId: "cf-table-actions-button"
|
|
@@ -6855,7 +6629,7 @@ var normalizeEditorValue = function normalizeEditorValue(value, options) {
|
|
|
6855
6629
|
};
|
|
6856
6630
|
|
|
6857
6631
|
var STYLE_EDITOR_BORDER = "1px solid " + tokens.gray400;
|
|
6858
|
-
var styles$
|
|
6632
|
+
var styles$g = {
|
|
6859
6633
|
root: /*#__PURE__*/css({
|
|
6860
6634
|
position: 'relative'
|
|
6861
6635
|
}),
|
|
@@ -6971,7 +6745,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
6971
6745
|
}, actions);
|
|
6972
6746
|
};
|
|
6973
6747
|
|
|
6974
|
-
var styles$
|
|
6748
|
+
var styles$h = {
|
|
6975
6749
|
toolbar: /*#__PURE__*/css({
|
|
6976
6750
|
border: "1px solid " + tokens.gray400,
|
|
6977
6751
|
backgroundColor: tokens.gray100,
|
|
@@ -7016,14 +6790,14 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7016
6790
|
var shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
|
|
7017
6791
|
return /*#__PURE__*/React__default.createElement(Flex, {
|
|
7018
6792
|
testId: "toolbar",
|
|
7019
|
-
className: styles$
|
|
6793
|
+
className: styles$h.toolbar,
|
|
7020
6794
|
alignItems: "center"
|
|
7021
6795
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
7022
|
-
className: styles$
|
|
6796
|
+
className: styles$h.formattingOptionsWrapper
|
|
7023
6797
|
}, /*#__PURE__*/React__default.createElement(ToolbarHeadingButton, {
|
|
7024
6798
|
isDisabled: isDisabled || !canInsertBlocks
|
|
7025
6799
|
}), validationInfo.isAnyMarkEnabled && /*#__PURE__*/React__default.createElement("span", {
|
|
7026
|
-
className: styles$
|
|
6800
|
+
className: styles$h.divider
|
|
7027
6801
|
}), isMarkEnabled(sdk.field, MARKS.BOLD) && /*#__PURE__*/React__default.createElement(ToolbarBoldButton, {
|
|
7028
6802
|
isDisabled: isDisabled
|
|
7029
6803
|
}), isMarkEnabled(sdk.field, MARKS.ITALIC) && /*#__PURE__*/React__default.createElement(ToolbarItalicButton, {
|
|
@@ -7033,11 +6807,11 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7033
6807
|
}), isMarkEnabled(sdk.field, MARKS.CODE) && /*#__PURE__*/React__default.createElement(ToolbarCodeButton, {
|
|
7034
6808
|
isDisabled: isDisabled
|
|
7035
6809
|
}), validationInfo.isAnyHyperlinkEnabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
7036
|
-
className: styles$
|
|
6810
|
+
className: styles$h.divider
|
|
7037
6811
|
}), /*#__PURE__*/React__default.createElement(ToolbarHyperlinkButton, {
|
|
7038
6812
|
isDisabled: isDisabled
|
|
7039
6813
|
})), validationInfo.isAnyBlockFormattingEnabled && /*#__PURE__*/React__default.createElement("span", {
|
|
7040
|
-
className: styles$
|
|
6814
|
+
className: styles$h.divider
|
|
7041
6815
|
}), /*#__PURE__*/React__default.createElement(ToolbarListButton, {
|
|
7042
6816
|
isDisabled: isDisabled || !canInsertBlocks
|
|
7043
6817
|
}), isNodeTypeEnabled(sdk.field, BLOCKS.QUOTE) && /*#__PURE__*/React__default.createElement(ToolbarQuoteButton, {
|
|
@@ -7047,7 +6821,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7047
6821
|
}), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && /*#__PURE__*/React__default.createElement(ToolbarTableButton, {
|
|
7048
6822
|
isDisabled: shouldDisableTables
|
|
7049
6823
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
7050
|
-
className: styles$
|
|
6824
|
+
className: styles$h.embedActionsWrapper
|
|
7051
6825
|
}, /*#__PURE__*/React__default.createElement(EmbedEntityWidget, {
|
|
7052
6826
|
isDisabled: isDisabled,
|
|
7053
6827
|
canInsertBlocks: canInsertBlocks
|
|
@@ -7072,7 +6846,7 @@ function getValidationInfo(field) {
|
|
|
7072
6846
|
}
|
|
7073
6847
|
|
|
7074
6848
|
var _templateObject$b;
|
|
7075
|
-
var styles$
|
|
6849
|
+
var styles$i = {
|
|
7076
6850
|
nativeSticky: /*#__PURE__*/css(_templateObject$b || (_templateObject$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: -webkit-sticky;\n position: sticky;\n top: -1px;\n z-index: 2;\n "])))
|
|
7077
6851
|
};
|
|
7078
6852
|
|
|
@@ -7080,7 +6854,7 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
|
|
|
7080
6854
|
var isDisabled = _ref.isDisabled,
|
|
7081
6855
|
children = _ref.children;
|
|
7082
6856
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
7083
|
-
className: isDisabled ? '' : styles$
|
|
6857
|
+
className: isDisabled ? '' : styles$i.nativeSticky
|
|
7084
6858
|
}, children);
|
|
7085
6859
|
};
|
|
7086
6860
|
|
|
@@ -7175,9 +6949,9 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
7175
6949
|
setPendingExternalUpdate(true);
|
|
7176
6950
|
setEditorContent(editor, documentToEditorValue(props.value));
|
|
7177
6951
|
}, [props.value, id]);
|
|
7178
|
-
var classNames = cx(styles$
|
|
6952
|
+
var classNames = cx(styles$g.editor, props.minHeight !== undefined ? css({
|
|
7179
6953
|
minHeight: props.minHeight
|
|
7180
|
-
}) : undefined, props.isDisabled ? styles$
|
|
6954
|
+
}) : undefined, props.isDisabled ? styles$g.disabled : styles$g.enabled, props.isToolbarHidden && styles$g.hiddenToolbar);
|
|
7181
6955
|
useEffect(function () {
|
|
7182
6956
|
if (!isFirstRender) {
|
|
7183
6957
|
return;
|
|
@@ -7193,7 +6967,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
7193
6967
|
}, /*#__PURE__*/React__default.createElement(ContentfulEditorIdProvider, {
|
|
7194
6968
|
value: id
|
|
7195
6969
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
7196
|
-
className: styles$
|
|
6970
|
+
className: styles$g.root,
|
|
7197
6971
|
"data-test-id": "rich-text-editor"
|
|
7198
6972
|
}, /*#__PURE__*/React__default.createElement(Plate, {
|
|
7199
6973
|
id: id,
|
|
@@ -7220,7 +6994,7 @@ var RichTextEditor = function RichTextEditor(props) {
|
|
|
7220
6994
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
7221
6995
|
|
|
7222
6996
|
var isEmptyValue = useCallback(function (value) {
|
|
7223
|
-
return !value ||
|
|
6997
|
+
return !value || areEqual(value, EMPTY_DOCUMENT);
|
|
7224
6998
|
}, []);
|
|
7225
6999
|
var id = getContentfulEditorId(props.sdk);
|
|
7226
7000
|
return /*#__PURE__*/React__default.createElement(EntityProvider, {
|
|
@@ -7230,7 +7004,7 @@ var RichTextEditor = function RichTextEditor(props) {
|
|
|
7230
7004
|
field: sdk.field,
|
|
7231
7005
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
7232
7006
|
isEmptyValue: isEmptyValue,
|
|
7233
|
-
isEqualValues:
|
|
7007
|
+
isEqualValues: areEqual
|
|
7234
7008
|
}, function (_ref) {
|
|
7235
7009
|
var lastRemoteValue = _ref.lastRemoteValue,
|
|
7236
7010
|
disabled = _ref.disabled,
|