Ticket #3042: 3042_2.patch
File 3042_2.patch, 7.6 KB (added by , 16 years ago) |
---|
-
_source/plugins/listblock/plugin.js
29 29 { 30 30 pendingHtml : [], 31 31 items : {}, 32 // Rendering sequence of the list item ids. 33 itemList : [], 32 34 groups : {} 33 35 }; 34 36 }, … … 79 81 this._.started = 1; 80 82 } 81 83 82 this._.item s[ value ] = id;84 this._.itemList.push ( this._.items[ value ] = id ); 83 85 84 86 pendingHtml.push( '<li id=cke_', id, ' class=cke_panel_listItem><a hidefocus=true href="javascript:void(\'', value, '\')" onclick="CKEDITOR.tools.callFunction(', this._.getClick(), ',\'', value, '\');">', html || value, '</a></li>' ); 85 87 }, 86 88 89 /** 90 * Get the navigator cursor of the list items. 91 * Note : This function is used for establish keyboard accessiblity through the list. 92 */ 93 getCursor : function() 94 { 95 var doc = this.element.getDocument(), 96 idPrefix = 'cke_', 97 self = this, 98 itemList = self._.itemList, 99 items = self._.items; 100 101 var getItem = function ( itemIndex ) 102 { 103 return doc.getById( idPrefix + itemList[ itemIndex ] ); 104 }, 105 getItemLink = function ( itemIndex ) 106 { 107 return getItem( itemIndex ).getFirst().$; 108 }, 109 getItemValue = function ( itemIndex ) 110 { 111 for( var i in items ) 112 { 113 if( items [ i ] == itemList[ itemIndex ] ) 114 return i; 115 } 116 }, 117 isHiddenItem = function( itemIndex ){ 118 return getItem( itemIndex ).getComputedStyle( 'display' ) == 'none'; 119 }; 120 121 return { 122 123 currentIndex : -1, 124 125 forward : function() { 126 this.currentIndex = this.currentIndex == itemList.length -1 ? 0 : ( this.currentIndex + 1 ) ; 127 if( isHiddenItem( this.currentIndex ) ) 128 this.forward(); 129 }, 130 131 back : function() { 132 this.currentIndex = this.currentIndex <= 0 ? itemList.length -1 : ( this.currentIndex - 1 ); 133 if( isHiddenItem( this.currentIndex ) ) 134 this.back(); 135 }, 136 137 // Set current cursor position 138 setCursor : function( itemValue ) 139 { 140 var itemId = items[ itemValue ]; 141 var i, l = itemList.length; 142 for (i = 0; i < l; i++) { 143 if( itemList[ i ] == itemId ) 144 { 145 this.currentIndex = i; 146 return; 147 } 148 } 149 }, 150 151 focusAtCursor : function() 152 { 153 getItemLink( this.currentIndex ).focus(); 154 self.mark( getItemValue( this.currentIndex ) ); 155 }, 156 157 clickAtCursor: function() 158 { 159 getItemLink( this.currentIndex ).onclick(); 160 } 161 }; 162 }, 163 87 164 startGroup : function( title ) 88 165 { 89 166 this._.close(); … … 157 234 158 235 mark : function( value ) 159 236 { 160 if ( !this.multiSelect ) 161 this.unmarkAll(); 162 237 if( this._.previousMarked ) 238 this.unmark( this._.previousMarked ); 163 239 this.element.getDocument().getById( 'cke_' + this._.items[ value ] ).addClass( 'cke_selected' ); 240 this._.previousMarked = value; 164 241 }, 165 242 166 243 unmark : function( value ) -
_source/plugins/richcombo/plugin.js
47 47 this._ = 48 48 { 49 49 panelDefinition : panelDefinition, 50 items : {} 50 items : {}, 51 /** 52 * @see {@link CKEDITOR.ui.listBlock::getCursor} 53 */ 54 listItemCursor : null, 51 55 }; 52 56 }, 53 57 … … 100 104 _.committed = 1; 101 105 } 102 106 107 _.listItemCursor = _.list.getCursor(); 108 103 109 var value = this.getValue(); 104 110 if ( value ) 111 { 105 112 _.list.mark( value ); 113 114 // Ignore initial cursor position of multiple select combo 115 if ( !this.multiSelect ) 116 _.listItemCursor.setCursor( value ); 117 } 106 118 else 107 119 _.list.unmarkAll(); 120 121 // Register combo key processing on CKEDITOR.ui.panel. 122 _.panel._.panel.onKeyDown = CKEDITOR.tools.bind( this.onPanelKeyDown, this ); 123 _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 ); 108 124 109 _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 );110 125 }, 111 126 this ); 112 127 … … 297 312 commit : function() 298 313 { 299 314 this._.list.commit(); 315 }, 316 317 /** 318 * Key navigation logic for combo panel. 319 * @see {@link CKEDITOR.ui.panel.onKeyDown} 320 */ 321 onPanelKeyDown : function( keystroke ) 322 { 323 var cursor = this._.listItemCursor; 324 switch ( keystroke ) 325 { 326 case 40 : // DOWN-ARROW 327 case 9 : // TAB 328 cursor.forward(); 329 cursor.focusAtCursor(); 330 break; 331 case 38 : // UP-ARROW 332 case CKEDITOR.SHIFT + 9 : // SHIFT + TAB 333 cursor.back(); 334 cursor.focusAtCursor(); 335 break; 336 case 27 : // ESC 337 this._.panel.hide(); 338 break; 339 case 13 : // ENTER 340 case 32 : // SPACE 341 cursor.clickAtCursor(); 342 break; 343 } 300 344 } 301 345 } 302 346 }); -
_source/plugins/floatpanel/plugin.js
65 65 66 66 proto : 67 67 { 68 68 69 addBlock : function( name, block ) 69 70 { 70 71 return this._.panel.addBlock( name, block ); … … 120 121 else 121 122 element.removeStyle( 'height' ); 122 123 123 // Configure the IFrame blur event. Do thatonly once.124 if ( !this._. blurSet)124 // Configure the Panel(IFrame) events only once. 125 if ( !this._.panel._.eventInited ) 125 126 { 126 127 // Non IE prefer the event into a window object. 127 var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow ); 128 var focused = CKEDITOR.env.ie ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow ), 129 panelDoc = new CKEDITOR.dom.document( iframe.$.contentWindow.document ); 128 130 129 131 focused.on( 'blur', function() 130 132 { … … 139 141 this.hideChild(); 140 142 }, 141 143 this ); 142 143 this._.blurSet = 1; 144 145 panelDoc.on( 'keydown', function( evt ){ 146 // Delegate key processing to specific control types. 147 if( this.onKeyDown ) 148 { 149 var keystroke = evt.data.getKeystroke(); 150 this.onKeyDown( keystroke ); 151 evt.data.preventDefault(); 152 } 153 }, this._.panel ); 154 155 this._.panel._.eventInited = true; 144 156 } 145 157 146 158 // Set the IFrame focus, so the blur event gets fired. -
_source/plugins/panel/plugin.js
177 177 block.show(); 178 178 179 179 return block; 180 } 180 }, 181 182 /** 183 * This's a hook function provided by various panel based controls 184 * to handle keystrokes. When a control is opening it's own block, 185 * this function is required to be registered. 186 * 187 * @param {String} keystroke The current keystroke presentaton. 188 */ 189 onKeyDown : null 181 190 }; 182 191 183 192 CKEDITOR.ui.panel.block = function( blockHolder )