Ticket #6253: 6253_5.patch
File 6253_5.patch, 3.4 KB (added by , 14 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( includeComputedDirection ) 1561 { 1562 return this.getAttribute( 'dir' ) || this.getStyle( 'direction' ) || ( includeComputedDirection && this.getComputedStyle( 'direction' ) ); 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 ) || editor.config.contentsLangDirection; 300 301 if ( listDir !== null ) 302 { 303 if ( listDir && listDir != itemDir ) 304 listDir = null; 305 else 306 listDir = itemDir; 307 } 308 289 309 break; 290 310 } 291 311 contentNode = parentNode; … … 297 317 298 318 // Insert the list to the DOM tree. 299 319 var insertAnchor = listContents[ listContents.length - 1 ].getNext(), 300 listNode = doc.createElement( this.type ), 301 dir; 320 listNode = doc.createElement( this.type ); 302 321 303 322 listsCreated.push( listNode ); 323 324 var contentBlock, listItem; 325 304 326 while ( listContents.length ) 305 327 { 306 var contentBlock = listContents.shift(),307 328 contentBlock = listContents.shift(); 329 listItem = doc.createElement( 'li' ); 308 330 309 331 // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271) 310 332 if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) ) 311 333 contentBlock.appendTo( listItem ); 312 334 else 313 335 { 314 if ( contentBlock.hasAttribute( 'dir' ) ) 336 // Remove DIR attribute if it was merged into list root. 337 if ( listDir && contentBlock.getDirection() ) 315 338 { 316 dir = dir || contentBlock.getAttribute( 'dir' );339 contentBlock.removeStyle( 'direction' ); 317 340 contentBlock.removeAttribute( 'dir' ); 318 341 } 342 319 343 contentBlock.copyAttributes( listItem ); 320 344 contentBlock.moveChildren( listItem ); 321 345 contentBlock.remove(); … … 324 348 listItem.appendTo( listNode ); 325 349 } 326 350 327 if ( dir ) 328 listNode.setAttribute( 'dir', dir ); 351 // Apply list root dir only if it has been explicitly declared. 352 if ( listDir && explicitDirection ) 353 listNode.setAttribute( 'dir', listDir ); 329 354 330 355 if ( insertAnchor ) 331 356 listNode.insertBefore( insertAnchor );