Ticket #3389: 3389_5.patch
File 3389_5.patch, 6.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/menu/plugin.js
77 77 return; 78 78 } 79 79 80 // Record parent menu focused item first(#3389). 81 var block = this._.panel.getBlock( this.id ); 82 block._.focusIndex = index; 83 84 80 85 // Create the submenu, if not available, or clean the existing 81 86 // one. 82 87 if ( menu ) … … 86 91 menu = this._.subMenu = new CKEDITOR.menu( this.editor, this._.level + 1 ); 87 92 menu.parent = this; 88 93 menu.onClick = CKEDITOR.tools.bind( this.onClick, this ); 94 // Sub menu use their own scope for binding onEscape. 95 menu.onEscape = this.onEscape; 89 96 } 90 97 91 98 // Add all submenu items to the menu. … … 138 145 }, 139 146 this._.level); 140 147 141 panel.onEscape = CKEDITOR.tools.bind( function( )148 panel.onEscape = CKEDITOR.tools.bind( function( keystroke ) 142 149 { 143 this.onEscape && this.onEscape();144 this.hide();150 if ( this.onEscape && this.onEscape( keystroke ) === false ) 151 return false; 145 152 }, 146 153 this ); 147 154 … … 161 168 keys[ 38 ] = 'prev'; // ARROW-UP 162 169 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 163 170 keys[ 32 ] = 'click'; // SPACE 164 keys[ 39 ] = 'click'; // ARROW-RIGHT171 keys[ ( editor.lang.dir == 'rtl' ? 37 : 39 ) ] = 'click'; // ARROW-RIGHT/ARROW-LEFT(rtl) 165 172 166 173 element = this._.element = block.element; 167 174 element.addClass( editor.skinClass ); -
_source/core/dom/node.js
25 25 { 26 26 switch ( domNode.nodeType ) 27 27 { 28 // Safari don't consider document as element node type(#3389). 29 case CKEDITOR.NODE_DOCUMENT : 30 return new CKEDITOR.dom.document( domNode ); 31 28 32 case CKEDITOR.NODE_ELEMENT : 29 33 return new CKEDITOR.dom.element( domNode ); 30 34 … … 49 53 CKEDITOR.NODE_ELEMENT = 1; 50 54 51 55 /** 56 * Document node type. 57 * @constant 58 * @example 59 */ 60 CKEDITOR.NODE_DOCUMENT = 9; 61 62 /** 52 63 * Text node type. 53 64 * @constant 54 65 * @example -
_source/plugins/floatpanel/plugin.js
153 153 154 154 focused.on( 'blur', function( ev ) 155 155 { 156 if ( CKEDITOR.env.ie && !this.allowBlur() )157 return;158 159 156 // As we are using capture to register the listener, 160 157 // the blur event may get fired even when focusing 161 158 // inside the window itself, so we must ensure the 162 159 // 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' ) 167 164 return; 168 165 169 166 if ( this.visible && !this._.activeChild && !isShowing ) … … 184 181 this._.blurSet = 1; 185 182 } 186 183 187 panel.onEscape = CKEDITOR.tools.bind( function( )184 panel.onEscape = CKEDITOR.tools.bind( function( keystroke ) 188 185 { 189 this.onEscape && this.onEscape(); 186 if ( this.onEscape && this.onEscape( keystroke ) === false ); 187 return false; 190 188 }, 191 189 this ); 192 190 -
_source/plugins/panel/plugin.js
171 171 172 172 doc.on( 'keydown', function( evt ) 173 173 { 174 var keystroke = evt.data.getKeystroke(); 174 var keystroke = evt.data.getKeystroke(), 175 dir = this.document.getById( 'cke_' + this.id ).getAttribute( 'dir' ); 175 176 176 177 // Delegate key processing to block. 177 178 if ( this._.onKeyDown && this._.onKeyDown( keystroke ) === false ) … … 180 181 return; 181 182 } 182 183 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(); 185 188 }, 186 189 this ); 187 190 … … 258 261 this.element.disableContextMenu(); 259 262 }, 260 263 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 263 284 proto : 264 285 { 265 286 show : function() -
_source/plugins/contextmenu/plugin.js
68 68 noUnlock = false; 69 69 }, this ); 70 70 71 menu.onEscape = function( )71 menu.onEscape = function( keystroke ) 72 72 { 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; 77 94 }; 78 95 } 79 96 … … 140 157 141 158 CKEDITOR.tools.setTimeout( function() 142 159 { 143 this. _.onMenu( offsetParent, null, offsetX, offsetY );160 this.show( offsetParent, null, offsetX, offsetY ); 144 161 }, 145 162 0, this ); 146 163 },