Ticket #3042: 3042_3.patch
File 3042_3.patch, 15.9 KB (added by , 16 years ago) |
---|
-
_source/core/dom/element.js
311 311 */ 312 312 focus : function() 313 313 { 314 this.$.focus(); 314 // IE throws error if the element is not visible. 315 try 316 { 317 this.$.focus(); 318 } 319 catch (e) 320 {} 315 321 }, 316 322 317 323 /** -
_source/core/dom/nodelist.js
17 17 18 18 getItem : function( index ) 19 19 { 20 return new CKEDITOR.dom.node( this.$[ index ] ); 20 var $node = this.$[ index ]; 21 return $node ? new CKEDITOR.dom.node( $node ) : null; 21 22 } 22 23 }; -
_source/plugins/colorbutton/plugin.js
38 38 block.autoSize = true; 39 39 block.element.addClass( 'cke_colorblock' ); 40 40 block.element.setHtml( renderColors( panel, type ) ); 41 42 var keys = block.keys; 43 keys[ 39 ] = 'next'; // ARROW-RIGHT 44 keys[ 9 ] = 'next'; // TAB 45 keys[ 37 ] = 'prev'; // ARROW-LEFT 46 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 47 keys[ 32 ] = 'click'; // SPACE 41 48 }, 42 49 43 50 onOpen : function() … … 94 101 95 102 // Render the "Automatic" button. 96 103 output.push( 97 '<a class="cke_colorauto"' + 104 '<a class="cke_colorauto" _cke_focus=1 hidefocus=true' + 105 ' title="', lang.auto, '"' + 98 106 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',null,\'', type, '\');"' + 99 107 ' href="javascript:void(\'', lang.auto, '\')">' + 100 108 '<table cellspacing=0 cellpadding=0 width="100%">' + … … 119 127 var color = colors[ i ]; 120 128 output.push( 121 129 '<td>' + 122 '<a class="cke_colorbox"' + 130 '<a class="cke_colorbox" _cke_focus=1 hidefocus=true' + 131 ' title="', color, '"' + 123 132 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'#', color, '\',\'', type, '\');"' + 124 133 ' href="javascript:void(\'', color, '\')">' + 125 134 '<span class="cke_colorbox" style="background-color:#', color, '"></span>' + … … 134 143 '</tr>' + 135 144 '<tr>' + 136 145 '<td colspan=8 align=center>' + 137 '<a class="cke_colormore"' + 146 '<a class="cke_colormore" _cke_focus=1 hidefocus=true' + 147 ' title="', lang.more, '"' + 138 148 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'?\',\'', type, '\');"' + 139 149 ' href="javascript:void(\'', lang.more, '\')">', 140 150 lang.more, -
_source/plugins/floatpanel/plugin.js
149 149 iframe.$.contentWindow.focus(); 150 150 }, 0); 151 151 152 panel.onEscape = CKEDITOR.tools.bind( function() 153 { 154 this.onEscape && this.onEscape(); 155 }, 156 this ); 157 152 158 if ( this.onShow ) 153 159 this.onShow.call( this ); 154 160 }, -
_source/plugins/listblock/plugin.js
1 /*1 /* 2 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 24 24 this.base( blockHolder ); 25 25 26 26 this.multiSelect = !!multiSelect; 27 28 var keys = this.keys; 29 keys[ 40 ] = 'next'; // ARROW-DOWN 30 keys[ 9 ] = 'next'; // TAB 31 keys[ 38 ] = 'prev'; // ARROW-UP 32 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 33 keys[ 32 ] = 'click'; // SPACE 27 34 28 35 this._.pendingHtml = []; 29 36 this._.items = {}; … … 65 72 66 73 proto : 67 74 { 68 add : function( value, html )75 add : function( value, html, title ) 69 76 { 70 77 var pendingHtml = this._.pendingHtml, 71 id = CKEDITOR.tools.getNextNumber();78 id = 'cke_' + CKEDITOR.tools.getNextNumber(); 72 79 73 80 if ( !this._.started ) 74 81 { … … 78 85 79 86 this._.items[ value ] = id; 80 87 81 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>' ); 88 pendingHtml.push( 89 '<li id=', id, ' class=cke_panel_listItem>' + 90 '<a _cke_focus=1 hidefocus=true' + 91 ' title="', title || value, '"' + 92 ' href="javascript:void(\'', value, '\')"' + 93 ' onclick="CKEDITOR.tools.callFunction(', this._.getClick(), ',\'', value, '\');">', 94 html || value, 95 '</a>' + 96 '</li>' ); 82 97 }, 83 98 84 99 startGroup : function( title ) 85 100 { 86 101 this._.close(); 87 102 88 var id = CKEDITOR.tools.getNextNumber();103 var id = 'cke_' + CKEDITOR.tools.getNextNumber(); 89 104 90 105 this._.groups[ title ] = id; 91 106 92 this._.pendingHtml.push( '<h1 id= cke_', id, ' class=cke_panel_grouptitle>', title, '</h1>' );107 this._.pendingHtml.push( '<h1 id=', id, ' class=cke_panel_grouptitle>', title, '</h1>' ); 93 108 }, 94 109 95 110 commit : function() … … 112 127 113 128 hideGroup : function( groupTitle ) 114 129 { 115 var group = this.element.getDocument().getById( 'cke_' +this._.groups[ groupTitle ] ),130 var group = this.element.getDocument().getById( this._.groups[ groupTitle ] ), 116 131 list = group && group.getNext(); 117 132 118 133 if ( group ) … … 126 141 127 142 hideItem : function( value ) 128 143 { 129 this.element.getDocument().getById( 'cke_' +this._.items[ value ] ).setStyle( 'display', 'none' );144 this.element.getDocument().getById( this._.items[ value ] ).setStyle( 'display', 'none' ); 130 145 }, 131 146 132 147 showAll : function() … … 137 152 138 153 for ( var value in items ) 139 154 { 140 doc.getById( 'cke_' +items[ value ] ).setStyle( 'display', '' );155 doc.getById( items[ value ] ).setStyle( 'display', '' ); 141 156 } 142 157 143 158 for ( title in groups ) 144 159 { 145 var group = doc.getById( 'cke_' +groups[ title ] ),160 var group = doc.getById( groups[ title ] ), 146 161 list = group.getNext(); 147 162 148 163 group.setStyle( 'display', '' ); … … 157 172 if ( !this.multiSelect ) 158 173 this.unmarkAll(); 159 174 160 this.element.getDocument().getById( 'cke_' +this._.items[ value ] ).addClass( 'cke_selected' );175 this.element.getDocument().getById( this._.items[ value ] ).addClass( 'cke_selected' ); 161 176 }, 162 177 163 178 unmark : function( value ) 164 179 { 165 this.element.getDocument().getById( 'cke_' +this._.items[ value ] ).removeClass( 'cke_selected' );180 this.element.getDocument().getById( this._.items[ value ] ).removeClass( 'cke_selected' ); 166 181 }, 167 182 168 183 unmarkAll : function() … … 172 187 173 188 for ( var value in items ) 174 189 { 175 doc.getById( 'cke_' +items[ value ] ).removeClass( 'cke_selected' );190 doc.getById( items[ value ] ).removeClass( 'cke_selected' ); 176 191 } 177 192 }, 178 193 179 194 isMarked : function( value ) 180 195 { 181 return this.element.getDocument().getById( 'cke_' + this._.items[ value ] ).hasClass( 'cke_selected' ); 196 return this.element.getDocument().getById( this._.items[ value ] ).hasClass( 'cke_selected' ); 197 }, 198 199 focus : function( value ) 200 { 201 this._.focusIndex = -1; 202 203 if ( value ) 204 { 205 var selected = this.element.getDocument().getById( this._.items[ value ] ).getFirst(); 206 207 var links = this.element.getElementsByTag( 'a' ), 208 link, 209 i = -1; 210 211 while( ( link = links.getItem( ++i ) ) ) 212 { 213 if ( link.equals( selected ) ) 214 { 215 this._.focusIndex = i; 216 break; 217 } 218 } 219 220 setTimeout( function() 221 { 222 selected.focus(); 223 }, 224 0 ); 225 } 182 226 } 183 227 } 184 228 }); -
_source/plugins/panel/plugin.js
137 137 }, 138 138 this); 139 139 140 doc.on( 'keydown', function( evt ) 141 { 142 var keystroke = evt.data.getKeystroke(); 143 144 // Delegate key processing to block. 145 if ( this._.onKeyDown && this._.onKeyDown( keystroke ) === false ) 146 { 147 evt.data.preventDefault(); 148 return; 149 } 150 151 if ( keystroke == 27 ) // ESC 152 this.onEscape && this.onEscape(); 153 }, 154 this ); 155 140 156 holder = doc.getBody(); 141 157 } 142 158 else … … 174 190 175 191 this._.currentBlock = block; 176 192 193 this._.onKeyDown = block.onKeyDown && CKEDITOR.tools.bind( block.onKeyDown, block ); 194 177 195 block.show(); 178 196 179 197 return block; 180 198 } 181 199 }; 182 200 183 CKEDITOR.ui.panel.block = function( blockHolder )201 CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass( 184 202 { 185 this.element = blockHolder.append(186 blockHolder.getDocument().createElement( 'div',187 {188 attributes :203 $ : function( blockHolder ) 204 { 205 this.element = blockHolder.append( 206 blockHolder.getDocument().createElement( 'div', 189 207 { 190 'class' : 'cke_panel_block' 191 }, 192 styles : 193 { 194 display : 'none' 195 } 196 }) ); 197 }; 208 attributes : 209 { 210 'class' : 'cke_panel_block' 211 }, 212 styles : 213 { 214 display : 'none' 215 } 216 }) ); 217 218 this.keys = {}; 219 220 this._.focusIndex = -1; 221 }, 222 223 _ : {}, 198 224 199 CKEDITOR.ui.panel.block.prototype = 200 { 201 show : function() 225 proto : 202 226 { 203 this.element.setStyle( 'display', '' ); 204 }, 227 show : function() 228 { 229 this.element.setStyle( 'display', '' ); 230 }, 205 231 206 hide : function() 207 { 208 this.element.setStyle( 'display', 'none' ); 232 hide : function() 233 { 234 this.element.setStyle( 'display', 'none' ); 235 }, 236 237 onKeyDown : function( keystroke ) 238 { 239 var keyAction = this.keys[ keystroke ]; 240 switch ( keyAction ) 241 { 242 // Move forward. 243 case 'next' : 244 var index = this._.focusIndex, 245 links = this.element.getElementsByTag( 'a' ), 246 link; 247 248 while ( ( link = links.getItem( ++index ) ) ) 249 { 250 if ( link.getAttribute( '_cke_focus' ) && link.getStyle( 'display' ) != 'none' ) 251 { 252 this._.focusIndex = index; 253 link.focus(); 254 break; 255 } 256 } 257 return false; 258 259 // Move backward. 260 case 'prev' : 261 var index = this._.focusIndex, 262 links = this.element.getElementsByTag( 'a' ), 263 link; 264 265 while ( index > 0 && ( link = links.getItem( --index ) ) ) 266 { 267 if ( link.getAttribute( '_cke_focus' ) && link.getComputedStyle( 'display' ) != 'none' ) 268 { 269 this._.focusIndex = index; 270 link.focus(); 271 break; 272 } 273 } 274 return false; 275 276 case 'click' : 277 var index = this._.focusIndex, 278 link = index >= 0 && this.element.getElementsByTag( 'a' ).getItem( index ); 279 280 if ( link ) 281 link.$.click(); 282 283 return false; 284 } 285 } 209 286 } 210 } ;287 }); -
_source/plugins/panelbutton/plugin.js
93 93 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ){ 94 94 95 95 ev = new CKEDITOR.dom.event( ev ); 96 96 97 var keystroke = ev.getKeystroke(); 97 98 switch ( keystroke ) 98 99 { 99 case 13 : // ENTER 100 case 32 : // SPACE 100 case 13 : // ENTER 101 case 32 : // SPACE 102 case 40 : // ARROW-DOWN 101 103 // Show panel 102 104 CKEDITOR.tools.callFunction( clickFn, element ); 103 105 break; … … 105 107 // Delegate the default behavior to toolbar button key handling. 106 108 instance.onkey( instance, keystroke ); 107 109 } 110 108 111 // Avoid subsequent focus grab on editor document. 109 112 ev.preventDefault(); 110 113 }); … … 191 194 if ( me.onClose ) 192 195 me.onClose(); 193 196 }; 197 198 panel.onEscape = function() 199 { 200 panel.hide(); 201 me.document.getById( _.id ).focus(); 202 }; 203 194 204 195 205 if ( this.onBlock ) 196 206 this.onBlock( panel, _.id ); -
_source/plugins/richcombo/plugin.js
1 /*1 /* 2 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 120 120 }, 121 121 execute : clickFn 122 122 }; 123 124 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ){ 125 126 ev = new CKEDITOR.dom.event( ev ); 127 var keystroke = ev.getKeystroke(); 128 switch ( keystroke ) 123 124 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ) 129 125 { 130 case 13 : // ENTER 131 case 32 : // SPACE 132 // Show panel 133 CKEDITOR.tools.callFunction( clickFn, element ); 134 break; 135 default : 136 // Delegate the default behavior to toolbar button key handling. 137 instance.onkey( instance, keystroke ); 138 } 139 140 // Avoid subsequent focus grab on editor document. 141 ev.preventDefault(); 142 }); 143 126 ev = new CKEDITOR.dom.event( ev ); 127 128 var keystroke = ev.getKeystroke(); 129 switch ( keystroke ) 130 { 131 case 13 : // ENTER 132 case 32 : // SPACE 133 case 40 : // ARROW-DOWN 134 // Show panel 135 CKEDITOR.tools.callFunction( clickFn, element ); 136 break; 137 default : 138 // Delegate the default behavior to toolbar button key handling. 139 instance.onkey( instance, keystroke ); 140 } 141 142 // Avoid subsequent focus grab on editor document. 143 ev.preventDefault(); 144 }); 145 144 146 output.push( 145 147 '<span id=', id, ' class="cke_rcombo' ); 146 148 … … 200 202 this.element.addClass( me.className ); 201 203 202 204 me.document.getById( 'cke_' + me.id ).addClass( 'cke_on'); 205 206 list.focus( !me.multiSelect && me.getValue() ); 203 207 204 208 me._.on = 1; 205 209 … … 220 224 me.onClose(); 221 225 }; 222 226 227 panel.onEscape = function() 228 { 229 panel.hide(); 230 me.document.getById( 'cke_' + me.id ).getFirst().getNext().focus(); 231 }; 232 223 233 list.onClick = function( value, marked ) 224 234 { 225 235 // Move the focus to the main windows, otherwise it will stay … … 286 296 add : function( value, html, text ) 287 297 { 288 298 this._.items[ value ] = text || value; 289 this._.list.add( value, html );299 this._.list.add( value, html, text ); 290 300 }, 291 301 292 302 startGroup : function( title ) -
_source/skins/default/panel.css
154 154 float: left; 155 155 } 156 156 157 a:hover.cke_colorbox 157 a:hover.cke_colorbox, 158 a:focus.cke_colorbox, 159 a:active.cke_colorbox 158 160 { 159 161 border: #316ac5 1px solid; 160 162 background-color: #dff1ff; … … 169 171 } 170 172 171 173 a:hover.cke_colorauto, 172 a:hover.cke_colormore 174 a:hover.cke_colormore, 175 a:focus.cke_colorauto, 176 a:focus.cke_colormore, 177 a:active.cke_colorauto, 178 a:active.cke_colormore 173 179 { 174 180 border: #316ac5 1px solid; 175 181 background-color: #dff1ff;