Ticket #6253: 6253_6.patch
File 6253_6.patch, 3.4 KB (added by , 15 years ago) |
---|
-
_source/core/dom/element.js
1552 1552 this.setStyle( type, size + 'px' ); 1553 1553 } 1554 1554 }; 1555 })() 1556 }); 1555 })(), 1556 1557 /** 1558 * Gets element's direction. Supports both CSS 'direction' prop and 'dir' attr. 1559 */ 1560 getDirection : function( useComputed ) 1561 { 1562 return useComputed ? this.getComputedStyle( 'direction' ) : this.getStyle( 'direction' ) || this.getAttribute( 'dir' ); 1563 } 1564 }); 1565 No newline at end of file -
_source/plugins/list/plugin.js
275 275 for ( var i = 0 ; i < contents.length ; i++ ) 276 276 commonParent = commonParent.getCommonAncestor( contents[i].getParent() ); 277 277 278 var useComputedState = editor.config.useComputedState, 279 listDir, explicitDirection; 280 281 useComputedState = useComputedState === undefined || useComputedState; 282 278 283 // We want to insert things that are in the same tree level only, so calculate the contents again 279 284 // by expanding the selected blocks to the same tree level. 280 285 for ( i = 0 ; i < contents.length ; i++ ) … … 286 291 if ( parentNode.equals( commonParent ) ) 287 292 { 288 293 listContents.push( contentNode ); 294 295 // Determine the lists's direction. 296 if ( !explicitDirection && contentNode.getDirection() ) 297 explicitDirection = 1; 298 299 var itemDir = contentNode.getDirection( useComputedState ); 300 301 if ( listDir !== null ) 302 { 303 // If at least one LI have a different direction than current listDir, we can't have listDir. 304 if ( listDir && listDir != itemDir ) 305 listDir = null; 306 else 307 listDir = itemDir; 308 } 309 289 310 break; 290 311 } 291 312 contentNode = parentNode; … … 297 318 298 319 // Insert the list to the DOM tree. 299 320 var insertAnchor = listContents[ listContents.length - 1 ].getNext(), 300 listNode = doc.createElement( this.type ), 301 dir; 321 listNode = doc.createElement( this.type ); 302 322 303 323 listsCreated.push( listNode ); 324 325 var contentBlock, listItem; 326 304 327 while ( listContents.length ) 305 328 { 306 var contentBlock = listContents.shift(),307 329 contentBlock = listContents.shift(); 330 listItem = doc.createElement( 'li' ); 308 331 309 332 // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271) 310 333 if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) ) 311 334 contentBlock.appendTo( listItem ); 312 335 else 313 336 { 314 if ( contentBlock.hasAttribute( 'dir' ) ) 337 // Remove DIR attribute if it was merged into list root. 338 if ( listDir && contentBlock.getDirection() ) 315 339 { 316 dir = dir || contentBlock.getAttribute( 'dir' );340 contentBlock.removeStyle( 'direction' ); 317 341 contentBlock.removeAttribute( 'dir' ); 318 342 } 343 319 344 contentBlock.copyAttributes( listItem ); 320 345 contentBlock.moveChildren( listItem ); 321 346 contentBlock.remove(); … … 324 349 listItem.appendTo( listNode ); 325 350 } 326 351 327 if ( dir ) 328 listNode.setAttribute( 'dir', dir ); 352 // Apply list root dir only if it has been explicitly declared. 353 if ( listDir && explicitDirection ) 354 listNode.setAttribute( 'dir', listDir ); 329 355 330 356 if ( insertAnchor ) 331 357 listNode.insertBefore( insertAnchor );