Ticket #6376: 6376.patch
File 6376.patch, 3.1 KB (added by , 14 years ago) |
---|
-
_source/core/dom/element.js
1552 1552 this.setStyle( type, size + 'px' ); 1553 1553 } 1554 1554 }; 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 } 1556 1590 }); 1591 1592 CKEDITOR.DIRECTION_ATTR = 1; 1593 CKEDITOR.DIRECTION_CSS = 2; 1594 No newline at end of file -
_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 // Stop if direction is same as present. 58 if ( element.hasDirection() && element.getDirection() == dir ) 59 return; 60 57 61 var dirBefore = element.getComputedStyle( 'direction' ); 58 62 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 ); 64 64 65 65 // If the element direction changed, we need to switch the margins of 66 66 // the element and all its children, so it will get really reflected … … 98 98 } 99 99 100 100 editor.forceNextSelectionCheck(); 101 102 return null; 101 103 } 102 104 103 105 function getFullySelected( selection, elements ) … … 136 138 if ( selectedElement ) 137 139 { 138 140 if ( !selectedElement.isReadOnly() ) 139 switchDir( selectedElement, dir, editor , this.state);141 switchDir( selectedElement, dir, editor ); 140 142 } 141 143 else 142 144 { … … 163 165 164 166 while ( ( block = walker.next() ) ) 165 167 { 166 switchDir( block, dir, editor , this.state);168 switchDir( block, dir, editor ); 167 169 processedElements.push( block ); 168 170 } 169 171 … … 199 201 200 202 if ( !_break ) 201 203 { 202 switchDir( block, dir, editor , this.state);204 switchDir( block, dir, editor ); 203 205 } 204 206 } 205 207 }