]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js
WordPress 3.8.3
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / wpdialogs / js / wpdialog.js
1 (function($){
2         $.ui.dialog.prototype.options.closeOnEscape = false;
3         $.widget('wp.wpdialog', $.ui.dialog, {
4                 // Work around a bug in jQuery UI 1.9.1.
5                 // http://bugs.jqueryui.com/ticket/8805
6                 widgetEventPrefix: 'wpdialog',
7
8                 open: function() {
9                         var ed;
10
11                         // Initialize tinyMCEPopup if it exists and the editor is active.
12                         if ( tinyMCEPopup && typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
13                                 tinyMCEPopup.init();
14                         }
15
16                         // Add beforeOpen event.
17                         if ( this.isOpen() || false === this._trigger('beforeOpen') ) {
18                                 return;
19                         }
20
21                         // Open the dialog.
22                         this._super();
23                         // WebKit leaves focus in the TinyMCE editor unless we shift focus.
24                         this.element.focus();
25                         this._trigger('refresh');
26                 }
27         });
28 })(jQuery);