Ticket #3389: 3389_3.patch
File 3389_3.patch, 7.3 KB (added by , 14 years ago) |
---|
-
_source/plugins/menu/plugin.js
77 77 return; 78 78 } 79 79 80 // Record the focused parent menu item first(#3389). 81 var block = this._.panel.getBlock( this.id ); 82 block._.markItem( 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 -
_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/listblock/plugin.js
11 11 { 12 12 CKEDITOR.ui.panel.prototype.addListBlock = function( name, multiSelect ) 13 13 { 14 return this.addBlock( name, new CKEDITOR.ui.listBlock( this .getHolderElement(), multiSelect ) );14 return this.addBlock( name, new CKEDITOR.ui.listBlock( this, this.getHolderElement(), multiSelect ) ); 15 15 }; 16 16 17 17 CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass( 18 18 { 19 19 base : CKEDITOR.ui.panel.block, 20 20 21 $ : function( blockHolder, multiSelect )21 $ : function( panel, blockHolder, multiSelect ) 22 22 { 23 23 // Call the base contructor. 24 this.base( blockHolder );24 this.base( panel, blockHolder ); 25 25 26 26 this.multiSelect = !!multiSelect; 27 27 -
_source/plugins/floatpanel/plugin.js
153 153 154 154 focused.on( 'blur', function( ev ) 155 155 { 156 if ( CKEDITOR.env.ie &&!this.allowBlur() )156 if ( !this.allowBlur() ) 157 157 return; 158 158 159 159 // As we are using capture to register the listener, … … 163 163 var target = ev.data.getTarget(), 164 164 targetWindow = target.getWindow && target.getWindow(); 165 165 166 if ( targetWindow && targetWindow.equals( focused ) ) 166 // Safari always report document as target when window blurred(#3389). 167 if ( ( !CKEDITOR.env.webkit || target.$.nodeType != CKEDITOR.NODE_DOCUMENT ) 168 && targetWindow && targetWindow.equals( focused ) ) 167 169 return; 168 170 169 171 if ( this.visible && !this._.activeChild && !isShowing ) … … 184 186 this._.blurSet = 1; 185 187 } 186 188 187 panel.onEscape = CKEDITOR.tools.bind( function( )189 panel.onEscape = CKEDITOR.tools.bind( function( keystroke ) 188 190 { 189 this.onEscape && this.onEscape(); 191 if ( this.onEscape && this.onEscape( keystroke ) === false ); 192 return false; 190 193 }, 191 194 this ); 192 195 -
_source/plugins/panel/plugin.js
180 180 return; 181 181 } 182 182 183 if ( keystroke == 27 ) // ESC 184 this.onEscape && this.onEscape(); 183 if ( keystroke == 27 || keystroke == 37 ) // ESC/ARROW-LEFT 184 if ( this.onEscape && this.onEscape( keystroke ) === false ); 185 evt.data.preventDefault(); 185 186 }, 186 187 this ); 187 188 … … 198 199 199 200 addBlock : function( name, block ) 200 201 { 201 block = this._.blocks[ name ] = block || new CKEDITOR.ui.panel.block( this .getHolderElement() );202 block = this._.blocks[ name ] = block || new CKEDITOR.ui.panel.block( this, this.getHolderElement() ); 202 203 203 204 if ( !this._.currentBlock ) 204 205 this.showBlock( name ); … … 235 236 236 237 CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass( 237 238 { 238 $ : function( blockHolder )239 $ : function( panel, blockHolder ) 239 240 { 240 241 this.element = blockHolder.append( 241 242 blockHolder.getDocument().createElement( 'div', … … 249 250 display : 'none' 250 251 } 251 252 }) ); 252 253 this._.panel = panel; 253 254 this.keys = {}; 254 255 255 256 this._.focusIndex = -1; … … 259 260 CKEDITOR.plugins.contextMenu.prototype.addDisabledTarget( this.element ); 260 261 }, 261 262 262 _ : {}, 263 263 _ : { 264 265 /** 266 * Mark the item specified by the index as current activated. 267 */ 268 markItem: function( index ) 269 { 270 if ( index == -1 ) 271 return; 272 var links = this.element.getElementsByTag( 'a' ); 273 var item = links.getItem( this._.focusIndex = index ); 274 275 // Safari need focus on the iframe window first(#3389), but we need 276 // lock the blur to avoid hiding the panel. 277 if ( CKEDITOR.env.webkit ) 278 { 279 this._.panel.allowBlur = false; 280 item.getDocument().getWindow().focus(); 281 this._.panel.allowBlur = true; 282 } 283 item.focus(); 284 } 285 }, 286 264 287 proto : 265 288 { 266 289 show : function() -
_source/plugins/contextmenu/plugin.js
75 75 noUnlock = false; 76 76 }, this ); 77 77 78 menu.onEscape = function( )78 menu.onEscape = function( keystroke ) 79 79 { 80 editor.focus(); 81 82 if ( CKEDITOR.env.ie ) 83 editor.getSelection().unlock( true ); 80 var parent = this.parent; 81 // 1. If it's sub-menu, restore the last focused item 82 // of upper level menu. 83 // 2. In case of a top-menu, close it. 84 if( parent ) 85 { 86 parent._.panel.hideChild(); 87 // Restore parent block item focus. 88 var parentBlock = parent._.panel._.panel._.currentBlock, 89 parentFocusIndex = parentBlock._.focusIndex; 90 parentBlock._.markItem( parentFocusIndex ); 91 } 92 else if ( keystroke == 27 ) 93 { 94 this.hide(); 95 editor.focus(); 96 97 if ( CKEDITOR.env.ie ) 98 editor.getSelection().unlock( true ); 99 } 100 return false; 84 101 }; 85 102 } 86 103