@contentful/field-editor-reference 4.0.1 → 4.0.5
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 +24 -0
- package/dist/field-editor-reference.cjs.development.js +17 -2
- 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 +17 -2
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/package.json +7 -7
|
@@ -328,6 +328,9 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
|
328
328
|
dropdownSettings = _ref.dropdownSettings,
|
|
329
329
|
_ref$disabled = _ref.disabled,
|
|
330
330
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
331
|
+
contentTypes = contentTypes.sort(function (a, b) {
|
|
332
|
+
return a.name.localeCompare(b.name);
|
|
333
|
+
});
|
|
331
334
|
var suggestedContentType = contentTypes.find(function (ct) {
|
|
332
335
|
return ct.sys.id === suggestedContentTypeId;
|
|
333
336
|
});
|
|
@@ -509,6 +512,10 @@ function CombinedEntryLinkActions(props) {
|
|
|
509
512
|
}
|
|
510
513
|
|
|
511
514
|
function CombinedAssetLinkActions(props) {
|
|
515
|
+
var _React$useState = useState(false),
|
|
516
|
+
isOpen = _React$useState[0],
|
|
517
|
+
setOpen = _React$useState[1];
|
|
518
|
+
|
|
512
519
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
513
520
|
if (props.canLinkEntity) {
|
|
514
521
|
return createElement(Button, {
|
|
@@ -543,7 +550,15 @@ function CombinedAssetLinkActions(props) {
|
|
|
543
550
|
// that works without content types to cover asset use-case.
|
|
544
551
|
|
|
545
552
|
|
|
546
|
-
return createElement(Menu,
|
|
553
|
+
return createElement(Menu, {
|
|
554
|
+
isOpen: isOpen,
|
|
555
|
+
onClose: function onClose() {
|
|
556
|
+
setOpen(false);
|
|
557
|
+
},
|
|
558
|
+
onOpen: function onOpen() {
|
|
559
|
+
setOpen(true);
|
|
560
|
+
}
|
|
561
|
+
}, createElement(Menu.Trigger, null, createElement(Button, {
|
|
547
562
|
endIcon: createElement(ChevronDownIcon, null),
|
|
548
563
|
isDisabled: props.isDisabled,
|
|
549
564
|
testId: testIds$1.actionsWrapper,
|
|
@@ -551,7 +566,7 @@ function CombinedAssetLinkActions(props) {
|
|
|
551
566
|
variant: "secondary",
|
|
552
567
|
startIcon: createElement(PlusIcon, null),
|
|
553
568
|
size: "small"
|
|
554
|
-
}, "Add media")), createElement(Menu.List, {
|
|
569
|
+
}, "Add media")), isOpen && createElement(Menu.List, {
|
|
555
570
|
testId: testIds$1.dropdown
|
|
556
571
|
}, createElement(Menu.Item, {
|
|
557
572
|
testId: testIds$1.linkExisting,
|