Ticket #6253: 6253_4.patch

File 6253_4.patch, 3.7 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/core/dom/element.js

     
    15521552                                                this.setStyle( type, size + 'px' );
    15531553                                        }
    15541554                                };
    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
  • !TEST/UNIT-TESTS/tt/1659/1.html

     
    4747</pre>
    4848<textarea id="editor2" name="editor2" rows="10" cols="80"><p>text<br/>text<br/>text<br/>text<br/>text<br/>text<br/>text<br/>text<br/>text<br/>text<br/></p></textarea>
    4949<textarea id="editor3" name="editor3" rows="10" cols="80"><p>texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext</p></textarea>
     50<link href="" rel="stylesheet">
    5051</body>
    5152</html>
  • _source/plugins/list/plugin.js

     
    298298                // Insert the list to the DOM tree.
    299299                var insertAnchor = listContents[ listContents.length - 1 ].getNext(),
    300300                        listNode = doc.createElement( this.type ),
    301                         dir;
     301                        listDir, explicitDirection;
    302302
    303303                listsCreated.push( listNode );
     304
     305                var contentBlock, listItem;
     306
     307                // Loop over all items to figure out new list direction.
     308                for ( i = 0; i < listContents.length; i++ )
     309                {
     310                        contentBlock = listContents[ i ];
     311
     312                        if ( !explicitDirection && contentBlock.getDirection() )
     313                                explicitDirection = 1;
     314
     315                        var itemDir = contentBlock.getDirection( 1 ) || editor.config.contentsLangDirection;
     316
     317                        if ( listDir !== null )
     318                        {
     319                                if ( listDir && listDir != itemDir )
     320                                        listDir = null;
     321                                else
     322                                        listDir = itemDir;
     323                        }
     324                }
     325
    304326                while ( listContents.length )
    305327                {
    306                         var contentBlock = listContents.shift(),
    307                                 listItem = doc.createElement( 'li' );
     328                        contentBlock = listContents.shift();
     329                        listItem = doc.createElement( 'li' );
    308330
    309331                        // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271)
    310332                        if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) )
    311333                                contentBlock.appendTo( listItem );
    312334                        else
    313335                        {
    314                                 if ( contentBlock.hasAttribute( 'dir' ) )
     336                                // Remove DIR attribute if it was merged into list root.
     337                                if ( listDir && contentBlock.getDirection() )
    315338                                {
    316                                         dir = dir || contentBlock.getAttribute( 'dir' );
     339                                        contentBlock.removeStyle( 'direction' );
    317340                                        contentBlock.removeAttribute( 'dir' );
    318341                                }
     342                               
    319343                                contentBlock.copyAttributes( listItem );
    320344                                contentBlock.moveChildren( listItem );
    321345                                contentBlock.remove();
     
    324348                        listItem.appendTo( listNode );
    325349                }
    326350
    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 );
    329354
    330355                if ( insertAnchor )
    331356                        listNode.insertBefore( insertAnchor );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy