diff --git a/core/modules/block/js/block.js b/core/modules/block/js/block.js index 5fa500f..af0e193 100644 --- a/core/modules/block/js/block.js +++ b/core/modules/block/js/block.js @@ -99,7 +99,7 @@ } // Update the block weights - updateBlockweights(table); + updateBlockweights(table, regionName); }; // Add the behavior to each region select list. @@ -113,7 +113,7 @@ table.find('.region-' + select[0].value + '-message').nextUntil('.region-message').last().before(row); // Update the block weights - updateBlockweights(table); + updateBlockweights(table, select[0].value); // Modify empty regions with added or removed fields. checkEmptyRegions(table, row); // Remove focus from selectbox. @@ -121,11 +121,11 @@ }); }); - var updateBlockweights = function (table) { + var updateBlockweights = function (table, region) { // Calculate minimum weight. var weight = - Math.round(table.find('.draggable').length / 2); // Update the block weights. - table.find('.draggable').each(function () { + table.find('.region-' + region + '-message').nextUntil('.region-title').each(function () { $(this).find('select.block-weight').val(++weight); } );