X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpagebreak%2Fplugin.js;h=3daef0c7f1a41d31d819b44482b5a78fe6eac581;hb=66f4ae0bf0280ed56bf7c0f4ab175424dd1d47a0;hp=eaee4a6868a6b62499d87ce068199242fb04ea07;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/pagebreak/plugin.js b/_source/plugins/pagebreak/plugin.js index eaee4a6..3daef0c 100644 --- a/_source/plugins/pagebreak/plugin.js +++ b/_source/plugins/pagebreak/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -32,10 +32,11 @@ CKEDITOR.plugins.add( 'pagebreak', 'clear: both;' + 'display: block;' + 'float: none;' + - 'width: 100%;' + + 'width:100%;_width:99.9%;' + 'border-top: #999999 1px dotted;' + 'border-bottom: #999999 1px dotted;' + 'height: 5px;' + + 'page-break-after: always;' + '}' ); }, @@ -55,7 +56,8 @@ CKEDITOR.plugins.add( 'pagebreak', { div : function( element ) { - var style = element.attributes.style, + var attributes = element.attributes, + style = attributes && attributes.style, child = style && element.children.length == 1 && element.children[ 0 ], childStyle = child && ( child.name == 'span' ) && child.attributes.style; @@ -82,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 ]; @@ -91,6 +95,13 @@ CKEDITOR.plugins.pagebreakCmd = range.splitBlock( 'p' ); range.insertNode( breakObject ); + if ( i == ranges.length - 1 ) + { + range.moveToPosition( breakObject, CKEDITOR.POSITION_AFTER_END ); + range.select(); + } } + + editor.fire( 'saveSnapshot' ); } };