Ticket #7432: 7432_2.patch
File 7432_2.patch, 1.5 KB (added by , 13 years ago) |
---|
-
_source/plugins/list/plugin.js
457 457 listCommand.prototype = { 458 458 exec : function( editor ) 459 459 { 460 editor.focus();461 462 460 var doc = editor.document, 461 config = editor.config, 463 462 selection = editor.getSelection(), 464 463 ranges = selection && selection.getRanges( true ); 465 464 … … 473 472 if ( this.state == CKEDITOR.TRISTATE_OFF ) 474 473 { 475 474 var body = doc.getBody(); 476 body.trim(); 477 if ( !body.getFirst() ) 475 if ( !body.getFirst( nonEmpty ) ) 478 476 { 479 var paragraph = doc.createElement( editor.config.enterMode == CKEDITOR.ENTER_P ? 'p' : 480 ( editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'br' ) ); 481 paragraph.appendTo( body ); 482 ranges = new CKEDITOR.dom.rangeList( [ new CKEDITOR.dom.range( doc ) ] ); 483 // IE exception on inserting anything when anchor inside <br>. 484 if ( paragraph.is( 'br' ) ) 485 { 486 ranges[ 0 ].setStartBefore( paragraph ); 487 ranges[ 0 ].setEndAfter( paragraph ); 488 } 489 else 490 ranges[ 0 ].selectNodeContents( paragraph ); 477 config.enterMode == CKEDITOR.ENTER_BR ? 478 body.appendBogus() : 479 ranges[ 0 ].fixBlock( 1, config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ); 480 491 481 selection.selectRanges( ranges ); 492 482 } 493 483 // Maybe a single range there enclosing the whole list,