Ticket #3389: 3389_2.patch

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

     
    8686                                        menu = this._.subMenu = new CKEDITOR.menu( this.editor, this._.level + 1 );
    8787                                        menu.parent = this;
    8888                                        menu.onClick = CKEDITOR.tools.bind( this.onClick, this );
     89                                        // Sub menu use their own scope for binding onEscape.
     90                                        menu.onEscape = this.onEscape;
    8991                                }
    9092
    9193                                // Add all submenu items to the menu.
     
    138140                                                },
    139141                                                this._.level);
    140142
    141                                         panel.onEscape = CKEDITOR.tools.bind( function()
     143                                        panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    142144                                        {
    143                                                 this.onEscape && this.onEscape();
    144                                                 this.hide();
     145                                                if ( this.onEscape && this.onEscape( keystroke ) === false )
     146                                                        return false;
    145147                                        },
    146148                                        this );
    147149
     
    186188                                        this._.itemClickFn = CKEDITOR.tools.addFunction( function( index )
    187189                                                {
    188190                                                        var item = this.items[ index ];
     191                                                        // Focus the corresponding block item.
     192                                                        var block = this._.panel.getBlock( this.id );
     193                                                        block._.markItem( index );
    189194
    190195                                                        if ( item.state == CKEDITOR.TRISTATE_DISABLED )
    191196                                                        {
  • _source/plugins/floatpanel/plugin.js

     
    174174                                        this._.blurSet = 1;
    175175                                }
    176176
    177                                 panel.onEscape = CKEDITOR.tools.bind( function()
     177                                panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    178178                                        {
    179                                                 this.onEscape && this.onEscape();
     179                                                if ( this.onEscape && this.onEscape( keystroke ) === false );
     180                                                        return false;
    180181                                        },
    181182                                        this );
    182183
  • _source/plugins/panel/plugin.js

     
    179179                                                        return;
    180180                                                }
    181181
    182                                                 if ( keystroke == 27 )          // ESC
    183                                                         this.onEscape && this.onEscape();
     182                                                if ( keystroke == 27 || keystroke == 37 )               // ESC/ARROW-LEFT
     183                                                        if ( this.onEscape && this.onEscape( keystroke ) === false );
     184                                                                evt.data.preventDefault();
    184185                                        },
    185186                                        this );
    186187
     
    254255                this._.focusIndex = -1;
    255256        },
    256257
    257         _ : {},
    258 
     258        _ : {
     259               
     260                /**
     261                 * Mark the item specified by the index as current activated.
     262                 */
     263                markItem: function( index )
     264                {
     265                        if ( index == -1 )
     266                                return;
     267                        var links = this.element.getElementsByTag( 'a' );
     268                        links.getItem( this._.focusIndex = index ).focus();
     269                }
     270        },
     271
    259272        proto :
    260273        {
    261274                show : function()
  • _source/plugins/contextmenu/plugin.js

     
    6868                                        noUnlock = false;
    6969                                }, this );
    7070
    71                                 menu.onEscape = function()
     71                                menu.onEscape = function( keystroke )
    7272                                {
    73                                         editor.focus();
    74 
    75                                         if ( CKEDITOR.env.ie )
    76                                                 editor.getSelection().unlock( true );
     73                                        var parent = this.parent;
     74                                        // 1. If it's submenu, back to upper level.
     75                                        // 2. In case of a top level menu, close it.
     76                                        if( parent )
     77                                        {
     78                                                parent._.panel.hideChild();
     79                                               
     80                                                // Restore parent block item focus.
     81                                                var parentBlock = parent._.panel._.panel._.currentBlock,
     82                                                        parentFocusIndex =  parentBlock._.focusIndex;
     83                                                parentBlock._.markItem( parentFocusIndex );
     84                                        }
     85                                        else if ( keystroke == 27 )
     86                                        {
     87                                                this.hide();
     88                                                editor.focus();
     89       
     90                                                if ( CKEDITOR.env.ie )
     91                                                        editor.getSelection().unlock( true );
     92                                        }
     93                                        return false;
    7794                                };
     95                               
    7896                        }
    7997
    8098                        var listeners = this._.listeners,
  • CHANGES.html

     
    138138                <li>Updated the following language files:<ul>
    139139                        <li><a href="http://dev.fckeditor.net/ticket/3837">#3837</a> : Brazilian Portuguese.</li>
    140140                </ul>
     141                <li><a href="http://dev.fckeditor.net/ticket/3389">#3389</a> : Adding keystrokes for close sub menu.</li>
    141142                </li>
    142143        </ul>
    143144        <h3>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy