(function(){function g(a){var d=a.listenerData&&a.listenerData.editor,b=a.data.$.clipboardData,c=!1,e=/^image/;if(b)return Array.prototype.forEach.call(b.types,function(a,f){if(!c&&(a.match(e)||b.items[f].type.match(e)))return h(b.items[f],d),c=!0})}function h(a,d){if(a&&"function"===typeof a.getAsFile){var b=a.getAsFile(),c=new FileReader;c.onload=function(a){var b=d.document.createElement("img",{attributes:{src:a.target.result}});setTimeout(function(){d.insertElement(b)},10)};c.readAsDataURL(b)}}
CKEDITOR.plugins.add("pastebase64",{init:function(a){a.addFeature&&a.addFeature({allowedContent:"img[alt,id,!src]{width,height};"});a.on("contentDom",function(){(a.editable?a.editable():a.document).on("paste",g,null,{editor:a})})}})})();