diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js index 2813cd6a2c..240d567c2d 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js @@ -1 +1 @@ -!function(){tinymce.create("tinymce.plugins.wpEditImage",{url:"",editor:{},init:function(a,b){var c=this,d={};c.url=b,c.editor=a,c._createButtons(),a.addCommand("WP_EditImage",c._editImage),a.onInit.add(function(a){a.dom.events.add(a.getBody(),"mousedown",function(b){var c;"IMG"==b.target.nodeName&&(c=a.dom.getParent(b.target,"div.mceTemp"))&&(tinymce.isGecko?a.selection.select(c):tinymce.isWebKit&&a.dom.events.prevent(b))}),a.dom.events.add(a.getBody(),"keydown",function(b){var c,d,e,f;return 13==b.keyCode&&(c=a.selection.getNode(),d=a.dom.getParent(c,"dl.wp-caption"),d&&(e=a.dom.getParent(d,"div.mceTemp")),e)?(a.dom.events.cancel(b),f=a.dom.create("p",{},""),a.dom.insertAfter(f,e),a.selection.setCursorLocation(f,0),!1):void 0}),"ontouchstart"in window&&a.dom.events.add(a.getBody(),"touchstart",function(a){c._showButtons(a)})}),a.onMouseUp.add(function(a,b){if(!tinymce.isWebKit&&!tinymce.isOpera){if(d.x&&(b.clientX!=d.x||b.clientY!=d.y)){var c=a.selection.getNode();"IMG"==c.nodeName&&window.setTimeout(function(){var b,e=a.dom.getParent(c,"dl.wp-caption");(c.width!=d.img_w||c.height!=d.img_h)&&(c.className=c.className.replace(/size-[^ "']+/,"")),e&&(b=a.dom.getAttrib(c,"width")||c.width,b=parseInt(b,10),a.dom.setStyle(e,"width",10+b),a.execCommand("mceRepaint"))},100)}d={}}}),a.onMouseDown.add(function(a,b){c._showButtons(b)}),a.onBeforeSetContent.add(function(a,b){b.content=a.wpSetImgCaption(b.content)}),a.onPostProcess.add(function(a,b){b.get&&(b.content=a.wpGetImgCaption(b.content))}),a.wpSetImgCaption=function(a){return c._do_shcode(a)},a.wpGetImgCaption=function(a){return c._get_shcode(a)},a.onBeforeExecCommand.add(function(a,b){var c,d;if("mceInsertContent"==b){if(c=a.dom.getParent(a.selection.getNode(),"div.mceTemp"),!c)return;d=a.dom.create("p"),a.dom.insertAfter(d,c),a.selection.setCursorLocation(d,0)}})},_do_shcode:function(a){return a.replace(/(?:
)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(a,b,c){var d,e,f,g,h,i,j=tinymce.trim;return d=b.match(/id=['"]([^'"]*)['"] ?/),d&&(b=b.replace(d[0],"")),e=b.match(/align=['"]([^'"]*)['"] ?/),e&&(b=b.replace(e[0],"")),f=b.match(/width=['"]([0-9]*)['"] ?/),f&&(b=b.replace(f[0],"")),c=j(c),i=c.match(/((?:]+>)?]+>(?:<\/a>)?)([\s\S]*)/i),i&&i[2]?(g=j(i[2]),i=j(i[1])):(g=j(b).replace(/caption=['"]/,"").replace(/['"]$/,""),i=c),d=d&&d[1]?d[1]:"",e=e&&e[1]?e[1]:"alignnone",f=f&&f[1]?f[1]:"",f&&g?(h="mceTemp","aligncenter"==e&&(h+=" mceIEcenter"),' [\s\S]*<\/p>)?[\s\S]*/gi," $1 [\s\S]*<\/p>)?[\s\S]*/gi," $1]+)>\s*
"),'[caption id="'+e+'" align="'+f+'" width="'+g+'"]'+c+" "+d+"[/caption]"):c});return 0!==c.indexOf("[caption")&&(c=b.replace(/[\s\S]*?((?:]+>)?]+>(?:<\/a>)?)(]+)>\s*
"),'[caption id="'+e+'" align="'+f+'" width="'+g+'"]'+c+" "+d+"[/caption]"):c});return 0!==c.indexOf("[caption")&&(c=b.replace(/[\s\S]*?((?:]+>)?]+>(?:<\/a>)?)(