@contentful/field-editor-reference 5.6.0 → 5.8.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.
@@ -1597,7 +1597,8 @@ function _selectMultipleEntities() {
1597
1597
  return _selectMultipleEntities.apply(this, arguments);
1598
1598
  }
1599
1599
 
1600
- var _excluded = ["renderCustomActions"];
1600
+ var _excluded = ["renderCustomActions"],
1601
+ _excluded2 = ["renderCustomActions"];
1601
1602
  function useLinkActionsProps(props) {
1602
1603
  var _editorPermissions$va;
1603
1604
 
@@ -1796,10 +1797,13 @@ function LinkEntityActions(_ref4) {
1796
1797
  var renderCustomActions = _ref4.renderCustomActions,
1797
1798
  props = _objectWithoutPropertiesLoose(_ref4, _excluded);
1798
1799
 
1799
- var renderLinkActions = renderCustomActions ? renderCustomActions : function (props) {
1800
- return createElement(LinkActions, _extends({}, props));
1801
- };
1802
- return renderLinkActions(props);
1800
+ return renderCustomActions ? renderCustomActions(props) : createElement(LinkActions, _extends({}, props));
1801
+ }
1802
+ function CombinedLinkEntityActions(_ref5) {
1803
+ var renderCustomActions = _ref5.renderCustomActions,
1804
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1805
+
1806
+ return renderCustomActions ? renderCustomActions(props) : createElement(CombinedLinkActions, _extends({}, props));
1803
1807
  }
1804
1808
 
1805
1809
  // eslint-disable-next-line -- TODO: describe this disable no-restricted-imports
@@ -1918,7 +1922,7 @@ function AssetThumbnail(props) {
1918
1922
  }
1919
1923
 
1920
1924
  var _excluded$1 = ["priority"],
1921
- _excluded2 = ["children"];
1925
+ _excluded2$1 = ["children"];
1922
1926
 
1923
1927
  var globalQueue = /*#__PURE__*/new PQueue({
1924
1928
  concurrency: 50
@@ -2368,7 +2372,7 @@ function useResource(resourceType, urn, options) {
2368
2372
 
2369
2373
  function EntityProvider(_ref9) {
2370
2374
  var children = _ref9.children,
2371
- props = _objectWithoutPropertiesLoose(_ref9, _excluded2);
2375
+ props = _objectWithoutPropertiesLoose(_ref9, _excluded2$1);
2372
2376
 
2373
2377
  var reactQueryClient = useMemo(function () {
2374
2378
  var queryCache = new QueryCache();
@@ -3599,6 +3603,15 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
3599
3603
  e.preventDefault();
3600
3604
  onEdit && onEdit();
3601
3605
  } : undefined,
3606
+
3607
+ /* todo - remove this when onKeyDown is allowed as a prop for BaseCard in forma 36
3608
+ // @ts-expect-error */
3609
+ onKeyDown: isClickable ? function (e) {
3610
+ if (e.key === 'Enter' && onEdit) {
3611
+ e.preventDefault();
3612
+ onEdit();
3613
+ }
3614
+ } : undefined,
3602
3615
  dragHandleRender: props.renderDragHandle,
3603
3616
  withDragHandle: !!props.renderDragHandle,
3604
3617
  actions: [].concat(renderActions({
@@ -3669,6 +3682,12 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
3669
3682
  e.preventDefault();
3670
3683
  onEdit();
3671
3684
  },
3685
+ onKeyDown: function onKeyDown(e) {
3686
+ if (e.key === 'Enter' && onEdit) {
3687
+ e.preventDefault();
3688
+ onEdit();
3689
+ }
3690
+ },
3672
3691
  dragHandleRender: props.renderDragHandle,
3673
3692
  withDragHandle: !!props.renderDragHandle,
3674
3693
  actions: [renderActions({
@@ -4231,7 +4250,9 @@ function ResourceEditor(props) {
4231
4250
  onSortEnd: onSortEnd,
4232
4251
  onMove: onMove,
4233
4252
  onRemoteItemAtIndex: onRemoteItemAtIndex
4234
- })), createElement(CombinedLinkActions, _extends({}, linkActionsProps)));
4253
+ })), createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4254
+ renderCustomActions: props.renderCustomActions
4255
+ })));
4235
4256
  } // provides memoized callbacks bound to a given item
4236
4257
 
4237
4258
 
@@ -4279,6 +4300,7 @@ function MultipleResourceReferenceEditor(props) {
4279
4300
  items: value || EMPTY_ARRAY,
4280
4301
  isDisabled: disabled,
4281
4302
  setValue: setValue,
4303
+ renderCustomActions: props.renderCustomActions,
4282
4304
  key: externalReset + "-list"
4283
4305
  }), function (editorProps) {
4284
4306
  return createElement(SortableLinkList, _extends({}, editorProps), function (_ref4) {
@@ -4337,8 +4359,9 @@ function SingleResourceReferenceEditor(props) {
4337
4359
  resourceLink: value,
4338
4360
  isDisabled: disabled,
4339
4361
  getEntryRouteHref: props.getEntryRouteHref
4340
- }) : // TODO: support custom actions once publicly available
4341
- createElement(CombinedLinkActions, _extends({}, linkActionsProps));
4362
+ }) : createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4363
+ renderCustomActions: props.renderCustomActions
4364
+ }));
4342
4365
  }));
4343
4366
  }
4344
4367