CKEDITOR.plugins.add("ipsimage",{icons:"ipsimage",hidpi:!0,init:function(b){b.addCommand("ipsImage",{allowedContent:"img",exec:function(a){var c=a.getSelection().getSelectedElement(),b="",d=getComputedStyle(c.$,null).getPropertyValue("float");"A"===c.$.parentNode.tagName&&(b=c.$.parentNode.href,d=getComputedStyle(c.$.parentNode,null).getPropertyValue("float"));Debug.log(c.$);a={editorId:a.name,actualWidth:c.$.naturalWidth,actualHeight:c.$.naturalHeight,width:c.$.width,height:c.$.height,border:getComputedStyle(c.$,
null).getPropertyValue("border-left-width").replace("px",""),margin:getComputedStyle(c.$,null).getPropertyValue("margin-left").replace("px",""),"float":d,link:b};console.log(a);a="?app=core&module=system&controller=editor&do=image&"+$.param(a);ips.ui.dialog.create({title:ips.getString("editorImageButton"),fixed:!1,size:"narrow",url:a}).show()}});b.on("doubleclick",function(a){a=CKEDITOR.plugins.ipslink.getSelectedLink(b)||a.data.element;!a.isReadOnly()&&a.is("img")&&(b.getSelection().selectElement(a),
b.execCommand("ipsImage"))});b.contextMenu&&(b.addMenuGroup("ipsImage"),b.addMenuItem("editIpsImage",{label:ips.getString("editorImageButtonEdit"),icon:this.path+"icons"+(CKEDITOR.env.hidpi?"/hidpi":"")+"/ipsimage.png",command:"ipsImage",group:"ipsImage"}),b.contextMenu.addListener(function(a){if(a.getAscendant("img",!0))return{editIpsImage:CKEDITOR.TRISTATE_OFF}}))}});