WordPress.org

Make WordPress Core

Changeset 26900


Ignore:
Timestamp:
01/04/2014 01:27:59 AM (8 years ago)
Author:
azaozz
Message:

TinyMCE: 'wpdialogs' plugin, don't add the (external) UI dialogs element to the internal windows array, fix .close(). See #24067.

Location:
trunk/src/wp-includes/js/tinymce/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js

    r26899 r26900  
    99 */
    1010tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) {
     11    if ( this.wp ) {
     12        return this;
     13    }
    1114
     15    this.wp = {};
    1216    this.parent = editor.windowManager;
    1317    this.editor = editor;
     
    1620
    1721    this.open = function( args, params ) {
    18         var self = this, $element;
     22        var $element,
     23            self = this,
     24            wp = this.wp;
    1925
    2026        if ( ! args.wpDialog ) {
    21             return this.parent.open( args, params );
     27            return this.parent.open.apply( this, arguments );
    2228        } else if ( ! args.id ) {
    2329            return;
    2430        }
    2531
    26         self.element = $element = jQuery( '#' + args.id );
     32        wp.$element = $element = jQuery( '#' + args.id );
    2733
    2834        if ( ! $element.length ) {
     
    3440        }
    3541
    36         self.features = args;
    37         self.params = params;
    38         self.windows.push( $element );
     42        wp.features = args;
     43        wp.params = params;
    3944
    4045        // Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog.
     
    5661
    5762        $element.on( 'wpdialogclose', function() {
    58             var i = self.windows.length;
    59 
    60             while ( i-- && i > -1 ) {
    61                 if ( self.windows[i] === self.element ) {
    62                     self.windows.splice( i, 1 );
    63                 }
     63            if ( self.wp.$element ) {
     64                self.wp = {};
    6465            }
    6566        });
     
    6768
    6869    this.close = function() {
    69         if ( ! this.features.wpDialog ) {
     70        if ( ! this.wp.features || ! this.wp.features.wpDialog ) {
    7071            return this.parent.close.apply( this, arguments );
    7172        }
    7273
    73         this.element.wpdialog('close');
     74        this.wp.$element.wpdialog('close');
    7475    };
    75 }
     76};
    7677
    7778tinymce.PluginManager.add( 'wpdialogs', function( editor ) {
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r26882 r26900  
    5858
    5959                if ( out && out[1] ) {
    60                     return '<p>' + out[1] + '</p>'
     60                    return '<p>' + out[1] + '</p>';
    6161                }
    6262
Note: See TracChangeset for help on using the changeset viewer.