CoreFiles by mySites.guru
editor_plugin.js1 lines, 5,688 bytes, from wordpress-3.8.39.zip
Raw History Compare with 3.8.38
md5
7d1e1299416ecfdd476e8263c74c6091
sha1
ab189f798512f2ccff17164d82f93e935c1798cd
sha256
3295dd3275aaf76dd0e443b9888dd6e28a6e3efd2b1378f2b8f520d803827383
!function(){var d={};tinymce.create("tinymce.plugins.wpEditImage",{url:"",editor:{},init:function(e,t){var n=this;n.url=t,n.editor=e,n._createButtons(),e.addCommand("WP_EditImage",n._editImage),e.onInit.add(function(i){i.dom.events.add(i.getBody(),"mousedown",function(e){var t;"IMG"==e.target.nodeName&&(t=i.dom.getParent(e.target,"div.mceTemp"))&&(tinymce.isGecko?i.selection.select(t):tinymce.isWebKit&&i.dom.events.prevent(e))}),i.dom.events.add(i.getBody(),"keydown",function(e){var t,n;if(13==e.keyCode&&(t=i.selection.getNode(),n=(t=i.dom.getParent(t,"dl.wp-caption"))?i.dom.getParent(t,"div.mceTemp"):n))return i.dom.events.cancel(e),e=i.dom.create("p",{},"\ufeff"),i.dom.insertAfter(e,n),i.selection.setCursorLocation(e,0),!1}),"ontouchstart"in window&&i.dom.events.add(i.getBody(),"touchstart",function(e){n._showButtons(e)})}),e.onMouseUp.add(function(n,e){var i;tinymce.isWebKit||tinymce.isOpera||(!d.x||e.clientX==d.x&&e.clientY==d.y||"IMG"==(i=n.selection.getNode()).nodeName&&window.setTimeout(function(){var e,t=n.dom.getParent(i,"dl.wp-caption");i.width==d.img_w&&i.height==d.img_h||(i.className=i.className.replace(/size-[^ "']+/,"")),t&&(e=n.dom.getAttrib(i,"width")||i.width,e=parseInt(e,10),n.dom.setStyle(t,"width",10+e),n.execCommand("mceRepaint"))},100),d={})}),e.onMouseDown.add(function(e,t){n._showButtons(t)}),e.onBeforeSetContent.add(function(e,t){t.content=e.wpSetImgCaption(t.content)}),e.onPostProcess.add(function(e,t){t.get&&(t.content=e.wpGetImgCaption(t.content))}),e.wpSetImgCaption=function(e){return n._do_shcode(e)},e.wpGetImgCaption=function(e){return n._get_shcode(e)},e.onBeforeExecCommand.add(function(e,t){var n;"mceInsertContent"==t&&(n=e.dom.getParent(e.selection.getNode(),"div.mceTemp"))&&(t=e.dom.create("p"),e.dom.insertAfter(t,n),e.selection.setCursorLocation(t,0))})},_do_shcode:function(e){return e.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(e,t,n){var i,d,o,a,c=tinymce.trim,r=t.match(/id=['"]([^'"]*)['"] ?/);return(d=(t=(i=(t=r?t.replace(r[0],""):t).match(/align=['"]([^'"]*)['"] ?/))?t.replace(i[0],""):t).match(/width=['"]([0-9]*)['"] ?/))&&(t=t.replace(d[0],"")),a=(a=(n=c(n)).match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i))&&a[2]?(o=c(a[2]),c(a[1])):(o=c(t).replace(/caption=['"]/,"").replace(/['"]$/,""),n),r=r&&r[1]?r[1]:"",i=i&&i[1]?i[1]:"alignnone",(d=d&&d[1]?d[1]:"")&&o?(t="mceTemp","aligncenter"==i&&(t+=" mceIEcenter"),'<div class="'+t+'"><dl id="'+r+'" class="wp-caption '+i+'" style="width: '+(d=parseInt(d,10)+10)+'px"><dt class="wp-caption-dt">'+a+'</dt><dd class="wp-caption-dd">'+o+"</dd></dl></div>"):n})},_get_shcode:function(e){return e.replace(/<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g,function(e,t){var n=t.replace(/<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi,function(e,t,n,i){var d,o=n.match(/width="([0-9]*)"/);return(o=o&&o[1]?o[1]:"")&&i?'[caption id="'+(d=(d=t.match(/id="([^"]*)"/))&&d[1]?d[1]:"")+'" align="'+(t=(t=(t=t.match(/class="([^"]*)"/))&&t[1]?t[1]:"").match(/align[a-z]+/)||"alignnone")+'" width="'+o+'"]'+n+" "+(i=(i=i.replace(/\r\n|\r/g,"\n").replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(e){return e.replace(/[\r\n\t]+/," ")})).replace(/\s*\n\s*/g,"<br />"))+"[/caption]":n});return n=0!==n.indexOf("[caption")?t.replace(/[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi,"<p>$1</p>$2"):n})},_createButtons:function(){var e,t,n=this,i=tinymce.activeEditor,d=tinymce.DOM;d.get("wp_editbtns")||(t=window.devicePixelRatio&&1<window.devicePixelRatio||window.matchMedia&&window.matchMedia("(min-resolution:130dpi)").matches,d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"}),e=d.add("wp_editbtns","img",{src:t?n.url+"/img/image-2x.png":n.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:i.getLang("wpeditimage.edit_img")}),tinymce.dom.Event.add(e,"mousedown",function(){n._editImage(),i.plugins.wordpress._hideButtons()}),t=d.add("wp_editbtns","img",{src:t?n.url+"/img/delete-2x.png":n.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:i.getLang("wpeditimage.del_img")}),tinymce.dom.Event.add(t,"mousedown",function(){var e,t=tinymce.activeEditor,n=t.selection.getNode();if("IMG"==n.nodeName&&-1==t.dom.getAttrib(n,"class").indexOf("mceItem"))return(e=t.dom.getParent(n,"div"))&&t.dom.hasClass(e,"mceTemp")?t.dom.remove(e):("P"==(n="A"==n.parentNode.nodeName&&1==n.parentNode.childNodes.length?n.parentNode:n).parentNode.nodeName&&1==n.parentNode.childNodes.length&&(n=n.parentNode),t.dom.remove(n)),t.execCommand("mceRepaint"),!1;t.plugins.wordpress._hideButtons()}))},_editImage:function(){var e=tinymce.activeEditor,t=this.url,n=e.selection.getNode(),i=n.className;-1==i.indexOf("mceItem")&&-1==i.indexOf("wpGallery")&&"IMG"==n.nodeName&&(n=680<(i=tinymce.DOM.getViewPort()).h-70?680:i.h-70,i=650<i.w?650:i.w,e.windowManager.open({file:t+"/editimage.html",width:i+"px",height:n+"px",inline:!0}))},_showButtons:function(e){var t=this.editor,n=e.target;if("IMG"!=n.nodeName){if(!n.firstChild||"IMG"!=n.firstChild.nodeName||1!=n.childNodes.length)return void t.plugins.wordpress._hideButtons();n=n.firstChild}-1==t.dom.getAttrib(n,"class").indexOf("mceItem")&&(d={x:e.clientX,y:e.clientY,img_w:n.clientWidth,img_h:n.clientHeight},"touchstart"==e.type&&(t.selection.select(n),t.dom.events.cancel(e)),t.plugins.wordpress._hideButtons(),t.plugins.wordpress._showButtons(n,"wp_editbtns"))},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}}),tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)}();

The same content is in 6 releases, WordPress 3.8.36 to 3.8.41. See them all, or every version of this file.