Toggle display of plupload overlays when the select files button is hidden. see #22732.
git-svn-id: http://core.svn.wordpress.org/trunk@23053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c7fee4d3e6
commit
81d474cda0
|
@ -2085,6 +2085,31 @@
|
|||
}
|
||||
},
|
||||
|
||||
dispose: function() {
|
||||
if ( this.disposing )
|
||||
return media.View.prototype.dispose.apply( this, arguments );
|
||||
|
||||
// Run remove on `dispose`, so we can be sure to refresh the
|
||||
// uploader with a view-less DOM. Track whether we're disposing
|
||||
// so we don't trigger an infinite loop.
|
||||
this.disposing = true;
|
||||
return this.remove();
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
var result = media.View.prototype.remove.apply( this, arguments );
|
||||
|
||||
_.defer( _.bind( this.refresh, this ) );
|
||||
return result;
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var uploader = this.controller.uploader;
|
||||
|
||||
if ( uploader )
|
||||
uploader.refresh();
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
var $browser = this.options.$browser,
|
||||
$placeholder;
|
||||
|
@ -2101,6 +2126,7 @@
|
|||
$placeholder.replaceWith( $browser.show() );
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -293,7 +293,41 @@ window.wp = window.wp || {};
|
|||
progress: function() {},
|
||||
complete: function() {},
|
||||
refresh: function() {
|
||||
var node, enabled, container;
|
||||
|
||||
if ( this.browser ) {
|
||||
node = this.browser[0];
|
||||
|
||||
while ( node ) {
|
||||
if ( node === document.body ) {
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
this.uploader.disableBrowse( ! enabled );
|
||||
// Toggle all auto-created file containers.
|
||||
this._container().toggle( enabled );
|
||||
}
|
||||
|
||||
this.uploader.refresh();
|
||||
},
|
||||
|
||||
_container: function() {
|
||||
var runtime = this.uploader.runtime;
|
||||
|
||||
if ( this._$container && this._$container.length )
|
||||
return this._$container;
|
||||
|
||||
if ( 'html4' === runtime )
|
||||
return $('[target="' + this.uploader.id + '_iframe"]');
|
||||
|
||||
if ( 'html5' !== runtime && 'flash' !== runtime && 'silverlight' !== runtime )
|
||||
return $();
|
||||
|
||||
this._$container = $( '#' + this.uploader.id + '_' + runtime + '_container' );
|
||||
return this._$container;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue