Ticket #3230: 3230.patch

File 3230.patch, 2.5 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/dialogui/plugin.js

     
    452452                                        {
    453453                                                var element = this.getElement();
    454454
    455                                                 element.on( 'mousedown', function( evt )
    456                                                         {
    457                                                                 // If button is disabled, don't do anything.
    458                                                                 if ( me._.disabled )
    459                                                                         return;
    460 
    461                                                                 // Store the currently active button.
    462                                                                 CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
    463                                                         } );
    464 
    465                                                 element.on( 'keydown', function( evt )
    466                                                         {
    467                                                                 // Click if Enter is pressed.
    468                                                                 if ( evt.data.$.keyCode == 13 )
    469                                                                 {
    470                                                                         me.fire( 'click', { dialog : me.getDialog() } );
    471                                                                         evt.data.preventDefault();
    472                                                                 }
    473                                                         } );
    474 
    475                                                 if ( !eventInfo.data.buttonHandlerRegistered )
     455                                                (function()
    476456                                                {
    477                                                         CKEDITOR.document.on( 'mouseup', function( evt )
     457                                                        element.on( 'click', function( evt )
    478458                                                                {
    479                                                                         var target = evt.data.getTarget(),
    480                                                                                 activeButton = CKEDITOR.ui.dialog.button._.activeButton;
    481 
    482                                                                         // If there's no active button, bail out.
    483                                                                         if ( !activeButton )
    484                                                                                 return;
    485 
    486                                                                         // Fire the click event - but only if the
    487                                                                         // active button is the same as target.
    488                                                                         if ( activeButton[1].equals( target.getAscendant( 'a' ) ) )
    489                                                                                 activeButton[0].fire( 'click', { dialog : activeButton[0].getDialog() } );
    490 
    491                                                                         // Clear active button flag.
    492                                                                         CKEDITOR.ui.dialog.button._.activeButton = null;
     459                                                                        me.fire( 'click', { dialog : me.getDialog() } );
    493460                                                                } );
     461                                                })();
    494462
    495                                                         eventInfo.data.buttonHandlerRegistered = true;
    496                                                 }
    497 
    498                                                 this.getElement().getFirst().unselectable();
     463                                                element.unselectable();
    499464                                        }, this );
    500465
    501466                                var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
     
    510475                                        null,
    511476                                        {
    512477                                                style : elementDefinition.style,
    513                                                 href : 'javascript:void(0);',
     478                                                href : 'javascript:void(0)',
    514479                                                title : elementDefinition.label,
    515480                                                hidefocus : 'true'
    516481                                        },
     
    12581223
    12591224        CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button;
    12601225
    1261         CKEDITOR.ui.dialog.button._ = { activeButton : null };
    1262 
    12631226        CKEDITOR.dialog.addUIElement( 'text', textBuilder );
    12641227        CKEDITOR.dialog.addUIElement( 'password', textBuilder );
    12651228        CKEDITOR.dialog.addUIElement( 'textarea', commonBuilder );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy