diff --git a/src/js/composer.js b/src/js/composer.js index d07dbf31..476554ee 100644 --- a/src/js/composer.js +++ b/src/js/composer.js @@ -308,6 +308,12 @@ $(function() { cancel: '> :not(.adm-node,.orig-adm-node)', items: '> *.adm-node:not(.ui-header,.ui-content,.ui-footer),' + '> .ui-controlgroup-controls > .adm-node,' + + //When Collapsible is empty it is hard to move widgets into it. + //Treating ui-collapse-content as item will make it easier + // to move widgets in. + '> .ui-collapsible-content,' + + //Collapsible's items are under .ui-collapsible-content + ' > .ui-collapsible-content > .adm-node, ' + '> *.orig-adm-node:not(.ui-header,.ui-content,.ui-footer)', start: function(event, ui){ trackOffsets('start: ',ui,$(this).data('sortable')); @@ -349,13 +355,15 @@ $(function() { s.overflowOffset.left = sP.offsetWidth/2 - s.options.scrollSensitivity; } + targets.removeClass('ui-state-active'); + //The highlighted container should always be where the placeholder located + ui.placeholder.closest('.nrc-sortable-container').addClass('ui-state-active'); }, over: function(event, ui){ - $('.ui-sortable.ui-state-active') - .removeClass('ui-state-active'); - $(this).addClass('ui-state-active'); trackOffsets('over: ',ui,$(this).data('sortable')); + if ($(this).hasClass('nrc-sortable-container ui-collapsible')) + $(this).trigger('expand'); if (ui && ui.placeholder) { var s = ui.placeholder.siblings('.adm-node:visible,' + '.orig-adm-node:visible'), @@ -380,8 +388,10 @@ $(function() { } }, out: function(event, ui){ - $(this).removeClass('ui-state-active'); trackOffsets('out: ',ui,$(this).data('sortable')); + if ($(this).hasClass('nrc-sortable-container ui-collapsible') + && $(this).subtree('.ui-selected').length === 0) + $(this).trigger('collapse'); }, stop: function(event, ui){ trackOffsets('stop: ',ui,$(this).data('sortable')); diff --git a/src/js/widgets.js b/src/js/widgets.js index 6ba68eaf..2a865a4c 100644 --- a/src/js/widgets.js +++ b/src/js/widgets.js @@ -1491,11 +1491,6 @@ var BWidgetRegistry = { e.node = ADM.getDesignRoot().findNodeByUid(ADM.getSelected()); toggleCollapse(e); ADM.bind("selectionChanged", toggleCollapse); - // Fixup "Collapsible" to make the content div jQM adds at runtime - // be a "sortable" as well - $('.ui-collapsible-content', domNode) - .addClass('nrc-sortable-container') - .attr('data-uid', admNode.getUid()); return domNode; }, },