X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fnewpage%2Fplugin.js;h=6a9d7ca0962b44f5ba5aac9f4a08200d62b6274b;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=2c76877c074edb25734a6191aff367d070e6d298;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/newpage/plugin.js b/_source/plugins/newpage/plugin.js index 2c76877..6a9d7ca 100644 --- a/_source/plugins/newpage/plugin.js +++ b/_source/plugins/newpage/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -19,31 +19,21 @@ CKEDITOR.plugins.add( 'newpage', exec : function( editor ) { var command = this; - function afterCommand() + editor.setData( editor.config.newpage_html || '', function() { - // Defer to happen after 'selectionChange'. - setTimeout( function() + // Save the undo snapshot after all document changes are affected. (#4889) + setTimeout( function () { editor.fire( 'afterCommandExec', { name: command.name, command: command } ); - }, 500 ); - } - if ( editor.mode == 'wysiwyg') - editor.on( 'contentDom', function( evt ){ + editor.selectionChange(); - evt.removeListener(); - afterCommand(); - } ); - - editor.setData( editor.config.newpage_html ); + }, 200 ); + } ); editor.focus(); - - if( editor.mode == 'source' ) - afterCommand(); - }, async : true }); @@ -57,9 +47,9 @@ CKEDITOR.plugins.add( 'newpage', }); /** * The HTML to load in the editor when the "new page" command is executed. + * @name CKEDITOR.config.newpage_html * @type String * @default '' * @example * config.newpage_html = '<p>Type your text here.</p>'; */ -CKEDITOR.config.newpage_html = '';