Ticket #6749: 6749.patch
File 6749.patch, 12.5 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 … … 179 179 if ( this.className ) 180 180 classes += ' ' + this.className; 181 181 182 if ( this.className ) 183 classes += ' cke_pane_button'; 184 182 185 output.push( 183 186 '<span class="cke_button' + ( this.icon && this.icon.indexOf( '.png' ) == -1 ? ' cke_noalphafix' : '' ) + '">', 184 187 '<a id="', id, '"' + … … 225 228 '> </span>' + 226 229 '<span id="', id, '_label" class="cke_label">', this.label, '</span>' ); 227 230 231 if (this.additionalHTML) 232 output.push( this.additionalHTML ); 233 234 output.push( '</a>' ); 235 228 236 if ( this.hasArrow ) 229 237 { 230 238 output.push( 239 '<a id="', id, '_arrow"' + 240 ' class="', classes, '"', 241 env.gecko && env.version >= 10900 && !env.hc ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'", '' )+ '\')"', 242 ' title="', this.title, '"' + 243 ' tabindex="-1"' + 244 ' hidefocus="true"' + 245 ' role="button"' + 246 ' aria-labelledby="' + id + '_label"' + 247 ' aria-haspopup="true"' ); 248 249 // Some browsers don't cancel key events in the keydown but in the 250 // keypress. 251 // TODO: Check if really needed for Gecko+Mac. 252 if ( env.opera || ( env.gecko && env.mac ) ) 253 { 254 output.push( 255 ' onkeypress="return false;"' ); 256 } 257 258 // With Firefox, we need to force the button to redraw, otherwise it 259 // will remain in the focus state. 260 if ( env.gecko ) 261 { 262 output.push( 263 ' onblur="this.style.cssText = this.style.cssText;"' ); 264 } 265 266 output.push( 267 ' onkeydown="return CKEDITOR.tools.callFunction(', keydownFn, ', event);"' + 268 ' onfocus="return CKEDITOR.tools.callFunction(', focusFn,', event);" ' + 269 ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188 270 '="CKEDITOR.tools.callFunction(', clickFn, ', this, true); return false;">' ); 271 272 output.push( 231 273 '<span class="cke_buttonarrow">' 232 274 // BLACK DOWN-POINTING TRIANGLE 233 275 + ( CKEDITOR.env.hc ? '▼' : ' ' ) 234 276 + '</span>' ); 277 output.push( '</a>' ); 235 278 } 236 279 237 output.push( 238 '</a>', 239 '</span>' ); 280 output.push( '</span>' ); 240 281 241 282 if ( this.onRender ) 242 283 this.onRender(); … … 264 305 element.setAttribute( 'aria-pressed', true ) : 265 306 element.removeAttribute( 'aria-pressed' ); 266 307 308 // If the button has an arrow, apply the same state to it 309 if ( this.hasArrow ) 310 { 311 element = CKEDITOR.document.getById( this._.id + '_arrow' ); 312 313 if ( element ) 314 { 315 element.setState( state ); 316 state == CKEDITOR.TRISTATE_DISABLED ? 317 element.setAttribute( 'aria-disabled', true ) : 318 element.removeAttribute( 'aria-disabled' ); 319 320 state == CKEDITOR.TRISTATE_ON ? 321 element.setAttribute( 'aria-pressed', true ) : 322 element.removeAttribute( 'aria-pressed' ); 323 } 324 } 325 267 326 return true; 268 327 } 269 328 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/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/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_color_preview 421 { 422 bottom: 0; 423 display: inline-block; 424 height: 3px; 425 left: 4px; 426 position: absolute; 427 width: 16px; 428 } -
_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_color_preview 532 { 533 bottom: 0; 534 display: inline-block; 535 height: 3px; 536 left: 4px; 537 position: absolute; 538 width: 16px; 539 } -
_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_color_preview 475 { 476 bottom: 0; 477 display: inline-block; 478 height: 3px; 479 left: 4px; 480 position: absolute; 481 width: 16px; 482 }