- div.on( 'click', function()\r
- {\r
- insertTemplate( editor, template.html );\r
- });\r
-\r
- return div;\r
- }\r
-\r
- /**\r
- * Insert the specified template content\r
- * to document.\r
- * @param {Number} index\r
- */\r
- function insertTemplate( editor, html )\r
- {\r
- var dialog = CKEDITOR.dialog.getCurrent(),\r
- isInsert = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );\r
-\r
- if ( isInsert )\r
- {\r
- // Everything should happen after the document is loaded (#4073).\r
- editor.on( 'contentDom', function( evt )\r
- {\r
- evt.removeListener();\r
- dialog.hide();\r
-\r
- // Place the cursor at the first editable place.\r
- var range = new CKEDITOR.dom.range( editor.document );\r
- range.moveToElementEditStart( editor.document.getBody() );\r
- range.select( true );\r
- setTimeout( function ()\r