In the media modal, ensure modal events are always fired on its frame. This ensures restoreThickbox() and thus tbRemove() are called properly when clicking the close button of the modal.
Props koopersmith fixes #22632 git-svn-id: https://develop.svn.wordpress.org/trunk@22938 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3c145e0d49
commit
6b972a4c53
|
@ -1216,7 +1216,6 @@
|
||||||
media.view.MediaFrame.prototype[ method ] = function( view ) {
|
media.view.MediaFrame.prototype[ method ] = function( view ) {
|
||||||
if ( this.modal )
|
if ( this.modal )
|
||||||
this.modal[ method ].apply( this.modal, arguments );
|
this.modal[ method ].apply( this.modal, arguments );
|
||||||
this.trigger( method );
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -1657,7 +1656,8 @@
|
||||||
|
|
||||||
_.defaults( this.options, {
|
_.defaults( this.options, {
|
||||||
container: document.body,
|
container: document.body,
|
||||||
title: ''
|
title: '',
|
||||||
|
propagate: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1680,26 +1680,22 @@
|
||||||
|
|
||||||
attach: function() {
|
attach: function() {
|
||||||
this.$el.appendTo( this.options.container );
|
this.$el.appendTo( this.options.container );
|
||||||
this.trigger('attach');
|
return this.propagate('attach');
|
||||||
return this;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
detach: function() {
|
detach: function() {
|
||||||
this.$el.detach();
|
this.$el.detach();
|
||||||
this.trigger('detach');
|
return this.propagate('detach');
|
||||||
return this;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open: function() {
|
||||||
this.$el.show();
|
this.$el.show();
|
||||||
this.trigger('open');
|
return this.propagate('open');
|
||||||
return this;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
this.$el.hide();
|
this.$el.hide();
|
||||||
this.trigger('close');
|
return this.propagate('close');
|
||||||
return this;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
closeHandler: function( event ) {
|
closeHandler: function( event ) {
|
||||||
|
@ -1715,6 +1711,17 @@
|
||||||
// Set and render the content.
|
// Set and render the content.
|
||||||
this.options.$content = ( $content instanceof Backbone.View ) ? $content.$el : $content;
|
this.options.$content = ( $content instanceof Backbone.View ) ? $content.$el : $content;
|
||||||
return this.render();
|
return this.render();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Triggers a modal event and if the `propagate` option is set,
|
||||||
|
// forwards events to the modal's controller.
|
||||||
|
propagate: function( id ) {
|
||||||
|
this.trigger( id );
|
||||||
|
|
||||||
|
if ( this.options.propagate )
|
||||||
|
this.controller.trigger( id );
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue