Ticket #3219: 3219_3.patch

File 3219_3.patch, 5.1 KB (added by Artur Formella, 15 years ago)
  • plugins/floatpanel/plugin.js

     
    6464                                children : [],
    6565                                dir : editor.lang.dir
    6666                        };
     67
     68                        var me = this;
     69
     70                        // If the "contextmenu" plugin is loaded, register the listener.
     71                        if ( editor.contextMenu )
     72                        {
     73                                editor.contextMenu.addListener( function()
     74                                        {
     75                                                me.hide();
     76                                        });
     77                        }
     78                        editor.on( 'beforeCommandExec', function()
     79                                {
     80                                        me.hide();
     81                                });
    6782                },
    6883
    6984                proto :
     
    124139                                                display : ''
    125140                                        });
    126141
     142                                if ( this.onShow )
     143                                        this.onShow.call( this );
     144
     145                                // Non IE prefer the event into a window object.
     146                                var focusElement = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow );
     147
    127148                                // Configure the IFrame blur event. Do that only once.
    128149                                if ( !this._.blurSet )
    129150                                {
    130                                         // Non IE prefer the event into a window object.
    131                                         var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow );
     151                                        focusElement.on( 'blur', function()
     152                                                {
     153                                                        if ( !this._.panel.allowBlur )
     154                                                                return;
    132155
    133                                         focused.on( 'blur', function()
    134                                                 {
    135156                                                        if ( !this._.activeChild )
    136157                                                                this.hide();
    137158                                                },
    138159                                                this );
    139160
    140                                         focused.on( 'focus', function()
     161                                        focusElement.on( 'focus', function()
    141162                                                {
    142163                                                        this._.focused = true;
    143164                                                        this.hideChild();
     165                                                        this.allowBlur( true );
    144166                                                },
    145167                                                this );
    146168
     
    183205                                                // Set the IFrame focus, so the blur event gets fired.
    184206                                                setTimeout( function()
    185207                                                        {
    186                                                                 iframe.$.contentWindow.focus();
     208                                                                focusElement.focus();
    187209                                                        }, 0);
    188210                                        }, 0);
     211                        },
    189212
    190                                 if ( this.onShow )
    191                                         this.onShow.call( this );
     213                        allowBlur : function( allow )
     214                        {
     215                                this._.panel.allowBlur = allow;
    192216                        },
    193217
    194218                        hide : function()
  • plugins/panel/plugin.js

     
    261261
    262262                hide : function()
    263263                {
    264                         this.element.setStyle( 'display', 'none' );
     264                        if ( !this.onHide || this.onHide.call( this )  !== true )
     265                                this.element.setStyle( 'display', 'none' );
    265266                },
    266267
    267268                onKeyDown : function( keystroke )
  • plugins/panelbutton/plugin.js

     
    8585
    8686                                        this.createPanel( editor );
    8787
     88                                        var panel = _.panel;
     89                                        panel.allowBlur( false );
     90
    8891                                        if ( _.on )
    8992                                        {
    90                                                 _.panel.hide();
     93                                                panel.hide();
    9194                                                return;
    9295                                        }
     96                                        panel.showBlock( this._.id, new CKEDITOR.dom.element( $element ), 4 );
    9397
    94                                         _.panel.showBlock( this._.id, new CKEDITOR.dom.element( $element ), 4 );
     98                                        setTimeout( function()
     99                                                {
     100                                                        if (CKEDITOR.env.gecko )
     101                                                                panel._.iframe.$.focus();                                       // Force blur.
     102                                                        panel.allowBlur( true );
     103                                                }, 0 );
    95104                                },
    96105                                this );
    97106                        var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ){
     
    210219                                        me.document.getById( _.id ).focus();
    211220                                };
    212221
    213 
    214222                        if ( this.onBlock )
    215223                                this.onBlock( panel, _.id );
     224
     225                        panel.getBlock( _.id ).onHide = function()
     226                                {
     227                                        _.on = 0;
     228                                        me.setState( CKEDITOR.TRISTATE_OFF );
     229                                }
    216230                },
    217231
    218232                setState : CKEDITOR.ui.button.prototype.setState
  • plugins/richcombo/plugin.js

     
    9393
    9494                                        this.createPanel( editor );
    9595
     96                                        var panel = _.panel;
     97                                        panel.allowBlur( false );
     98
    9699                                        if ( _.on )
    97100                                        {
    98                                                 _.panel.hide();
     101                                                panel.hide();
    99102                                                return;
    100103                                        }
    101104
     
    111114                                        else
    112115                                                _.list.unmarkAll();
    113116
    114                                         _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 );
     117                                        panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 );
     118
     119                                        setTimeout( function()
     120                                                {
     121                                                        if (CKEDITOR.env.gecko )
     122                                                                panel._.iframe.$.focus();                                       // Force blur.
     123                                                        panel.allowBlur( true );
     124                                                }, 0 );
    115125                                },
    116126                                this );
    117127
     
    264274                        this._.panel = panel;
    265275                        this._.list = list;
    266276
     277                        panel.getBlock( this.id ).onHide = function()
     278                                {
     279                                        me._.on = 0;
     280                                        me.setState( CKEDITOR.TRISTATE_OFF );
     281                                }
     282
    267283                        if ( this.init )
    268284                                this.init();
    269285                },
  • plugins/stylescombo/plugin.js

     
    149149
    150150                                        onOpen : function()
    151151                                        {
    152                                                 editor.focus();
     152                                                if ( CKEDITOR.env.ie )
     153                                                        editor.focus();
    153154
    154155                                                var selection = editor.getSelection();
    155156
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy