Build/Test Tools: Support NodeJS 14.x in the 4.6 branch.
This updates the 4.6 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.
This also replaces the `npm-shrinkwrap.json` with a `package-lock.json` file. Lock files were not supported in earlier versions of NPM, but can now be used.
In addition to backporting the package updates that happened after branching 4.6, dependencies that were removed in future releases have also been updated to their latest versions.
Props desrosj, dd32, netweb, jorbin.
Merges [42460-42461,42463,42887,43320,43323,43977,44219,44233,44728,45321,45765,46404,46408-46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,50017,50126,50176,50185] to the 4.6 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.6@50206
git-svn-id: http://core.svn.wordpress.org/branches/4.6@49879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-04 23:17:44 -05:00
|
|
|
tinymce.PluginManager.add("wpeditimage",function(g){var o,t,n,a,e=tinymce.each,l=tinymce.trim,i=tinymce.Env.iOS;function c(e){return!(!g.dom.getAttrib(e,"data-mce-placeholder")&&!g.dom.getAttrib(e,"data-mce-object"))}function r(e){e=g.$(e).parents("[contenteditable]");return e&&"false"===e.attr("contenteditable")}function d(e){return e.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(e,t,n){var a,i,o,c,r,d=t.match(/id=['"]([^'"]*)['"] ?/);return(r=(t=(i=(t=(a=(t=d?t.replace(d[0],""):t).match(/align=['"]([^'"]*)['"] ?/))?t.replace(a[0],""):t).match(/class=['"]([^'"]*)['"] ?/))?t.replace(i[0],""):t).match(/width=['"]([0-9]*)['"] ?/))&&(t=t.replace(r[0],"")),c=(c=(n=l(n)).match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i))&&c[2]?(o=l(c[2]),l(c[1])):(o=l(t).replace(/caption=['"]/,"").replace(/['"]$/,""),n),d=d&&d[1]?d[1].replace(/[<>&]+/g,""):"",a=a&&a[1]?a[1]:"alignnone",i=i&&i[1]?" "+i[1].replace(/[<>&]+/g,""):"",(r=(r=!r&&c?c.match(/width=['"]([0-9]*)['"]/):r)&&r[1]?r[1]:r)&&o?(r=parseInt(r,10),g.getParam("wpeditimage_html5_captions")||(r+=10),'<div class="mceTemp"><dl id="'+d+'" class="wp-caption '+a+i+'" style="width: '+r+'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+o+"</dd></dl></div>"):n})}function s(e){return e.replace(/(?:<div [^>]+mceTemp[^>]+>)?\s*(<dl [^>]+wp-caption[^>]+>[\s\S]+?<\/dl>)\s*(?:<\/div>)?/g,function(e,t){var n="";return-1===t.indexOf("<img ")?(n=t.match(/<dd [^>]+>([\s\S]+?)<\/dd>/i))&&n[1]?"<p>"+n[1]+"</p>":"":-1===(n=t.replace(/\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi,function(e,t,n,a){var i,o,c=n.match(/width="([0-9]*)"/);return c=c&&c[1]?c[1]:"",o=(i=(i=t.match(/class="([^"]*)"/))&&i[1]?i[1]:"").match(/align[a-z]+/i)||"alignnone",c&&a?'[caption id="'+(t=(t=t.match(/id="([^"]*)"/))&&t[1]?t[1]:"")+'" align="'+o+'" width="'+c+'"'+(i=(i=i.replace(/wp-caption ?|align[a-z]+ ?/gi,""))&&' class="'+i+'"')+"]"+n+" "+(a=(a=a.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]":"alignnone"!==o[0]?n.replace(/><img/,' class="'+o[0]+'"><img'):n})).indexOf("[caption")?t.replace(/[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi,"<p>$1</p>$2"):n})}function m(e){return e&&(e.textContent||e.innerText)}function u(e){return!e||-1===e.indexOf("<")&&-1===e.indexOf(">")?e:(t=t||new tinymce.html.Serializer({},g.schema)).serialize(g.parser.parse(e,{forced_root_block:!1}))}function p(e){var t=g.dom.getParent(e,"div.mceTemp");(t=!t&&"IMG"===e.nodeName?g.dom.getParent(e,"a"):t)?(t.nextSibling?g.selection.select(t.nextSibling):t.previousSibling?g.selection.select(t.previousSibling):g.selection.select(t.parentNode),g.selection.collapse(!0),g.dom.remove(t)):g.dom.remove(e),g.nodeChanged(),g.undoManager.add()}return g.addButton("wp_img_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",onclick:function(){p(g.selection.getNode())}}),g.addButton("wp_img_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",onclick:function(){var p,e,t;p=g.selection.getNode(),"undefined"!=typeof wp&&wp.media?(t=function(e){var t,n,a,i,o=[],c=g.dom,r=/^\d+$/;(n={attachment_id:!1,size:"custom",caption:"",align:"none",extraClasses:"",link:!1,linkUrl:"",linkClassName:"",linkTargetBlank:!1,linkRel:"",title:""}).url=c.getAttrib(e,"src"),n.alt=c.getAttrib(e,"alt"),n.title=c.getAttrib(e,"title"),a=c.getAttrib(e,"width"),i=c.getAttrib(e,"height"),(!r.test(a)||parseInt(a,10)<1)&&(a=e.naturalWidth||e.width);(!r.test(i)||parseInt(i,10)<1)&&(i=e.naturalHeight||e.height);n.customWidth=n.width=a,n.customHeight=n.height=i,a=tinymce.explode(e.className," "),t=[],tinymce.each(a,function(e){/^wp-image/.test(e)?n.attachment_id=parseInt(e.replace("wp-image-",""),10):/^align/.test(e)?n.align=e.replace("align",""):/^size/.test(e)?n.size=e.replace("size-",""):t.push(e)}),n.extraClasses=t.join(" "),(i=c.getParents(e,".wp-caption")).length&&(i=i[0],a=i.className.split(" "),tinymce.each(a,function(e){/^align/.test(e)?n.ali
|