Ticket #5335: 5335.patch

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

     
    279279                {
    280280                        var contentBlock = listContents.shift(),
    281281                                listItem = doc.createElement( 'li' );
    282                         contentBlock.moveChildren( listItem );
    283                         contentBlock.remove();
     282
     283                        listItem = CKEDITOR.plugins.styles.replaceBlock( contentBlock, listItem, true );
    284284                        listItem.appendTo( listNode );
    285285
    286286                        // Append a bogus BR to force the LI to render at full height
  • _source/plugins/styles/plugin.js

     
    88        requires : [ 'selection' ]
    99});
    1010
     11CKEDITOR.plugins.styles = {};
     12
    1113/**
    1214 * Registers a function to be called whenever a style changes its state in the
    1315 * editing area. The current state is passed to the function. The possible
     
    791793                while ( ( block = iterator.getNextParagraph() ) )               // Only one =
    792794                {
    793795                        var newBlock = getElement( this, doc );
    794                         replaceBlock( block, newBlock );
     796                        CKEDITOR.plugins.styles.replaceBlock( block, newBlock );
    795797                }
    796798
    797799                range.moveToBookmark( bookmark );
     
    800802        // Replace the original block with new one, with special treatment
    801803        // for <pre> blocks to make sure content format is well preserved, and merging/splitting adjacent
    802804        // when necessary.(#3188)
    803         function replaceBlock( block, newBlock )
     805        CKEDITOR.plugins.styles.replaceBlock = function( block, newBlock, dontReplace )
    804806        {
    805807                var newBlockIsPre       = newBlock.is( 'pre' );
    806808                var blockIsPre          = block.is( 'pre' );
     
    816818                else
    817819                        block.moveChildren( newBlock );
    818820
    819                 newBlock.replace( block );
     821                dontReplace ? block.remove() : newBlock.replace( block );
    820822
    821823                if ( newBlockIsPre )
    822824                {
    823825                        // Merge previous <pre> blocks.
    824826                        mergePre( newBlock );
    825827                }
     828
     829                if ( dontReplace )
     830                        return newBlock;
    826831        }
    827832
    828833        /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy