Skip to content

Commit

Permalink
Keep the block position on the screen when moving blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 20, 2017
1 parent c2c4a33 commit 734653f
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 @@ -308,9 +308,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 734653f

Please sign in to comment.