@contentful/field-editor-shared 1.4.4 → 1.4.5
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/CharCounter.js +3 -1
- package/dist/cjs/CharValidation.js +4 -2
- package/dist/cjs/FieldConnector.js +4 -2
- package/dist/cjs/FieldConnector.test.js +3 -1
- package/dist/cjs/ModalDialogLauncher.js +8 -6
- package/dist/cjs/PredefinedValuesError.js +3 -1
- package/dist/cjs/index.js +32 -30
- package/dist/cjs/typesEntity.js +5 -5
- package/dist/cjs/utils/entityHelpers.js +23 -23
- package/dist/cjs/utils/shortenStorageUnit.js +4 -4
- package/dist/esm/CharValidation.js +1 -1
- package/dist/esm/FieldConnector.js +1 -1
- package/dist/esm/ModalDialogLauncher.js +2 -2
- package/dist/esm/utils/entityHelpers.js +7 -7
- package/dist/esm/utils/shortenStorageUnit.js +1 -1
- package/package.json +3 -3
package/dist/cjs/CharCounter.js
CHANGED
|
@@ -37,7 +37,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
37
37
|
if (cache && cache.has(obj)) {
|
|
38
38
|
return cache.get(obj);
|
|
39
39
|
}
|
|
40
|
-
var newObj = {
|
|
40
|
+
var newObj = {
|
|
41
|
+
__proto__: null
|
|
42
|
+
};
|
|
41
43
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
44
|
for(var key in obj){
|
|
43
45
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -30,7 +30,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
30
30
|
if (cache && cache.has(obj)) {
|
|
31
31
|
return cache.get(obj);
|
|
32
32
|
}
|
|
33
|
-
var newObj = {
|
|
33
|
+
var newObj = {
|
|
34
|
+
__proto__: null
|
|
35
|
+
};
|
|
34
36
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
35
37
|
for(var key in obj){
|
|
36
38
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -49,7 +51,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
49
51
|
return newObj;
|
|
50
52
|
}
|
|
51
53
|
function CharValidation(props) {
|
|
52
|
-
const { constraints
|
|
54
|
+
const { constraints } = props;
|
|
53
55
|
if (constraints.type === 'max') {
|
|
54
56
|
return _react.createElement("span", null, "Maximum ", constraints.max, " characters");
|
|
55
57
|
} else if (constraints.type === 'min') {
|
|
@@ -50,7 +50,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
50
|
if (cache && cache.has(obj)) {
|
|
51
51
|
return cache.get(obj);
|
|
52
52
|
}
|
|
53
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
54
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
57
|
for(var key in obj){
|
|
56
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -71,7 +73,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
71
73
|
var _React_Component;
|
|
72
74
|
class FieldConnector extends (_React_Component = _react.Component) {
|
|
73
75
|
componentDidMount() {
|
|
74
|
-
const { field
|
|
76
|
+
const { field } = this.props;
|
|
75
77
|
this.unsubscribeErrors = field.onSchemaErrorsChanged((errors)=>{
|
|
76
78
|
this.setState({
|
|
77
79
|
errors: errors || []
|
|
@@ -33,7 +33,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
33
33
|
if (cache && cache.has(obj)) {
|
|
34
34
|
return cache.get(obj);
|
|
35
35
|
}
|
|
36
|
-
var newObj = {
|
|
36
|
+
var newObj = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
};
|
|
37
39
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
40
|
for(var key in obj){
|
|
39
41
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,14 +9,14 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
12
15
|
open: function() {
|
|
13
16
|
return open;
|
|
14
17
|
},
|
|
15
18
|
openDialog: function() {
|
|
16
19
|
return openDialog;
|
|
17
|
-
},
|
|
18
|
-
default: function() {
|
|
19
|
-
return _default;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _react = _interop_require_wildcard(require("react"));
|
|
@@ -49,7 +49,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
49
49
|
if (cache && cache.has(obj)) {
|
|
50
50
|
return cache.get(obj);
|
|
51
51
|
}
|
|
52
|
-
var newObj = {
|
|
52
|
+
var newObj = {
|
|
53
|
+
__proto__: null
|
|
54
|
+
};
|
|
53
55
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
54
56
|
for(var key in obj){
|
|
55
57
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -82,7 +84,7 @@ function open(componentRenderer) {
|
|
|
82
84
|
onClose,
|
|
83
85
|
isShown: true
|
|
84
86
|
};
|
|
85
|
-
function render({ onClose
|
|
87
|
+
function render({ onClose, isShown }) {
|
|
86
88
|
_reactdom.default.render(componentRenderer({
|
|
87
89
|
onClose,
|
|
88
90
|
isShown
|
|
@@ -103,7 +105,7 @@ function open(componentRenderer) {
|
|
|
103
105
|
function openDialog(options, Component) {
|
|
104
106
|
const key = Date.now();
|
|
105
107
|
const size = (0, _isNumber.default)(options.width) ? `${options.width}px` : options.width;
|
|
106
|
-
return open(({ isShown
|
|
108
|
+
return open(({ isShown, onClose })=>{
|
|
107
109
|
const onCloseHandler = ()=>onClose();
|
|
108
110
|
return _react.createElement(_f36components.Modal, {
|
|
109
111
|
key: key,
|
|
@@ -31,7 +31,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
31
31
|
if (cache && cache.has(obj)) {
|
|
32
32
|
return cache.get(obj);
|
|
33
33
|
}
|
|
34
|
-
var newObj = {
|
|
34
|
+
var newObj = {
|
|
35
|
+
__proto__: null
|
|
36
|
+
};
|
|
35
37
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
38
|
for(var key in obj){
|
|
37
39
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,15 +15,30 @@ _export(exports, {
|
|
|
15
15
|
AppConfigAPI: function() {
|
|
16
16
|
return _appsdk.AppConfigAPI;
|
|
17
17
|
},
|
|
18
|
+
Asset: function() {
|
|
19
|
+
return _typesEntity.Asset;
|
|
20
|
+
},
|
|
18
21
|
BaseAppSDK: function() {
|
|
19
22
|
return _appsdk.BaseAppSDK;
|
|
20
23
|
},
|
|
24
|
+
CharCounter: function() {
|
|
25
|
+
return _CharCounter.CharCounter;
|
|
26
|
+
},
|
|
27
|
+
CharValidation: function() {
|
|
28
|
+
return _CharValidation.CharValidation;
|
|
29
|
+
},
|
|
30
|
+
ConstraintsUtils: function() {
|
|
31
|
+
return _constraints;
|
|
32
|
+
},
|
|
21
33
|
ContentType: function() {
|
|
22
34
|
return _appsdk.ContentType;
|
|
23
35
|
},
|
|
24
36
|
DialogsAPI: function() {
|
|
25
37
|
return _appsdk.DialogsAPI;
|
|
26
38
|
},
|
|
39
|
+
Entry: function() {
|
|
40
|
+
return _typesEntity.Entry;
|
|
41
|
+
},
|
|
27
42
|
EntryAPI: function() {
|
|
28
43
|
return _appsdk.EntryAPI;
|
|
29
44
|
},
|
|
@@ -36,6 +51,12 @@ _export(exports, {
|
|
|
36
51
|
FieldAppSDK: function() {
|
|
37
52
|
return _appsdk.FieldAppSDK;
|
|
38
53
|
},
|
|
54
|
+
FieldConnector: function() {
|
|
55
|
+
return _FieldConnector.FieldConnector;
|
|
56
|
+
},
|
|
57
|
+
File: function() {
|
|
58
|
+
return _typesEntity.File;
|
|
59
|
+
},
|
|
39
60
|
IdsAPI: function() {
|
|
40
61
|
return _appsdk.IdsAPI;
|
|
41
62
|
},
|
|
@@ -45,6 +66,9 @@ _export(exports, {
|
|
|
45
66
|
LocationAPI: function() {
|
|
46
67
|
return _appsdk.LocationAPI;
|
|
47
68
|
},
|
|
69
|
+
ModalDialogLauncher: function() {
|
|
70
|
+
return _ModalDialogLauncher;
|
|
71
|
+
},
|
|
48
72
|
NavigatorAPI: function() {
|
|
49
73
|
return _appsdk.NavigatorAPI;
|
|
50
74
|
},
|
|
@@ -57,32 +81,17 @@ _export(exports, {
|
|
|
57
81
|
ParametersAPI: function() {
|
|
58
82
|
return _appsdk.ParametersAPI;
|
|
59
83
|
},
|
|
84
|
+
PredefinedValuesError: function() {
|
|
85
|
+
return _PredefinedValuesError.PredefinedValuesError;
|
|
86
|
+
},
|
|
60
87
|
SpaceAPI: function() {
|
|
61
88
|
return _appsdk.SpaceAPI;
|
|
62
89
|
},
|
|
63
90
|
WindowAPI: function() {
|
|
64
91
|
return _appsdk.WindowAPI;
|
|
65
92
|
},
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
},
|
|
69
|
-
CharValidation: function() {
|
|
70
|
-
return _CharValidation.CharValidation;
|
|
71
|
-
},
|
|
72
|
-
FieldConnector: function() {
|
|
73
|
-
return _FieldConnector.FieldConnector;
|
|
74
|
-
},
|
|
75
|
-
PredefinedValuesError: function() {
|
|
76
|
-
return _PredefinedValuesError.PredefinedValuesError;
|
|
77
|
-
},
|
|
78
|
-
Asset: function() {
|
|
79
|
-
return _typesEntity.Asset;
|
|
80
|
-
},
|
|
81
|
-
Entry: function() {
|
|
82
|
-
return _typesEntity.Entry;
|
|
83
|
-
},
|
|
84
|
-
File: function() {
|
|
85
|
-
return _typesEntity.File;
|
|
93
|
+
entityHelpers: function() {
|
|
94
|
+
return _entityHelpers;
|
|
86
95
|
},
|
|
87
96
|
isValidImage: function() {
|
|
88
97
|
return _isValidImage.isValidImage;
|
|
@@ -92,15 +101,6 @@ _export(exports, {
|
|
|
92
101
|
},
|
|
93
102
|
toLocaleString: function() {
|
|
94
103
|
return _shortenStorageUnit.toLocaleString;
|
|
95
|
-
},
|
|
96
|
-
ModalDialogLauncher: function() {
|
|
97
|
-
return _ModalDialogLauncher;
|
|
98
|
-
},
|
|
99
|
-
entityHelpers: function() {
|
|
100
|
-
return _entityHelpers;
|
|
101
|
-
},
|
|
102
|
-
ConstraintsUtils: function() {
|
|
103
|
-
return _constraints;
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
const _appsdk = require("@contentful/app-sdk");
|
|
@@ -135,7 +135,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
135
135
|
if (cache && cache.has(obj)) {
|
|
136
136
|
return cache.get(obj);
|
|
137
137
|
}
|
|
138
|
-
var newObj = {
|
|
138
|
+
var newObj = {
|
|
139
|
+
__proto__: null
|
|
140
|
+
};
|
|
139
141
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
140
142
|
for(var key in obj){
|
|
141
143
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
package/dist/cjs/typesEntity.js
CHANGED
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
Asset: function() {
|
|
13
|
+
return _appsdk.Asset;
|
|
14
|
+
},
|
|
12
15
|
BaseAppSDK: function() {
|
|
13
16
|
return _appsdk.BaseAppSDK;
|
|
14
17
|
},
|
|
@@ -18,14 +21,11 @@ _export(exports, {
|
|
|
18
21
|
ContentTypeField: function() {
|
|
19
22
|
return _appsdk.ContentTypeField;
|
|
20
23
|
},
|
|
21
|
-
Link: function() {
|
|
22
|
-
return _appsdk.Link;
|
|
23
|
-
},
|
|
24
24
|
Entry: function() {
|
|
25
25
|
return _appsdk.Entry;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return _appsdk.
|
|
27
|
+
Link: function() {
|
|
28
|
+
return _appsdk.Link;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _appsdk = require("@contentful/app-sdk");
|
|
@@ -9,32 +9,32 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getFieldValue: function() {
|
|
13
|
-
return getFieldValue;
|
|
14
|
-
},
|
|
15
12
|
getAssetTitle: function() {
|
|
16
13
|
return getAssetTitle;
|
|
17
14
|
},
|
|
18
|
-
isAssetField: function() {
|
|
19
|
-
return isAssetField;
|
|
20
|
-
},
|
|
21
|
-
isDisplayField: function() {
|
|
22
|
-
return isDisplayField;
|
|
23
|
-
},
|
|
24
|
-
isDescriptionField: function() {
|
|
25
|
-
return isDescriptionField;
|
|
26
|
-
},
|
|
27
15
|
getEntityDescription: function() {
|
|
28
16
|
return getEntityDescription;
|
|
29
17
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
18
|
+
getEntryImage: function() {
|
|
19
|
+
return getEntryImage;
|
|
32
20
|
},
|
|
33
21
|
getEntryStatus: function() {
|
|
34
22
|
return getEntryStatus;
|
|
35
23
|
},
|
|
36
|
-
|
|
37
|
-
return
|
|
24
|
+
getEntryTitle: function() {
|
|
25
|
+
return getEntryTitle;
|
|
26
|
+
},
|
|
27
|
+
getFieldValue: function() {
|
|
28
|
+
return getFieldValue;
|
|
29
|
+
},
|
|
30
|
+
isAssetField: function() {
|
|
31
|
+
return isAssetField;
|
|
32
|
+
},
|
|
33
|
+
isDescriptionField: function() {
|
|
34
|
+
return isDescriptionField;
|
|
35
|
+
},
|
|
36
|
+
isDisplayField: function() {
|
|
37
|
+
return isDisplayField;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const _get = _interop_require_default(require("lodash/get"));
|
|
@@ -57,7 +57,7 @@ function titleOrDefault(title, defaultTitle) {
|
|
|
57
57
|
}
|
|
58
58
|
return defaultTitle;
|
|
59
59
|
}
|
|
60
|
-
function getFieldValue({ entity
|
|
60
|
+
function getFieldValue({ entity, fieldId, localeCode, defaultLocaleCode }) {
|
|
61
61
|
const values = (0, _get.default)(entity, [
|
|
62
62
|
'fields',
|
|
63
63
|
fieldId
|
|
@@ -68,7 +68,7 @@ function getFieldValue({ entity , fieldId , localeCode , defaultLocaleCode }) {
|
|
|
68
68
|
const firstLocaleCode = Object.keys(values)[0];
|
|
69
69
|
return values[localeCode] || values[defaultLocaleCode] || values[firstLocaleCode];
|
|
70
70
|
}
|
|
71
|
-
function getAssetTitle({ asset
|
|
71
|
+
function getAssetTitle({ asset, localeCode, defaultLocaleCode, defaultTitle }) {
|
|
72
72
|
const title = getFieldValue({
|
|
73
73
|
entity: {
|
|
74
74
|
fields: {
|
|
@@ -82,10 +82,10 @@ function getAssetTitle({ asset , localeCode , defaultLocaleCode , defaultTitle
|
|
|
82
82
|
return titleOrDefault(title, defaultTitle);
|
|
83
83
|
}
|
|
84
84
|
const isAssetField = (field)=>field.type === 'Link' && field.linkType === 'Asset';
|
|
85
|
-
function isDisplayField({ field
|
|
85
|
+
function isDisplayField({ field, contentType }) {
|
|
86
86
|
return field.id === contentType.displayField;
|
|
87
87
|
}
|
|
88
|
-
function isDescriptionField({ field
|
|
88
|
+
function isDescriptionField({ field, contentType }) {
|
|
89
89
|
const isTextField = (field)=>[
|
|
90
90
|
'Symbol',
|
|
91
91
|
'Text'
|
|
@@ -96,7 +96,7 @@ function isDescriptionField({ field , contentType }) {
|
|
|
96
96
|
contentType
|
|
97
97
|
}) && !isMaybeSlugField(field);
|
|
98
98
|
}
|
|
99
|
-
function getEntityDescription({ entity
|
|
99
|
+
function getEntityDescription({ entity, contentType, localeCode, defaultLocaleCode }) {
|
|
100
100
|
if (!contentType) {
|
|
101
101
|
return '';
|
|
102
102
|
}
|
|
@@ -114,7 +114,7 @@ function getEntityDescription({ entity , contentType , localeCode , defaultLocal
|
|
|
114
114
|
defaultLocaleCode
|
|
115
115
|
}) || '';
|
|
116
116
|
}
|
|
117
|
-
function getEntryTitle({ entry
|
|
117
|
+
function getEntryTitle({ entry, contentType, localeCode, defaultLocaleCode, defaultTitle }) {
|
|
118
118
|
let title;
|
|
119
119
|
if (!contentType) {
|
|
120
120
|
return defaultTitle;
|
|
@@ -178,7 +178,7 @@ function getEntryStatus(sys) {
|
|
|
178
178
|
return 'draft';
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
const getEntryImage = async ({ entry
|
|
181
|
+
const getEntryImage = async ({ entry, contentType, localeCode }, getAsset)=>{
|
|
182
182
|
if (!contentType) {
|
|
183
183
|
return null;
|
|
184
184
|
}
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
toLocaleString: function() {
|
|
13
|
-
return toLocaleString;
|
|
14
|
-
},
|
|
15
12
|
shortenStorageUnit: function() {
|
|
16
13
|
return shortenStorageUnit;
|
|
14
|
+
},
|
|
15
|
+
toLocaleString: function() {
|
|
16
|
+
return toLocaleString;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function toLocaleString(number) {
|
|
@@ -50,6 +50,6 @@ function shortenStorageUnit(value, uom) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
const { number
|
|
53
|
+
const { number, unit } = reduce(value, uom);
|
|
54
54
|
return `${formatFloat(number, false)} ${unit}`;
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export function CharValidation(props) {
|
|
3
|
-
const { constraints
|
|
3
|
+
const { constraints } = props;
|
|
4
4
|
if (constraints.type === 'max') {
|
|
5
5
|
return React.createElement("span", null, "Maximum ", constraints.max, " characters");
|
|
6
6
|
} else if (constraints.type === 'min') {
|
|
@@ -17,7 +17,7 @@ import isEqual from 'lodash/isEqual';
|
|
|
17
17
|
var _React_Component;
|
|
18
18
|
export class FieldConnector extends (_React_Component = React.Component) {
|
|
19
19
|
componentDidMount() {
|
|
20
|
-
const { field
|
|
20
|
+
const { field } = this.props;
|
|
21
21
|
this.unsubscribeErrors = field.onSchemaErrorsChanged((errors)=>{
|
|
22
22
|
this.setState({
|
|
23
23
|
errors: errors || []
|
|
@@ -17,7 +17,7 @@ export function open(componentRenderer) {
|
|
|
17
17
|
onClose,
|
|
18
18
|
isShown: true
|
|
19
19
|
};
|
|
20
|
-
function render({ onClose
|
|
20
|
+
function render({ onClose, isShown }) {
|
|
21
21
|
ReactDOM.render(componentRenderer({
|
|
22
22
|
onClose,
|
|
23
23
|
isShown
|
|
@@ -38,7 +38,7 @@ export function open(componentRenderer) {
|
|
|
38
38
|
export function openDialog(options, Component) {
|
|
39
39
|
const key = Date.now();
|
|
40
40
|
const size = isNumber(options.width) ? `${options.width}px` : options.width;
|
|
41
|
-
return open(({ isShown
|
|
41
|
+
return open(({ isShown, onClose })=>{
|
|
42
42
|
const onCloseHandler = ()=>onClose();
|
|
43
43
|
return React.createElement(Modal, {
|
|
44
44
|
key: key,
|
|
@@ -13,7 +13,7 @@ function titleOrDefault(title, defaultTitle) {
|
|
|
13
13
|
}
|
|
14
14
|
return defaultTitle;
|
|
15
15
|
}
|
|
16
|
-
export function getFieldValue({ entity
|
|
16
|
+
export function getFieldValue({ entity, fieldId, localeCode, defaultLocaleCode }) {
|
|
17
17
|
const values = get(entity, [
|
|
18
18
|
'fields',
|
|
19
19
|
fieldId
|
|
@@ -24,7 +24,7 @@ export function getFieldValue({ entity , fieldId , localeCode , defaultLocaleCod
|
|
|
24
24
|
const firstLocaleCode = Object.keys(values)[0];
|
|
25
25
|
return values[localeCode] || values[defaultLocaleCode] || values[firstLocaleCode];
|
|
26
26
|
}
|
|
27
|
-
export function getAssetTitle({ asset
|
|
27
|
+
export function getAssetTitle({ asset, localeCode, defaultLocaleCode, defaultTitle }) {
|
|
28
28
|
const title = getFieldValue({
|
|
29
29
|
entity: {
|
|
30
30
|
fields: {
|
|
@@ -38,10 +38,10 @@ export function getAssetTitle({ asset , localeCode , defaultLocaleCode , default
|
|
|
38
38
|
return titleOrDefault(title, defaultTitle);
|
|
39
39
|
}
|
|
40
40
|
export const isAssetField = (field)=>field.type === 'Link' && field.linkType === 'Asset';
|
|
41
|
-
export function isDisplayField({ field
|
|
41
|
+
export function isDisplayField({ field, contentType }) {
|
|
42
42
|
return field.id === contentType.displayField;
|
|
43
43
|
}
|
|
44
|
-
export function isDescriptionField({ field
|
|
44
|
+
export function isDescriptionField({ field, contentType }) {
|
|
45
45
|
const isTextField = (field)=>[
|
|
46
46
|
'Symbol',
|
|
47
47
|
'Text'
|
|
@@ -52,7 +52,7 @@ export function isDescriptionField({ field , contentType }) {
|
|
|
52
52
|
contentType
|
|
53
53
|
}) && !isMaybeSlugField(field);
|
|
54
54
|
}
|
|
55
|
-
export function getEntityDescription({ entity
|
|
55
|
+
export function getEntityDescription({ entity, contentType, localeCode, defaultLocaleCode }) {
|
|
56
56
|
if (!contentType) {
|
|
57
57
|
return '';
|
|
58
58
|
}
|
|
@@ -70,7 +70,7 @@ export function getEntityDescription({ entity , contentType , localeCode , defau
|
|
|
70
70
|
defaultLocaleCode
|
|
71
71
|
}) || '';
|
|
72
72
|
}
|
|
73
|
-
export function getEntryTitle({ entry
|
|
73
|
+
export function getEntryTitle({ entry, contentType, localeCode, defaultLocaleCode, defaultTitle }) {
|
|
74
74
|
let title;
|
|
75
75
|
if (!contentType) {
|
|
76
76
|
return defaultTitle;
|
|
@@ -134,7 +134,7 @@ export function getEntryStatus(sys) {
|
|
|
134
134
|
return 'draft';
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
export const getEntryImage = async ({ entry
|
|
137
|
+
export const getEntryImage = async ({ entry, contentType, localeCode }, getAsset)=>{
|
|
138
138
|
if (!contentType) {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@contentful/app-sdk": "^4.17.1",
|
|
39
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
39
|
+
"@contentful/field-editor-test-utils": "^1.4.6"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@contentful/f36-note": "^4.2.8",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"registry": "https://npm.pkg.github.com/"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "142d2039f023bf4ced956aae1dd08b27c35fdbaa"
|
|
55
55
|
}
|