Ticket #3042: 3042_4.patch
File 3042_4.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
37 37 block.autoSize = true; 38 38 block.element.addClass( 'cke_colorblock' ); 39 39 block.element.setHtml( renderColors( panel, type ) ); 40 41 var keys = block.keys; 42 keys[ 39 ] = 'next'; // ARROW-RIGHT 43 keys[ 9 ] = 'next'; // TAB 44 keys[ 37 ] = 'prev'; // ARROW-LEFT 45 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 46 keys[ 32 ] = 'click'; // SPACE 40 47 }, 41 48 42 49 onOpen : function() … … 93 100 94 101 // Render the "Automatic" button. 95 102 output.push( 96 '<a class="cke_colorauto"' + 103 '<a class="cke_colorauto" _cke_focus=1 hidefocus=true' + 104 ' title="', lang.auto, '"' + 97 105 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',null,\'', type, '\');"' + 98 106 ' href="javascript:void(\'', lang.auto, '\')">' + 99 107 '<table cellspacing=0 cellpadding=0 width="100%">' + … … 118 126 var color = colors[ i ]; 119 127 output.push( 120 128 '<td>' + 121 '<a class="cke_colorbox"' + 129 '<a class="cke_colorbox" _cke_focus=1 hidefocus=true' + 130 ' title="', color, '"' + 122 131 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'#', color, '\',\'', type, '\');"' + 123 132 ' href="javascript:void(\'', color, '\')">' + 124 133 '<span class="cke_colorbox" style="background-color:#', color, '"></span>' + … … 133 142 '</tr>' + 134 143 '<tr>' + 135 144 '<td colspan=8 align=center>' + 136 '<a class="cke_colormore"' + 145 '<a class="cke_colormore" _cke_focus=1 hidefocus=true' + 146 ' title="', lang.more, '"' + 137 147 ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'?\',\'', type, '\');"' + 138 148 ' href="javascript:void(\'', lang.more, '\')">', 139 149 lang.more, -
_source/plugins/floatpanel/plugin.js
150 150 iframe.$.contentWindow.focus(); 151 151 }, 0); 152 152 153 panel.onEscape = CKEDITOR.tools.bind( function() 154 { 155 this.onEscape && this.onEscape(); 156 }, 157 this ); 158 153 159 if ( this.onShow ) 154 160 this.onShow.call( this ); 155 161 }, -
_source/plugins/listblock/plugin.js
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
138 138 }, 139 139 this); 140 140 141 doc.on( 'keydown', function( evt ) 142 { 143 var keystroke = evt.data.getKeystroke(); 144 145 // Delegate key processing to block. 146 if ( this._.onKeyDown && this._.onKeyDown( keystroke ) === false ) 147 { 148 evt.data.preventDefault(); 149 return; 150 } 151 152 if ( keystroke == 27 ) // ESC 153 this.onEscape && this.onEscape(); 154 }, 155 this ); 156 141 157 holder = doc.getBody(); 142 158 } 143 159 else … … 175 191 176 192 this._.currentBlock = block; 177 193 194 // Reset the focus index, so it will always go into the first one. 195 block._.focusIndex = -1; 196 197 this._.onKeyDown = block.onKeyDown && CKEDITOR.tools.bind( block.onKeyDown, block ); 198 178 199 block.show(); 179 200 180 201 return block; 181 202 } 182 203 }; 183 204 184 CKEDITOR.ui.panel.block = function( blockHolder )205 CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass( 185 206 { 186 this.element = blockHolder.append(187 blockHolder.getDocument().createElement( 'div',188 {189 attributes :207 $ : function( blockHolder ) 208 { 209 this.element = blockHolder.append( 210 blockHolder.getDocument().createElement( 'div', 190 211 { 191 'class' : 'cke_panel_block' 192 }, 193 styles : 194 { 195 display : 'none' 196 } 197 }) ); 198 }; 212 attributes : 213 { 214 'class' : 'cke_panel_block' 215 }, 216 styles : 217 { 218 display : 'none' 219 } 220 }) ); 221 222 this.keys = {}; 223 224 this._.focusIndex = -1; 225 }, 226 227 _ : {}, 199 228 200 CKEDITOR.ui.panel.block.prototype = 201 { 202 show : function() 229 proto : 203 230 { 204 this.element.setStyle( 'display', '' ); 205 }, 231 show : function() 232 { 233 this.element.setStyle( 'display', '' ); 234 }, 206 235 207 hide : function() 208 { 209 this.element.setStyle( 'display', 'none' ); 236 hide : function() 237 { 238 this.element.setStyle( 'display', 'none' ); 239 }, 240 241 onKeyDown : function( keystroke ) 242 { 243 var keyAction = this.keys[ keystroke ]; 244 switch ( keyAction ) 245 { 246 // Move forward. 247 case 'next' : 248 var index = this._.focusIndex, 249 links = this.element.getElementsByTag( 'a' ), 250 link; 251 252 while ( ( link = links.getItem( ++index ) ) ) 253 { 254 // Move the focus only if the element is marked with 255 // the _cke_focus and it it's visible (check if it has 256 // width). 257 if ( link.getAttribute( '_cke_focus' ) && link.$.offsetWidth ) 258 { 259 this._.focusIndex = index; 260 link.focus(); 261 break; 262 } 263 } 264 return false; 265 266 // Move backward. 267 case 'prev' : 268 var index = this._.focusIndex, 269 links = this.element.getElementsByTag( 'a' ), 270 link; 271 272 while ( index > 0 && ( link = links.getItem( --index ) ) ) 273 { 274 // Move the focus only if the element is marked with 275 // the _cke_focus and it it's visible (check if it has 276 // width). 277 if ( link.getAttribute( '_cke_focus' ) && link.$.offsetWidth ) 278 { 279 this._.focusIndex = index; 280 link.focus(); 281 break; 282 } 283 } 284 return false; 285 286 case 'click' : 287 var index = this._.focusIndex, 288 link = index >= 0 && this.element.getElementsByTag( 'a' ).getItem( index ); 289 290 if ( link ) 291 link.$.click(); 292 293 return false; 294 } 295 } 210 296 } 211 } ;297 }); -
_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 }); … … 190 193 if ( me.onClose ) 191 194 me.onClose(); 192 195 }; 196 197 panel.onEscape = function() 198 { 199 panel.hide(); 200 me.document.getById( _.id ).focus(); 201 }; 202 193 203 194 204 if ( this.onBlock ) 195 205 this.onBlock( panel, _.id ); -
_source/plugins/richcombo/plugin.js
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 class="cke_rcombo">', 146 148 '<span id=', id ); … … 202 204 this.element.getFirst().addClass( me.className + '_panel' ); 203 205 204 206 me.document.getById( 'cke_' + me.id ).addClass( 'cke_on'); 207 208 list.focus( !me.multiSelect && me.getValue() ); 205 209 206 210 me._.on = 1; 207 211 … … 222 226 me.onClose(); 223 227 }; 224 228 229 panel.onEscape = function() 230 { 231 panel.hide(); 232 me.document.getById( 'cke_' + me.id ).getFirst().getNext().focus(); 233 }; 234 225 235 list.onClick = function( value, marked ) 226 236 { 227 237 // Move the focus to the main windows, otherwise it will stay … … 288 298 add : function( value, html, text ) 289 299 { 290 300 this._.items[ value ] = text || value; 291 this._.list.add( value, html );301 this._.list.add( value, html, text ); 292 302 }, 293 303 294 304 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;