Ticket #6253: 6253_3.patch
File 6253_3.patch, 3.5 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/list/plugin.js
291 291 // Insert the list to the DOM tree. 292 292 var insertAnchor = listContents[ listContents.length - 1 ].getNext(), 293 293 listNode = doc.createElement( this.type ), 294 dir;294 listDir, explicitDirection; 295 295 296 296 listsCreated.push( listNode ); 297 298 var contentBlock, listItem; 299 300 // Loop over all items to figure out new list direction. 301 for ( i = 0; i < listContents.length; i++ ) 302 { 303 contentBlock = listContents[ i ]; 304 305 if ( !explicitDirection && contentBlock.hasDirection() ) 306 explicitDirection = 1; 307 308 var itemDir = contentBlock.getDirection() || editor.config.contentsLangDirection; 309 310 if ( listDir !== null ) 311 { 312 if ( listDir && listDir != itemDir ) 313 listDir = null; 314 else 315 listDir = itemDir; 316 } 317 } 318 297 319 while ( listContents.length ) 298 320 { 299 var contentBlock = listContents.shift(),300 321 contentBlock = listContents.shift(); 322 listItem = doc.createElement( 'li' ); 301 323 302 324 // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271) 303 325 if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) ) 304 326 contentBlock.appendTo( listItem ); 305 327 else 306 328 { 307 if ( contentBlock.hasAttribute( 'dir' ) ) 308 { 309 dir = dir || contentBlock.getAttribute( 'dir' ); 310 contentBlock.removeAttribute( 'dir' ); 311 } 329 // Remove DIR attribute if it was merged into list root. 330 if ( listDir && contentBlock.hasDirection() ) 331 contentBlock.removeDirection(); 332 312 333 contentBlock.copyAttributes( listItem ); 313 334 contentBlock.moveChildren( listItem ); 314 335 contentBlock.remove(); … … 321 342 listItem.appendTo( listNode ); 322 343 } 323 344 324 if ( dir ) 325 listNode.setAttribute( 'dir', dir ); 345 // Apply list root dir only if it has been explicitly declared. 346 if ( listDir && explicitDirection ) 347 listNode.setAttribute( 'dir', listDir ); 326 348 327 349 if ( insertAnchor ) 328 350 listNode.insertBefore( insertAnchor );