Skip to content

Commit

Permalink
Restore window scroll position after native paste.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Dec 27, 2012
1 parent a6aa231 commit 1fe0478
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/clipboard/plugin.js
Expand Up @@ -743,8 +743,15 @@
} );
}

var scrollTop = CKEDITOR.document.getWindow().getScrollPosition().y;

// Wait a while and grab the pasted contents.
setTimeout( function() {
// Restore main window's scroll position which could have been changed
// by browser in cases described in #9771.
if ( CKEDITOR.env.webkit || CKEDITOR.env.opera )
CKEDITOR.document[ CKEDITOR.env.webkit ? 'getBody' : 'getDocumentElement' ]().$.scrollTop = scrollTop;

// Blur will be fired only on non-native paste. In other case manually remove listener.
blurListener && blurListener.removeListener();

Expand Down

0 comments on commit 1fe0478

Please sign in to comment.