Do not alter the body's overflow attribute when the media modal is opened. Fix image insertion in the visual editor in Firefox. props azaozz. fixes #22765.

git-svn-id: https://develop.svn.wordpress.org/trunk@23085 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-12-06 03:15:39 +00:00
parent 2255750962
commit 977deb7d63
1 changed files with 4 additions and 11 deletions

View File

@ -1849,7 +1849,7 @@
container: document.body, container: document.body,
title: '', title: '',
propagate: true, propagate: true,
freeze: document.body freeze: true
}); });
}, },
@ -1886,8 +1886,7 @@
open: function() { open: function() {
var $el = this.$el, var $el = this.$el,
options = this.options, options = this.options;
$freeze;
if ( $el.is(':visible') ) if ( $el.is(':visible') )
return this; return this;
@ -1895,15 +1894,11 @@
if ( ! this.views.attached ) if ( ! this.views.attached )
this.attach(); this.attach();
// If the `freeze` option is set, record the window's scroll // If the `freeze` option is set, record the window's scroll position.
// position and the body's overflow, and then set overflow to hidden.
if ( options.freeze ) { if ( options.freeze ) {
$freeze = $( options.freeze );
this._freeze = { this._freeze = {
overflow: $freeze.css('overflow'),
scrollTop: $( window ).scrollTop() scrollTop: $( window ).scrollTop()
}; };
$freeze.css( 'overflow', 'hidden' );
} }
$el.show().focus(); $el.show().focus();
@ -1919,10 +1914,8 @@
this.$el.hide(); this.$el.hide();
this.propagate('close'); this.propagate('close');
// If the `freeze` option is set, restore the container's scroll // If the `freeze` option is set, restore the container's scroll position.
// position and overflow property.
if ( freeze ) { if ( freeze ) {
$( this.options.freeze ).css( 'overflow', freeze.overflow );
$( window ).scrollTop( freeze.scrollTop ); $( window ).scrollTop( freeze.scrollTop );
} }