CKEDITOR.plugins.add("basewidget",{requires:"widget",init:pluginInit});function pluginInit(b){CKEDITOR.on("dialogDefinition",function(b){var a=b.data.definition.dialog,d=a._.element;a.on("show",function(){a.definition.nockereset&&d.removeClass("cke_reset_all")})})}
function addWidget(b,e,a){var d={};d.init=new FunctionManager;if(a.extend)for(var c in a.extend)if(a.extend.hasOwnProperty(c)&&"function"==typeof a.extend[c])if(d.hasOwnProperty(c))d[c].addFunction(c,a.extend[c],1);else throw"no such function "+c;d.init.addFunction("configToolbar",function(a){var b=function(){var b=document.createElement("span");b.id="configToolbar-panel";b.className="btn-group btn-group-sm basewidget-menu-wrapper";b.style.display="block";b.style.position="absolute";b.style.top="-30px";
b.style.left="20px";var c=function(b){var a=document.createElement("button");a.style.zIndex="2147483647";a.type="button";a.className="btn btn-default";a.onclick=b.onClick.bind(this);var c=document.createElement("span");c.className="glyphicon"+b.icon;a.appendChild(c);b=document.createTextNode(b.label);a.appendChild(b);return a}.bind(this),e=[];e.push(c({label:"remove",icon:"",onClick:function(){this.repository.del(this)}.bind(this)}));if(a&&(a.defaultButtons?a.defaultButtons.edit&&a.defaultButtons.edit.onClick&&
e.push(c({label:"edit",icon:"glyphicon-edit",onClick:a.defaultButtons.edit.onClick.bind(this)})):e=[],a.buttons))for(var d=0;d<a.buttons.length;d++)e.push(c.call(this,a.buttons[d]));for(d=0;d<e.length;d++)b.appendChild(e[d]);this.wrapper.$.insertBefore(b,this.element.$)}.bind(this),c=function(){var a=document.getElementById("configToolbar-panel");a&&a.parentNode.removeChild(a)};this.wrapper.$.onmouseenter=function(a){var d=document.getElementById("configToolbar-panel");d&&c();setTimeout(function(){(d=
document.getElementById("configToolbar-panel"))&&c();b()},200)}.bind(this);this.wrapper.$.onmouseleave=function(a){setTimeout(function(){c()}.bind(this),170)}.bind(this)},1);d.init.addFunction("blockEvents",function(){var a=this.element.$,b=function(a){a.stopPropagation()};a.onclick=b;a.ondblclick=b;a.onmousedown=b;a.onmouseup=b;a.onbeforecut=b;a.oncut=b;a.onbeforepaste=b;a.onpaste=b;a.oninput=b;a.onkeydown=b;a.onkeyup=b;a.onkeypress=b;a.onselectionchange=b},1);d.init.addFunction("onDestroy",function(a){this.on("destroy",
function(){a.call(this)}.bind(this))},1);if(a.configuration)for(c in a.configuration)if(a.configuration.hasOwnProperty(c))if(d.hasOwnProperty(c))for(var f in a.configuration[c])a.configuration[c].hasOwnProperty(f)&&(a.configuration[c][f]?(d[c].enable(f),d[c].setFunctionConfiguration(f,a.configuration[c][f])):d[c].disable(f));else throw"no such function "+c;CKEDITOR.tools.extend(a,{init:function(){d.init.executeAll(this)}});b.widgets.add(e,a)}function FunctionManager(){this.functionsMap={}}
FunctionManager.prototype.addFunction=function(b,e,a){this.functionsMap[b]={body:e,status:a}};FunctionManager.prototype.disable=function(b){this.hasFunction(b)&&(this.functionsMap[b].status=0)};FunctionManager.prototype.enable=function(b){this.hasFunction(b)&&(this.functionsMap[b].status=1)};FunctionManager.prototype.isEnabled=function(b){return 1==this.functionsMap[b].status};FunctionManager.prototype.setFunctionConfiguration=function(b,e){this.functionsMap[b].configuration=e};
FunctionManager.prototype.hasFunction=function(b){if(this.functionsMap.hasOwnProperty(b))return!0;throw"no such function "+b;};FunctionManager.prototype.getEnabled=function(){var b=[],e;for(e in this.functionsMap)this.isEnabled(e)&&b.push(this.functionsMap[e]);return b};FunctionManager.prototype.executeAll=function(b){for(var e=this.getEnabled(),a=0;a<e.length;a++)e[a].body.call(b,e[a].configuration)};CKEDITOR.basewidget=CKEDITOR.basewidget||{};CKEDITOR.tools.extend(CKEDITOR.basewidget,{addWidget:addWidget});