X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ftemplates%2Fdialogs%2Ftemplates.js;h=42a6a93290c1fca6c0874cd6b937bdb04f968417;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hp=752e7bea876a3cf71b704e40d95dfcfb3cb2162c;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/templates/dialogs/templates.js b/_source/plugins/templates/dialogs/templates.js index 752e7be..42a6a93 100644 --- a/_source/plugins/templates/dialogs/templates.js +++ b/_source/plugins/templates/dialogs/templates.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -81,14 +81,24 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if( isInsert ) { + // Everything should happen after the document is loaded (#4073). + editor.on( 'contentDom', function( evt ) + { + evt.removeListener(); + dialog.hide(); + + // Place the cursor at the first editable place. + var range = new CKEDITOR.dom.range( editor.document ); + range.moveToElementEditStart( editor.document.getBody() ); + range.select( true ); + } ); editor.setData( html ); } else { editor.insertHtml( html ); + dialog.hide(); } - - dialog.hide(); } CKEDITOR.dialog.add( 'templates', function( editor )