@contentful/field-editor-reference 5.5.3 → 5.6.0
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 +14 -0
- package/dist/field-editor-reference.cjs.development.js +20 -12
- package/dist/field-editor-reference.cjs.development.js.map +1 -1
- package/dist/field-editor-reference.cjs.production.min.js +1 -1
- package/dist/field-editor-reference.cjs.production.min.js.map +1 -1
- package/dist/field-editor-reference.esm.js +20 -12
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/resources/useResourceLinkActions.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.6.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.5.4...@contentful/field-editor-reference@5.6.0) (2023-01-02)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- solve multi ref drag issue [TOL-823] ([#1314](https://github.com/contentful/field-editors/issues/1314)) ([2d37f1c](https://github.com/contentful/field-editors/commit/2d37f1ca2b9a89710e7999278afcb492a069c8a8))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- lower search and update width entry ref [TOL-247] ([#1313](https://github.com/contentful/field-editors/issues/1313)) ([ed6edbc](https://github.com/contentful/field-editors/commit/ed6edbc2ddce352d6ac7a7f8aced2129c4c2e5b4))
|
|
15
|
+
|
|
16
|
+
## [5.5.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.5.3...@contentful/field-editor-reference@5.5.4) (2022-12-23)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @contentful/field-editor-reference
|
|
19
|
+
|
|
6
20
|
## [5.5.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.5.2...@contentful/field-editor-reference@5.5.3) (2022-12-08)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @contentful/field-editor-reference
|
|
@@ -8,9 +8,9 @@ var React = require('react');
|
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var emotion = require('emotion');
|
|
10
10
|
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
11
|
-
var get = _interopDefault(require('lodash/get'));
|
|
12
11
|
var f36Components = require('@contentful/f36-components');
|
|
13
12
|
var f36Icons = require('@contentful/f36-icons');
|
|
13
|
+
var get = _interopDefault(require('lodash/get'));
|
|
14
14
|
var moment = _interopDefault(require('moment'));
|
|
15
15
|
var fieldEditorShared = require('@contentful/field-editor-shared');
|
|
16
16
|
var deepEqual = _interopDefault(require('deep-equal'));
|
|
@@ -197,7 +197,7 @@ var action = /*#__PURE__*/emotion.css({
|
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
200
|
-
var MAX_ITEMS_WITHOUT_SEARCH =
|
|
200
|
+
var MAX_ITEMS_WITHOUT_SEARCH = 5;
|
|
201
201
|
var menuPlacementMap = {
|
|
202
202
|
'bottom-left': 'bottom-start',
|
|
203
203
|
'bottom-right': 'bottom-end'
|
|
@@ -403,7 +403,8 @@ var standardStyles = {
|
|
|
403
403
|
var redesignStyles = /*#__PURE__*/_extends({}, standardStyles, {
|
|
404
404
|
action: /*#__PURE__*/emotion.css({
|
|
405
405
|
textDecoration: 'none',
|
|
406
|
-
fontWeight: 'bold'
|
|
406
|
+
fontWeight: 'bold',
|
|
407
|
+
maxWidth: '300px'
|
|
407
408
|
})
|
|
408
409
|
});
|
|
409
410
|
|
|
@@ -3364,7 +3365,9 @@ var styles$3 = {
|
|
|
3364
3365
|
position: 'relative'
|
|
3365
3366
|
}),
|
|
3366
3367
|
item: /*#__PURE__*/emotion.css({
|
|
3367
|
-
marginBottom: tokens.spacingM
|
|
3368
|
+
marginBottom: tokens.spacingM,
|
|
3369
|
+
zIndex: tokens.zIndexModalContent // setting this to an index above 99 fixes dragged item disappearing issue
|
|
3370
|
+
|
|
3368
3371
|
})
|
|
3369
3372
|
};
|
|
3370
3373
|
|
|
@@ -4044,32 +4047,37 @@ function ResourceCard(props) {
|
|
|
4044
4047
|
})));
|
|
4045
4048
|
}
|
|
4046
4049
|
|
|
4047
|
-
var toLinkItem = function toLinkItem(entry) {
|
|
4050
|
+
var toLinkItem = function toLinkItem(entry, apiUrl) {
|
|
4051
|
+
var _entry$sys$urn;
|
|
4052
|
+
|
|
4048
4053
|
return {
|
|
4049
4054
|
sys: {
|
|
4050
4055
|
type: 'ResourceLink',
|
|
4051
4056
|
linkType: 'Contentful:Entry',
|
|
4052
|
-
urn: entry.sys.urn
|
|
4057
|
+
urn: (_entry$sys$urn = entry.sys.urn) != null ? _entry$sys$urn : "crn:" + apiUrl + ":::content:spaces/" + entry.sys.space.sys.id + "/entries/" + entry.sys.id
|
|
4053
4058
|
}
|
|
4054
4059
|
};
|
|
4055
4060
|
};
|
|
4056
4061
|
|
|
4057
|
-
var getUpdatedValue = function getUpdatedValue(field, entries) {
|
|
4062
|
+
var getUpdatedValue = function getUpdatedValue(field, entries, apiUrl) {
|
|
4058
4063
|
var multiple = field.type === 'Array';
|
|
4059
4064
|
|
|
4060
4065
|
if (multiple) {
|
|
4061
|
-
var linkItems = entries.map(
|
|
4066
|
+
var linkItems = entries.map(function (entry) {
|
|
4067
|
+
return toLinkItem(entry, apiUrl);
|
|
4068
|
+
});
|
|
4062
4069
|
var prevValue = field.getValue() || [];
|
|
4063
4070
|
return [].concat(prevValue, linkItems);
|
|
4064
4071
|
} else {
|
|
4065
|
-
return toLinkItem(entries[0]);
|
|
4072
|
+
return toLinkItem(entries[0], apiUrl);
|
|
4066
4073
|
}
|
|
4067
4074
|
};
|
|
4068
4075
|
|
|
4069
4076
|
function useResourceLinkActions(_ref) {
|
|
4070
4077
|
var dialogs = _ref.dialogs,
|
|
4071
4078
|
field = _ref.field,
|
|
4072
|
-
onAfterLink = _ref.onAfterLink
|
|
4079
|
+
onAfterLink = _ref.onAfterLink,
|
|
4080
|
+
apiUrl = _ref.apiUrl;
|
|
4073
4081
|
var handleAfterLink = React.useCallback(function (entries) {
|
|
4074
4082
|
if (!onAfterLink) {
|
|
4075
4083
|
return;
|
|
@@ -4079,11 +4087,11 @@ function useResourceLinkActions(_ref) {
|
|
|
4079
4087
|
}, [onAfterLink]);
|
|
4080
4088
|
var onLinkedExisting = React.useMemo(function () {
|
|
4081
4089
|
return function (entries) {
|
|
4082
|
-
var updatedValue = getUpdatedValue(field, entries);
|
|
4090
|
+
var updatedValue = getUpdatedValue(field, entries, apiUrl);
|
|
4083
4091
|
field.setValue(updatedValue);
|
|
4084
4092
|
handleAfterLink(entries);
|
|
4085
4093
|
};
|
|
4086
|
-
}, [field, handleAfterLink]);
|
|
4094
|
+
}, [field, handleAfterLink, apiUrl]);
|
|
4087
4095
|
var multiple = field.type === 'Array';
|
|
4088
4096
|
var onLinkExisting = React.useMemo(function () {
|
|
4089
4097
|
var promptSelection = multiple ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|