Index: /CKEditor/branches/prototype/_source/core/editor.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/editor.js	(revision 2978)
+++ /CKEditor/branches/prototype/_source/core/editor.js	(revision 2979)
@@ -425,23 +425,19 @@
 		insertHtml : function( data )
 		{
-			var eventData = { insert : data };
-			this.fire( 'insertHtml', eventData );
-			this.fire( 'afterInsertHtml', eventData );
-			this._.data = this.document.getBody().getHtml();
-		},
-
-		/**
-		 * Inserts an element into the currently selected position in the editor.
-		 * @param {CKEDITOR.dom.element} element Element to be inserted into the editor.
-		 * @example
-		 * var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' );
+			this.fire( 'insertHtml', data );
+		},
+
+		/**
+		 * Inserts an element into the currently selected position in the
+		 * editor.
+		 * @param {CKEDITOR.dom.element} element The element to be inserted
+		 *		into the editor.
+		 * @example
+		 * var element = CKEDITOR.dom.element.createFromHtml( '&lt;img src="hello.png" border="0" title="Hello" /&gt;' );
 		 * CKEDITOR.instances.editor1.<b>insertElement( element )</b>;
 		 */
 		insertElement : function( element )
 		{
-			var eventData = { insert : element };
-			this.fire( 'insertElement', eventData );
-			this.fire( 'afterInsertElement', eventData );
-			this._.data = this.document.getBody().getHtml();
+			this.fire( 'insertElement', element );
 		},
 
Index: /CKEditor/branches/prototype/_source/plugins/editingblock/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/editingblock/plugin.js	(revision 2978)
+++ /CKEditor/branches/prototype/_source/plugins/editingblock/plugin.js	(revision 2979)
@@ -19,6 +19,4 @@
 	// the following data handling functions.
 	var isHandlingData;
-
-	var blockElements = { address:1,blockquote:1,center:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,marquee:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1 };
 
 	CKEDITOR.plugins.add( 'editingblock',
@@ -57,53 +55,4 @@
 					}
 				});
-
-			editor.on( 'afterInsertHtml', function( evt )
-				{
-					if ( editor.mode )
-					{
-						if ( CKEDITOR.env.ie )
-							editor.document.$.selection.createRange().pasteHtml( evt.data.insert );
-						else
-							editor.document.$.execCommand( 'inserthtml', false, evt.data.insert );
-					}
-				});
-
-			editor.on( 'afterInsertElement', function( evt )
-				{
-					if ( editor.mode )
-					{
-						var selection = new CKEDITOR.dom.selection( editor.document ),
-							ranges = selection.getRanges(),
-							clone, lastRange, bookmark,
-							isBlock = blockElements[ evt.data.insert.getName() ];
-
-						for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
-						{
-							// Remove the original contents.
-							ranges[i].deleteContents();
-
-							clone = evt.data.insert.clone( true );
-
-							// If the new node is a block element, split the current block.
-							if ( editor.config.enterMode != 'br' && isBlock )
-								ranges[i].splitBlock();
-
-							// Insert the new node.
-							ranges[i].insertNode( clone );
-
-							// Move the caret after the last insertion point.
-							if ( !lastRange )
-							{
-								lastRange = ranges[i];
-								lastRange.setStartAfter( clone );
-								lastRange.collapse( true );
-								bookmark = lastRange.createBookmark();
-							}
-						}
-
-						lastRange.moveToBookmark( bookmark );
-						selection.selectRanges( [lastRange] );
-					}
-				} );
 
 			editor.on( 'beforeGetData', function()
Index: /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js	(revision 2978)
+++ /CKEditor/branches/prototype/_source/plugins/wysiwygarea/plugin.js	(revision 2979)
@@ -66,4 +66,56 @@
 		};
 	// #### protectAttributes - END
+
+	var onInsertHtml = function( evt )
+	{
+		if ( this.mode == 'wysiwyg' )
+		{
+			var $doc = this.document.$;
+
+			if ( CKEDITOR.env.ie )
+				$doc.selection.createRange().pasteHtml( evt.data );
+			else
+				$doc.execCommand( 'inserthtml', false, evt.data );
+		}
+	};
+
+	var onInsertElement = function( evt )
+	{
+		if ( this.mode == 'wysiwyg' )
+		{
+			var element = evt.data;
+				isBlock = CKEDITOR.dtd.$block[ element.getName() ];
+
+			var selection = this.getSelection(),
+				ranges = selection.getRanges();
+
+			var range, clone, lastElement, bookmark;
+
+			for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
+			{
+				range = ranges[ i ];
+
+				// Remove the original contents.
+				range.deleteContents();
+
+				clone = element.clone( true );
+
+				// If the new node is a block element, split the current block.
+				if ( this.config.enterMode != 'br' && isBlock )
+					range.splitBlock();
+
+				// Insert the new node.
+				range.insertNode( clone );
+
+				// Save the last element reference so we can make the
+				// selection later.
+				if ( !lastElement )
+					lastElement = clone;
+			}
+
+			range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
+			selection.selectRanges( [ range ] );
+		}
+	};
 
 	CKEDITOR.plugins.add( 'wysiwygarea',
@@ -318,4 +370,7 @@
 							}
 						});
+
+					editor.on( 'insertHtml', onInsertHtml, null, null, 20 );
+					editor.on( 'insertElement', onInsertElement, null, null, 20 );
 				});
 		}
