Ticket #6479: 6479_3.patch

File 6479_3.patch, 2.2 KB (added by Paweł Horzela, 13 years ago)

Patch

  • _source/plugins/enterkey/plugin.js

     
    9898                        }
    9999                        else
    100100                        {
    101                                 var newBlock;
     101                                var newBlock,
     102                                        newBlockDir;
    102103
    103104                                if ( previousBlock )
    104105                                {
     
    115116                                        newBlock = nextBlock.clone();
    116117
    117118                                if ( !newBlock )
     119                                {
    118120                                        newBlock = doc.createElement( blockTag );
     121                                        if ( previousBlock && ( newBlockDir = previousBlock.getDirection() ) )
     122                                                newBlock.setAttribute( 'dir', newBlockDir );
     123                                }
    119124                                // Force the enter block unless we're talking of a list item.
    120125                                else if ( forceMode && !newBlock.is( 'li' ) )
    121126                                        newBlock.renameNode( blockTag );
     
    222227                        // If we are at the end of a header block.
    223228                        if ( !forceMode && isEndOfBlock && headerTagRegex.test( startBlockTag ) )
    224229                        {
    225                                 // Insert a <br> after the current paragraph.
    226                                 doc.createElement( 'br' ).insertAfter( startBlock );
     230                                var newBlock,
     231                                        newBlockDir;
     232                                       
     233                                if ( newBlockDir = startBlock.getDirection() )
     234                                {
     235                                        newBlock = doc.createElement( 'div' );
     236                                        newBlock.setAttribute( 'dir', newBlockDir );
     237                                        newBlock.insertAfter( startBlock );
     238                                        range.setStart( newBlock, 0 );
     239                                }
     240                                else
     241                                {
     242                                        // Insert a <br> after the current paragraph.
     243                                        doc.createElement( 'br' ).insertAfter( startBlock );
    227244
    228                                 // A text node is required by Gecko only to make the cursor blink.
    229                                 if ( CKEDITOR.env.gecko )
    230                                         doc.createText( '' ).insertAfter( startBlock );
     245                                        // A text node is required by Gecko only to make the cursor blink.
     246                                        if ( CKEDITOR.env.gecko )
     247                                                doc.createText( '' ).insertAfter( startBlock );
    231248
    232                                 // IE has different behaviors regarding position.
    233                                 range.setStartAt( startBlock.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START );
     249                                        // IE has different behaviors regarding position.
     250                                        range.setStartAt( startBlock.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START );
     251                                }
    234252                        }
    235253                        else
    236254                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy