diff --git a/lib/yui/blocks/blocks.js b/lib/yui/blocks/blocks.js index cec719f859b..b0835f69035 100644 --- a/lib/yui/blocks/blocks.js +++ b/lib/yui/blocks/blocks.js @@ -68,23 +68,26 @@ YUI.add('moodle-core-blocks', function(Y) { padding: '40 240 40 240' }); + // Make each div element in the list of blocks draggable + var del = new Y.DD.Delegate({ + container: blockregionnode, + nodes: '.'+CSS.BLOCK, + target: true, + handles: ['.'+CSS.HEADER], + dragConfig: {groups: this.groups} + }); + del.dd.plug(Y.Plugin.DDProxy, { + // Don't move the node at the end of the drag + moveOnEnd: false + }); + del.dd.plug(Y.Plugin.DDWinScroll); + var blocklist = blockregionnode.all('.'+CSS.BLOCK); blocklist.each(function(blocknode) { var move = blocknode.one('a.'+CSS.EDITINGMOVE); if (move) { move.remove(); blocknode.one('.'+CSS.HEADER).setStyle('cursor', 'move'); - // Make each div element in the list of blocks draggable - var dd = new Y.DD.Drag({ - node: blocknode, - groups: this.groups, - // Make each div a Drop target too - target: true, - handles: ['.'+CSS.HEADER] - }).plug(Y.Plugin.DDProxy, { - // Don't move the node at the end of the drag - moveOnEnd: false - }).plug(Y.Plugin.DDWinScroll); } }, this); }, this);