JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1.1
[ckeditor.git] / _source / plugins / templates / dialogs / templates.js
index 42a6a93..770eeef 100644 (file)
@@ -39,12 +39,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                // Build the inner HTML of our new item DIV.\r
                var html = '<table style="width:350px;" class="cke_tpl_preview"><tr>';\r
 \r
-               if( template.image && imagesPath )\r
+               if ( template.image && imagesPath )\r
                        html += '<td class="cke_tpl_preview_img"><img src="' + CKEDITOR.getUrl( imagesPath + template.image ) + '"></td>';\r
 \r
                html += '<td style="white-space:normal;"><span class="cke_tpl_title">' + template.title + '</span><br/>';\r
 \r
-               if( template.description )\r
+               if ( template.description )\r
                        html += '<span>' + template.description + '</span>';\r
 \r
                html += '</td></tr></table>';\r
@@ -79,7 +79,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                var dialog = CKEDITOR.dialog.getCurrent(),\r
                        isInsert = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );\r
 \r
-               if( isInsert )\r
+               if ( isInsert )\r
                {\r
                        // Everything should happen after the document is loaded (#4073).\r
                        editor.on( 'contentDom', function( evt )\r
@@ -91,7 +91,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                var range = new CKEDITOR.dom.range( editor.document );\r
                                range.moveToElementEditStart( editor.document.getBody() );\r
                                range.select( true );\r
+                               setTimeout( function ()\r
+                               {\r
+                                       editor.fire( 'saveSnapshot' );\r
+                               }, 0 );\r
                        } );\r
+\r
+                       editor.fire( 'saveSnapshot' );\r
                        editor.setData( html );\r
                }\r
                else\r