/* Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.add("colorbutton",{requires:"panelbutton,floatpanel",lang:"af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",icons:"bgcolor,textcolor",hidpi:!0,init:function(e){function u(a,d,g,y,l){var n=new CKEDITOR.style(m["colorButton_"+d+"Style"]),q=CKEDITOR.tools.getNextId()+"_colorBox",k={type:d},p;l=l|| {};e.ui.add(a,CKEDITOR.UI_PANELBUTTON,{label:g,title:g,modes:{wysiwyg:1},editorFocus:0,toolbar:"colors,"+y,allowedContent:n,requiredContent:n,contentTransformations:l.contentTransformations,panel:{css:CKEDITOR.skin.getPath("editor"),attributes:{role:"listbox","aria-label":h.panelTitle}},onBlock:function(a,b){p=b;b.autoSize=!0;b.element.addClass("cke_colorblock");b.element.setHtml(z(a,d,q,k));b.element.getDocument().getBody().setStyle("overflow","hidden");CKEDITOR.ui.fire("ready",this);var c=b.keys, f="rtl"==e.lang.dir;c[f?37:39]="next";c[40]="next";c[9]="next";c[f?39:37]="prev";c[38]="prev";c[CKEDITOR.SHIFT+9]="prev";c[32]="click"},refresh:function(){e.activeFilter.check(n)||this.setState(CKEDITOR.TRISTATE_DISABLED)},onOpen:function(){var a=e.getSelection(),b=a&&a.getStartElement(),c=e.elementPath(b);if(c){b=c.block||c.blockLimit||e.document.getBody();do c=b&&b.getComputedStyle("back"==d?"background-color":"color")||"transparent";while("back"==d&&"transparent"==c&&b&&(b=b.getParent()));c&&"transparent"!= c||(c="#ffffff");!1!==m.colorButton_enableAutomatic&&this._.panel._.iframe.getFrameDocument().getById(q).setStyle("background-color",c);if(b=a&&a.getRanges()[0]){for(var a=new CKEDITOR.dom.walker(b),f=b.collapsed?b.startContainer:a.next(),b="";f;){f.type!==CKEDITOR.NODE_ELEMENT&&(f=f.getParent());f=r(f.getComputedStyle("back"==d?"background-color":"color"));b=b||f;if(b!==f){b="";break}f=a.next()}"transparent"==b&&(b="");"fore"==d&&(k.automaticTextColor="#"+r(c));k.selectionColor=b?"#"+b:"";a=b;b= p._.getItems();for(f=0;f