Ticket #6253: 6253.patch
File 6253.patch, 2.1 KB (added by , 14 years ago) |
---|
-
_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.hasAttribute( 'dir' ) ) 306 explicitDirection = 1; 307 308 var itemDir = contentBlock.getAttribute( 'dir' ) || 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 heading structure when converting to list item. (#5271) 303 325 if ( 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' ); 329 // Remove DIR attribute if it was merged into list root. 330 if ( listDir && contentBlock.hasAttribute( 'dir' ) ) 310 331 contentBlock.removeAttribute( 'dir' ); 311 }332 312 333 contentBlock.copyAttributes( listItem ); 313 334 contentBlock.moveChildren( listItem ); 314 335 contentBlock.remove(); … … 321 342 listItem.appendBogus(); 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 );