@contentful/field-editor-rich-text 4.12.4 → 4.13.1
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/cjs/__fixtures__/FakeSdk.js +7 -7
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +2 -6
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +1 -3
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +2 -2
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +2 -2
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +23 -31
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +21 -29
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +4 -5
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +4 -5
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +7 -8
- package/dist/esm/__fixtures__/FakeSdk.js +8 -8
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +3 -7
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +2 -4
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +2 -2
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +2 -2
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +24 -32
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +22 -30
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +4 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +4 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +7 -8
- package/package.json +6 -7
|
@@ -57,8 +57,8 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
57
57
|
const sdk = {
|
|
58
58
|
field,
|
|
59
59
|
locales,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
cma: {
|
|
61
|
+
entry: {
|
|
62
62
|
get: async ({ entryId })=>{
|
|
63
63
|
if (props?.fetchDelay) {
|
|
64
64
|
await delay(props.fetchDelay);
|
|
@@ -75,7 +75,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
75
75
|
return Promise.reject({});
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
|
|
78
|
+
asset: {
|
|
79
79
|
get: async ({ assetId })=>{
|
|
80
80
|
if (props?.fetchDelay) {
|
|
81
81
|
await delay(props.fetchDelay);
|
|
@@ -92,7 +92,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
92
92
|
return Promise.reject({});
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
space: {
|
|
96
96
|
get: async (params)=>{
|
|
97
97
|
if (params.spaceId === _fixtures.spaces.indifferent.sys.id) {
|
|
98
98
|
return _fixtures.spaces.indifferent;
|
|
@@ -100,7 +100,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
100
100
|
return Promise.reject({});
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
-
|
|
103
|
+
contentType: {
|
|
104
104
|
get: async ({ contentTypeId })=>{
|
|
105
105
|
if (contentTypeId === _fixtures.contentTypes.published.sys.id) {
|
|
106
106
|
return _fixtures.contentTypes.published;
|
|
@@ -108,10 +108,10 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
108
108
|
return Promise.reject({});
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
locale: {
|
|
112
112
|
getMany: async ()=>_fixtures.locales.list
|
|
113
113
|
}
|
|
114
|
-
}
|
|
114
|
+
},
|
|
115
115
|
space: {
|
|
116
116
|
...space,
|
|
117
117
|
getCachedContentTypes () {
|
|
@@ -107,9 +107,7 @@ function InternalFetchingWrappedInlineEntryCard({ entry, allContentTypes, locale
|
|
|
107
107
|
disabled: isDisabled,
|
|
108
108
|
testId: "delete"
|
|
109
109
|
}, "Remove")
|
|
110
|
-
]
|
|
111
|
-
key: i
|
|
112
|
-
}, item))
|
|
110
|
+
]
|
|
113
111
|
}, /*#__PURE__*/ _react.createElement(_fieldeditorreference.ScheduledIconWithTooltip, {
|
|
114
112
|
getEntityScheduledActions: getEntityScheduledActions,
|
|
115
113
|
entityType: "Entry",
|
|
@@ -157,9 +155,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
157
155
|
onClick: props.onRemove,
|
|
158
156
|
testId: "delete"
|
|
159
157
|
}, "Remove")
|
|
160
|
-
]
|
|
161
|
-
key: i
|
|
162
|
-
}, item))
|
|
158
|
+
]
|
|
163
159
|
});
|
|
164
160
|
}
|
|
165
161
|
return /*#__PURE__*/ _react.createElement(InternalFetchingWrappedInlineEntryCard, {
|
|
@@ -103,8 +103,6 @@ function FetchingWrappedResourceInlineCard(props) {
|
|
|
103
103
|
disabled: props.isDisabled,
|
|
104
104
|
testId: "delete"
|
|
105
105
|
}, "Remove")
|
|
106
|
-
]
|
|
107
|
-
key: i
|
|
108
|
-
}, item))
|
|
106
|
+
]
|
|
109
107
|
}, /*#__PURE__*/ _react.createElement(_f36components.Text, null, title));
|
|
110
108
|
}
|
|
@@ -85,14 +85,14 @@ const createMarkToolbarButton = ({ mark, title, icon })=>{
|
|
|
85
85
|
]);
|
|
86
86
|
if (!editor) return null;
|
|
87
87
|
if (!icon) {
|
|
88
|
-
return /*#__PURE__*/ _react.createElement(_f36components.Menu
|
|
88
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
89
89
|
onClick: handleClick,
|
|
90
90
|
disabled: isDisabled,
|
|
91
91
|
className: (0, _emotion.cx)({
|
|
92
92
|
[styles.isActive]: (0, _queries.isMarkActive)(editor, mark)
|
|
93
93
|
}),
|
|
94
94
|
testId: `${mark}-toolbar-button`
|
|
95
|
-
}, title)
|
|
95
|
+
}, title);
|
|
96
96
|
}
|
|
97
97
|
return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
98
98
|
title: title,
|
|
@@ -94,7 +94,7 @@ function EmbeddedBlockToolbarIcon({ isDisabled, nodeType, onClose }) {
|
|
|
94
94
|
};
|
|
95
95
|
const type = getEntityTypeFromNodeType(nodeType);
|
|
96
96
|
const baseClass = `rich-text__${nodeType}`;
|
|
97
|
-
return /*#__PURE__*/ _react.createElement(_f36components.Menu
|
|
97
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
98
98
|
disabled: isDisabled,
|
|
99
99
|
className: `${baseClass}-list-item`,
|
|
100
100
|
onClick: handleClick,
|
|
@@ -106,7 +106,7 @@ function EmbeddedBlockToolbarIcon({ isDisabled, nodeType, onClose }) {
|
|
|
106
106
|
as: type === 'Asset' ? _f36icons.ImageSquareIcon : _f36icons.EmbeddedBlockIcon,
|
|
107
107
|
className: `rich-text__embedded-entry-list-icon ${styles.icon}`,
|
|
108
108
|
color: _f36tokens.default.gray900
|
|
109
|
-
}), /*#__PURE__*/ _react.createElement("span", null, type, nodeType == _richtexttypes.BLOCKS.EMBEDDED_RESOURCE && /*#__PURE__*/ _react.createElement(_ResourceNewBadge.ResourceNewBadge, null))))
|
|
109
|
+
}), /*#__PURE__*/ _react.createElement("span", null, type, nodeType == _richtexttypes.BLOCKS.EMBEDDED_RESOURCE && /*#__PURE__*/ _react.createElement(_ResourceNewBadge.ResourceNewBadge, null))));
|
|
110
110
|
}
|
|
111
111
|
function getEntityTypeFromNodeType(nodeType) {
|
|
112
112
|
const words = nodeType.toLowerCase().split('-');
|
|
@@ -92,7 +92,7 @@ function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled }) {
|
|
|
92
92
|
}
|
|
93
93
|
(0, _editor.moveToTheNextChar)(editor);
|
|
94
94
|
}
|
|
95
|
-
return /*#__PURE__*/ _react.createElement(_f36components.Menu
|
|
95
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Menu.Item, {
|
|
96
96
|
disabled: isDisabled,
|
|
97
97
|
className: "rich-text__entry-link-block-button",
|
|
98
98
|
testId: `toolbar-toggle-${nodeType}`,
|
|
@@ -103,5 +103,5 @@ function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled }) {
|
|
|
103
103
|
}, /*#__PURE__*/ _react.createElement(_f36icons.EmbeddedLineIcon, {
|
|
104
104
|
color: _f36tokens.default.gray900,
|
|
105
105
|
className: `rich-text__embedded-entry-list-icon ${styles.icon}`
|
|
106
|
-
}), /*#__PURE__*/ _react.createElement("span", null, "Inline entry", nodeType == _richtexttypes.INLINES.EMBEDDED_RESOURCE && /*#__PURE__*/ _react.createElement(_ResourceNewBadge.ResourceNewBadge, null))))
|
|
106
|
+
}), /*#__PURE__*/ _react.createElement("span", null, "Inline entry", nodeType == _richtexttypes.INLINES.EMBEDDED_RESOURCE && /*#__PURE__*/ _react.createElement(_ResourceNewBadge.ResourceNewBadge, null))));
|
|
107
107
|
}
|
|
@@ -59,54 +59,47 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
}
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
|
-
const InternalAssetCard = /*#__PURE__*/ _react.memo((
|
|
63
|
-
const
|
|
64
|
-
const activeLocales = (0, _fieldeditorshared.useActiveLocales)(props.sdk);
|
|
62
|
+
const InternalAssetCard = /*#__PURE__*/ _react.memo(({ asset, sdk, isDisabled, isSelected, locale, onEdit, onRemove, loadEntityScheduledActions, localesStatusMap, release, releaseStatusMap, releaseAction })=>{
|
|
63
|
+
const activeLocales = (0, _fieldeditorshared.useActiveLocales)(sdk);
|
|
65
64
|
return /*#__PURE__*/ _react.createElement(_fieldeditorreference.WrappedAssetCard, {
|
|
66
|
-
getEntityScheduledActions:
|
|
65
|
+
getEntityScheduledActions: loadEntityScheduledActions,
|
|
67
66
|
size: "small",
|
|
68
|
-
isSelected:
|
|
69
|
-
isDisabled:
|
|
70
|
-
localeCode:
|
|
71
|
-
defaultLocaleCode:
|
|
72
|
-
asset:
|
|
73
|
-
onEdit:
|
|
74
|
-
onRemove:
|
|
67
|
+
isSelected: isSelected,
|
|
68
|
+
isDisabled: isDisabled,
|
|
69
|
+
localeCode: locale,
|
|
70
|
+
defaultLocaleCode: sdk.locales.default,
|
|
71
|
+
asset: asset,
|
|
72
|
+
onEdit: onEdit,
|
|
73
|
+
onRemove: isDisabled ? undefined : onRemove,
|
|
75
74
|
isClickable: false,
|
|
76
|
-
useLocalizedEntityStatus:
|
|
77
|
-
localesStatusMap:
|
|
75
|
+
useLocalizedEntityStatus: sdk.parameters.instance.useLocalizedEntityStatus,
|
|
76
|
+
localesStatusMap: localesStatusMap,
|
|
78
77
|
activeLocales: activeLocales,
|
|
79
|
-
renderDragHandle: !
|
|
78
|
+
renderDragHandle: !isDisabled ? (dragHandleProps)=>/*#__PURE__*/ _react.createElement(_f36components.DragHandle, {
|
|
80
79
|
label: "drag embedded asset",
|
|
81
80
|
...dragHandleProps
|
|
82
81
|
}) : undefined,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
activeRelease: activeRelease,
|
|
82
|
+
releaseStatusMap: releaseStatusMap,
|
|
83
|
+
release: release,
|
|
86
84
|
releaseAction: releaseAction
|
|
87
85
|
});
|
|
88
86
|
}, _fastdeepequal.default);
|
|
89
87
|
InternalAssetCard.displayName = 'InternalAssetCard';
|
|
90
88
|
function FetchingWrappedAssetCard(props) {
|
|
91
89
|
const { onEntityFetchComplete } = props;
|
|
92
|
-
const { data: asset, status } = (0, _fieldeditorreference.useEntity)('Asset', props.assetId);
|
|
90
|
+
const { data: asset, status, currentEntity } = (0, _fieldeditorreference.useEntity)('Asset', props.assetId);
|
|
93
91
|
const { getEntityScheduledActions } = (0, _fieldeditorreference.useEntityLoader)();
|
|
94
92
|
const loadEntityScheduledActions = _react.useCallback(()=>getEntityScheduledActions('Asset', props.assetId), [
|
|
95
93
|
getEntityScheduledActions,
|
|
96
94
|
props.assetId
|
|
97
95
|
]);
|
|
98
96
|
const localesStatusMap = (0, _fieldeditorshared.useLocalePublishStatus)(asset, props.sdk.locales);
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
releaseVersionMap,
|
|
105
|
-
locales,
|
|
106
|
-
activeRelease,
|
|
107
|
-
releases
|
|
97
|
+
const { releaseStatusMap, releaseAction } = (0, _fieldeditorshared.useReleaseStatus)({
|
|
98
|
+
entity: asset,
|
|
99
|
+
previousEntityOnTimeline: currentEntity,
|
|
100
|
+
locales: props.sdk.locales,
|
|
101
|
+
release: props.sdk.release
|
|
108
102
|
});
|
|
109
|
-
const { releaseAction } = (0, _fieldeditorshared.getEntityReleaseStatus)(props.assetId, locales, activeRelease);
|
|
110
103
|
_react.useEffect(()=>{
|
|
111
104
|
if (status === 'success') {
|
|
112
105
|
onEntityFetchComplete?.();
|
|
@@ -138,9 +131,8 @@ function FetchingWrappedAssetCard(props) {
|
|
|
138
131
|
onEdit: props.onEdit,
|
|
139
132
|
onRemove: props.onRemove,
|
|
140
133
|
localesStatusMap: localesStatusMap,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
activeRelease: activeRelease,
|
|
134
|
+
releaseStatusMap: releaseStatusMap,
|
|
135
|
+
release: props.sdk.release,
|
|
144
136
|
releaseAction: releaseAction
|
|
145
137
|
});
|
|
146
138
|
}
|
|
@@ -59,57 +59,50 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
}
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
|
-
const InternalEntryCard = /*#__PURE__*/ _react.memo((
|
|
63
|
-
const { entry, sdk, loadEntityScheduledActions, releaseLocalesStatusMap, isActiveReleaseLoading, activeRelease, releaseAction } = props;
|
|
62
|
+
const InternalEntryCard = /*#__PURE__*/ _react.memo(({ entry, sdk, loadEntityScheduledActions, releaseStatusMap, release, releaseAction, isSelected, isDisabled, locale, onEdit, onRemove, localesStatusMap })=>{
|
|
64
63
|
const contentType = sdk.space.getCachedContentTypes().find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
65
|
-
const activeLocales = (0, _fieldeditorshared.useActiveLocales)(
|
|
64
|
+
const activeLocales = (0, _fieldeditorshared.useActiveLocales)(sdk);
|
|
66
65
|
return /*#__PURE__*/ _react.createElement(_fieldeditorreference.WrappedEntryCard, {
|
|
67
66
|
size: "default",
|
|
68
|
-
getAsset:
|
|
67
|
+
getAsset: sdk.space.getAsset,
|
|
69
68
|
getEntityScheduledActions: loadEntityScheduledActions,
|
|
70
|
-
isSelected:
|
|
71
|
-
isDisabled:
|
|
72
|
-
localeCode:
|
|
73
|
-
defaultLocaleCode:
|
|
69
|
+
isSelected: isSelected,
|
|
70
|
+
isDisabled: isDisabled,
|
|
71
|
+
localeCode: locale,
|
|
72
|
+
defaultLocaleCode: sdk.locales.default,
|
|
74
73
|
contentType: contentType,
|
|
75
74
|
entry: entry,
|
|
76
|
-
onEdit:
|
|
77
|
-
onRemove:
|
|
75
|
+
onEdit: onEdit,
|
|
76
|
+
onRemove: isDisabled ? undefined : onRemove,
|
|
78
77
|
isClickable: false,
|
|
79
78
|
useLocalizedEntityStatus: sdk.parameters.instance.useLocalizedEntityStatus,
|
|
80
|
-
localesStatusMap:
|
|
79
|
+
localesStatusMap: localesStatusMap,
|
|
81
80
|
activeLocales: activeLocales,
|
|
82
|
-
renderDragHandle: !
|
|
81
|
+
renderDragHandle: !isDisabled ? (dragHandleProps)=>/*#__PURE__*/ _react.createElement(_f36components.DragHandle, {
|
|
83
82
|
label: "drag embedded entry",
|
|
84
83
|
...dragHandleProps
|
|
85
84
|
}) : undefined,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
activeRelease: activeRelease,
|
|
85
|
+
releaseStatusMap: releaseStatusMap,
|
|
86
|
+
release: release,
|
|
89
87
|
releaseAction: releaseAction
|
|
90
88
|
});
|
|
91
89
|
}, _fastdeepequal.default);
|
|
92
90
|
InternalEntryCard.displayName = 'ReferenceCard';
|
|
93
91
|
const FetchingWrappedEntryCard = (props)=>{
|
|
94
92
|
const { entryId, onEntityFetchComplete } = props;
|
|
95
|
-
const { data: entry, status } = (0, _fieldeditorreference.useEntity)('Entry', entryId);
|
|
93
|
+
const { data: entry, status, currentEntity } = (0, _fieldeditorreference.useEntity)('Entry', entryId);
|
|
96
94
|
const { getEntityScheduledActions } = (0, _fieldeditorreference.useEntityLoader)();
|
|
97
95
|
const loadEntityScheduledActions = _react.useCallback(()=>getEntityScheduledActions('Entry', entryId), [
|
|
98
96
|
getEntityScheduledActions,
|
|
99
97
|
entryId
|
|
100
98
|
]);
|
|
101
99
|
const localesStatusMap = (0, _fieldeditorshared.useLocalePublishStatus)(entry, props.sdk.locales);
|
|
102
|
-
const {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
releaseVersionMap,
|
|
108
|
-
locales,
|
|
109
|
-
activeRelease,
|
|
110
|
-
releases
|
|
100
|
+
const { releaseStatusMap, releaseAction } = (0, _fieldeditorshared.useReleaseStatus)({
|
|
101
|
+
entity: entry,
|
|
102
|
+
previousEntityOnTimeline: currentEntity,
|
|
103
|
+
locales: props.sdk.locales,
|
|
104
|
+
release: props.sdk.release
|
|
111
105
|
});
|
|
112
|
-
const { releaseAction } = (0, _fieldeditorshared.getEntityReleaseStatus)(props.entryId, locales, activeRelease);
|
|
113
106
|
_react.useEffect(()=>{
|
|
114
107
|
if (status === 'success') {
|
|
115
108
|
onEntityFetchComplete?.();
|
|
@@ -140,9 +133,8 @@ const FetchingWrappedEntryCard = (props)=>{
|
|
|
140
133
|
onRemove: props.onRemove,
|
|
141
134
|
loadEntityScheduledActions: loadEntityScheduledActions,
|
|
142
135
|
localesStatusMap: localesStatusMap,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
activeRelease: activeRelease,
|
|
136
|
+
releaseStatusMap: releaseStatusMap,
|
|
137
|
+
release: props.sdk.release,
|
|
146
138
|
releaseAction: releaseAction
|
|
147
139
|
});
|
|
148
140
|
};
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
7
|
-
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
8
7
|
require("@testing-library/jest-dom/extend-expect");
|
|
9
8
|
const _react1 = require("@testing-library/react");
|
|
10
9
|
const _published_assetjson = /*#__PURE__*/ _interop_require_default(require("../__fixtures__/published_asset.json"));
|
|
@@ -70,17 +69,17 @@ beforeEach(()=>{
|
|
|
70
69
|
'en-US': 'English (United States)'
|
|
71
70
|
}
|
|
72
71
|
},
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
cma: {
|
|
73
|
+
asset: {
|
|
75
74
|
get: jest.fn().mockResolvedValue(_published_assetjson.default)
|
|
76
75
|
},
|
|
77
|
-
|
|
76
|
+
scheduledAction: {
|
|
78
77
|
getMany: jest.fn().mockResolvedValue({
|
|
79
78
|
items: [],
|
|
80
79
|
total: 0
|
|
81
80
|
})
|
|
82
81
|
}
|
|
83
|
-
}
|
|
82
|
+
},
|
|
84
83
|
space: {
|
|
85
84
|
getEntityScheduledActions: jest.fn().mockResolvedValue([])
|
|
86
85
|
},
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
7
|
-
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
8
7
|
require("@testing-library/jest-dom/extend-expect");
|
|
9
8
|
const _react1 = require("@testing-library/react");
|
|
10
9
|
const _published_content_typejson = /*#__PURE__*/ _interop_require_default(require("../__fixtures__/published_content_type.json"));
|
|
@@ -71,17 +70,17 @@ beforeEach(()=>{
|
|
|
71
70
|
'en-US': 'English (United States)'
|
|
72
71
|
}
|
|
73
72
|
},
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
cma: {
|
|
74
|
+
entry: {
|
|
76
75
|
get: jest.fn().mockResolvedValue(_published_entryjson.default)
|
|
77
76
|
},
|
|
78
|
-
|
|
77
|
+
scheduledAction: {
|
|
79
78
|
getMany: jest.fn().mockResolvedValue({
|
|
80
79
|
items: [],
|
|
81
80
|
total: 0
|
|
82
81
|
})
|
|
83
82
|
}
|
|
84
|
-
}
|
|
83
|
+
},
|
|
85
84
|
space: {
|
|
86
85
|
getEntityScheduledActions: jest.fn().mockResolvedValue([]),
|
|
87
86
|
getCachedContentTypes: jest.fn().mockReturnValue([
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
require("@testing-library/jest-dom/extend-expect");
|
|
7
7
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
8
|
-
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
9
8
|
const _react1 = require("@testing-library/react");
|
|
10
9
|
const _published_content_typejson = /*#__PURE__*/ _interop_require_default(require("../__fixtures__/published_content_type.json"));
|
|
11
10
|
const _published_entryjson = /*#__PURE__*/ _interop_require_default(require("../__fixtures__/published_entry.json"));
|
|
@@ -74,11 +73,11 @@ beforeEach(()=>{
|
|
|
74
73
|
'en-US': 'English (United States)'
|
|
75
74
|
}
|
|
76
75
|
},
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
cma: {
|
|
77
|
+
contentType: {
|
|
79
78
|
get: jest.fn().mockReturnValue(_published_content_typejson.default)
|
|
80
79
|
},
|
|
81
|
-
|
|
80
|
+
entry: {
|
|
82
81
|
get: jest.fn().mockImplementation(({ entryId })=>{
|
|
83
82
|
if (entryId === 'linked-entry-urn') {
|
|
84
83
|
return Promise.resolve(_published_entryjson.default);
|
|
@@ -86,7 +85,7 @@ beforeEach(()=>{
|
|
|
86
85
|
return Promise.reject(new Error());
|
|
87
86
|
})
|
|
88
87
|
},
|
|
89
|
-
|
|
88
|
+
locale: {
|
|
90
89
|
getMany: jest.fn().mockResolvedValue({
|
|
91
90
|
items: [
|
|
92
91
|
{
|
|
@@ -96,16 +95,16 @@ beforeEach(()=>{
|
|
|
96
95
|
]
|
|
97
96
|
})
|
|
98
97
|
},
|
|
99
|
-
|
|
98
|
+
scheduledAction: {
|
|
100
99
|
getMany: jest.fn().mockResolvedValue({
|
|
101
100
|
items: [],
|
|
102
101
|
total: 0
|
|
103
102
|
})
|
|
104
103
|
},
|
|
105
|
-
|
|
104
|
+
space: {
|
|
106
105
|
get: jest.fn().mockResolvedValue(_spacejson.default)
|
|
107
106
|
}
|
|
108
|
-
}
|
|
107
|
+
},
|
|
109
108
|
space: {
|
|
110
109
|
onEntityChanged: jest.fn()
|
|
111
110
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createFakeFieldAPI, createFakeLocalesAPI, createFakeSpaceAPI } from '@contentful/field-editor-test-utils';
|
|
2
2
|
import { assets, contentTypes, entries, locales as localesFixtures, spaces } from './fixtures';
|
|
3
3
|
const newLink = (linkType, id)=>({
|
|
4
4
|
sys: {
|
|
@@ -47,8 +47,8 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
47
47
|
const sdk = {
|
|
48
48
|
field,
|
|
49
49
|
locales,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
cma: {
|
|
51
|
+
entry: {
|
|
52
52
|
get: async ({ entryId })=>{
|
|
53
53
|
if (props?.fetchDelay) {
|
|
54
54
|
await delay(props.fetchDelay);
|
|
@@ -65,7 +65,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
65
65
|
return Promise.reject({});
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
asset: {
|
|
69
69
|
get: async ({ assetId })=>{
|
|
70
70
|
if (props?.fetchDelay) {
|
|
71
71
|
await delay(props.fetchDelay);
|
|
@@ -82,7 +82,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
82
82
|
return Promise.reject({});
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
space: {
|
|
86
86
|
get: async (params)=>{
|
|
87
87
|
if (params.spaceId === spaces.indifferent.sys.id) {
|
|
88
88
|
return spaces.indifferent;
|
|
@@ -90,7 +90,7 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
90
90
|
return Promise.reject({});
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
-
|
|
93
|
+
contentType: {
|
|
94
94
|
get: async ({ contentTypeId })=>{
|
|
95
95
|
if (contentTypeId === contentTypes.published.sys.id) {
|
|
96
96
|
return contentTypes.published;
|
|
@@ -98,10 +98,10 @@ export function newReferenceEditorFakeSdk(props) {
|
|
|
98
98
|
return Promise.reject({});
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
locale: {
|
|
102
102
|
getMany: async ()=>localesFixtures.list
|
|
103
103
|
}
|
|
104
|
-
}
|
|
104
|
+
},
|
|
105
105
|
space: {
|
|
106
106
|
...space,
|
|
107
107
|
getCachedContentTypes () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { InlineEntryCard,
|
|
2
|
+
import { InlineEntryCard, MenuItem, Text } from '@contentful/f36-components';
|
|
3
3
|
import { ClockIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
5
|
import { ScheduledIconWithTooltip, useEntity, useEntityLoader } from '@contentful/field-editor-reference';
|
|
@@ -51,9 +51,7 @@ function InternalFetchingWrappedInlineEntryCard({ entry, allContentTypes, locale
|
|
|
51
51
|
disabled: isDisabled,
|
|
52
52
|
testId: "delete"
|
|
53
53
|
}, "Remove")
|
|
54
|
-
]
|
|
55
|
-
key: i
|
|
56
|
-
}, item))
|
|
54
|
+
]
|
|
57
55
|
}, /*#__PURE__*/ React.createElement(ScheduledIconWithTooltip, {
|
|
58
56
|
getEntityScheduledActions: getEntityScheduledActions,
|
|
59
57
|
entityType: "Entry",
|
|
@@ -101,9 +99,7 @@ export function FetchingWrappedInlineEntryCard(props) {
|
|
|
101
99
|
onClick: props.onRemove,
|
|
102
100
|
testId: "delete"
|
|
103
101
|
}, "Remove")
|
|
104
|
-
]
|
|
105
|
-
key: i
|
|
106
|
-
}, item))
|
|
102
|
+
]
|
|
107
103
|
});
|
|
108
104
|
}
|
|
109
105
|
return /*#__PURE__*/ React.createElement(InternalFetchingWrappedInlineEntryCard, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { InlineEntryCard,
|
|
2
|
+
import { InlineEntryCard, MenuItem, Text } from '@contentful/f36-components';
|
|
3
3
|
import { useResource } from '@contentful/field-editor-reference';
|
|
4
4
|
import { entityHelpers } from '@contentful/field-editor-shared';
|
|
5
5
|
import { INLINES } from '@contentful/rich-text-types';
|
|
@@ -52,8 +52,6 @@ export function FetchingWrappedResourceInlineCard(props) {
|
|
|
52
52
|
disabled: props.isDisabled,
|
|
53
53
|
testId: "delete"
|
|
54
54
|
}, "Remove")
|
|
55
|
-
]
|
|
56
|
-
key: i
|
|
57
|
-
}, item))
|
|
55
|
+
]
|
|
58
56
|
}, /*#__PURE__*/ React.createElement(Text, null, title));
|
|
59
57
|
}
|
|
@@ -29,14 +29,14 @@ export const createMarkToolbarButton = ({ mark, title, icon })=>{
|
|
|
29
29
|
]);
|
|
30
30
|
if (!editor) return null;
|
|
31
31
|
if (!icon) {
|
|
32
|
-
return /*#__PURE__*/ React.createElement(Menu
|
|
32
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
33
33
|
onClick: handleClick,
|
|
34
34
|
disabled: isDisabled,
|
|
35
35
|
className: cx({
|
|
36
36
|
[styles.isActive]: isMarkActive(editor, mark)
|
|
37
37
|
}),
|
|
38
38
|
testId: `${mark}-toolbar-button`
|
|
39
|
-
}, title)
|
|
39
|
+
}, title);
|
|
40
40
|
}
|
|
41
41
|
return /*#__PURE__*/ React.createElement(ToolbarButton, {
|
|
42
42
|
title: title,
|
|
@@ -31,7 +31,7 @@ export function EmbeddedBlockToolbarIcon({ isDisabled, nodeType, onClose }) {
|
|
|
31
31
|
};
|
|
32
32
|
const type = getEntityTypeFromNodeType(nodeType);
|
|
33
33
|
const baseClass = `rich-text__${nodeType}`;
|
|
34
|
-
return /*#__PURE__*/ React.createElement(Menu
|
|
34
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
35
35
|
disabled: isDisabled,
|
|
36
36
|
className: `${baseClass}-list-item`,
|
|
37
37
|
onClick: handleClick,
|
|
@@ -43,7 +43,7 @@ export function EmbeddedBlockToolbarIcon({ isDisabled, nodeType, onClose }) {
|
|
|
43
43
|
as: type === 'Asset' ? ImageSquareIcon : EmbeddedBlockIcon,
|
|
44
44
|
className: `rich-text__embedded-entry-list-icon ${styles.icon}`,
|
|
45
45
|
color: tokens.gray900
|
|
46
|
-
}), /*#__PURE__*/ React.createElement("span", null, type, nodeType == BLOCKS.EMBEDDED_RESOURCE && /*#__PURE__*/ React.createElement(ResourceNewBadge, null))))
|
|
46
|
+
}), /*#__PURE__*/ React.createElement("span", null, type, nodeType == BLOCKS.EMBEDDED_RESOURCE && /*#__PURE__*/ React.createElement(ResourceNewBadge, null))));
|
|
47
47
|
}
|
|
48
48
|
function getEntityTypeFromNodeType(nodeType) {
|
|
49
49
|
const words = nodeType.toLowerCase().split('-');
|
|
@@ -36,7 +36,7 @@ export function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled }) {
|
|
|
36
36
|
}
|
|
37
37
|
moveToTheNextChar(editor);
|
|
38
38
|
}
|
|
39
|
-
return /*#__PURE__*/ React.createElement(Menu
|
|
39
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
40
40
|
disabled: isDisabled,
|
|
41
41
|
className: "rich-text__entry-link-block-button",
|
|
42
42
|
testId: `toolbar-toggle-${nodeType}`,
|
|
@@ -47,5 +47,5 @@ export function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled }) {
|
|
|
47
47
|
}, /*#__PURE__*/ React.createElement(EmbeddedLineIcon, {
|
|
48
48
|
color: tokens.gray900,
|
|
49
49
|
className: `rich-text__embedded-entry-list-icon ${styles.icon}`
|
|
50
|
-
}), /*#__PURE__*/ React.createElement("span", null, "Inline entry", nodeType == INLINES.EMBEDDED_RESOURCE && /*#__PURE__*/ React.createElement(ResourceNewBadge, null))))
|
|
50
|
+
}), /*#__PURE__*/ React.createElement("span", null, "Inline entry", nodeType == INLINES.EMBEDDED_RESOURCE && /*#__PURE__*/ React.createElement(ResourceNewBadge, null))));
|
|
51
51
|
}
|
|
@@ -1,56 +1,49 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AssetCard, DragHandle } from '@contentful/f36-components';
|
|
3
3
|
import { useEntity, useEntityLoader, MissingEntityCard, WrappedAssetCard } from '@contentful/field-editor-reference';
|
|
4
|
-
import { useLocalePublishStatus, useActiveLocales,
|
|
4
|
+
import { useLocalePublishStatus, useActiveLocales, useReleaseStatus } from '@contentful/field-editor-shared';
|
|
5
5
|
import areEqual from 'fast-deep-equal';
|
|
6
|
-
const InternalAssetCard = /*#__PURE__*/ React.memo((
|
|
7
|
-
const
|
|
8
|
-
const activeLocales = useActiveLocales(props.sdk);
|
|
6
|
+
const InternalAssetCard = /*#__PURE__*/ React.memo(({ asset, sdk, isDisabled, isSelected, locale, onEdit, onRemove, loadEntityScheduledActions, localesStatusMap, release, releaseStatusMap, releaseAction })=>{
|
|
7
|
+
const activeLocales = useActiveLocales(sdk);
|
|
9
8
|
return /*#__PURE__*/ React.createElement(WrappedAssetCard, {
|
|
10
|
-
getEntityScheduledActions:
|
|
9
|
+
getEntityScheduledActions: loadEntityScheduledActions,
|
|
11
10
|
size: "small",
|
|
12
|
-
isSelected:
|
|
13
|
-
isDisabled:
|
|
14
|
-
localeCode:
|
|
15
|
-
defaultLocaleCode:
|
|
16
|
-
asset:
|
|
17
|
-
onEdit:
|
|
18
|
-
onRemove:
|
|
11
|
+
isSelected: isSelected,
|
|
12
|
+
isDisabled: isDisabled,
|
|
13
|
+
localeCode: locale,
|
|
14
|
+
defaultLocaleCode: sdk.locales.default,
|
|
15
|
+
asset: asset,
|
|
16
|
+
onEdit: onEdit,
|
|
17
|
+
onRemove: isDisabled ? undefined : onRemove,
|
|
19
18
|
isClickable: false,
|
|
20
|
-
useLocalizedEntityStatus:
|
|
21
|
-
localesStatusMap:
|
|
19
|
+
useLocalizedEntityStatus: sdk.parameters.instance.useLocalizedEntityStatus,
|
|
20
|
+
localesStatusMap: localesStatusMap,
|
|
22
21
|
activeLocales: activeLocales,
|
|
23
|
-
renderDragHandle: !
|
|
22
|
+
renderDragHandle: !isDisabled ? (dragHandleProps)=>/*#__PURE__*/ React.createElement(DragHandle, {
|
|
24
23
|
label: "drag embedded asset",
|
|
25
24
|
...dragHandleProps
|
|
26
25
|
}) : undefined,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
activeRelease: activeRelease,
|
|
26
|
+
releaseStatusMap: releaseStatusMap,
|
|
27
|
+
release: release,
|
|
30
28
|
releaseAction: releaseAction
|
|
31
29
|
});
|
|
32
30
|
}, areEqual);
|
|
33
31
|
InternalAssetCard.displayName = 'InternalAssetCard';
|
|
34
32
|
export function FetchingWrappedAssetCard(props) {
|
|
35
33
|
const { onEntityFetchComplete } = props;
|
|
36
|
-
const { data: asset, status } = useEntity('Asset', props.assetId);
|
|
34
|
+
const { data: asset, status, currentEntity } = useEntity('Asset', props.assetId);
|
|
37
35
|
const { getEntityScheduledActions } = useEntityLoader();
|
|
38
36
|
const loadEntityScheduledActions = React.useCallback(()=>getEntityScheduledActions('Asset', props.assetId), [
|
|
39
37
|
getEntityScheduledActions,
|
|
40
38
|
props.assetId
|
|
41
39
|
]);
|
|
42
40
|
const localesStatusMap = useLocalePublishStatus(asset, props.sdk.locales);
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
releaseVersionMap,
|
|
49
|
-
locales,
|
|
50
|
-
activeRelease,
|
|
51
|
-
releases
|
|
41
|
+
const { releaseStatusMap, releaseAction } = useReleaseStatus({
|
|
42
|
+
entity: asset,
|
|
43
|
+
previousEntityOnTimeline: currentEntity,
|
|
44
|
+
locales: props.sdk.locales,
|
|
45
|
+
release: props.sdk.release
|
|
52
46
|
});
|
|
53
|
-
const { releaseAction } = getEntityReleaseStatus(props.assetId, locales, activeRelease);
|
|
54
47
|
React.useEffect(()=>{
|
|
55
48
|
if (status === 'success') {
|
|
56
49
|
onEntityFetchComplete?.();
|
|
@@ -82,9 +75,8 @@ export function FetchingWrappedAssetCard(props) {
|
|
|
82
75
|
onEdit: props.onEdit,
|
|
83
76
|
onRemove: props.onRemove,
|
|
84
77
|
localesStatusMap: localesStatusMap,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
activeRelease: activeRelease,
|
|
78
|
+
releaseStatusMap: releaseStatusMap,
|
|
79
|
+
release: props.sdk.release,
|
|
88
80
|
releaseAction: releaseAction
|
|
89
81
|
});
|
|
90
82
|
}
|
|
@@ -1,59 +1,52 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DragHandle, EntryCard } from '@contentful/f36-components';
|
|
3
3
|
import { useEntity, MissingEntityCard, WrappedEntryCard, useEntityLoader } from '@contentful/field-editor-reference';
|
|
4
|
-
import { useLocalePublishStatus, useActiveLocales,
|
|
4
|
+
import { useLocalePublishStatus, useActiveLocales, useReleaseStatus } from '@contentful/field-editor-shared';
|
|
5
5
|
import areEqual from 'fast-deep-equal';
|
|
6
|
-
const InternalEntryCard = /*#__PURE__*/ React.memo((
|
|
7
|
-
const { entry, sdk, loadEntityScheduledActions, releaseLocalesStatusMap, isActiveReleaseLoading, activeRelease, releaseAction } = props;
|
|
6
|
+
const InternalEntryCard = /*#__PURE__*/ React.memo(({ entry, sdk, loadEntityScheduledActions, releaseStatusMap, release, releaseAction, isSelected, isDisabled, locale, onEdit, onRemove, localesStatusMap })=>{
|
|
8
7
|
const contentType = sdk.space.getCachedContentTypes().find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
9
|
-
const activeLocales = useActiveLocales(
|
|
8
|
+
const activeLocales = useActiveLocales(sdk);
|
|
10
9
|
return /*#__PURE__*/ React.createElement(WrappedEntryCard, {
|
|
11
10
|
size: "default",
|
|
12
|
-
getAsset:
|
|
11
|
+
getAsset: sdk.space.getAsset,
|
|
13
12
|
getEntityScheduledActions: loadEntityScheduledActions,
|
|
14
|
-
isSelected:
|
|
15
|
-
isDisabled:
|
|
16
|
-
localeCode:
|
|
17
|
-
defaultLocaleCode:
|
|
13
|
+
isSelected: isSelected,
|
|
14
|
+
isDisabled: isDisabled,
|
|
15
|
+
localeCode: locale,
|
|
16
|
+
defaultLocaleCode: sdk.locales.default,
|
|
18
17
|
contentType: contentType,
|
|
19
18
|
entry: entry,
|
|
20
|
-
onEdit:
|
|
21
|
-
onRemove:
|
|
19
|
+
onEdit: onEdit,
|
|
20
|
+
onRemove: isDisabled ? undefined : onRemove,
|
|
22
21
|
isClickable: false,
|
|
23
22
|
useLocalizedEntityStatus: sdk.parameters.instance.useLocalizedEntityStatus,
|
|
24
|
-
localesStatusMap:
|
|
23
|
+
localesStatusMap: localesStatusMap,
|
|
25
24
|
activeLocales: activeLocales,
|
|
26
|
-
renderDragHandle: !
|
|
25
|
+
renderDragHandle: !isDisabled ? (dragHandleProps)=>/*#__PURE__*/ React.createElement(DragHandle, {
|
|
27
26
|
label: "drag embedded entry",
|
|
28
27
|
...dragHandleProps
|
|
29
28
|
}) : undefined,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
activeRelease: activeRelease,
|
|
29
|
+
releaseStatusMap: releaseStatusMap,
|
|
30
|
+
release: release,
|
|
33
31
|
releaseAction: releaseAction
|
|
34
32
|
});
|
|
35
33
|
}, areEqual);
|
|
36
34
|
InternalEntryCard.displayName = 'ReferenceCard';
|
|
37
35
|
export const FetchingWrappedEntryCard = (props)=>{
|
|
38
36
|
const { entryId, onEntityFetchComplete } = props;
|
|
39
|
-
const { data: entry, status } = useEntity('Entry', entryId);
|
|
37
|
+
const { data: entry, status, currentEntity } = useEntity('Entry', entryId);
|
|
40
38
|
const { getEntityScheduledActions } = useEntityLoader();
|
|
41
39
|
const loadEntityScheduledActions = React.useCallback(()=>getEntityScheduledActions('Entry', entryId), [
|
|
42
40
|
getEntityScheduledActions,
|
|
43
41
|
entryId
|
|
44
42
|
]);
|
|
45
43
|
const localesStatusMap = useLocalePublishStatus(entry, props.sdk.locales);
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
releaseVersionMap,
|
|
52
|
-
locales,
|
|
53
|
-
activeRelease,
|
|
54
|
-
releases
|
|
44
|
+
const { releaseStatusMap, releaseAction } = useReleaseStatus({
|
|
45
|
+
entity: entry,
|
|
46
|
+
previousEntityOnTimeline: currentEntity,
|
|
47
|
+
locales: props.sdk.locales,
|
|
48
|
+
release: props.sdk.release
|
|
55
49
|
});
|
|
56
|
-
const { releaseAction } = getEntityReleaseStatus(props.entryId, locales, activeRelease);
|
|
57
50
|
React.useEffect(()=>{
|
|
58
51
|
if (status === 'success') {
|
|
59
52
|
onEntityFetchComplete?.();
|
|
@@ -84,9 +77,8 @@ export const FetchingWrappedEntryCard = (props)=>{
|
|
|
84
77
|
onRemove: props.onRemove,
|
|
85
78
|
loadEntityScheduledActions: loadEntityScheduledActions,
|
|
86
79
|
localesStatusMap: localesStatusMap,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
activeRelease: activeRelease,
|
|
80
|
+
releaseStatusMap: releaseStatusMap,
|
|
81
|
+
release: props.sdk.release,
|
|
90
82
|
releaseAction: releaseAction
|
|
91
83
|
});
|
|
92
84
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EntityProvider } from '@contentful/field-editor-reference';
|
|
3
|
-
import { createFakeCMAAdapter } from '@contentful/field-editor-test-utils';
|
|
4
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
4
|
import { configure, fireEvent, render, waitFor } from '@testing-library/react';
|
|
6
5
|
import publishedAsset from '../__fixtures__/published_asset.json';
|
|
@@ -20,17 +19,17 @@ beforeEach(()=>{
|
|
|
20
19
|
'en-US': 'English (United States)'
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
cma: {
|
|
23
|
+
asset: {
|
|
25
24
|
get: jest.fn().mockResolvedValue(publishedAsset)
|
|
26
25
|
},
|
|
27
|
-
|
|
26
|
+
scheduledAction: {
|
|
28
27
|
getMany: jest.fn().mockResolvedValue({
|
|
29
28
|
items: [],
|
|
30
29
|
total: 0
|
|
31
30
|
})
|
|
32
31
|
}
|
|
33
|
-
}
|
|
32
|
+
},
|
|
34
33
|
space: {
|
|
35
34
|
getEntityScheduledActions: jest.fn().mockResolvedValue([])
|
|
36
35
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EntityProvider } from '@contentful/field-editor-reference';
|
|
3
|
-
import { createFakeCMAAdapter } from '@contentful/field-editor-test-utils';
|
|
4
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
4
|
import { configure, fireEvent, render, waitFor } from '@testing-library/react';
|
|
6
5
|
import publishedCT from '../__fixtures__/published_content_type.json';
|
|
@@ -21,17 +20,17 @@ beforeEach(()=>{
|
|
|
21
20
|
'en-US': 'English (United States)'
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
cma: {
|
|
24
|
+
entry: {
|
|
26
25
|
get: jest.fn().mockResolvedValue(publishedEntry)
|
|
27
26
|
},
|
|
28
|
-
|
|
27
|
+
scheduledAction: {
|
|
29
28
|
getMany: jest.fn().mockResolvedValue({
|
|
30
29
|
items: [],
|
|
31
30
|
total: 0
|
|
32
31
|
})
|
|
33
32
|
}
|
|
34
|
-
}
|
|
33
|
+
},
|
|
35
34
|
space: {
|
|
36
35
|
getEntityScheduledActions: jest.fn().mockResolvedValue([]),
|
|
37
36
|
getCachedContentTypes: jest.fn().mockReturnValue([
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@testing-library/jest-dom/extend-expect';
|
|
3
3
|
import { EntityProvider } from '@contentful/field-editor-reference';
|
|
4
|
-
import { createFakeCMAAdapter } from '@contentful/field-editor-test-utils';
|
|
5
4
|
import { configure, render, waitFor } from '@testing-library/react';
|
|
6
5
|
import publishedCT from '../__fixtures__/published_content_type.json';
|
|
7
6
|
import publishedEntry from '../__fixtures__/published_entry.json';
|
|
@@ -24,11 +23,11 @@ beforeEach(()=>{
|
|
|
24
23
|
'en-US': 'English (United States)'
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
cma: {
|
|
27
|
+
contentType: {
|
|
29
28
|
get: jest.fn().mockReturnValue(publishedCT)
|
|
30
29
|
},
|
|
31
|
-
|
|
30
|
+
entry: {
|
|
32
31
|
get: jest.fn().mockImplementation(({ entryId })=>{
|
|
33
32
|
if (entryId === 'linked-entry-urn') {
|
|
34
33
|
return Promise.resolve(publishedEntry);
|
|
@@ -36,7 +35,7 @@ beforeEach(()=>{
|
|
|
36
35
|
return Promise.reject(new Error());
|
|
37
36
|
})
|
|
38
37
|
},
|
|
39
|
-
|
|
38
|
+
locale: {
|
|
40
39
|
getMany: jest.fn().mockResolvedValue({
|
|
41
40
|
items: [
|
|
42
41
|
{
|
|
@@ -46,16 +45,16 @@ beforeEach(()=>{
|
|
|
46
45
|
]
|
|
47
46
|
})
|
|
48
47
|
},
|
|
49
|
-
|
|
48
|
+
scheduledAction: {
|
|
50
49
|
getMany: jest.fn().mockResolvedValue({
|
|
51
50
|
items: [],
|
|
52
51
|
total: 0
|
|
53
52
|
})
|
|
54
53
|
},
|
|
55
|
-
|
|
54
|
+
space: {
|
|
56
55
|
get: jest.fn().mockResolvedValue(space)
|
|
57
56
|
}
|
|
58
|
-
}
|
|
57
|
+
},
|
|
59
58
|
space: {
|
|
60
59
|
onEntityChanged: jest.fn()
|
|
61
60
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.1",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -35,18 +35,17 @@
|
|
|
35
35
|
"test": "jest --watch",
|
|
36
36
|
"test:ci": "jest --ci --passWithNoTests",
|
|
37
37
|
"tsc": "tsc -p ./ --noEmit",
|
|
38
|
-
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx"
|
|
39
|
-
"prepublishOnly": "yarn build"
|
|
38
|
+
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@contentful/app-sdk": "^4.
|
|
41
|
+
"@contentful/app-sdk": "^4.42.0",
|
|
43
42
|
"@contentful/contentful-slatejs-adapter": "^15.16.5",
|
|
44
43
|
"@contentful/f36-components": "^5.4.1",
|
|
45
44
|
"@contentful/f36-icons": "^5.4.1",
|
|
46
45
|
"@contentful/f36-tokens": "^5.1.0",
|
|
47
46
|
"@contentful/f36-utils": "^5.1.0",
|
|
48
|
-
"@contentful/field-editor-reference": "^6.
|
|
49
|
-
"@contentful/field-editor-shared": "^2.
|
|
47
|
+
"@contentful/field-editor-reference": "^6.13.1",
|
|
48
|
+
"@contentful/field-editor-shared": "^2.13.1",
|
|
50
49
|
"@contentful/rich-text-plain-text-renderer": "^17.0.0",
|
|
51
50
|
"@contentful/rich-text-types": "^17.0.0",
|
|
52
51
|
"@popperjs/core": "^2.11.5",
|
|
@@ -89,5 +88,5 @@
|
|
|
89
88
|
"publishConfig": {
|
|
90
89
|
"registry": "https://npm.pkg.github.com/"
|
|
91
90
|
},
|
|
92
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "5a7e41aa7b9bbd285221f164daa777fb48cbdb01"
|
|
93
92
|
}
|