X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Ftemplates%2Fdialogs%2Ftemplates.js;h=44ef3e30eac3e410d3a2475a4526c975dc04e596;hp=72d85303c8aab45efbba18559053ec813938dd8b;hb=8665a7c6c60586526e32e8941fe2896739b6ebfb;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1 diff --git a/plugins/templates/dialogs/templates.js b/plugins/templates/dialogs/templates.js index 72d8530..44ef3e3 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(h,i){h.setHtml('');for(var j=0;j
'),k='';if(h.image&&i)k+='';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.equals(i);if(j||g.contains(i)){var k=h.data.getKeystroke(),l=g.getElementsByTag('a'),m;if(l){if(j)m=l.getItem(0);else 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: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 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);}};});})(); +(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);}};});})();