X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpagebreak%2Fplugin.js;h=8c0c9f75fcc918772bd04495a61d0a3a638cf8d4;hb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;hp=b73fbcf82296247b5164ad00b40dd31526c65db1;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/pagebreak/plugin.js b/_source/plugins/pagebreak/plugin.js index b73fbcf..8c0c9f7 100644 --- a/_source/plugins/pagebreak/plugin.js +++ b/_source/plugins/pagebreak/plugin.js @@ -32,10 +32,10 @@ CKEDITOR.plugins.add( 'pagebreak', 'clear: both;' + 'display: block;' + 'float: none;' + - 'width: 100%;' + + 'width:100% !important; _width:99.9% !important;' + 'border-top: #999999 1px dotted;' + 'border-bottom: #999999 1px dotted;' + - 'height: 5px;' + + 'height: 5px !important;' + 'page-break-after: always;' + '}' ); @@ -82,13 +82,15 @@ CKEDITOR.plugins.pagebreakCmd = // Creates the fake image used for this element. breakObject = editor.createFakeElement( breakObject, 'cke_pagebreak', 'div' ); - var ranges = editor.getSelection().getRanges(); + var ranges = editor.getSelection().getRanges( true ); - for ( var range, i = 0 ; i < ranges.length ; i++ ) + editor.fire( 'saveSnapshot' ); + + for ( var range, i = ranges.length - 1 ; i >= 0; i-- ) { range = ranges[ i ]; - if ( i > 0 ) + if ( i < ranges.length -1 ) breakObject = breakObject.clone( true ); range.splitBlock( 'p' ); @@ -98,6 +100,13 @@ CKEDITOR.plugins.pagebreakCmd = range.moveToPosition( breakObject, CKEDITOR.POSITION_AFTER_END ); range.select(); } + + var previous = breakObject.getPrevious(); + + if ( CKEDITOR.dtd[ previous.getName() ].div ) + breakObject.move( previous ); } + + editor.fire( 'saveSnapshot' ); } };