Ticket #3389: 3389_5.patch

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

     
    7777                                        return;
    7878                                }
    7979
     80                                // Record parent menu focused item first(#3389).
     81                                var block = this._.panel.getBlock( this.id );
     82                                block._.focusIndex = index;
     83
     84
    8085                                // Create the submenu, if not available, or clean the existing
    8186                                // one.
    8287                                if ( menu )
     
    8691                                        menu = this._.subMenu = new CKEDITOR.menu( this.editor, this._.level + 1 );
    8792                                        menu.parent = this;
    8893                                        menu.onClick = CKEDITOR.tools.bind( this.onClick, this );
     94                                        // Sub menu use their own scope for binding onEscape.
     95                                        menu.onEscape = this.onEscape;
    8996                                }
    9097
    9198                                // Add all submenu items to the menu.
     
    138145                                                },
    139146                                                this._.level);
    140147
    141                                         panel.onEscape = CKEDITOR.tools.bind( function()
     148                                        panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    142149                                        {
    143                                                 this.onEscape && this.onEscape();
    144                                                 this.hide();
     150                                                if ( this.onEscape && this.onEscape( keystroke ) === false )
     151                                                        return false;
    145152                                        },
    146153                                        this );
    147154
     
    161168                                        keys[ 38 ]      = 'prev';                                       // ARROW-UP
    162169                                        keys[ CKEDITOR.SHIFT + 9 ]      = 'prev';       // SHIFT + TAB
    163170                                        keys[ 32 ]      = 'click';                                      // SPACE
    164                                         keys[ 39 ]      = 'click';                                      // ARROW-RIGHT
     171                                        keys[ ( editor.lang.dir == 'rtl' ? 37 : 39 ) ]  = 'click';  // ARROW-RIGHT/ARROW-LEFT(rtl)
    165172
    166173                                        element = this._.element = block.element;
    167174                                        element.addClass( editor.skinClass );
  • _source/core/dom/node.js

     
    2525        {
    2626                switch ( domNode.nodeType )
    2727                {
     28                        // Safari don't consider document as element node type(#3389).
     29                        case CKEDITOR.NODE_DOCUMENT :
     30                                return new CKEDITOR.dom.document( domNode );
     31
    2832                        case CKEDITOR.NODE_ELEMENT :
    2933                                return new CKEDITOR.dom.element( domNode );
    3034
     
    4953CKEDITOR.NODE_ELEMENT = 1;
    5054
    5155/**
     56 * Document node type.
     57 * @constant
     58 * @example
     59 */
     60CKEDITOR.NODE_DOCUMENT = 9;
     61
     62/**
    5263 * Text node type.
    5364 * @constant
    5465 * @example
  • _source/plugins/floatpanel/plugin.js

     
    153153
    154154                                        focused.on( 'blur', function( ev )
    155155                                                {
    156                                                         if ( CKEDITOR.env.ie && !this.allowBlur() )
    157                                                                 return;
    158 
    159156                                                        // As we are using capture to register the listener,
    160157                                                        // the blur event may get fired even when focusing
    161158                                                        // inside the window itself, so we must ensure the
    162159                                                        // target is out of it.
    163                                                         var target = ev.data.getTarget(),
    164                                                                 targetWindow = target.getWindow && target.getWindow();
    165 
    166                                                         if ( targetWindow && targetWindow.equals( focused ) )
     160                                                        var target;
     161                                                        if ( CKEDITOR.env.ie && !this.allowBlur()
     162                                                                 || ( target = ev.data.getTarget() )
     163                                                                      && target.getName && target.getName() != 'iframe' )
    167164                                                                return;
    168165
    169166                                                        if ( this.visible && !this._.activeChild && !isShowing )
     
    184181                                        this._.blurSet = 1;
    185182                                }
    186183
    187                                 panel.onEscape = CKEDITOR.tools.bind( function()
     184                                panel.onEscape = CKEDITOR.tools.bind( function( keystroke )
    188185                                        {
    189                                                 this.onEscape && this.onEscape();
     186                                                if ( this.onEscape && this.onEscape( keystroke ) === false );
     187                                                        return false;
    190188                                        },
    191189                                        this );
    192190
  • _source/plugins/panel/plugin.js

     
    171171
    172172                                doc.on( 'keydown', function( evt )
    173173                                        {
    174                                                 var keystroke = evt.data.getKeystroke();
     174                                                var keystroke = evt.data.getKeystroke(),
     175                                                        dir = this.document.getById( 'cke_' + this.id ).getAttribute( 'dir' );
    175176
    176177                                                // Delegate key processing to block.
    177178                                                if ( this._.onKeyDown && this._.onKeyDown( keystroke ) === false )
     
    180181                                                        return;
    181182                                                }
    182183
    183                                                 if ( keystroke == 27 )          // ESC
    184                                                         this.onEscape && this.onEscape();
     184                                                // ESC/ARROW-LEFT/ARROW-RIGHT(rtl)
     185                                                if ( keystroke == 27 || keystroke == ( dir == 'rtl' ? 39 : 37 ) )
     186                                                        if ( this.onEscape && this.onEscape( keystroke ) === false );
     187                                                                evt.data.preventDefault();
    185188                                        },
    186189                                        this );
    187190
     
    258261                this.element.disableContextMenu();
    259262        },
    260263
    261         _ : {},
    262 
     264        _ : {
     265               
     266                /**
     267                 * Mark the item specified by the index as current activated.
     268                 */
     269                markItem: function( index )
     270                {
     271                        if ( index == -1 )
     272                                return;
     273                        var links = this.element.getElementsByTag( 'a' );
     274                        var item = links.getItem( this._.focusIndex = index );
     275
     276                        // Safari need focus on the iframe window first(#3389), but we need
     277                        // lock the blur to avoid hiding the panel.
     278                        if ( CKEDITOR.env.webkit )
     279                                item.getDocument().getWindow().focus();
     280                        item.focus();
     281                }
     282        },
     283
    263284        proto :
    264285        {
    265286                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 sub-menu, restore the last focused item
     75                                        // of upper level menu.
     76                                        // 2. In case of a top-menu, close it.
     77                                        if( parent )
     78                                        {
     79                                                parent._.panel.hideChild();
     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                                };
    7895                        }
    7996
     
    140157
    141158                                        CKEDITOR.tools.setTimeout( function()
    142159                                                {
    143                                                         this._.onMenu( offsetParent, null, offsetX, offsetY );
     160                                                        this.show( offsetParent, null, offsetX, offsetY );
    144161                                                },
    145162                                                0, this );
    146163                                },
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy