Ticket #5936: 5936.patch

File 5936.patch, 1020 bytes (added by Karen Ananiev, 14 years ago)
  • _source/plugins/menubutton/plugin.js

     
    2929                if ( _.state === CKEDITOR.TRISTATE_DISABLED )
    3030                        return;
    3131
    32                 _.previousState = _.state;
     32                if ( !_.on )
     33                {
     34                        _.previousState = _.state;
     35                }
    3336
    3437                // Check if we already have a menu for it, otherwise just create it.
    3538                var menu = _.menu;
     
    4144                        menu.onHide = CKEDITOR.tools.bind( function()
    4245                                {
    4346                                        this.setState( _.previousState );
     47                                        _.on = false;
    4448                                },
    4549                                this );
    4650
     
    5357
    5458                if ( _.on )
    5559                {
    56                         menu.hide();
     60                        menu._.menu.hide();
     61                        menu.editor.focus();
    5762                        return;
    5863                }
    5964
     65                menu.show( CKEDITOR.document.getById( this._.id ), 4 );
     66
     67                /**
     68                 * menu.show() hides the menu before show it
     69                 * so let set state to ON after menu.show
     70                 * to prevent enabled button after second click
     71                 */
    6072                this.setState( CKEDITOR.TRISTATE_ON );
    6173
    62                 menu.show( CKEDITOR.document.getById( this._.id ), 4 );
     74                _.on = true;
    6375        };
    6476
    6577
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy