Ticket #6479: 6479_2.patch

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

Patch

  • _source/plugins/enterkey/plugin.js

     
    115115                                        newBlock = nextBlock.clone();
    116116
    117117                                if ( !newBlock )
     118                                {
    118119                                        newBlock = doc.createElement( blockTag );
     120                                        previousBlock && previousBlock.hasAttribute( 'dir' ) && newBlock.setAttribute( 'dir', previousBlock.getAttribute( 'dir' ) );
     121                                }
    119122                                // Force the enter block unless we're talking of a list item.
    120123                                else if ( forceMode && !newBlock.is( 'li' ) )
    121124                                        newBlock.renameNode( blockTag );
     
    222225                        // If we are at the end of a header block.
    223226                        if ( !forceMode && isEndOfBlock && headerTagRegex.test( startBlockTag ) )
    224227                        {
    225                                 // Insert a <br> after the current paragraph.
    226                                 doc.createElement( 'br' ).insertAfter( startBlock );
     228                                var newBlock;
     229                                if ( startBlock.hasAttribute( 'dir' ) )
     230                                {
     231                                        newBlock = doc.createElement( 'div' );
     232                                        newBlock.setAttribute( 'dir', startBlock.getAttribute( 'dir' ) );
     233                                        newBlock.insertAfter( startBlock );
     234                                        range.setStart( newBlock, 0 );
     235                                }
     236                                else
     237                                {
     238                                        // Insert a <br> after the current paragraph.
     239                                        doc.createElement( 'br' ).insertAfter( startBlock );
    227240
    228                                 // A text node is required by Gecko only to make the cursor blink.
    229                                 if ( CKEDITOR.env.gecko )
    230                                         doc.createText( '' ).insertAfter( startBlock );
     241                                        // A text node is required by Gecko only to make the cursor blink.
     242                                        if ( CKEDITOR.env.gecko )
     243                                                doc.createText( '' ).insertAfter( startBlock );
    231244
    232                                 // IE has different behaviors regarding position.
    233                                 range.setStartAt( startBlock.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START );
     245                                        // IE has different behaviors regarding position.
     246                                        range.setStartAt( startBlock.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START );
     247                                }
    234248                        }
    235249                        else
    236250                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy