Ticket #6099: 6099_2.patch
File 6099_2.patch, 1.8 KB (added by , 14 years ago) |
---|
-
_source/plugins/bidi/plugin.js
22 22 23 23 useComputedState = useComputedState === undefined || useComputedState; 24 24 25 if ( useComputedState ) 25 // We can use computedState provided by the browser or traverse parents manually. 26 if ( !useComputedState ) 26 27 { 27 var selection = editor.getSelection(), 28 ranges = selection.getRanges(); 28 selectedElement = editor.getSelection().getCommonAncestor(); 29 29 30 selectedElement = ranges && ranges[ 0 ].getEnclosedNode(); 31 32 // If this is not our element of interest, apply to fully selected elements from guardElements. 33 if ( !selectedElement || selectedElement 34 && !( selectedElement.type == CKEDITOR.NODE_ELEMENT && selectedElement.getName() in directSelectionGuardElements ) 35 ) 36 selectedElement = getFullySelected( selection, guardElements ); 37 } 30 while ( !selectedElement.hasAttribute || 31 !( selectedElement.hasAttribute( 'dir' ) || selectedElement.getStyle( 'direction' ) ) 32 ) 33 { 34 var parent = selectedElement.getParent(); 35 if ( !parent ) 36 break; 37 selectedElement = parent; 38 } 39 } 38 40 39 41 selectedElement = selectedElement || path.block || path.blockLimit; 40 42 41 if ( !selectedElement || selectedElement.getName() == 'body' ) 42 return CKEDITOR.TRISTATE_OFF; 43 44 selectedElement = useComputedState ? 43 var selectedElementDir = useComputedState ? 45 44 selectedElement.getComputedStyle( 'direction' ) : 46 45 selectedElement.getStyle( 'direction' ) || selectedElement.getAttribute( 'dir' ); 47 46 48 return ( selectedElement == dir ) ?47 return ( selectedElementDir == dir ) ? 49 48 CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF; 50 49 } 51 50