Skip to content

Commit a8e340f

Browse files
committed
Fix adding keys on wrong parent
1 parent a77c011 commit a8e340f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/eventHandlers/mousedown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const mousedownHandler : EventHandler = (node, event, options) => {
1919
const body : Element = findParent(event.target as Element, 'body');
2020
body.setAttribute('style', getBodyStyle());
2121

22-
const parent : VNode = select(options.parentSelector, node)[0];
22+
const parent : VNode = addKeys(select(options.parentSelector, node)[0]);
2323
const index : number = getIndex(item);
2424

2525
const ghostAttrs : { [name : string]: string } = {

src/makeSortable.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DOMSource, VNode } from '@cycle/dom';
44
import { adapt } from '@cycle/run/lib/adapt';
55

66
import { SortableOptions, Transform, EventDetails } from './definitions';
7-
import { applyDefaults, addKeys } from './helpers';
7+
import { applyDefaults } from './helpers';
88
import { handleEvent } from './eventHandlers';
99
import { emitBetween } from './xstreamHelpers';
1010

@@ -17,7 +17,6 @@ function augmentEvent(ev : any) : any {
1717
return ev;
1818
}
1919

20-
2120
/**
2221
* Can be composed with a Stream of VNodes to make them sortable via drag&drop
2322
* @param {DOMSource} dom The preselected root VNode of the sortable, also indicates the area in which the ghost can be dragged
@@ -28,7 +27,6 @@ export function makeSortable<T>(dom : DOMSource, options? : SortableOptions) : (
2827
{
2928
return sortable => adapt(
3029
(xs.fromObservable(sortable as any) as Stream<VNode>)
31-
.map(addKeys)
3230
.map(node => {
3331
const defaults : SortableOptions = applyDefaults(options || {}, node);
3432

0 commit comments

Comments
 (0)