Ticket #6376: 6376.patch

File 6376.patch, 3.1 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/core/dom/element.js

     
    15521552                                                this.setStyle( type, size + 'px' );
    15531553                                        }
    15541554                                };
    1555                 })()
     1555                })(),
     1556
     1557                /**
     1558                 * Checks for element's direction. Supports both CSS 'direction' prop and 'dir' attr.
     1559                 */
     1560                hasDirection : function()
     1561                {
     1562                        return !!( this.hasAttribute( 'dir' ) || this.getStyle( 'direction' ) );
     1563                },
     1564
     1565                /**
     1566                 * Gets element's direction. Supports both CSS 'direction' prop and 'dir' attr.
     1567                 */
     1568                getDirection : function()
     1569                {
     1570                        return this.hasDirection() && this.getAttribute( 'dir' ) || this.getStyle( 'direction' );
     1571                },
     1572
     1573                /**
     1574                 * Removes element's direction. Supports both CSS 'direction' prop and 'dir' attr.
     1575                 *
     1576                 * @param direcitonFlag CKEDITOR.DIRECTION_ATTR or CKEDITOR.DIRECTION_CSS
     1577                 *    Defaults to both.
     1578                 */
     1579                removeDirection : function( direcitonFlag )
     1580                {
     1581                        if ( direcitonFlag === undefined )
     1582                                direcitonFlag = CKEDITOR.DIRECTION_ATTR | CKEDITOR.DIRECTION_CSS;
     1583
     1584                        if ( direcitonFlag & CKEDITOR.DIRECTION_ATTR )
     1585                                this.hasAttribute( 'dir ') && this.removeAttribute( 'dir ');
     1586
     1587                        if ( direcitonFlag & CKEDITOR.DIRECTION_CSS )
     1588                                this.removeStyle( 'direction' );
     1589                }
    15561590        });
     1591
     1592CKEDITOR.DIRECTION_ATTR = 1;
     1593CKEDITOR.DIRECTION_CSS = 2;
     1594 No newline at end of file
  • _source/plugins/bidi/plugin.js

     
    5252                        chromeRoot.removeClass( 'cke_mixed_dir_content' );
    5353        }
    5454
    55         function switchDir( element, dir, editor, state )
     55        function switchDir( element, dir, editor )
    5656        {
     57                // Stop if direction is same as present.
     58                if ( element.hasDirection() && element.getDirection() == dir )
     59                        return;
     60
    5761                var dirBefore = element.getComputedStyle( 'direction' );
    5862
    59                 element.removeStyle( 'direction' );
    60                 element.removeAttribute( 'dir' );
    61 
    62                 if ( state == CKEDITOR.TRISTATE_OFF && element.getComputedStyle( 'direction' ).toLowerCase() != dir )
    63                         element.setAttribute( 'dir', dir );
     63                element.setAttribute( 'dir', dir );
    6464
    6565                // If the element direction changed, we need to switch the margins of
    6666                // the element and all its children, so it will get really reflected
     
    9898                }
    9999
    100100                editor.forceNextSelectionCheck();
     101
     102                return null;
    101103        }
    102104
    103105        function getFullySelected( selection, elements )
     
    136138                                if ( selectedElement )
    137139                                {
    138140                                        if ( !selectedElement.isReadOnly() )
    139                                                 switchDir( selectedElement, dir, editor, this.state );
     141                                                switchDir( selectedElement, dir, editor );
    140142                                }
    141143                                else
    142144                                {
     
    163165
    164166                                                while ( ( block = walker.next() ) )
    165167                                                {
    166                                                         switchDir( block, dir, editor, this.state );
     168                                                        switchDir( block, dir, editor );
    167169                                                        processedElements.push( block );
    168170                                                }
    169171
     
    199201
    200202                                                        if ( !_break )
    201203                                                        {
    202                                                                 switchDir( block, dir, editor, this.state );
     204                                                                switchDir( block, dir, editor );
    203205                                                        }
    204206                                                }
    205207                                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy