@contentful/field-editor-reference 5.4.0 → 5.5.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.
- package/CHANGELOG.md +12 -0
- package/dist/common/ReferenceEditor.d.ts +6 -0
- package/dist/field-editor-reference.cjs.development.js +8 -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 +8 -2
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [5.5.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.5.0...@contentful/field-editor-reference@5.5.1) (2022-11-07)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- on sort end multiple reference field ([#1273](https://github.com/contentful/field-editors/issues/1273)) ([1f7788b](https://github.com/contentful/field-editors/commit/1f7788bfb4de6a83b14c75578a43fa036202491e))
|
|
11
|
+
|
|
12
|
+
# [5.5.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.4.0...@contentful/field-editor-reference@5.5.0) (2022-11-04)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- expose sorting end multiple ref field ([#1272](https://github.com/contentful/field-editors/issues/1272)) ([8ad297f](https://github.com/contentful/field-editors/commit/8ad297fc88feebcd07347671bac1497c43c3f3c4))
|
|
17
|
+
|
|
6
18
|
# [5.4.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.3.3...@contentful/field-editor-reference@5.4.0) (2022-11-02)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Offset, SortEndHandler } from 'react-sortable-hoc';
|
|
2
3
|
import { FieldConnector } from '@contentful/field-editor-shared';
|
|
3
4
|
import type { LinkActionsProps } from '../components';
|
|
4
5
|
import { Action, ActionLabels, FieldExtensionSDK, ViewType } from '../types';
|
|
@@ -29,6 +30,11 @@ export interface ReferenceEditorProps {
|
|
|
29
30
|
updateBeforeSortStart?: ({ index }: {
|
|
30
31
|
index: number;
|
|
31
32
|
}) => void;
|
|
33
|
+
onSortingEnd?: (({ oldIndex, newIndex, }: {
|
|
34
|
+
oldIndex: number;
|
|
35
|
+
newIndex: number;
|
|
36
|
+
collection: Offset;
|
|
37
|
+
}) => void) & SortEndHandler;
|
|
32
38
|
}
|
|
33
39
|
export declare type CustomActionProps = LinkActionsProps;
|
|
34
40
|
export declare function ReferenceEditor<T>(props: ReferenceEditorProps & {
|
|
@@ -3296,12 +3296,18 @@ function Editor$1(props) {
|
|
|
3296
3296
|
}, []);
|
|
3297
3297
|
var onSortEnd = React.useCallback(function (_ref) {
|
|
3298
3298
|
var oldIndex = _ref.oldIndex,
|
|
3299
|
-
newIndex = _ref.newIndex
|
|
3299
|
+
newIndex = _ref.newIndex,
|
|
3300
|
+
collection = _ref.collection;
|
|
3300
3301
|
var newItems = arrayMove(items, oldIndex, newIndex);
|
|
3301
3302
|
setValue(newItems);
|
|
3302
3303
|
setIndexToUpdate && setIndexToUpdate(undefined);
|
|
3303
3304
|
document.body.classList.remove('grabbing');
|
|
3304
|
-
|
|
3305
|
+
props.onSortingEnd && props.onSortingEnd({
|
|
3306
|
+
oldIndex: oldIndex,
|
|
3307
|
+
newIndex: newIndex,
|
|
3308
|
+
collection: collection
|
|
3309
|
+
});
|
|
3310
|
+
}, [items, props, setIndexToUpdate, setValue]);
|
|
3305
3311
|
var onMove = React.useCallback(function (oldIndex, newIndex) {
|
|
3306
3312
|
var newItems = arrayMove(items, oldIndex, newIndex);
|
|
3307
3313
|
setValue(newItems);
|