@contentful/field-editor-rich-text 3.20.1 → 3.20.2
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/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +7 -3
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +8 -7
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +8 -7
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +7 -3
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +8 -7
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +8 -7
- package/package.json +3 -3
|
@@ -76,11 +76,14 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
76
76
|
const allContentTypes = props.sdk.space.getCachedContentTypes();
|
|
77
77
|
const { onEntityFetchComplete } = props;
|
|
78
78
|
const contentType = _react.useMemo(()=>{
|
|
79
|
-
if (!entry || !allContentTypes)
|
|
79
|
+
if (requestStatus !== 'success' || !entry || !allContentTypes) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
80
82
|
return allContentTypes.find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
81
83
|
}, [
|
|
82
84
|
allContentTypes,
|
|
83
|
-
entry
|
|
85
|
+
entry,
|
|
86
|
+
requestStatus
|
|
84
87
|
]);
|
|
85
88
|
_react.useEffect(()=>{
|
|
86
89
|
if (requestStatus !== 'success') {
|
|
@@ -92,7 +95,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
92
95
|
onEntityFetchComplete
|
|
93
96
|
]);
|
|
94
97
|
const contentTypeName = contentType ? contentType.name : '';
|
|
95
|
-
const title = _react.useMemo(()=>getEntryTitle({
|
|
98
|
+
const title = _react.useMemo(()=>requestStatus === 'success' && getEntryTitle({
|
|
96
99
|
entry,
|
|
97
100
|
contentType,
|
|
98
101
|
localeCode: props.sdk.field.locale,
|
|
@@ -100,6 +103,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
100
103
|
defaultTitle: 'Untitled'
|
|
101
104
|
}), [
|
|
102
105
|
entry,
|
|
106
|
+
requestStatus,
|
|
103
107
|
contentType,
|
|
104
108
|
props.sdk.field.locale,
|
|
105
109
|
props.sdk.locales.default
|
|
@@ -59,19 +59,19 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
return newObj;
|
|
60
60
|
}
|
|
61
61
|
const InternalAssetCard = _react.memo((props)=>{
|
|
62
|
-
if (props.
|
|
63
|
-
return _react.createElement(_f36components.AssetCard, {
|
|
64
|
-
size: "default",
|
|
65
|
-
isLoading: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (props.asset === 'failed') {
|
|
62
|
+
if (props.status === 'error') {
|
|
69
63
|
return _react.createElement(_fieldeditorreference.MissingEntityCard, {
|
|
70
64
|
isDisabled: props.isDisabled,
|
|
71
65
|
onRemove: props.onRemove,
|
|
72
66
|
providerName: "Contentful"
|
|
73
67
|
});
|
|
74
68
|
}
|
|
69
|
+
if (!props.asset) {
|
|
70
|
+
return _react.createElement(_f36components.AssetCard, {
|
|
71
|
+
size: "default",
|
|
72
|
+
isLoading: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
75
|
return _react.createElement(_fieldeditorreference.WrappedAssetCard, {
|
|
76
76
|
getEntityScheduledActions: props.loadEntityScheduledActions,
|
|
77
77
|
size: "small",
|
|
@@ -104,6 +104,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
104
104
|
]);
|
|
105
105
|
return _react.createElement(InternalAssetCard, {
|
|
106
106
|
asset: asset,
|
|
107
|
+
status: status,
|
|
107
108
|
sdk: props.sdk,
|
|
108
109
|
isDisabled: props.isDisabled,
|
|
109
110
|
isSelected: props.isSelected,
|
|
@@ -59,19 +59,19 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
return newObj;
|
|
60
60
|
}
|
|
61
61
|
const InternalEntryCard = _react.memo((props)=>{
|
|
62
|
-
const { entry, sdk, loadEntityScheduledActions } = props;
|
|
63
|
-
if (
|
|
64
|
-
return _react.createElement(_f36components.EntryCard, {
|
|
65
|
-
isLoading: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (entry === 'failed') {
|
|
62
|
+
const { entry, sdk, loadEntityScheduledActions, status } = props;
|
|
63
|
+
if (status === 'error') {
|
|
69
64
|
return _react.createElement(_fieldeditorreference.MissingEntityCard, {
|
|
70
65
|
isDisabled: props.isDisabled,
|
|
71
66
|
onRemove: props.onRemove,
|
|
72
67
|
providerName: "Contentful"
|
|
73
68
|
});
|
|
74
69
|
}
|
|
70
|
+
if (entry === undefined) {
|
|
71
|
+
return _react.createElement(_f36components.EntryCard, {
|
|
72
|
+
isLoading: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
75
|
const contentType = sdk.space.getCachedContentTypes().find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
76
76
|
return _react.createElement(_fieldeditorreference.WrappedEntryCard, {
|
|
77
77
|
size: "default",
|
|
@@ -106,6 +106,7 @@ const FetchingWrappedEntryCard = (props)=>{
|
|
|
106
106
|
status
|
|
107
107
|
]);
|
|
108
108
|
return _react.createElement(InternalEntryCard, {
|
|
109
|
+
status: status,
|
|
109
110
|
entry: entry,
|
|
110
111
|
sdk: props.sdk,
|
|
111
112
|
locale: props.locale,
|
|
@@ -20,11 +20,14 @@ export function FetchingWrappedInlineEntryCard(props) {
|
|
|
20
20
|
const allContentTypes = props.sdk.space.getCachedContentTypes();
|
|
21
21
|
const { onEntityFetchComplete } = props;
|
|
22
22
|
const contentType = React.useMemo(()=>{
|
|
23
|
-
if (!entry || !allContentTypes)
|
|
23
|
+
if (requestStatus !== 'success' || !entry || !allContentTypes) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
24
26
|
return allContentTypes.find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
25
27
|
}, [
|
|
26
28
|
allContentTypes,
|
|
27
|
-
entry
|
|
29
|
+
entry,
|
|
30
|
+
requestStatus
|
|
28
31
|
]);
|
|
29
32
|
React.useEffect(()=>{
|
|
30
33
|
if (requestStatus !== 'success') {
|
|
@@ -36,7 +39,7 @@ export function FetchingWrappedInlineEntryCard(props) {
|
|
|
36
39
|
onEntityFetchComplete
|
|
37
40
|
]);
|
|
38
41
|
const contentTypeName = contentType ? contentType.name : '';
|
|
39
|
-
const title = React.useMemo(()=>getEntryTitle({
|
|
42
|
+
const title = React.useMemo(()=>requestStatus === 'success' && getEntryTitle({
|
|
40
43
|
entry,
|
|
41
44
|
contentType,
|
|
42
45
|
localeCode: props.sdk.field.locale,
|
|
@@ -44,6 +47,7 @@ export function FetchingWrappedInlineEntryCard(props) {
|
|
|
44
47
|
defaultTitle: 'Untitled'
|
|
45
48
|
}), [
|
|
46
49
|
entry,
|
|
50
|
+
requestStatus,
|
|
47
51
|
contentType,
|
|
48
52
|
props.sdk.field.locale,
|
|
49
53
|
props.sdk.locales.default
|
|
@@ -3,19 +3,19 @@ import { AssetCard } from '@contentful/f36-components';
|
|
|
3
3
|
import { useEntity, useEntityLoader, MissingEntityCard, WrappedAssetCard } from '@contentful/field-editor-reference';
|
|
4
4
|
import areEqual from 'fast-deep-equal';
|
|
5
5
|
const InternalAssetCard = React.memo((props)=>{
|
|
6
|
-
if (props.
|
|
7
|
-
return React.createElement(AssetCard, {
|
|
8
|
-
size: "default",
|
|
9
|
-
isLoading: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
if (props.asset === 'failed') {
|
|
6
|
+
if (props.status === 'error') {
|
|
13
7
|
return React.createElement(MissingEntityCard, {
|
|
14
8
|
isDisabled: props.isDisabled,
|
|
15
9
|
onRemove: props.onRemove,
|
|
16
10
|
providerName: "Contentful"
|
|
17
11
|
});
|
|
18
12
|
}
|
|
13
|
+
if (!props.asset) {
|
|
14
|
+
return React.createElement(AssetCard, {
|
|
15
|
+
size: "default",
|
|
16
|
+
isLoading: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
19
|
return React.createElement(WrappedAssetCard, {
|
|
20
20
|
getEntityScheduledActions: props.loadEntityScheduledActions,
|
|
21
21
|
size: "small",
|
|
@@ -48,6 +48,7 @@ export function FetchingWrappedAssetCard(props) {
|
|
|
48
48
|
]);
|
|
49
49
|
return React.createElement(InternalAssetCard, {
|
|
50
50
|
asset: asset,
|
|
51
|
+
status: status,
|
|
51
52
|
sdk: props.sdk,
|
|
52
53
|
isDisabled: props.isDisabled,
|
|
53
54
|
isSelected: props.isSelected,
|
|
@@ -3,19 +3,19 @@ import { EntryCard } from '@contentful/f36-components';
|
|
|
3
3
|
import { useEntity, MissingEntityCard, WrappedEntryCard, useEntityLoader } from '@contentful/field-editor-reference';
|
|
4
4
|
import areEqual from 'fast-deep-equal';
|
|
5
5
|
const InternalEntryCard = React.memo((props)=>{
|
|
6
|
-
const { entry, sdk, loadEntityScheduledActions } = props;
|
|
7
|
-
if (
|
|
8
|
-
return React.createElement(EntryCard, {
|
|
9
|
-
isLoading: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
if (entry === 'failed') {
|
|
6
|
+
const { entry, sdk, loadEntityScheduledActions, status } = props;
|
|
7
|
+
if (status === 'error') {
|
|
13
8
|
return React.createElement(MissingEntityCard, {
|
|
14
9
|
isDisabled: props.isDisabled,
|
|
15
10
|
onRemove: props.onRemove,
|
|
16
11
|
providerName: "Contentful"
|
|
17
12
|
});
|
|
18
13
|
}
|
|
14
|
+
if (entry === undefined) {
|
|
15
|
+
return React.createElement(EntryCard, {
|
|
16
|
+
isLoading: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
19
|
const contentType = sdk.space.getCachedContentTypes().find((contentType)=>contentType.sys.id === entry.sys.contentType.sys.id);
|
|
20
20
|
return React.createElement(WrappedEntryCard, {
|
|
21
21
|
size: "default",
|
|
@@ -50,6 +50,7 @@ export const FetchingWrappedEntryCard = (props)=>{
|
|
|
50
50
|
status
|
|
51
51
|
]);
|
|
52
52
|
return React.createElement(InternalEntryCard, {
|
|
53
|
+
status: status,
|
|
53
54
|
entry: entry,
|
|
54
55
|
sdk: props.sdk,
|
|
55
56
|
locale: props.locale,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.2",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@contentful/f36-icons": "^4.1.1",
|
|
45
45
|
"@contentful/f36-tokens": "^4.0.0",
|
|
46
46
|
"@contentful/f36-utils": "^4.19.0",
|
|
47
|
-
"@contentful/field-editor-reference": "^5.27.
|
|
47
|
+
"@contentful/field-editor-reference": "^5.27.2",
|
|
48
48
|
"@contentful/field-editor-shared": "^1.4.8",
|
|
49
49
|
"@contentful/rich-text-plain-text-renderer": "^16.0.4",
|
|
50
50
|
"@contentful/rich-text-types": "16.3.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"registry": "https://npm.pkg.github.com/"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "0d8d60dde84e039189af98d4e746d27588ed10ff"
|
|
90
90
|
}
|