@contentful/field-editor-reference 4.2.1 → 4.3.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 +18 -0
- package/dist/common/ReferenceEditor.d.ts +2 -0
- package/dist/common/SingleReferenceEditor.d.ts +2 -0
- package/dist/entries/WrappedEntryCard/WrappedEntryCard.d.ts +5 -3
- package/dist/field-editor-reference.cjs.development.js +23 -11
- 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 +23 -11
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -2301,7 +2301,8 @@ function useEditorPermissions(props) {
|
|
|
2301
2301
|
|
|
2302
2302
|
function _checkLinkAccess() {
|
|
2303
2303
|
_checkLinkAccess = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2304
|
-
var canRead;
|
|
2304
|
+
var canRead, _canRead;
|
|
2305
|
+
|
|
2305
2306
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2306
2307
|
while (1) {
|
|
2307
2308
|
switch (_context2.prev = _context2.next) {
|
|
@@ -2330,7 +2331,10 @@ function useEditorPermissions(props) {
|
|
|
2330
2331
|
|
|
2331
2332
|
case 8:
|
|
2332
2333
|
if (entityType === 'Entry') {
|
|
2333
|
-
|
|
2334
|
+
// Hardcoded `true` value following https://contentful.atlassian.net/browse/DANTE-486
|
|
2335
|
+
// TODO: refine permissions check in order to account for tags in rules
|
|
2336
|
+
_canRead = readableContentTypes.length > 0 || true;
|
|
2337
|
+
setCanLinkEntity(_canRead);
|
|
2334
2338
|
}
|
|
2335
2339
|
|
|
2336
2340
|
case 9:
|
|
@@ -2417,7 +2421,8 @@ function SingleReferenceEditor(props) {
|
|
|
2417
2421
|
});
|
|
2418
2422
|
}
|
|
2419
2423
|
SingleReferenceEditor.defaultProps = {
|
|
2420
|
-
hasCardEditActions: true
|
|
2424
|
+
hasCardEditActions: true,
|
|
2425
|
+
hasCardRemoveActions: true
|
|
2421
2426
|
};
|
|
2422
2427
|
|
|
2423
2428
|
var getEntryTitle = entityHelpers.getEntryTitle,
|
|
@@ -2432,7 +2437,8 @@ var styles$1 = {
|
|
|
2432
2437
|
var defaultProps = {
|
|
2433
2438
|
isClickable: true,
|
|
2434
2439
|
hasCardEditActions: true,
|
|
2435
|
-
|
|
2440
|
+
hasCardMoveActions: true,
|
|
2441
|
+
hasCardRemoveActions: true
|
|
2436
2442
|
};
|
|
2437
2443
|
function WrappedEntryCard(props) {
|
|
2438
2444
|
var _props$entry;
|
|
@@ -2509,18 +2515,18 @@ function WrappedEntryCard(props) {
|
|
|
2509
2515
|
onClick: function onClick() {
|
|
2510
2516
|
props.onEdit && props.onEdit();
|
|
2511
2517
|
}
|
|
2512
|
-
}, "Edit") : null, props.onRemove ? createElement(MenuItem, {
|
|
2518
|
+
}, "Edit") : null, props.hasCardRemoveActions && props.onRemove ? createElement(MenuItem, {
|
|
2513
2519
|
key: "delete",
|
|
2514
2520
|
testId: "delete",
|
|
2515
2521
|
onClick: function onClick() {
|
|
2516
2522
|
props.onRemove && props.onRemove();
|
|
2517
2523
|
}
|
|
2518
|
-
}, "Remove") : null, props.
|
|
2524
|
+
}, "Remove") : null, props.hasCardMoveActions && (props.onMoveTop || props.onMoveBottom) ? createElement(MenuDivider, null) : null, props.hasCardMoveActions && props.onMoveTop ? createElement(MenuItem, {
|
|
2519
2525
|
onClick: function onClick() {
|
|
2520
2526
|
return props.onMoveTop && props.onMoveTop();
|
|
2521
2527
|
},
|
|
2522
2528
|
testId: "move-top"
|
|
2523
|
-
}, "Move to top") : null, props.
|
|
2529
|
+
}, "Move to top") : null, props.hasCardMoveActions && props.onMoveBottom ? createElement(MenuItem, {
|
|
2524
2530
|
onClick: function onClick() {
|
|
2525
2531
|
return props.onMoveBottom && props.onMoveBottom();
|
|
2526
2532
|
},
|
|
@@ -2615,7 +2621,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2615
2621
|
switch (_context.prev = _context.next) {
|
|
2616
2622
|
case 0:
|
|
2617
2623
|
_context.next = 2;
|
|
2618
|
-
return openEntry(props.sdk,
|
|
2624
|
+
return openEntry(props.sdk, props.entryId, {
|
|
2619
2625
|
bulkEditing: props.parameters.instance.bulkEditing,
|
|
2620
2626
|
index: props.index
|
|
2621
2627
|
});
|
|
@@ -2625,7 +2631,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2625
2631
|
props.onAction && props.onAction({
|
|
2626
2632
|
entity: 'Entry',
|
|
2627
2633
|
type: 'edit',
|
|
2628
|
-
id:
|
|
2634
|
+
id: props.entryId,
|
|
2629
2635
|
contentTypeId: get(entry, 'sys.contentType.sys.id'),
|
|
2630
2636
|
slide: slide
|
|
2631
2637
|
});
|
|
@@ -2648,7 +2654,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2648
2654
|
props.onAction && props.onAction({
|
|
2649
2655
|
entity: 'Entry',
|
|
2650
2656
|
type: 'delete',
|
|
2651
|
-
id:
|
|
2657
|
+
id: props.entryId,
|
|
2652
2658
|
contentTypeId: get(entry, 'sys.contentType.sys.id')
|
|
2653
2659
|
});
|
|
2654
2660
|
};
|
|
@@ -2706,11 +2712,15 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2706
2712
|
onMoveTop: props.onMoveTop,
|
|
2707
2713
|
onMoveBottom: props.onMoveBottom
|
|
2708
2714
|
};
|
|
2709
|
-
var hasCardEditActions = props.hasCardEditActions
|
|
2715
|
+
var hasCardEditActions = props.hasCardEditActions,
|
|
2716
|
+
hasCardMoveActions = props.hasCardMoveActions,
|
|
2717
|
+
hasCardRemoveActions = props.hasCardRemoveActions;
|
|
2710
2718
|
|
|
2711
2719
|
function renderDefaultCard(props) {
|
|
2712
2720
|
var builtinCardProps = _extends({}, sharedCardProps, props, {
|
|
2713
2721
|
hasCardEditActions: hasCardEditActions,
|
|
2722
|
+
hasCardMoveActions: hasCardMoveActions,
|
|
2723
|
+
hasCardRemoveActions: hasCardRemoveActions,
|
|
2714
2724
|
getAsset: getOrLoadAsset,
|
|
2715
2725
|
getEntityScheduledActions: loadEntityScheduledActions,
|
|
2716
2726
|
entry: (props == null ? void 0 : props.entity) || sharedCardProps.entity,
|
|
@@ -2742,6 +2752,7 @@ function SingleEntryReferenceEditor(props) {
|
|
|
2742
2752
|
entityId = _ref.entityId,
|
|
2743
2753
|
setValue = _ref.setValue,
|
|
2744
2754
|
renderCustomCard = _ref.renderCustomCard,
|
|
2755
|
+
hasCardRemoveActions = _ref.hasCardRemoveActions,
|
|
2745
2756
|
hasCardEditActions = _ref.hasCardEditActions;
|
|
2746
2757
|
return createElement(FetchingWrappedEntryCard, Object.assign({}, props, {
|
|
2747
2758
|
allContentTypes: allContentTypes,
|
|
@@ -2749,6 +2760,7 @@ function SingleEntryReferenceEditor(props) {
|
|
|
2749
2760
|
entryId: entityId,
|
|
2750
2761
|
renderCustomCard: renderCustomCard,
|
|
2751
2762
|
hasCardEditActions: hasCardEditActions,
|
|
2763
|
+
hasCardRemoveActions: hasCardRemoveActions,
|
|
2752
2764
|
onRemove: function onRemove() {
|
|
2753
2765
|
setValue(null);
|
|
2754
2766
|
}
|