Index: /CKEditor/trunk/_source/core/commanddefinition.js
===================================================================
--- /CKEditor/trunk/_source/core/commanddefinition.js	(revision 3667)
+++ /CKEditor/trunk/_source/core/commanddefinition.js	(revision 3668)
@@ -53,2 +53,20 @@
  * });
  */
+
+/**
+ * Whether the command is asynchronous, which means the 'afterCommandExec' event
+ * will be fired by the command itself manually, and the 'exec' function return value
+ * of this command is not to be returned.
+ * @name  CKEDITOR.commandDefinition.async
+ * @type {Boolean} If defined as 'true', the command is asynchronous.
+ * @example
+ * editorInstance.addCommand( 'alertName',
+ * {
+ *     exec : function( editor )
+ *     {
+ *         // Asynchronous operation below.
+ *         CKEDITOR.ajax.loadXml( 'data.xml' );
+ *     },
+ *     async : true    // The command need some time to complete after exec function returns.
+ * });
+ */
Index: /CKEditor/trunk/_source/core/editor.js
===================================================================
--- /CKEditor/trunk/_source/core/editor.js	(revision 3667)
+++ /CKEditor/trunk/_source/core/editor.js	(revision 3668)
@@ -478,5 +478,6 @@
 					eventData.returnValue = command.exec( eventData.commandData );
 
-					if ( this.fire( 'afterCommandExec', eventData ) !== true )
+					// Fire the 'afterCommandExec' immediately if command is synchronous.
+					if ( !command.async && this.fire( 'afterCommandExec', eventData ) !== true )
 						return eventData.returnValue;
 				}
Index: /CKEditor/trunk/_source/plugins/newpage/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/newpage/plugin.js	(revision 3667)
+++ /CKEditor/trunk/_source/plugins/newpage/plugin.js	(revision 3668)
@@ -19,7 +19,32 @@
 				exec : function( editor )
 				{
+					var command = this;
+					function afterCommand()
+					{
+						// Defer to happen after 'selectionChange'.
+						setTimeout( function()
+						{
+							editor.fire( 'afterCommandExec',
+							{
+								name: command.name,
+								command: command
+							} );
+						}, 500 );
+					}
+					if ( editor.mode == 'wysiwyg')
+						editor.on( 'contentDom', function( evt ){
+
+							evt.removeListener();
+	                        afterCommand();
+						} );
+
 					editor.setData( editor.config.newpage_html );
 					editor.focus();
-				}
+
+					if( editor.mode == 'source' )
+						afterCommand();
+
+				},
+				async : true
 			});
 
