Ticket #6141: 6141_3.patch

File 6141_3.patch, 2.1 KB (added by Sa'ar Zac Elias, 14 years ago)
  • _source/plugins/indent/plugin.js

     
    256256                                }
    257257                                else
    258258                                {
    259                                         var indentCssProperty = getIndentCssProperty( element );
    260                                         var currentOffset = parseInt( element.getStyle( indentCssProperty ), 10 );
     259                                        var indentCssProperty = getIndentCssProperty( element ),
     260                                                currentOffset = parseInt( element.getStyle( indentCssProperty ), 10 );
     261                                        // For lists, when indentOffset == 0 we must use 1 instead of zero here so it'll be possible to indent it. (#6141)
    261262                                        if ( isNaN( currentOffset ) )
    262263                                                currentOffset = 0;
    263264                                        currentOffset += ( self.name == 'indent' ? 1 : -1 ) * editor.config.indentOffset;
     
    283284
    284285                        var skipBookmarks = function( node )
    285286                        {
    286                                 return ! node.hasAttribute( '_cke_bookmark' );
     287                                return !node.hasAttribute( '_cke_bookmark' );
    287288                        };
    288289
    289290                        var iterator = ranges.createIterator();
     
    321322                                        range.endContainer = walker.previous();
    322323                                }
    323324
    324                                 if ( nearestListBlock  )
     325                                if ( nearestListBlock )
    325326                                {
    326327                                        var firstListItem = nearestListBlock.getFirst( function( node )
    327328                                                {
     
    330331                                                rangeStart = range.startContainer,
    331332                                                indentWholeList = firstListItem.equals( rangeStart ) || firstListItem.contains( rangeStart );
    332333
    333                                         // Indent the entire list if  cursor is inside the first list item. (#3893)
    334                                         if ( !( indentWholeList && indentElement( nearestListBlock ) ) )
    335                                                 indentList( nearestListBlock );
     334                                        // Indent the entire list if cursor is inside the first list item. (#3893)
     335                                        // Only do that for indenting or when there is something to outdent. (#6141)
     336                                        if ( !( indentWholeList &&
     337                                                ( self.name == 'indent' || parseInt( nearestListBlock.getStyle( getIndentCssProperty( nearestListBlock ) ), 10 ) ) &&
     338                                                indentElement( nearestListBlock ) ) )
     339                                                        indentList( nearestListBlock );
    336340                                }
    337341                                else
    338342                                        indentBlock();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy