From 513f19e60bbbf20305e16fe7efdfc86aa157fdca Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Mon, 19 Jan 2009 11:34:22 +0000 Subject: [PATCH] draggable,sortable: if connectToSortable is used, ui.sender has to be the original draggable (fixes #3856) --- ui/ui.draggable.js | 7 ++----- ui/ui.sortable.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index a1d17aef4..b70435e77 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -466,10 +466,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { //Trigger the stop of the sortable this.instance._mouseStop(event); - - //Also propagate receive event, since the sortable is actually receiving a element - this.instance.element.triggerHandler("sortreceive", [event, $.extend(this.instance._uiHash(), { sender: inst.element })], this.instance.options["receive"]); - + this.instance.options.helper = this.instance.options._helper; //If the helper has been the original item, restore properties in the sortable @@ -523,7 +520,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { inst._trigger("toSortable", event); inst.dropped = this.instance.element; //draggable revert needs that - this.instance.fromOutside = true; //Little hack so receive/update callbacks work + this.instance.fromOutside = inst; //Little hack so receive/update callbacks work } diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 5e7ffa1ca..a51c20f5b 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -902,7 +902,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this.currentItem.show(); } - if(this.fromOutside && !noPropagation) this._trigger("receive", event, this._uiHash(this)); + if(this.fromOutside && !noPropagation) this._trigger("receive", event, this._uiHash(this.fromOutside)); if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not("."+this.options.cssNamespace+"-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) this._trigger("update", event, this._uiHash()); //Trigger update callback if the DOM position has changed if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element if(!noPropagation) this._trigger("remove", event, this._uiHash());