Ticket #5767: 5767.patch
File 5767.patch, 2.1 KB (added by , 14 years ago) |
---|
-
_source/core/dom/element.js
234 234 this.append( new CKEDITOR.dom.text( text ) ); 235 235 }, 236 236 237 appendBogus : function()238 {239 var lastChild = this.getLast() ;240 241 // Ignore empty/spaces text.242 while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )243 lastChild = lastChild.getPrevious();244 if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) )245 {246 var bogus = CKEDITOR.env.opera ?247 this.getDocument().createText('') :248 this.getDocument().createElement( 'br' );249 250 CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' );251 252 this.append( bogus );253 }254 },255 256 237 /** 257 238 * Breaks one of the ancestor element in the element position, moving 258 239 * this element between the broken parts. -
_source/core/dom/walker.js
448 448 return false; 449 449 }; 450 450 451 var whitespaces = CKEDITOR.dom.walker.whitespaces(), 452 bookmarks = CKEDITOR.dom.walker.bookmark( false ); 453 454 CKEDITOR.dom.element.prototype.appendBogus = function () 455 { 456 var range = new CKEDITOR.dom.range( this.document ); 457 range.selectNodeContents( this ); 458 var walker = new CKEDITOR.dom.walker( range ); 459 460 walker.evaluator = function( node ) 461 { 462 if ( whitespaces( node ) 463 || bookmarks( node ) 464 || node.type == CKEDITOR.NODE_ELEMENT 465 && node.getName() in CKEDITOR.dtd.$inline 466 && !( node.getName() in CKEDITOR.dtd.$empty ) ) 467 { 468 return false; 469 } 470 }; 471 472 if ( !walker.previous() ) 473 { 474 var bogus = CKEDITOR.env.opera ? 475 this.getDocument().createText('') : 476 this.getDocument().createElement( 'br' ); 477 478 CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' ); 479 480 this.append( bogus ); 481 } 482 }; 483 451 484 })();