Ticket #6237: 6237_2.patch
File 6237_2.patch, 2.0 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 )55 function switchDir( element, dir, editor, firstBlockDir ) 56 56 { 57 57 var dirBefore = element.getComputedStyle( 'direction' ), 58 58 currentDir = element.getStyle( 'direction' ) || element.getAttribute( 'dir' ) || ''; 59 59 60 60 element.removeStyle( 'direction' ); 61 61 62 if ( currentDir.toLowerCase() == dir ) 63 element.removeAttribute( 'dir' ); 62 if ( firstBlockDir ) 63 { 64 element.setAttribute( 'dir', firstBlockDir ); 65 } 64 66 else 65 element.setAttribute( 'dir', dir ); 67 { 68 if ( currentDir.toLowerCase() == dir ) 69 element.removeAttribute( 'dir' ); 70 else 71 element.setAttribute( 'dir', dir ); 72 } 66 73 67 74 // If the element direction changed, we need to switch the margins of 68 75 // the element and all its children, so it will get really reflected … … 146 153 var bookmarks = selection.createBookmarks(); 147 154 148 155 var iterator, 149 block; 156 block, 157 firstBlockDir; 150 158 151 159 for ( var i = ranges.length - 1 ; i >= 0 ; i-- ) 152 160 { … … 165 173 166 174 while ( ( block = walker.next() ) ) 167 175 { 168 switchDir( block, dir, editor );176 switchDir( block, dir, editor, firstBlockDir ); 169 177 processedElements.push( block ); 178 179 if ( !firstBlockDir ) 180 firstBlockDir = block.getComputedStyle( 'direction' ); 170 181 } 171 182 172 183 iterator = ranges[ i ].createIterator(); … … 201 212 202 213 if ( !_break ) 203 214 { 204 switchDir( block, dir, editor );215 switchDir( block, dir, editor, firstBlockDir ); 205 216 } 217 218 if ( !firstBlockDir ) 219 firstBlockDir = block.getComputedStyle( 'direction' ); 206 220 } 207 221 } 208 222