@contentful/field-editor-reference 7.0.2-canary.9 → 7.0.3-canary.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.
@@ -140,7 +140,8 @@ function Editor(props) {
140
140
  onSortStart,
141
141
  onSortEnd,
142
142
  onMove,
143
- renderCustomCard: props.renderCustomCard && customCardRenderer
143
+ renderCustomCard: props.renderCustomCard && customCardRenderer,
144
+ items
144
145
  }), /*#__PURE__*/ _react.createElement(_components.LinkEntityActions, {
145
146
  renderCustomActions: props.renderCustomActions,
146
147
  ...linkActionsProps
@@ -63,8 +63,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
63
63
  }
64
64
  return newObj;
65
65
  }
66
+ const nullableValue = {
67
+ sys: {
68
+ type: 'ResourceLink',
69
+ urn: 'null-value'
70
+ }
71
+ };
66
72
  function ResourceEditor(props) {
67
- const { setValue, items } = props;
73
+ const { setValue } = props;
74
+ const items = _react.useMemo(()=>(props.items || []).map((link)=>link || nullableValue), [
75
+ props.items
76
+ ]);
68
77
  const onSortStart = ()=>(0, _noop.default)();
69
78
  const onSortEnd = (0, _react.useCallback)(({ oldIndex, newIndex })=>{
70
79
  const newItems = (0, _sortable.arrayMove)(items, oldIndex, newIndex);
@@ -90,7 +90,8 @@ function Editor(props) {
90
90
  onSortStart,
91
91
  onSortEnd,
92
92
  onMove,
93
- renderCustomCard: props.renderCustomCard && customCardRenderer
93
+ renderCustomCard: props.renderCustomCard && customCardRenderer,
94
+ items
94
95
  }), /*#__PURE__*/ React.createElement(LinkEntityActions, {
95
96
  renderCustomActions: props.renderCustomActions,
96
97
  ...linkActionsProps
@@ -8,8 +8,17 @@ import { SortableLinkList } from '../common/SortableLinkList';
8
8
  import { CombinedLinkEntityActions } from '../components/LinkActions/LinkEntityActions';
9
9
  import { ResourceCard } from './Cards/ResourceCard';
10
10
  import { useResourceLinkActions } from './useResourceLinkActions';
11
+ const nullableValue = {
12
+ sys: {
13
+ type: 'ResourceLink',
14
+ urn: 'null-value'
15
+ }
16
+ };
11
17
  function ResourceEditor(props) {
12
- const { setValue, items } = props;
18
+ const { setValue } = props;
19
+ const items = React.useMemo(()=>(props.items || []).map((link)=>link || nullableValue), [
20
+ props.items
21
+ ]);
13
22
  const onSortStart = ()=>noop();
14
23
  const onSortEnd = useCallback(({ oldIndex, newIndex })=>{
15
24
  const newItems = arrayMove(items, oldIndex, newIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "7.0.2-canary.9+78e1d2c5",
3
+ "version": "7.0.3-canary.1+660fa121",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@contentful/f36-components": "^6.7.1",
40
40
  "@contentful/f36-icons": "^6.7.1",
41
41
  "@contentful/f36-tokens": "^6.1.2",
42
- "@contentful/field-editor-shared": "^3.0.2-canary.9+78e1d2c5",
42
+ "@contentful/field-editor-shared": "^3.0.2",
43
43
  "@contentful/mimetype": "^2.2.29",
44
44
  "@dnd-kit/core": "^6.0.8",
45
45
  "@dnd-kit/sortable": "^8.0.0",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "registry": "https://npm.pkg.github.com/"
71
71
  },
72
- "gitHead": "78e1d2c5e559a6db26a47ce2ddb109a8eb985715"
72
+ "gitHead": "660fa1215eebdd5b31ec011bb8ece7cc89483e77"
73
73
  }