X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpagebreak%2Fplugin.js;h=558733075e8023be110c3e595232682049b978c0;hb=055b6b0792ce7dc53d47af606b367c04b927c2ab;hp=cd70e55fb7754f6a3483a50129eefda6d061ce9a;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/pagebreak/plugin.js b/_source/plugins/pagebreak/plugin.js index cd70e55..5587330 100644 --- a/_source/plugins/pagebreak/plugin.js +++ b/_source/plugins/pagebreak/plugin.js @@ -32,10 +32,11 @@ 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;' + '}' ); }, @@ -83,6 +84,8 @@ CKEDITOR.plugins.pagebreakCmd = var ranges = editor.getSelection().getRanges(); + editor.fire( 'saveSnapshot' ); + for ( var range, i = 0 ; i < ranges.length ; i++ ) { range = ranges[ i ]; @@ -92,6 +95,18 @@ CKEDITOR.plugins.pagebreakCmd = range.splitBlock( 'p' ); range.insertNode( breakObject ); + if ( i == ranges.length - 1 ) + { + 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' ); } };