Ticket #3389: 3389.patch

File 3389.patch, 3.9 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/menu/plugin.js

     
    7979                                        menu = this._.subMenu = new CKEDITOR.menu( this.editor, this._.level + 1 );
    8080                                        menu.parent = this;
    8181                                        menu.onClick = CKEDITOR.tools.bind( this.onClick, this );
     82                                        // Sub menu use their own scope for binding onEscape.
     83                                        menu.onEscape = this.onEscape;
    8284                                }
    8385
    8486                                // Add all submenu items to the menu.
     
    125127                                                },
    126128                                                this._.level);
    127129
    128                                         panel.onEscape = CKEDITOR.tools.bind( function()
     130                                        panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    129131                                        {
    130                                                 this.onEscape && this.onEscape();
    131                                                 this.hide();
     132                                                if ( this.onEscape && this.onEscape( keystroke ) === false )
     133                                                        return false;
    132134                                        },
    133135                                        this );
    134136
  • _source/plugins/contextmenu/plugin.js

     
    6262                                        menu.onHide = null;
    6363
    6464                                        noUnlock = true;
    65                                         menu.hide();
    66 
    67                                         if ( CKEDITOR.env.ie )
    68                                                 menu.onEscape();
     65                                        menu.onEscape();
    6966
    7067                                        if ( item.onClick )
    7168                                                item.onClick();
     
    7572                                        noUnlock = false;
    7673                                }, this );
    7774
    78                                 menu.onEscape = function()
     75                                menu.onEscape = function( keystroke )
    7976                                {
    80                                         editor.focus();
    81 
    82                                         if ( CKEDITOR.env.ie )
    83                                                 editor.getSelection().unlock( true );
     77                                        var parent = this.parent;
     78                                        // 1. Close sub menu on ESC/ARROW-RIGHT.
     79                                        // 2. Close menu on ESC.
     80                                        if( parent )
     81                                        {
     82                                                parent._.panel.hideChild();
     83                                               
     84                                                // Restore parent block item focus.
     85                                                var parentBlock = parent._.panel._.panel._.currentBlock;
     86                                                parentBlock._.markItem( parentBlock._.focusIndex );
     87                                                return false;
     88                                        }
     89                                        else if ( keystroke == 27 )
     90                                        {
     91                                                this.hide();
     92                                                editor.focus();
     93       
     94                                                if ( CKEDITOR.env.ie )
     95                                                        editor.getSelection().unlock( true );
     96                                                return false;
     97                                        }
    8498                                };
     99                               
    85100                        }
    86101
    87102                        var listeners = this._.listeners,
  • _source/plugins/floatpanel/plugin.js

     
    147147                                        this._.blurSet = 1;
    148148                                }
    149149
    150                                 panel.onEscape = CKEDITOR.tools.bind( function()
     150                                panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    151151                                        {
    152                                                 this.onEscape && this.onEscape();
     152                                                if ( this.onEscape && this.onEscape( keystroke ) === false );
     153                                                        return false;
    153154                                        },
    154155                                        this );
    155156
  • _source/plugins/panel/plugin.js

     
    175175                                                        return;
    176176                                                }
    177177
    178                                                 if ( keystroke == 27 )          // ESC
    179                                                         this.onEscape && this.onEscape();
     178                                                if ( keystroke == 27 || keystroke == 37 )               // ESC/ARROW-LEFT
     179                                                        if ( this.onEscape && this.onEscape( keystroke ) === false );
     180                                                                evt.data.preventDefault();
    180181                                        },
    181182                                        this );
    182183
     
    250251                this._.focusIndex = -1;
    251252        },
    252253
    253         _ : {},
     254        _ : {
     255               
     256                /**
     257                 * Mark the item specified by the index as current activated.
     258                 */
     259                markItem: function( index )
     260                {
     261                        var links = this.element.getElementsByTag( 'a' );
     262                        links.getItem( this._.focusIndex = index ).focus();
     263                }
     264        },
    254265
    255266        proto :
    256267        {
     
    313324                                        link = index >= 0 && this.element.getElementsByTag( 'a' ).getItem( index );
    314325
    315326                                        if ( link )
    316                                                 link.$.click();
     327                                                link.$.click?
     328                                                        link.$.click() :  link.$.onclick();
    317329
    318330                                        return false;
    319331                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy