1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/webtrees_ynh.git synced 2024-09-03 18:26:37 +02:00
webtrees_ynh/sources/packages/ckeditor-4.5.2-custom/plugins/specialchar/dialogs/specialchar.js

1 line
No EOL
4.6 KiB
JavaScript

CKEDITOR.dialog.add("specialchar",function(i){var o,c=i.lang.specialchar,f=function(e){var d;e=e.data?e.data.getTarget():new CKEDITOR.dom.element(e);"a"==e.getName()&&(d=e.getChild(0).getHtml())&&(e.removeClass("cke_light_background"),o.hide(),e=i.document.createElement("span"),e.setHtml(d),i.insertText(e.getText()))},b=CKEDITOR.tools.addFunction(f),h,j=function(k,d){var e;d=d||k.data.getTarget();"span"==d.getName()&&(d=d.getParent());if("a"==d.getName()&&(e=d.getChild(0).getHtml())){h&&r(null,h);var g=o.getContentElement("info","htmlPreview").getElement();o.getContentElement("info","charPreview").getElement().setHtml(e);g.setHtml(CKEDITOR.tools.htmlEncode(e));d.getParent().addClass("cke_light_background");h=d}},r=function(e,d){d=d||e.data.getTarget();"span"==d.getName()&&(d=d.getParent());"a"==d.getName()&&(o.getContentElement("info","charPreview").getElement().setHtml("&nbsp;"),o.getContentElement("info","htmlPreview").getElement().setHtml("&nbsp;"),d.getParent().removeClass("cke_light_background"),h=void 0)},a=CKEDITOR.tools.addFunction(function(k){k=new CKEDITOR.dom.event(k);var d=k.getTarget(),e;e=k.getKeystroke();var g="rtl"==i.lang.dir;switch(e){case 38:if(e=d.getParent().getParent().getPrevious()){e=e.getChild([d.getParent().getIndex(),0]),e.focus(),r(null,d),j(null,e)}k.preventDefault();break;case 40:(e=d.getParent().getParent().getNext())&&(e=e.getChild([d.getParent().getIndex(),0]))&&1==e.type&&(e.focus(),r(null,d),j(null,e));k.preventDefault();break;case 32:f({data:k});k.preventDefault();break;case g?37:39:if(e=d.getParent().getNext()){e=e.getChild(0),1==e.type?(e.focus(),r(null,d),j(null,e),k.preventDefault(!0)):r(null,d)}else{if(e=d.getParent().getParent().getNext()){(e=e.getChild([0,0]))&&1==e.type?(e.focus(),r(null,d),j(null,e),k.preventDefault(!0)):r(null,d)}}break;case g?39:37:(e=d.getParent().getPrevious())?(e=e.getChild(0),e.focus(),r(null,d),j(null,e),k.preventDefault(!0)):(e=d.getParent().getParent().getPrevious())?(e=e.getLast().getChild(0),e.focus(),r(null,d),j(null,e),k.preventDefault(!0)):r(null,d)}});return{title:c.title,minWidth:430,minHeight:280,buttons:[CKEDITOR.dialog.cancelButton],charColumns:17,onLoad:function(){for(var v=this.definition.charColumns,w=i.config.specialChars,x=CKEDITOR.tools.getNextId()+"_specialchar_table_label",s=['<table role="listbox" aria-labelledby="'+x+'" style="width: 320px; height: 100%; border-collapse: separate;" align="center" cellspacing="2" cellpadding="2" border="0">'],u=0,q=w.length,p,t;u<q;){s.push('<tr role="presentation">');for(var n=0;n<v;n++,u++){if(p=w[u]){p instanceof Array?(t=p[1],p=p[0]):(t=p.replace("&","").replace(";","").replace("#",""),t=c[t]||p);var k="cke_specialchar_label_"+u+"_"+CKEDITOR.tools.getNextNumber();s.push('<td class="cke_dark_background" style="cursor: default" role="presentation"><a href="javascript: void(0);" role="option" aria-posinset="'+(u+1)+'"',' aria-setsize="'+q+'"',' aria-labelledby="'+k+'"',' class="cke_specialchar" title="',CKEDITOR.tools.htmlEncode(t),'" onkeydown="CKEDITOR.tools.callFunction( '+a+', event, this )" onclick="CKEDITOR.tools.callFunction('+b+', this); return false;" tabindex="-1"><span style="margin: 0 auto;cursor: inherit">'+p+'</span><span class="cke_voice_label" id="'+k+'">'+t+"</span></a>")}else{s.push('<td class="cke_dark_background">&nbsp;')}s.push("</td>")}s.push("</tr>")}s.push("</tbody></table>",'<span id="'+x+'" class="cke_voice_label">'+c.options+"</span>");this.getContentElement("info","charContainer").getElement().setHtml(s.join(""))},contents:[{id:"info",label:i.lang.common.generalTab,title:i.lang.common.generalTab,padding:0,align:"top",elements:[{type:"hbox",align:"top",widths:["320px","90px"],children:[{type:"html",id:"charContainer",html:"",onMouseover:j,onMouseout:r,focus:function(){var d=this.getElement().getElementsByTag("a").getItem(0);setTimeout(function(){d.focus();j(null,d)},0)},onShow:function(){var d=this.getElement().getChild([0,0,0,0,0]);setTimeout(function(){d.focus();j(null,d)},0)},onLoad:function(d){o=d.sender}},{type:"hbox",align:"top",widths:["100%"],children:[{type:"vbox",align:"top",children:[{type:"html",html:"<div></div>"},{type:"html",id:"charPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"},{type:"html",id:"htmlPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"}]}]}]}]}]}});