Ticket #6376: 6376_4.patch
File 6376_4.patch, 2.4 KB (added by , 14 years ago) |
---|
-
_source/plugins/bidi/plugin.js
52 52 chromeRoot.removeClass( 'cke_mixed_dir_content' ); 53 53 } 54 54 55 function switchDir( element, dir, editor , state)55 function switchDir( element, dir, editor ) 56 56 { 57 var dirBefore = element.getComputedStyle( 'direction' ); 58 57 var useComputedState = ( 'useComputedState' in editor.config ) ? editor.config.useComputedState : 1; 58 59 var elementDir = useComputedState ? element.getComputedStyle( 'direction' ) 60 : element.getStyle( 'direction' ) || element.hasAttribute( 'dir' ); 61 62 // Stop if direction is same as present. 63 if ( elementDir == dir ) 64 return; 65 66 // Reuse computedState if we already have it. 67 var dirBefore = useComputedState ? elementDir : element.getComputedStyle( 'direction' ); 68 69 // Clear direction on this element. 59 70 element.removeStyle( 'direction' ); 60 element.removeAttribute( 'dir' );61 71 62 if ( state == CKEDITOR.TRISTATE_OFF && element.getComputedStyle( 'direction' ).toLowerCase() != dir )63 72 // Set new direction for this element. 73 element.setAttribute( 'dir', dir ); 64 74 65 75 // If the element direction changed, we need to switch the margins of 66 76 // the element and all its children, so it will get really reflected 67 77 // like a mirror. (#5910) 68 var dirAfter = element.getComputedStyle( 'direction' ); 69 if ( dirAfter != dirBefore ) 78 if ( dir != dirBefore ) 70 79 { 71 80 var range = new CKEDITOR.dom.range( element.getDocument() ); 72 81 range.setStartBefore( element ); … … 98 107 } 99 108 100 109 editor.forceNextSelectionCheck(); 110 111 return null; 101 112 } 102 113 103 114 function getFullySelected( selection, elements ) … … 136 147 if ( selectedElement ) 137 148 { 138 149 if ( !selectedElement.isReadOnly() ) 139 switchDir( selectedElement, dir, editor , this.state);150 switchDir( selectedElement, dir, editor ); 140 151 } 141 152 else 142 153 { … … 163 174 164 175 while ( ( block = walker.next() ) ) 165 176 { 166 switchDir( block, dir, editor , this.state);177 switchDir( block, dir, editor ); 167 178 processedElements.push( block ); 168 179 } 169 180 … … 199 210 200 211 if ( !_break ) 201 212 { 202 switchDir( block, dir, editor , this.state);213 switchDir( block, dir, editor ); 203 214 } 204 215 } 205 216 }