Ticket #4797: 4797_3.patch

File 4797_3.patch, 1.7 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/dialog/plugin.js

     
    542542
    543543        CKEDITOR.dialog.prototype =
    544544        {
     545                destroy : function()
     546                {
     547                        this._.element.remove();
     548                },
     549
    545550                /**
    546551                 * Resizes the dialog.
    547552                 * @param {Number} width The width of the dialog in pixels.
     
    658663                        if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
    659664                                element.appendTo( CKEDITOR.document.getBody() );
    660665                        else
    661                                 return;
     666                                element.setStyle( 'display', 'block' );
    662667
    663668                        // FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8.
    664669                        if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
     
    798803                {
    799804                        this.fire( 'hide', {} );
    800805                        this._.editor.fire( 'dialogHide', this );
    801 
    802                         // Remove the dialog's element from the root document.
    803806                        var element = this._.element;
    804                         if ( !element.getParent() )
    805                                 return;
    806 
    807                         element.remove();
     807                        element.setStyle( 'display', 'none' );
    808808                        this.parts.dialog.setStyle( 'visibility', 'hidden' );
    809 
    810809                        // Unregister all access keys associated with this dialog.
    811810                        unregisterAccessKey( this );
    812811
     
    27792778                        }
    27802779                };
    27812780        })();
     2781
     2782        CKEDITOR.on( 'instanceDestroyed', function( evt )
     2783        {
     2784                var dialogs = evt.editor._.storedDialogs;
     2785                for ( var name in dialogs )
     2786                        dialogs[ name ].destroy();
     2787
     2788                // Remove dialog cover on last instance destroy.
     2789                if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) );
     2790                        coverElement.remove();
     2791        });
     2792
    27822793})();
    27832794
    27842795// Extend the CKEDITOR.editor class with dialog specific functions.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy