var functionNumber = CKEDITOR.tools.addFunction(function(url){ this.insertHtml('<img src="'+url+'" />'); CKEDITOR.dialog.getCurrent().click('cancel'); }, editor);