@contentful/field-editor-reference 5.5.0 → 5.5.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.
@@ -3290,11 +3290,17 @@ function Editor$1(props) {
3290
3290
  var onSortEnd = useCallback(function (_ref) {
3291
3291
  var oldIndex = _ref.oldIndex,
3292
3292
  newIndex = _ref.newIndex;
3293
+ // custom callback that is invoked *before* we sort the array
3294
+ // e.g. in Compose we want to sort the references in the referenceMap before re-rendering drag and drop
3295
+ props.onSortingEnd && props.onSortingEnd({
3296
+ oldIndex: oldIndex,
3297
+ newIndex: newIndex
3298
+ });
3293
3299
  var newItems = arrayMove(items, oldIndex, newIndex);
3294
3300
  setValue(newItems);
3295
3301
  setIndexToUpdate && setIndexToUpdate(undefined);
3296
3302
  document.body.classList.remove('grabbing');
3297
- }, [items, setIndexToUpdate, setValue]);
3303
+ }, [items, props, setIndexToUpdate, setValue]);
3298
3304
  var onMove = useCallback(function (oldIndex, newIndex) {
3299
3305
  var newItems = arrayMove(items, oldIndex, newIndex);
3300
3306
  setValue(newItems);
@@ -3412,8 +3418,7 @@ function MultipleEntryReferenceEditor(props) {
3412
3418
  return createElement(SortableLinkList, _extends({}, childrenProps, {
3413
3419
  axis: "y",
3414
3420
  useDragHandle: true,
3415
- updateBeforeSortStart: updateBeforeSortStart,
3416
- onSortEnd: props.onSortingEnd
3421
+ updateBeforeSortStart: updateBeforeSortStart
3417
3422
  }), function (_ref2) {
3418
3423
  var items = _ref2.items,
3419
3424
  item = _ref2.item,