/*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
exec : function( editor )\r
{\r
var command = this;\r
- function afterCommand()\r
+ editor.setData( editor.config.newpage_html || '', function()\r
{\r
- // Defer to happen after 'selectionChange'.\r
- setTimeout( function()\r
+ // Save the undo snapshot after all document changes are affected. (#4889)\r
+ setTimeout( function ()\r
{\r
editor.fire( 'afterCommandExec',\r
{\r
- name: command.name,\r
+ name: 'newpage',\r
command: command\r
} );\r
- }, 500 );\r
- }\r
- if ( editor.mode == 'wysiwyg')\r
- editor.on( 'contentDom', function( evt ){\r
+ editor.selectionChange();\r
\r
- evt.removeListener();\r
- afterCommand();\r
- } );\r
-\r
- editor.setData( editor.config.newpage_html );\r
+ }, 200 );\r
+ } );\r
editor.focus();\r
-\r
- if( editor.mode == 'source' )\r
- afterCommand();\r
-\r
},\r
async : true\r
});\r
});\r
/**\r
* The HTML to load in the editor when the "new page" command is executed.\r
+ * @name CKEDITOR.config.newpage_html\r
* @type String\r
* @default ''\r
* @example\r
* config.newpage_html = '<p>Type your text here.</p>';\r
*/\r
-CKEDITOR.config.newpage_html = '';\r