Ticket #6099: 6099_4.patch

File 6099_4.patch, 1.4 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/bidi/plugin.js

     
    1818
    1919                useComputedState = useComputedState === undefined || useComputedState;
    2020
    21                 if ( useComputedState )
     21                // We can use computedState provided by the browser or traverse parents manually.
     22                if ( !useComputedState )
    2223                {
    23                         var selection = editor.getSelection(),
    24                                 ranges = selection.getRanges();
     24                        selectedElement = path.elements[ 0 ];
    2525
    26                         selectedElement = ranges && ranges[ 0 ].getEnclosedNode();
    27 
    28                         // If this is not our element of interest, apply to fully selected elements from guardElements.
    29                         if ( !selectedElement || selectedElement
    30                                         && !( selectedElement.type == CKEDITOR.NODE_ELEMENT && selectedElement.getName() in directSelectionGuardElements )
    31                                 )
    32                                 selectedElement = getFullySelected( selection, guardElements );
    33                 }
     26                        while ( !selectedElement.hasAttribute ||
     27                                !( selectedElement.hasAttribute( 'dir' ) || selectedElement.getStyle( 'direction' ) ) ||
     28                                !( selectedElement.getName() in directSelectionGuardElements )
     29                        )
     30                        {
     31                                var parent = selectedElement.getParent();
     32                                if ( !parent )
     33                                        break;
     34                                selectedElement = parent;
     35                        }
     36                }
    3437
    3538                selectedElement = selectedElement || path.block || path.blockLimit;
    3639
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy