CKEDITOR.plugins.add("ipsimage",{init:function(c){c.addCommand("ipsImage",{allowedContent:"img",exec:function(a){var b=a.getSelection().getSelectedElement(),c="",d=getComputedStyle(b.$,null).getPropertyValue("float");"A"===b.$.parentNode.tagName&&(c=b.$.parentNode.href,d=getComputedStyle(b.$.parentNode,null).getPropertyValue("float"));Debug.log(b.$);a={editorId:$("."+a.id).parent().data("ipseditor-name"),actualWidth:b.$.naturalWidth,actualHeight:b.$.naturalHeight,width:b.$.width,height:b.$.height,
border:getComputedStyle(b.$,null).getPropertyValue("border-left-width").replace("px",""),margin:getComputedStyle(b.$,null).getPropertyValue("margin-left").replace("px",""),"float":d,link:c};a="?app=core&module=system&controller=editor&do=image&"+$.param(a);ips.ui.dialog.create({title:ips.getString("editorImageButton"),fixed:!1,url:a}).show()}});c.on("doubleclick",function(a){a=CKEDITOR.plugins.ipslink.getSelectedLink(c)||a.data.element;!a.isReadOnly()&&a.is("img")&&(c.getSelection().selectElement(a),
c.execCommand("ipsImage"))})}});