X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=plugins%2Ftemplates%2Fdialogs%2Ftemplates.js;h=4867aca3555deea3024f7f9127c9413bffbfd7e5;hb=26ea9b471a69b563dfa9fb7c9c8d97db8e56de0e;hp=8342011cab28180540641cf72e98dc551663e8a4;hpb=059b4c2fef02528bf1af189f7996e80652faddfb;p=ckeditor.git diff --git a/plugins/templates/dialogs/templates.js b/plugins/templates/dialogs/templates.js index 8342011..4867aca 100644 --- a/plugins/templates/dialogs/templates.js +++ b/plugins/templates/dialogs/templates.js @@ -1,7 +1,10 @@ -/* -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+='
'+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);}};});})(); +/* + Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +(function(){CKEDITOR.dialog.add("templates",function(c){function o(a,b){var k=CKEDITOR.dom.element.createFromHtml('
'),d='';a.image&&b&&(d+='');d+='");k.on("click",function(){p(a.html)});return k}function p(a){var b=CKEDITOR.dialog.getCurrent();b.getValueOf("selectTpl","chkInsertOpt")?(c.fire("saveSnapshot"),c.setData(a,function(){b.hide();var a=c.createRange();a.moveToElementEditStart(c.editable());a.select();setTimeout(function(){c.fire("saveSnapshot")},0)})):(c.insertHtml(a),b.hide())}function i(a){var b=a.data.getTarget(), +c=g.equals(b);if(c||g.contains(b)){var d=a.data.getKeystroke(),f=g.getElementsByTag("a"),e;if(f){if(c)e=f.getItem(0);else switch(d){case 40:e=b.getNext();break;case 38:e=b.getPrevious();break;case 13:case 32:b.fire("click")}e&&(e.focus(),a.data.preventDefault())}}}var h=CKEDITOR.plugins.get("templates");CKEDITOR.document.appendStyleSheet(CKEDITOR.getUrl(h.path+"dialogs/templates.css"));var g,h="cke_tpl_list_label_"+CKEDITOR.tools.getNextNumber(),f=c.lang.templates,l=c.config;return{title:c.lang.templates.title, +minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:"selectTpl",label:f.title,elements:[{type:"vbox",padding:5,children:[{id:"selectTplText",type:"html",html:""+f.selectPromptMsg+""},{id:"templatesList",type:"html",focus:!0,html:'
'+f.options+""},{id:"chkInsertOpt",type:"checkbox",label:f.insertOption, +"default":l.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var a=this.getContentElement("selectTpl","templatesList");g=a.getElement();CKEDITOR.loadTemplates(l.templates_files,function(){var b=(l.templates||"default").split(",");if(b.length){var c=g;c.setHtml("");for(var d=0,h=b.length;d'+f.emptyListMsg+"")});this._.element.on("keydown",i)},onHide:function(){this._.element.removeListener("keydown",i)}}})})(); \ No newline at end of file