Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 5165)
+++ /CKEditor/trunk/CHANGES.html	(revision 5166)
@@ -100,4 +100,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/5163">#5163</a> : The undo system was not working on some specific cases.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/5162">#5162</a> : The ajax sample was throwing errors when loading data.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4999">#4999</a> : The Template dialog was not generating an undo snapshot.</li>
 		<li>Updated the following language files:<ul>
 			<li><a href="http://dev.fckeditor.net/ticket/5006">#5006</a> : Dutch;</li>
Index: /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js
===================================================================
--- /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js	(revision 5165)
+++ /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js	(revision 5166)
@@ -92,5 +92,11 @@
 				range.moveToElementEditStart( editor.document.getBody() );
 				range.select( true );
+				setTimeout( function ()
+				{
+					editor.fire( 'saveSnapshot' );
+				}, 0 );
 			} );
+
+			editor.fire( 'saveSnapshot' );
 			editor.setData( html );
 		}
