@contentful/field-editor-reference 4.1.2 → 4.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ ## [4.2.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.2.1...@contentful/field-editor-reference@4.2.2) (2022-03-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - pass already known entry link id to onAction ([#1089](https://github.com/contentful/field-editors/issues/1089)) ([5b30d2f](https://github.com/contentful/field-editors/commit/5b30d2fade2edce5c99956108167aa5732b9bfbb))
11
+
12
+ ## [4.2.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.2.0...@contentful/field-editor-reference@4.2.1) (2022-03-29)
13
+
14
+ ### Bug Fixes
15
+
16
+ - allow linking assets on permission rule with tags ([#1085](https://github.com/contentful/field-editors/issues/1085)) ([d7465d0](https://github.com/contentful/field-editors/commit/d7465d05ecc2674c3e10c927c6f2f414adb5df04))
17
+
18
+ # [4.2.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.1.2...@contentful/field-editor-reference@4.2.0) (2022-03-02)
19
+
20
+ ### Features
21
+
22
+ - support onclick on wrappedentrycard components ([#1053](https://github.com/contentful/field-editors/issues/1053)) ([2480c9c](https://github.com/contentful/field-editors/commit/2480c9cbf1609b9ee2da73a951355a6972fdd859))
23
+
6
24
  ## [4.1.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.1.1...@contentful/field-editor-reference@4.1.2) (2022-02-15)
7
25
 
8
26
  ### Bug Fixes
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { SpaceAPI } from '@contentful/app-sdk';
3
3
  import { ContentType, Entry, RenderDragFn } from '../../types';
4
4
  export interface WrappedEntryCardProps {
@@ -10,6 +10,7 @@ export interface WrappedEntryCardProps {
10
10
  isSelected?: boolean;
11
11
  onRemove?: () => void;
12
12
  onEdit?: () => void;
13
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void;
13
14
  localeCode: string;
14
15
  defaultLocaleCode: string;
15
16
  contentType?: ContentType;
@@ -2314,7 +2314,7 @@ function useEditorPermissions(props) {
2314
2314
  switch (_context2.prev = _context2.next) {
2315
2315
  case 0:
2316
2316
  if (!(entityType === 'Asset')) {
2317
- _context2.next = 5;
2317
+ _context2.next = 8;
2318
2318
  break;
2319
2319
  }
2320
2320
 
@@ -2322,15 +2322,25 @@ function useEditorPermissions(props) {
2322
2322
  return canPerformAction('read', 'Asset');
2323
2323
 
2324
2324
  case 3:
2325
- canRead = _context2.sent;
2325
+ _context2.t0 = _context2.sent;
2326
+
2327
+ if (_context2.t0) {
2328
+ _context2.next = 6;
2329
+ break;
2330
+ }
2331
+
2332
+ _context2.t0 = true;
2333
+
2334
+ case 6:
2335
+ canRead = _context2.t0;
2326
2336
  setCanLinkEntity(canRead);
2327
2337
 
2328
- case 5:
2338
+ case 8:
2329
2339
  if (entityType === 'Entry') {
2330
2340
  setCanLinkEntity(readableContentTypes.length > 0);
2331
2341
  }
2332
2342
 
2333
- case 6:
2343
+ case 9:
2334
2344
  case "end":
2335
2345
  return _context2.stop();
2336
2346
  }
@@ -2528,6 +2538,7 @@ function WrappedEntryCard(props) {
2528
2538
  onClick: function onClick(e) {
2529
2539
  e.preventDefault();
2530
2540
  if (!props.isClickable) return;
2541
+ if (props.onClick) return props.onClick(e);
2531
2542
  props.onEdit && props.onEdit();
2532
2543
  }
2533
2544
  });
@@ -2611,7 +2622,7 @@ function FetchingWrappedEntryCard(props) {
2611
2622
  switch (_context.prev = _context.next) {
2612
2623
  case 0:
2613
2624
  _context.next = 2;
2614
- return openEntry(props.sdk, get(entry, 'sys.id'), {
2625
+ return openEntry(props.sdk, props.entryId, {
2615
2626
  bulkEditing: props.parameters.instance.bulkEditing,
2616
2627
  index: props.index
2617
2628
  });
@@ -2621,7 +2632,7 @@ function FetchingWrappedEntryCard(props) {
2621
2632
  props.onAction && props.onAction({
2622
2633
  entity: 'Entry',
2623
2634
  type: 'edit',
2624
- id: get(entry, 'sys.id'),
2635
+ id: props.entryId,
2625
2636
  contentTypeId: get(entry, 'sys.contentType.sys.id'),
2626
2637
  slide: slide
2627
2638
  });
@@ -2644,7 +2655,7 @@ function FetchingWrappedEntryCard(props) {
2644
2655
  props.onAction && props.onAction({
2645
2656
  entity: 'Entry',
2646
2657
  type: 'delete',
2647
- id: get(entry, 'sys.id'),
2658
+ id: props.entryId,
2648
2659
  contentTypeId: get(entry, 'sys.contentType.sys.id')
2649
2660
  });
2650
2661
  };