wpdialog.js 560 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * @output wp-includes/js/wpdialog.js
  3. */
  4. /*
  5. * Wrap the jQuery UI Dialog open function remove focus from tinyMCE.
  6. */
  7. ( function($) {
  8. $.widget('wp.wpdialog', $.ui.dialog, {
  9. open: function() {
  10. // Add beforeOpen event.
  11. if ( this.isOpen() || false === this._trigger('beforeOpen') ) {
  12. return;
  13. }
  14. // Open the dialog.
  15. this._super();
  16. // WebKit leaves focus in the TinyMCE editor unless we shift focus.
  17. this.element.focus();
  18. this._trigger('refresh');
  19. }
  20. });
  21. $.wp.wpdialog.prototype.options.closeOnEscape = false;
  22. })(jQuery);