X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Ftemplates%2Fdialogs%2Ftemplates.js;h=61f09cf8bc39f2ef09db1f1971481ca8f5373f03;hp=44ef3e30eac3e410d3a2475a4526c975dc04e596;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/plugins/templates/dialogs/templates.js b/plugins/templates/dialogs/templates.js index 44ef3e3..61f09cf 100644 --- a/plugins/templates/dialogs/templates.js +++ b/plugins/templates/dialogs/templates.js @@ -3,5 +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;CKEDITOR.dialog.add('templates',function(b){function c(i,j){i.setHtml('');for(var k=0;k
'),l='';if(i.image&&j)l+='';l+='';k.getFirst().setHtml(l);k.on('click',function(){e(i.html);});return k;};function e(i){var j=CKEDITOR.dialog.getCurrent(),k=j.getValueOf('selectTpl','chkInsertOpt');if(k){b.on('contentDom',function(l){l.removeListener();j.hide();var m=new CKEDITOR.dom.range(b.document);m.moveToElementEditStart(b.document.getBody());m.select(true);setTimeout(function(){b.fire('saveSnapshot');},0);});b.fire('saveSnapshot');b.setData(i);}else{b.insertHtml(i);j.hide();}};function f(i){var j=i.data.getTarget(),k=g.equals(j);if(k||g.contains(j)){var l=i.data.getKeystroke(),m=g.getElementsByTag('a'),n;if(m){if(k)n=m.getItem(0);else switch(l){case 40:n=j.getNext();break;case 38:n=j.getPrevious();break;case 13:case 32:j.fire('click');}if(n){n.focus();i.data.preventDefault();}}}};CKEDITOR.skins.load(b,'templates');var g,h='cke_tpl_list_label_'+CKEDITOR.tools.getNextNumber();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:true,html:'
'+'
'+'
'+''+b.lang.templates.options+''},{id:'chkInsertOpt',type:'checkbox',label:b.lang.templates.insertOption,'default':b.config.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var i=this.getContentElement('selectTpl','templatesList'); -g=i.getElement();CKEDITOR.loadTemplates(b.config.templates_files,function(){var j=b.config.templates.split(',');if(j.length){c(g,j);i.focus();}else g.setHtml('
'+b.lang.templates.emptyListMsg+''+'
');});this._.element.on('keydown',f);},onHide:function(){this._.element.removeListener('keydown',f);}};});})(); +(function(){var a=CKEDITOR.document;CKEDITOR.dialog.add('templates',function(b){function c(k,l){k.setHtml('');for(var m=0,n=l.length;m
'),n='';if(k.image&&l)n+='';n+='';m.getFirst().setHtml(n);m.on('click',function(){e(k.html);});return m;};function e(k){var l=CKEDITOR.dialog.getCurrent(),m=l.getValueOf('selectTpl','chkInsertOpt');if(m){b.on('contentDom',function(n){n.removeListener();l.hide();var o=new CKEDITOR.dom.range(b.document);o.moveToElementEditStart(b.document.getBody());o.select(1);setTimeout(function(){b.fire('saveSnapshot');},0);});b.fire('saveSnapshot');b.setData(k);}else{b.insertHtml(k);l.hide();}};function f(k){var l=k.data.getTarget(),m=g.equals(l);if(m||g.contains(l)){var n=k.data.getKeystroke(),o=g.getElementsByTag('a'),p;if(o){if(m)p=o.getItem(0);else switch(n){case 40:p=l.getNext();break;case 38:p=l.getPrevious();break;case 13:case 32:l.fire('click');}if(p){p.focus();k.data.preventDefault();}}}};CKEDITOR.skins.load(b,'templates');var g,h='cke_tpl_list_label_'+CKEDITOR.tools.getNextNumber(),i=b.lang.templates,j=b.config;return{title:b.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:'selectTpl',label:i.title,elements:[{type:'vbox',padding:5,children:[{type:'html',html:''+i.selectPromptMsg+''},{id:'templatesList',type:'html',focus:true,html:'
'+'
'+'
'+''+i.options+''},{id:'chkInsertOpt',type:'checkbox',label:i.insertOption,'default':j.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var k=this.getContentElement('selectTpl','templatesList'); +g=k.getElement();CKEDITOR.loadTemplates(j.templates_files,function(){var l=(j.templates||'default').split(',');if(l.length){c(g,l);k.focus();}else g.setHtml('
'+i.emptyListMsg+''+'
');});this._.element.on('keydown',f);},onHide:function(){this._.element.removeListener('keydown',f);}};});})();