Ticket #4886: 4886.patch
File 4886.patch, 2.2 KB (added by , 13 years ago) |
---|
-
_source/plugins/styles/plugin.js
278 278 return ( styleDefinition._ST = stylesText ); 279 279 }; 280 280 281 282 var notLineContent = CKEDITOR.dom.walker.lineContent( true, true ); 283 281 284 function applyInlineStyle( range ) 282 285 { 283 286 var document = range.document; … … 436 439 // Apply the style if we have something to which apply it. 437 440 if ( applyStyle && hasContents && styleRange && !styleRange.collapsed ) 438 441 { 442 // Tails BRs in the range are never selected by the user, 443 // we shouldn't include them in the range which are either line-breaks 444 // or just block filler in non-IE. (#4886) 445 var walker = new CKEDITOR.dom.walker( styleRange ); 446 walker.guard = notLineContent; 447 walker.evaluator = function( node ) 448 { 449 if( node.type == CKEDITOR.NODE_ELEMENT && node.is( 'br' ) ) 450 styleRange.setEndBefore( node ); 451 }; 452 walker.checkBackward(); 453 439 454 // Build the style element, based on the style object definition. 440 455 var styleNode = getElement( this, document ); 441 456 -
_source/core/dom/walker.js
410 410 }; 411 411 412 412 /** 413 * Whether it's a non-empty text node or non-empty inline element. 414 * @param {Boolean} ignoreBr Br should not be considered as line content. 415 * @param {Boolean} isReject 416 */ 417 CKEDITOR.dom.walker.lineContent = function( ignoreBr, isReject ) 418 { 419 return function( node ) 420 { 421 var isLineContent = node.type == CKEDITOR.NODE_TEXT && !!CKEDITOR.tools.trim( node.getText() ) 422 || ( node.type == CKEDITOR.NODE_ELEMENT 423 && !CKEDITOR.dtd.$removeEmpty[ node.getName() ] 424 && ( !ignoreBr || !node.is( 'br' ) ) ); 425 return !!( isReject ^ isLineContent ); 426 }; 427 }; 428 429 /** 413 430 * Whether the node is invisible in wysiwyg mode. 414 431 * @param isReject 415 432 */