Ticket #6091: 6091_2.patch

File 6091_2.patch, 2.1 KB (added by Martin, 14 years ago)
  • _source/plugins/pagebreak/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    7878        requires : [ 'fakeobjects' ]
    7979});
    8080
     81// keep items on which page break cannot be done
     82var disallowedPagebrakeItems = { li:1 };
     83
    8184CKEDITOR.plugins.pagebreakCmd =
    8285{
    8386        exec : function( editor )
     
    102105                        if ( i < ranges.length -1 )
    103106                                breakObject = breakObject.clone( true );
    104107
    105                         range.splitBlock( 'p' );
     108            var boundaryBlocks = range.getBoundaryBlocks();
     109
     110            // split block on allowed items
     111            if( !disallowedPagebrakeItems[ boundaryBlocks.startBlock.getName() ] && !disallowedPagebrakeItems[ boundaryBlocks.endBlock.getName() ] )
     112                range.splitBlock( 'p' );
     113
    106114                        range.insertNode( breakObject );
    107115                        if ( i == ranges.length - 1 )
    108116                        {
     
    118126
    119127                editor.fire( 'saveSnapshot' );
    120128        }
    121 };
     129};
     130 No newline at end of file
  • _source/core/dom/range.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    644644                        return { startNode : startNode, endNode : endNode };
    645645                },
    646646
     647                getBoundaryBlocks : function()
     648                {
     649                        var startPath   = new CKEDITOR.dom.elementPath( this.startContainer ),
     650                                endPath         = new CKEDITOR.dom.elementPath( this.endContainer );
     651
     652                        var startBlockLimit     = startPath.blockLimit,
     653                                endBlockLimit   = endPath.blockLimit;
     654
     655                        return { startBlock : startPath.block, endBlock : endPath.block };
     656
     657                },
     658
    647659                /**
    648660                 * Find the node which fully contains the range.
    649661                 * @param includeSelf
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy