WordPress dialog jQuery UI widget:

* Link to the upstream bug report.
 * No need to specify the default value for an option.
 * Use the new _super() UI method to open the dialog, avoiding a direct reference to the parent.
 * Fix typo in comment.
 * Use public isOpen() method rather than a private property.

props scott.gonzalez.
fixes #22399.



git-svn-id: https://develop.svn.wordpress.org/trunk@22514 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-09 22:36:35 +00:00
parent e625c90923
commit 595cd943bf
1 changed files with 6 additions and 7 deletions

View File

@ -1,26 +1,25 @@
(function($){ (function($){
$.ui.dialog.prototype.options.closeOnEscape = false; $.ui.dialog.prototype.options.closeOnEscape = false;
$.widget("wp.wpdialog", $.ui.dialog, { $.widget('wp.wpdialog', $.ui.dialog, {
options: { // Work around a bug in jQuery UI 1.9.1.
closeOnEscape: false // http://bugs.jqueryui.com/ticket/8805
},
widgetEventPrefix: 'wpdialog', widgetEventPrefix: 'wpdialog',
open: function() { open: function() {
var ed; var ed;
// Initialize tinyMCEPopup if it exists and is the editor is active. // Initialize tinyMCEPopup if it exists and the editor is active.
if ( tinyMCEPopup && typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { if ( tinyMCEPopup && typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
tinyMCEPopup.init(); tinyMCEPopup.init();
} }
// Add beforeOpen event. // Add beforeOpen event.
if ( this._isOpen || false === this._trigger('beforeOpen') ) { if ( this.isOpen() || false === this._trigger('beforeOpen') ) {
return; return;
} }
// Open the dialog. // Open the dialog.
$.ui.dialog.prototype.open.apply( this, arguments ); this._super();
// WebKit leaves focus in the TinyMCE editor unless we shift focus. // WebKit leaves focus in the TinyMCE editor unless we shift focus.
this.element.focus(); this.element.focus();
this._trigger('refresh'); this._trigger('refresh');