X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Ftemplates%2Fdialogs%2Ftemplates.js;h=8342011cab28180540641cf72e98dc551663e8a4;hp=633030d91408717829ca053874a59c604ee238b4;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hpb=c6e377a02b54abc07129d72b632763c727476a15 diff --git a/plugins/templates/dialogs/templates.js b/plugins/templates/dialogs/templates.js index 633030d..8342011 100644 --- a/plugins/templates/dialogs/templates.js +++ b/plugins/templates/dialogs/templates.js @@ -3,4 +3,5 @@ Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ -(function(){var a=CKEDITOR.document,b='cke'+CKEDITOR.tools.getNextNumber();function c(f,g){var h=a.getById(b);h.setHtml('');for(var i=0;i';j+=''+g.title+'
';if(g.description)j+=''+g.description+'';j+='';i.setHtml(j);i.on('mouseover',function(){i.addClass('cke_tpl_hover');});i.on('mouseout',function(){i.removeClass('cke_tpl_hover');});i.on('click',function(){e(f,g.html);});return i;};function e(f,g){var h=CKEDITOR.dialog.getCurrent(),i=h.getValueOf('selectTpl','chkInsertOpt');if(i){f.on('contentDom',function(j){j.removeListener();h.hide();var k=new CKEDITOR.dom.range(f.document);k.moveToElementEditStart(f.document.getBody());k.select(true);setTimeout(function(){f.fire('saveSnapshot');},0);});f.fire('saveSnapshot');f.setData(g);}else{f.insertHtml(g);h.hide();}};CKEDITOR.dialog.add('templates',function(f){CKEDITOR.skins.load(f,'templates');var g=false;return{title:f.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:'selectTpl',label:f.lang.templates.title,elements:[{type:'vbox',padding:5,children:[{type:'html',html:''+f.lang.templates.selectPromptMsg+''},{type:'html',html:'
'+'
'+'
'},{id:'chkInsertOpt',type:'checkbox',label:f.lang.templates.insertOption,'default':f.config.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){CKEDITOR.loadTemplates(f.config.templates_files,function(){var h=f.config.templates.split(',');if(h.length)c(f,h);else{var i=a.getById(b);i.setHtml('
'+f.lang.templates.emptyListMsg+''+'
');}});}};});})(); +(function(){var a=CKEDITOR.document;CKEDITOR.dialog.add('templates',function(b){function c(h,i){h.setHtml('');for(var j=0;j
'),k='';if(h.image&&i)k+='';k+='
'+h.title+'
';if(h.description)k+=''+h.description+'';k+='
';j.getFirst().setHtml(k);j.on('click',function(){e(h.html);});return j;};function e(h){var i=CKEDITOR.dialog.getCurrent(),j=i.getValueOf('selectTpl','chkInsertOpt');if(j){b.on('contentDom',function(k){k.removeListener();i.hide();var l=new CKEDITOR.dom.range(b.document);l.moveToElementEditStart(b.document.getBody());l.select(true);setTimeout(function(){b.fire('saveSnapshot');},0);});b.fire('saveSnapshot');b.setData(h);}else{b.insertHtml(h);i.hide();}};function f(h){var i=h.data.getTarget(),j=g.getPosition(i);if(j>CKEDITOR.POSITION_CONTAINS){var k=h.data.getKeystroke(),l=g.getElementsByTag('a'),m;if(l){switch(k){case 40:m=i.getNext();break;case 38:m=i.getPrevious();break;case 13:case 32:i.fire('click');}if(m){m.focus();h.data.preventDefault();}}}};CKEDITOR.skins.load(b,'templates');var g;return{title:b.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:'selectTpl',label:b.lang.templates.title,elements:[{type:'vbox',padding:5,children:[{type:'html',html:''+b.lang.templates.selectPromptMsg+''},{id:'templatesList',type:'html',focus:function(){try{this.getElement().getElementsByTag('a').getItem(0).focus();}catch(h){}},html:'
'+b.lang.common.options+''},{id:'chkInsertOpt',type:'checkbox',label:b.lang.templates.insertOption,'default':b.config.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var h=this.getContentElement('selectTpl','templatesList');g=h.getElement();CKEDITOR.loadTemplates(b.config.templates_files,function(){var i=b.config.templates.split(','); +if(i.length){c(g,i);h.focus();}else g.setHtml('
'+b.lang.templates.emptyListMsg+''+'
');});this._.element.on('keydown',f);},onHide:function(){this._.element.removeListener('keydown',f);}};});})();