Ticket #6376: 6376_3.patch

File 6376_3.patch, 2.2 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/bidi/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    5252                        chromeRoot.removeClass( 'cke_mixed_dir_content' );
    5353        }
    5454
    55         function switchDir( element, dir, editor, state )
     55        function switchDir( element, dir, editor )
    5656        {
     57                var useComputedState = editor.config.useComputedState;
     58                useComputedState = useComputedState === undefined || useComputedState;
     59               
     60                var elementDir = useComputedState ? element.getComputedStyle( 'direction' )
     61                        : element.getStyle( 'direction' ) || element.hasAttribute( 'dir' );
     62
     63                // Stop if direction is same as present.
     64                if ( elementDir == dir )
     65                        return;
     66
    5767                var dirBefore = element.getComputedStyle( 'direction' );
    5868
    59                 element.removeStyle( 'direction' );
    6069                element.removeAttribute( 'dir' );
     70                element.setStyle( 'direction', dir );
    6171
    62                 if ( state == CKEDITOR.TRISTATE_OFF && element.getComputedStyle( 'direction' ).toLowerCase() != dir )
    63                         element.setAttribute( 'dir', dir );
    64 
    6572                // If the element direction changed, we need to switch the margins of
    6673                // the element and all its children, so it will get really reflected
    6774                // like a mirror. (#5910)
     
    7077                        editor.fire( 'dirChanged', element );
    7178
    7279                editor.forceNextSelectionCheck();
     80
     81                return null;
    7382        }
    7483
    7584        function getFullySelected( selection, elements )
     
    108117                                if ( selectedElement )
    109118                                {
    110119                                        if ( !selectedElement.isReadOnly() )
    111                                                 switchDir( selectedElement, dir, editor, this.state );
     120                                                switchDir( selectedElement, dir, editor );
    112121                                }
    113122                                else
    114123                                {
     
    135144
    136145                                                while ( ( block = walker.next() ) )
    137146                                                {
    138                                                         switchDir( block, dir, editor, this.state );
     147                                                        switchDir( block, dir, editor );
    139148                                                        processedElements.push( block );
    140149                                                }
    141150
     
    171180
    172181                                                        if ( !_break )
    173182                                                        {
    174                                                                 switchDir( block, dir, editor, this.state );
     183                                                                switchDir( block, dir, editor );
    175184                                                        }
    176185                                                }
    177186                                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy