Ticket #5335: 5335_2.patch

File 5335_2.patch, 3.3 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/list/plugin.js

     
    288288                        var contentBlock = listContents.shift(),
    289289                                listItem = doc.createElement( 'li' );
    290290
    291                         // Preserve heading structure when converting to list item. (#5271)
    292                         if ( headerTagRegex.test( contentBlock.getName() ) )
     291                        // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271)
     292                        if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) )
    293293                                contentBlock.appendTo( listItem );
    294294                        else
    295295                        {
    296296                                contentBlock.copyAttributes( listItem );
    297297                                contentBlock.moveChildren( listItem );
    298298                                contentBlock.remove();
    299                         }
    300299
    301                         listItem.appendTo( listNode );
    302 
    303                         // Append a bogus BR to force the LI to render at full height
    304                         if ( !CKEDITOR.env.ie )
    305                                 listItem.appendBogus();
    306                 }
     300                                // Append a bogus BR to force the LI to render at full height
     301                                if ( !CKEDITOR.env.ie )
     302                                        listItem.appendBogus();
     303                        }
     304
     305                        listItem.appendTo( listNode );
     306                }
    307307                if ( insertAnchor )
    308308                        listNode.insertBefore( insertAnchor );
    309309                else
  • _source/plugins/domiterator/plugin.js

     
    4444                        // Indicats that the current element in the loop is the last one.
    4545                        var isLast;
    4646
     47                        // Indicate at least one of the range boundaries is inside a preformat block.
     48                        var touchPre;
     49
    4750                        // Instructs to cleanup remaining BRs.
    4851                        var removePreviousBr, removeLastBr;
    4952
     
    5154                        if ( !this._.lastNode )
    5255                        {
    5356                                range = this.range.clone();
    54                                 range.enlarge( this.forceBrBreak || !this.enlargeBr ?
     57
     58                                touchPre = range.endContainer.hasAscendant( 'pre', true )
     59                                        || range.startContainer.hasAscendant( 'pre', true );
     60
     61                                range.enlarge( this.forceBrBreak && !touchPre || !this.enlargeBr ?
    5562                                                           CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS : CKEDITOR.ENLARGE_BLOCK_CONTENTS );
    5663
    5764                                var walker = new CKEDITOR.dom.walker( range ),
     
    102109                        {
    103110                                // closeRange indicates that a paragraph boundary has been found,
    104111                                // so the range can be closed.
    105                                 var closeRange = false;
     112                                var closeRange = false,
     113                                                parentPre = currentNode.hasAscendant( 'pre' );
    106114
    107115                                // includeNode indicates that the current node is good to be part
    108116                                // of the range. By default, any non-element node is ok for it.
     
    115123                                {
    116124                                        var nodeName = currentNode.getName();
    117125
    118                                         if ( currentNode.isBlockBoundary( this.forceBrBreak && { br : 1 } ) )
     126                                        if ( currentNode.isBlockBoundary( this.forceBrBreak &&
     127                                                        !parentPre && { br : 1 } ) )
    119128                                        {
    120129                                                // <br> boundaries must be part of the range. It will
    121130                                                // happen only if ForceBrBreak.
     
    189198                                        {
    190199                                                var parentNode = currentNode.getParent();
    191200
    192                                                 if ( parentNode.isBlockBoundary( this.forceBrBreak && { br : 1 } ) )
     201                                                if ( parentNode.isBlockBoundary( this.forceBrBreak
     202                                                                && !parentPre && { br : 1 } ) )
    193203                                                {
    194204                                                        closeRange = true;
    195205                                                        isLast = isLast || ( parentNode.equals( lastNode) );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy