Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

Commit

Permalink
[Layout View] Fix bug: Can't drag a ThumbnailSplitList
Browse files Browse the repository at this point in the history
Actually this bug is caused by a bug in jQuery UI sortable's
_removeCurrentsFromItems. But if we make sure we don't have
items in the currentItem, this bug will not be triggered.
So I did the following to make this happen:
* Make sure a sortable doesnt connect with the currentItem
and its child sortables and  update the items correctly after
changing connectWith,
* Make sure the items selector doesn't select unwanted items -
The item selector of Navbar actaully makes Content select
elements in a ThumbnailSplitList as items.
This patch also fixes the problem that dragging a container
may cause DOM hierachy error. This is because if the children in
the currentItem is connected with the sortable, it's possible
that the placeholder be put into the children of the currentItem
and when dropping, jQuery UI will try to insert currentItem
after/before placeholder, which will cause a DOM hierachy error.
  • Loading branch information
zhizhangchen committed Sep 8, 2012
1 parent 2bfe83d commit c068f9b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/js/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ $(function() {
// Filter out those that will not accept this widget
return s.filter( function(index) {
var uid = $(this).attr('data-uid');
return uid && a.canAddChild(uid, t);
return this !== el[0] && !el.find(this)[0]
&& uid && a.canAddChild(uid, t);
});
};

Expand Down Expand Up @@ -504,7 +505,7 @@ $(function() {
'> .ui-controlgroup-controls > .adm-node,' +
// Collapsible's items are under .ui-collapsible-content
'> .ui-collapsible-content > .adm-node,' +
'> ul > li.adm-node,' +
'> ul[class*=ui-grid-] > li.adm-node,' +
'> div.customHeader > .adm-node,' +
'> div > div > a > .adm-node,' +
'> *.orig-adm-node:not(.ui-header,.ui-content,.ui-footer)',
Expand All @@ -524,6 +525,11 @@ $(function() {
//jQuery UI should have done this after hiding current item
//and creating placeholder.
$(this).sortable('refresh');
$.each($(this).data('sortable').containers, function () {
this.options.connectWith = '.ui-sortable-connected';
this._refreshItems();
});
$(this).data('sortable')._refreshItems();



Expand Down

0 comments on commit c068f9b

Please sign in to comment.