Ticket #6749: 6749_2.patch
File 6749_2.patch, 14.9 KB (added by , 11 years ago) |
---|
-
_source/plugins/button/plugin.js
87 87 var element = CKEDITOR.document.getById( id ); 88 88 element.focus(); 89 89 }, 90 execute : function( )90 execute : function( button, onArrow ) 91 91 { 92 92 // IE 6 needs some time before execution (#7922) 93 93 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) 94 CKEDITOR.tools.setTimeout( function(){ this.button.click( editor ); }, 0, this );94 CKEDITOR.tools.setTimeout( function(){ this.button.click( editor, button, onArrow ); }, 0, this ); 95 95 else 96 this.button.click( editor );96 this.button.click( editor, button, onArrow ); 97 97 } 98 98 }; 99 99 … … 182 182 output.push( 183 183 '<span class="cke_button' + ( this.icon && this.icon.indexOf( '.png' ) == -1 ? ' cke_noalphafix' : '' ) + '">', 184 184 '<a id="', id, '"' + 185 ' class="', classes, '"',185 ' class="', classes, ( this.hasArrow ? ' cke_pane_button' : '' ), '"', 186 186 env.gecko && env.version >= 10900 && !env.hc ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'", '' )+ '\')"', 187 187 ' title="', this.title, '"' + 188 188 ' tabindex="-1"' + … … 225 225 '> </span>' + 226 226 '<span id="', id, '_label" class="cke_label">', this.label, '</span>' ); 227 227 228 if (this.additionalHTML) 229 output.push( this.additionalHTML ); 230 231 output.push( '</a>' ); 232 228 233 if ( this.hasArrow ) 229 234 { 230 235 output.push( 236 '<a id="', id, '_arrow"' + 237 ' class="', classes, ' cke_pane_arrow', '"', 238 env.gecko && env.version >= 10900 && !env.hc ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'", '' )+ '\')"', 239 ' title="', this.title, '"' + 240 ' tabindex="-1"' + 241 ' hidefocus="true"' + 242 ' role="button"' + 243 ' aria-labelledby="' + id + '_label"' + 244 ' aria-haspopup="true"' ); 245 246 // Some browsers don't cancel key events in the keydown but in the 247 // keypress. 248 // TODO: Check if really needed for Gecko+Mac. 249 if ( env.opera || ( env.gecko && env.mac ) ) 250 { 251 output.push( 252 ' onkeypress="return false;"' ); 253 } 254 255 // With Firefox, we need to force the button to redraw, otherwise it 256 // will remain in the focus state. 257 if ( env.gecko ) 258 { 259 output.push( 260 ' onblur="this.style.cssText = this.style.cssText;"' ); 261 } 262 263 output.push( 264 ' onkeydown="return CKEDITOR.tools.callFunction(', keydownFn, ', event);"' + 265 ' onfocus="return CKEDITOR.tools.callFunction(', focusFn,', event);" ' + 266 ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188 267 '="CKEDITOR.tools.callFunction(', clickFn, ', this, true); return false;">' ); 268 269 output.push( 231 270 '<span class="cke_buttonarrow">' 232 271 // BLACK DOWN-POINTING TRIANGLE 233 272 + ( CKEDITOR.env.hc ? '▼' : ' ' ) 234 273 + '</span>' ); 274 output.push( '</a>' ); 235 275 } 236 276 237 output.push( 238 '</a>', 239 '</span>' ); 277 output.push( '</span>' ); 240 278 241 279 if ( this.onRender ) 242 280 this.onRender(); … … 264 302 element.setAttribute( 'aria-pressed', true ) : 265 303 element.removeAttribute( 'aria-pressed' ); 266 304 305 // If the button has an arrow, apply the same state to it 306 if ( this.hasArrow ) 307 { 308 element = CKEDITOR.document.getById( this._.id + '_arrow' ); 309 310 if ( element ) 311 { 312 element.setState( state ); 313 state == CKEDITOR.TRISTATE_DISABLED ? 314 element.setAttribute( 'aria-disabled', true ) : 315 element.removeAttribute( 'aria-disabled' ); 316 317 state == CKEDITOR.TRISTATE_ON ? 318 element.setAttribute( 'aria-pressed', true ) : 319 element.removeAttribute( 'aria-pressed' ); 320 } 321 } 322 267 323 return true; 268 324 } 269 325 else -
_source/plugins/colorbutton/plugin.js
15 15 init : function( editor ) 16 16 { 17 17 var config = editor.config, 18 lang = editor.lang.colorButton; 18 lang = editor.lang.colorButton, 19 lastColor = {}; 19 20 20 21 var clickFn; 21 22 22 23 if ( !CKEDITOR.env.hc ) 23 24 { 24 addButton( 'TextColor', 'fore', lang.textColorTitle );25 addButton( 'BGColor', 'back', lang.bgColorTitle );25 addButton( 'TextColor', 'fore', lang.textColorTitle, editor.config.colorButton_defaultFore || '#f00' ); 26 addButton( 'BGColor', 'back', lang.bgColorTitle, editor.config.colorButton_defaultBack || '#a9a9a9' ); 26 27 } 27 28 28 function addButton( name, type, title )29 function addButton( name, type, title, initialValue ) 29 30 { 30 31 var colorBoxId = CKEDITOR.tools.getNextId() + '_colorBox'; 32 33 lastColor[ type ] = initialValue; 34 31 35 editor.ui.add( name, CKEDITOR.UI_PANELBUTTON, 32 36 { 33 37 label : title, 34 38 title : title, 35 39 className : 'cke_button_' + name.toLowerCase(), 36 40 modes : { wysiwyg : 1 }, 37 41 additionalHTML : '<span class="cke_color_preview" id="' + type + '_preview_' + editor.id + '" style="background:' + initialValue + ';"></span>', 38 42 panel : 39 43 { 40 44 css : editor.skin.editor.css, 41 45 attributes : { role : 'listbox', 'aria-label' : lang.panelTitle } 42 46 }, 43 47 48 onButtonClick: function() 49 { 50 // one-click color 51 applyColor( lastColor[ type ], type ); 52 }, 53 44 54 onBlock : function( panel, block ) 45 55 { 46 56 block.autoSize = true; … … 89 99 }); 90 100 } 91 101 102 function applyColor( color, type ) 103 { 104 editor.focus(); 92 105 106 editor.fire( 'saveSnapshot' ); 107 108 // Clean up any conflicting style within the range. 109 new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document ); 110 111 if ( color ) 112 { 113 var colorStyle = config['colorButton_' + type + 'Style']; 114 115 colorStyle.childRule = type == 'back' ? 116 function( element ) 117 { 118 // It's better to apply background color as the innermost style. (#3599) 119 // Except for "unstylable elements". (#6103) 120 return isUnstylable( element ); 121 } 122 : 123 function( element ) 124 { 125 // Fore color style must be applied inside links instead of around it. (#4772,#6908) 126 return !( element.is( 'a' ) || element.getElementsByTag( 'a' ).count() ) || isUnstylable( element ); 127 }; 128 129 new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document ); 130 } 131 132 editor.fire( 'saveSnapshot' ); 133 134 // Update toolbar preview: 135 var preview = CKEDITOR.document.getById( type + '_preview_' + editor.id ); 136 if ( preview ) 137 preview.setStyle('backgroundColor', color); 138 } 139 93 140 function renderColors( panel, type, colorBoxId ) 94 141 { 95 142 var output = [], … … 117 164 return; 118 165 } 119 166 120 editor.focus(); 167 // Store it for one-click reuse 168 lastColor[ type ] = color; 121 169 122 170 panel.hide( false ); 123 171 124 editor.fire( 'saveSnapshot' ); 125 126 // Clean up any conflicting style within the range. 127 new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document ); 128 129 if ( color ) 130 { 131 var colorStyle = config['colorButton_' + type + 'Style']; 132 133 colorStyle.childRule = type == 'back' ? 134 function( element ) 135 { 136 // It's better to apply background color as the innermost style. (#3599) 137 // Except for "unstylable elements". (#6103) 138 return isUnstylable( element ); 139 } 140 : 141 function( element ) 142 { 143 // Fore color style must be applied inside links instead of around it. (#4772,#6908) 144 return !( element.is( 'a' ) || element.getElementsByTag( 'a' ).count() ) || isUnstylable( element ); 145 }; 146 147 new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document ); 148 } 149 150 editor.fire( 'saveSnapshot' ); 172 applyColor( color, type ); 151 173 }); 152 174 153 175 // Render the "Automatic" button. … … 298 320 element : 'span', 299 321 styles : { 'background-color' : '#(color)' } 300 322 }; 323 324 /** 325 * Default value for the text foreground color button. 326 * @name CKEDITOR.config.colorButton_defaultFore 327 * @default <code>'#f00'</code> 328 * @type string 329 * @since 3.6.3 330 * @example 331 * config.colorButton_defaultFore = '#0f0'; 332 */ 333 334 /** 335 * Default value for the text background color button. 336 * @name CKEDITOR.config.colorButton_defaultBack 337 * @default <code>'#a9a9a9'</code> 338 * @type string 339 * @since 3.6.3 340 * @example 341 * config.colorButton_defaultBack = '#ff0'; 342 */ 343 No newline at end of file -
_source/plugins/menubutton/plugin.js
21 21 22 22 (function() 23 23 { 24 var clickFn = function( editor )24 var clickFn = function( editor, button, onArrow ) 25 25 { 26 26 var _ = this._; 27 27 … … 29 29 if ( _.state === CKEDITOR.TRISTATE_DISABLED ) 30 30 return; 31 31 32 // If the click wasn't on the arrow and the instance has a handler defined 33 // notify it and don't show the pane 34 if ( !onArrow && this.onButtonClick ) 35 { 36 this.onButtonClick(); 37 return; 38 } 39 32 40 _.previousState = _.state; 33 41 34 42 // Check if we already have a menu for it, otherwise just create it. -
_source/plugins/panelbutton/plugin.js
8 8 requires : [ 'button' ], 9 9 onLoad : function() 10 10 { 11 function clickFn( editor )11 function clickFn( editor, button, onArrow ) 12 12 { 13 13 var _ = this._; 14 14 15 15 if ( _.state == CKEDITOR.TRISTATE_DISABLED ) 16 16 return; 17 17 18 // If the click wasn't on the arrow and the instance has a handler defined 19 // notify it and don't show the pane 20 if ( !onArrow && this.onButtonClick ) 21 { 22 this.onButtonClick(); 23 return; 24 } 25 18 26 this.createPanel( editor ); 19 27 20 28 if ( _.on ) -
_source/plugins/scayt/plugin.js
615 615 { 616 616 command.on( 'state', function() 617 617 { 618 console.log(this) 618 619 this.setState( command.state ); 619 620 }, 620 621 this); 621 622 }, 623 onButtonClick: function() 624 { 625 // one-click toggle 626 command.exec(); 627 }, 622 628 onMenu : function() 623 629 { 624 630 var isEnabled = plugin.isScaytEnabled( editor ); -
_source/skins/kama/toolbar.css
206 206 } 207 207 208 208 .cke_skin_kama .cke_button a:hover.cke_on, 209 .cke_skin_kama .cke_button:hover a.cke_on, 209 210 .cke_skin_kama .cke_button a:focus.cke_on, 210 211 .cke_skin_kama .cke_button a:active.cke_on, /* IE */ 211 212 .cke_skin_kama .cke_button a:hover.cke_off, 213 .cke_skin_kama .cke_button:hover a.cke_off, 212 214 .cke_skin_kama .cke_button a:focus.cke_off, 213 215 .cke_skin_kama .cke_button a:active.cke_off /* IE */ 214 216 { … … 218 220 } 219 221 220 222 .cke_skin_kama .cke_button a:hover, 223 .cke_skin_kama .cke_button:hover a, 221 224 .cke_skin_kama .cke_button a:focus, 222 225 .cke_skin_kama .cke_button a:active /* IE */ 223 226 { … … 225 228 } 226 229 227 230 .cke_skin_kama .cke_button a:hover.cke_on, 231 .cke_skin_kama .cke_button:hover a.cke_on, 228 232 .cke_skin_kama .cke_button a:focus.cke_on, 229 233 .cke_skin_kama .cke_button a:active.cke_on /* IE */ 230 234 { … … 232 236 } 233 237 234 238 .cke_skin_kama .cke_hc .cke_button a:hover, 239 .cke_skin_kama .cke_hc .cke_button:hover a, 235 240 .cke_skin_kama .cke_hc .cke_button a:focus, 236 241 .cke_skin_kama .cke_hc .cke_button a:active /* IE */ 237 242 { … … 406 411 { 407 412 padding-bottom: 0; 408 413 } 414 415 .cke_pane_button 416 { 417 position: relative; 418 } 419 420 .cke_skin_kama .cke_button a.cke_pane_button 421 { 422 border-radius: 3px 0px 0px 3px; 423 border-right: 0; 424 padding-right: 0 !important; 425 } 426 427 .cke_skin_kama .cke_button a.cke_pane_arrow 428 { 429 border-radius: 0px 3px 3px 0px; 430 padding-left: 0 !important; 431 } 432 433 .cke_color_preview 434 { 435 bottom: 0; 436 display: inline-block; 437 height: 3px; 438 left: 4px; 439 position: absolute; 440 width: 16px; 441 } -
_source/skins/office2003/toolbar.css
269 269 } 270 270 271 271 .cke_skin_office2003 .cke_hc .cke_button a:hover, 272 .cke_skin_office2003 .cke_hc .cke_button:hover a, 272 273 .cke_skin_office2003 .cke_hc .cke_button a:focus, 273 274 .cke_skin_office2003 .cke_hc .cke_button a:active /* IE */ 274 275 { … … 308 309 } 309 310 310 311 .cke_skin_office2003 .cke_button a:hover, 312 .cke_skin_office2003 .cke_button:hover a, 311 313 .cke_skin_office2003 .cke_button a:focus, 312 314 .cke_skin_office2003 .cke_button a:active /* IE */ 313 315 { … … 520 522 { 521 523 cursor: default; 522 524 } 525 526 .cke_pane_button 527 { 528 position: relative; 529 } 530 531 .cke_skin_office2003 .cke_button a.cke_pane_button 532 { 533 border-radius: 3px 0px 0px 3px; 534 border-right: 0; 535 padding-right: 0 !important; 536 } 537 538 .cke_skin_office2003 .cke_button a.cke_pane_arrow 539 { 540 border-radius: 0px 3px 3px 0px; 541 padding-left: 0 !important; 542 } 543 544 .cke_color_preview 545 { 546 bottom: 0; 547 display: inline-block; 548 height: 3px; 549 left: 4px; 550 position: absolute; 551 width: 16px; 552 } -
_source/skins/v2/toolbar.css
278 278 } 279 279 280 280 .cke_skin_v2 .cke_button a:hover, 281 .cke_skin_v2 .cke_button:hover a, 281 282 .cke_skin_v2 .cke_button a:focus, 282 283 .cke_skin_v2 .cke_button a:active /* IE */ 283 284 { … … 287 288 } 288 289 289 290 .cke_skin_v2 .cke_hc .cke_button a:hover, 291 .cke_skin_v2 .cke_hc .cke_button:hover a, 290 292 .cke_skin_v2 .cke_hc .cke_button a:focus, 291 293 .cke_skin_v2 .cke_hc .cke_button a:active /* IE */ 292 294 { … … 463 465 { 464 466 cursor: default; 465 467 } 468 469 .cke_pane_button 470 { 471 position: relative; 472 } 473 474 .cke_skin_v2 .cke_button a.cke_pane_button 475 { 476 border-radius: 3px 0px 0px 3px; 477 border-right: 0; 478 padding-right: 0 !important; 479 } 480 481 .cke_skin_v2 .cke_button a.cke_pane_arrow 482 { 483 border-radius: 0px 3px 3px 0px; 484 padding-left: 0 !important; 485 position: relative; 486 top: -1px; 487 } 488 489 .cke_color_preview 490 { 491 bottom: 0; 492 display: inline-block; 493 height: 3px; 494 left: 4px; 495 position: absolute; 496 width: 16px; 497 }