Skip to content

Commit

Permalink
Merge pull request #100 from WordPress/update/keep-block-position
Browse files Browse the repository at this point in the history
Keep the block position on the screen when moving blocks
  • Loading branch information
youknowriad authored Feb 20, 2017
2 parents 52c59f5 + e86a88e commit b3e9083
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,11 @@ function attachControlActions() {
if ( getter ) {
node.addEventListener( 'click', function( event ) {
event.stopPropagation();
var previousOffset = selectedBlock.offsetTop;
swapNodes( selectedBlock, getter( selectedBlock ) );
attachBlockHandlers();
reselect();
window.scrollTo( window.scrollX, window.scrollY + selectedBlock.offsetTop - previousOffset );
}, false );
}
} );
Expand Down

0 comments on commit b3e9083

Please sign in to comment.