Skip to content

Commit dc9bfce

Browse files
Merge pull request #15 from CloudCannon/fix/array-and-edit-improvements
Array and edit improvements
2 parents 5abb6a5 + d1e91ba commit dc9bfce

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/index.d.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,15 @@ export interface EditOptions {
195195
slug: string;
196196
/** Optional style information */
197197
style?: string | null;
198-
/** The mouse event that triggered the edit */
199-
e?: MouseEvent;
198+
/** The coordinates of the edit, and the bounding rectangle of the element being edited */
199+
position?: {
200+
x: number;
201+
y: number;
202+
left: number;
203+
width: number;
204+
top: number;
205+
height: number;
206+
};
200207
}
201208

202209
/**
@@ -215,16 +222,20 @@ export interface AddArrayItemOptions extends ArrayOptions {
215222
index: number | null;
216223
/** The value to insert */
217224
value: any;
218-
/** The mouse event that triggered the addition */
219-
e?: MouseEvent;
225+
/** The index to clone from if value isnt provided */
226+
sourceIndex?: number;
220227
}
221228

222229
/**
223230
* Options for moving an array item in the v2 API
224231
*/
225-
export interface MoveArrayItemOptions extends ArrayOptions {
232+
export interface MoveArrayItemOptions {
233+
/** the identifier of the array field to move from */
234+
fromSlug: string;
235+
/** the identifier of the array field to move to, defaults to fromSlug if not provided */
236+
toSlug?: string;
226237
/** The current index of the item */
227-
index: number;
238+
fromIndex: number;
228239
/** The target index for the item */
229240
toIndex: number;
230241
}

0 commit comments

Comments
 (0)