Make WordPress Core

Changeset 26899


Ignore:
Timestamp:
01/03/2014 02:33:00 AM (13 years ago)
Author:
azaozz
Message:

TinyMCE: back-compat, refresh and re-enable the 'wpdialogs' plugin, and mark it as deprecated. See #24067.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r26898 r26899  
    235235                                                'wpgallery',
    236236                                                'wplink',
     237                                                'wpdialogs',
    237238                                        ) ) );
    238239
  • trunk/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js

    r26876 r26899  
    11/* global tinymce */
    2 
    3 tinymce.WPWindowManager = function( editor ) {
    4         var element;
     2/**
     3 * Included for back-compat.
     4 * The default WindowManager in TinyMCE 4.0 supports three types of dialogs:
     5 *      - With HTML created from JS.
     6 *      - With inline HTML (like WPWindowManager).
     7 *      - Old type iframe based dialogs.
     8 * For examples see the default plugins: https://github.com/tinymce/tinymce/tree/master/js/tinymce/plugins
     9 */
     10tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) {
    511
    612        this.parent = editor.windowManager;
    713        this.editor = editor;
    814
    9         tinymce.extend( this, this.parent )
     15        tinymce.extend( this, this.parent );
    1016
    1117        this.open = function( args, params ) {
    12                 var self = this, element;
     18                var self = this, $element;
    1319
    14                 if ( ! args.wpDialog )
     20                if ( ! args.wpDialog ) {
    1521                        return this.parent.open( args, params );
    16                 else if ( ! args.id )
     22                } else if ( ! args.id ) {
    1723                        return;
     24                }
    1825
    19                 self.element = element = jQuery('#' + args.id);
    20                 if ( ! element.length )
     26                self.element = $element = jQuery( '#' + args.id );
     27
     28                if ( ! $element.length ) {
    2129                        return;
     30                }
     31
     32                if ( window && window.console ) {
     33                        window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.');
     34                }
    2235
    2336                self.features = args;
    2437                self.params = params;
    25                 self.onOpen.dispatch( self, args, params );
    26                 self.windows.push( element );
     38                self.windows.push( $element );
    2739
    28                 // Store selection
    29         //      self.bookmark = self.editor.selection.getBookmark(1);
     40                // Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog.
     41                editor.nodeChanged();
    3042
    3143                // Create the dialog if necessary
    32                 if ( ! element.data('wpdialog') ) {
    33                         element.wpdialog({
     44                if ( ! $element.data('wpdialog') ) {
     45                        $element.wpdialog({
    3446                                title: args.title,
    3547                                width: args.width,
     
    4153                }
    4254
    43                 element.wpdialog('open');
     55                $element.wpdialog('open');
     56
     57                $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                                }
     64                        }
     65                });
    4466        };
    4567
    4668        this.close = function() {
    47                 if ( ! this.features.wpDialog )
     69                if ( ! this.features.wpDialog ) {
    4870                        return this.parent.close.apply( this, arguments );
     71                }
    4972
    5073                this.element.wpdialog('close');
Note: See TracChangeset for help on using the changeset viewer.