mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 19:56:49 +01:00
This updates the 4.4 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. Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401). 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.4, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin. Merges [35859,35862,36860-36865,36935,36978-36979,37017,37019-37020,37212,37612,38111,38688,39110,39113-39119,39478,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,50192] to the 4.4 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/4.4@50210 git-svn-id: http://core.svn.wordpress.org/branches/4.4@49881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
!function(E){E.ui.FloatPanel.zIndex=100100,E.PluginManager.add("wordpress",function(c){var i,t,x=E.DOM,l=E.each,d=c.editorManager.i18n.translate,a=window.jQuery,o=window.wp,r=o&&o.editor&&o.editor.autop&&c.getParam("wpautop",!0);function e(n){var e,o=0,t="hide"===n;!(e=c.theme.panel?c.theme.panel.find(".toolbar:not(.menubar)"):e)||e.length<2||"hide"===n&&!e[1].visible()||(!n&&e[1].visible()&&(n="hide"),l(e,function(e,t){0<t&&("hide"===n?(e.hide(),o+=30):(e.show(),o-=30))}),o&&!t&&(E.Env.iOS||(t=c.getContentAreaContainer().firstChild,x.setStyle(t,"height",t.clientHeight+o)),"hide"===n?(setUserSetting("hidetb","0"),i&&i.active(!1)):(setUserSetting("hidetb","1"),i&&i.active(!0))),c.fire("wp-toolbar-toggle"))}function n(){}return a&&a(document).triggerHandler("tinymce-editor-setup",[c]),c.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){(i=this).active("1"===getUserSetting("hidetb"))}}),c.on("PostRender",function(){c.getParam("wordpress_adv_hidden",!0)&&"0"===getUserSetting("hidetb","0")&&e("hide")}),c.addCommand("WP_Adv",function(){e()}),c.on("focus",function(){window.wpActiveEditor=c.id}),c.on("BeforeSetContent",function(e){var n;e.content&&(-1!==e.content.indexOf("\x3c!--more")&&(n=d("Read more..."),e.content=e.content.replace(/<!--more(.*?)-->/g,function(e,t){return'<img src="'+E.Env.transparentSrc+'" data-wp-more="more" data-wp-more-text="'+t+'" class="wp-more-tag mce-wp-more" alt="" title="'+n+'" data-mce-resize="false" data-mce-placeholder="1" />'})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=d("Page break"),e.content=e.content.replace(/<!--nextpage-->/g,'<img src="'+E.Env.transparentSrc+'" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" alt="" title="'+n+'" data-mce-resize="false" data-mce-placeholder="1" />')),e.load&&"raw"!==e.format&&r&&(e.content=o.editor.autop(e.content)),e.content=e.content.replace(/<p>(?: |\u00a0|\uFEFF|\s)+<\/p>/gi,"<p><br /></p>"))}),c.on("PostProcess",function(e){e.get&&(e.content=e.content.replace(/<img[^>]+>/g,function(e){var t,n="";return-1!==e.indexOf('data-wp-more="more"')?e="\x3c!--more"+(n=(t=e.match(/data-wp-more-text="([^"]+)"/))?t[1]:n)+"--\x3e":-1!==e.indexOf('data-wp-more="nextpage"')&&(e="\x3c!--nextpage--\x3e"),e}))}),c.on("ResolveName",function(e){var t;"IMG"===e.target.nodeName&&(t=c.dom.getAttrib(e.target,"data-wp-more"))&&(e.name=t)}),c.addCommand("WP_More",function(e){var t,n="wp-more-tag",o=c.dom,i=c.selection.getNode();n+=" mce-wp-"+(e=e||"more"),t=d("more"===e?"Read more...":"Next page"),e='<img src="'+E.Env.transparentSrc+'" alt="" title="'+t+'" class="'+n+'" data-wp-more="'+e+'" data-mce-resize="false" data-mce-placeholder="1" />',"BODY"===i.nodeName||"P"===i.nodeName&&"BODY"===i.parentNode.nodeName?c.insertContent(e):(i=o.getParent(i,function(e){return!(!e.parentNode||"BODY"!==e.parentNode.nodeName)},c.getBody()))&&("P"===i.nodeName?i.appendChild(o.create("p",null,e).firstChild):o.insertAfter(o.create("p",null,e),i),c.nodeChanged())}),c.addCommand("WP_Code",function(){c.formatter.toggle("code")}),c.addCommand("WP_Page",function(){c.execCommand("WP_More","nextpage")}),c.addCommand("WP_Help",function(){var e,t,n=E.Env.mac?d("Ctrl + Alt + letter:"):d("Shift + Alt + letter:"),o=E.Env.mac?d("Cmd + letter:"):d("Ctrl + letter:"),i=[],a=[];function r(e){var n="<tr>";return l(e,function(e,t){n+=e?"<td><kbd>"+t+"</kbd></td><td>"+d(e)+"</td>":"<td></td><td></td>"}),n+"</tr>"}l([{c:"Copy",x:"Cut"},{v:"Paste",a:"Select all"},{z:"Undo",y:"Redo"},{b:"Bold",i:"Italic"},{u:"Underline",k:"Insert/edit link"}],function(e){i.push(r(e))}),l([{1:"Heading 1",2:"Heading 2"},{3:"Heading 3",4:"Heading 4"},{5:"Heading 5",6:"Heading 6"},{l:"Align left",c:"Align center"},{r:"Align right",j:"Justify"},{d:"Strikethrough",q:"Blockquote"},{u:"Bullet list",o:"Numbered list"},{a:"Insert/edit link",s:"Remove link"},{m:"Insert/edit image",t:"Insert Read More tag"},{h:"Keyboard Shortcuts",x:"Code"},{p:"Insert Page Break tag",w:"Distraction-free writing mode"}],function(e){a.push(r(e))}),e="<tr><th>"+(e=[d("Letter"),d("Action"),d("Letter"),d("Action")]).join("</th><th>")+"</th></tr>",t=(t='<div class="wp-editor-help">')+"<h2>"+d("Default shortcuts,")+" "+o+'</h2><table class="wp-help-th-center">'+e+i.join("")+"</table><h2>"+d("Additional shortcuts,")+" "+n+'</h2><table class="wp-help-th-center">'+e+a.join("")+"</table>",t=(t=c.plugins.wptextpattern?(t=t+"<h2>"+d("When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.")+"</h2><table>"+r({"*":"Bullet list"})+r({"-":"Bullet list"})+r({"1.":"Numbered list"})+r({"1)":"Numbered list"})+"</table>")+"<h2>"+d("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+"</h2><table>"+r({">":"Blockquote"})+r({"##":"Heading 2"})+r({"###":"Heading 3"})+r({"####":"Heading 4"})+r({"#####":"Heading 5"})+r({"######":"Heading 6"})+"</table>":t)+"<h2>"+d("Focus shortcuts:")+"</h2><table>"+r({"Alt + F8":"Inline toolbar (when an image, link or preview is selected)"})+r({"Alt + F9":"Editor menu (when enabled)"})+r({"Alt + F10":"Editor toolbar"})+r({"Alt + F11":"Elements path"})+"</table><p>"+d("To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.")+"</p>",t+="</div>",(t=c.windowManager.open({title:"Keyboard Shortcuts",items:{type:"container",classes:"wp-help",html:t},buttons:{text:"Close",onclick:"close"}})).$el&&(t.$el.find('div[role="application"]').attr("role","document"),(t=t.$el.find(".mce-wp-help"))[0]&&(t.attr("tabindex","0"),t[0].focus(),t.on("keydown",function(e){33<=e.keyCode&&e.keyCode<=40&&e.stopPropagation()})))}),c.addCommand("WP_Medialib",function(){o&&o.media&&o.media.editor&&o.media.editor.open(c.id)}),c.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){c.execCommand("WP_More","more")}}),c.addButton("wp_page",{tooltip:"Page break",onclick:function(){c.execCommand("WP_More","nextpage")}}),c.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),c.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),o&&o.media&&o.media.editor&&c.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),c.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){c.execCommand("WP_More","more")}}),c.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){c.execCommand("WP_More","nextpage")}}),c.on("BeforeExecCommand",function(e){!E.Env.webkit||"InsertUnorderedList"!==e.command&&"InsertOrderedList"!==e.command||(t=t||c.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}"),c.getDoc().head.appendChild(t))}),c.on("ExecCommand",function(e){E.Env.webkit&&t&&("InsertUnorderedList"===e.command||"InsertOrderedList"===e.command)&&c.dom.remove(t)}),c.on("init",function(){var e=E.Env,t=["mceContentBody"],n=c.getDoc(),o=c.dom;e.iOS&&o.addClass(n.documentElement,"ios"),"rtl"===c.getParam("directionality")&&(t.push("rtl"),o.setAttrib(n.documentElement,"dir","rtl")),o.setAttrib(n.documentElement,"lang",c.getParam("wp_lang_attr")),e.ie?9===parseInt(e.ie,10)?t.push("ie9"):8===parseInt(e.ie,10)?t.push("ie8"):e.ie<8&&t.push("ie7"):e.webkit&&t.push("webkit"),t.push("wp-editor"),l(t,function(e){e&&o.addClass(n.body,e)}),c.on("BeforeSetContent",function(e){e.content&&(e.content=e.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi,"<$1$2>").replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi,"</$1>"))}),a&&a(document).triggerHandler("tinymce-editor-init",[c]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&o.bind(n,"dragstart dragend dragover drop",function(e){a&&a(document).trigger(new a.Event(e))}),c.getParam("wp_paste_filters",!0)&&(c.on("PastePreProcess",function(e){e.content=e.content.replace(/<br class="?Apple-interchange-newline"?>/gi,""),E.Env.webkit||(e.content=e.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),e.content=e.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2"))}),c.on("PastePostProcess",function(e){l(o.select("p",e.node),function(e){o.isEmpty(e)&&o.remove(e)})}))}),c.on("SaveContent",function(e){c.inline||!c.isHidden()?(e.content=e.content.replace(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g,"<p> </p>"),r&&(e.content=o.editor.removep(e.content))):e.content=e.element.value}),c.on("preInit",function(){c.schema.addValidElements("@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b,script[src|async|defer|type|charset|crossorigin|integrity]"),E.Env.iOS&&(c.settings.height=300),l({c:"JustifyCenter",r:"JustifyRight",l:"JustifyLeft",j:"JustifyFull",q:"mceBlockQuote",u:"InsertUnorderedList",o:"InsertOrderedList",s:"unlink",m:"WP_Medialib",z:"WP_Adv",t:"WP_More",d:"Strikethrough",h:"WP_Help",p:"WP_Page",x:"WP_Code"},function(e,t){c.shortcuts.add("access+"+t,"",e)}),c.addShortcut("meta+s","",function(){o&&o.autosave&&o.autosave.server.triggerSave()})}),c.on("preinit",function(){var n,b,t,v,y,C,r=E.ui.Factory,d=c.settings,e=c.getContainer(),P=document.getElementById("wpadminbar"),_=document.getElementById(c.id+"_ifr");function o(e){n&&(n.hide(),"hide"===e.type?n=!1:"resize"!==e.type&&"scroll"!==e.type||(clearTimeout(t),t=setTimeout(function(){n&&"function"==typeof n.show&&n.show()},250)))}e&&(v=E.$(".mce-toolbar-grp",e)[0],y=E.$(".mce-statusbar",e)[0]),"content"===c.id&&(C=document.getElementById("post-status-info")),c.shortcuts.add("alt+119","",function(){var e;n&&(e=n.find("toolbar")[0])&&e.focus(!0)}),c.on("nodechange",function(e){var t=c.selection.isCollapsed(),t={element:e.element,parents:e.parents,collapsed:t};c.fire("wptoolbar",t),b=t.selection||t.element,n&&n.hide(),t.toolbar?(n=t.toolbar).show():n=!1}),c.on("focus",function(){n&&n.show()}),x.bind(window,"resize scroll",o),c.dom.bind(c.getWin(),"resize scroll",o),c.on("remove",function(){x.unbind(window,"resize scroll",o),c.dom.unbind(c.getWin(),"resize scroll",o)}),c.on("blur hide",o),c.wp=c.wp||{},c.wp._createToolbar=function(e,t){var n,o,a=[];return l(e,function(i){var t;function e(){var e=c.selection;"bullist"===t&&e.selectorChanged("ul > li",function(e,t){for(var n,o=t.parents.length;o--&&"OL"!==(n=t.parents[o].nodeName)&&"UL"!=n;);i.active(e&&"UL"===n)}),"numlist"===t&&e.selectorChanged("ol > li",function(e,t){for(var n,o=t.parents.length;o--&&"OL"!==(n=t.parents[o].nodeName)&&"UL"!==n;);i.active(e&&"OL"===n)}),i.settings.stateSelector&&e.selectorChanged(i.settings.stateSelector,function(e){i.active(e)},!0),i.settings.disabledStateSelector&&e.selectorChanged(i.settings.disabledStateSelector,function(e){i.disabled(e)})}"|"===i?o=null:r.has(i)?(i={type:i},d.toolbar_items_size&&(i.size=d.toolbar_items_size),a.push(i),o=null):(o||(o={type:"buttongroup",items:[]},a.push(o)),c.buttons[i]&&(t=i,(i="function"==typeof(i=c.buttons[t])?i():i).type=i.type||"button",d.toolbar_items_size&&(i.size=d.toolbar_items_size),i=r.create(i),o.items.push(i),c.initialized?e():c.on("init",e)))}),(n=r.create({type:"panel",layout:"stack",classes:"toolbar-grp inline-toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:[{type:"toolbar",layout:"flow",items:a}]})).bottom=t,n.on("show",function(){this.reposition()}),n.on("keydown",function(e){27===e.keyCode&&(this.hide(),c.focus())}),c.on("remove",function(){n.remove()}),n.reposition=function(){if(!b)return this;var e,t=window.pageXOffset||document.documentElement.scrollLeft,n=window.pageYOffset||document.documentElement.scrollTop,o=window.innerWidth,i=window.innerHeight,a=_?_.getBoundingClientRect():{top:0,right:o,bottom:i,left:0,width:o,height:i},r=this.getEl(),d=r.offsetWidth,c=r.offsetHeight,l=b.getBoundingClientRect(),s=(l.left+l.right)/2,m=c+8+5,p=P?P.getBoundingClientRect().bottom:0,u=v?v.getBoundingClientRect().bottom:0,g=y?i-y.getBoundingClientRect().top:0,h=C?i-C.getBoundingClientRect().top:0,f=Math.max(0,p,u,a.top),w=Math.max(0,g,h,i-a.bottom),p=l.top+a.top-f,u=i-a.top-l.bottom-w,g=i-f-w,h="",i=0,w=0;return g<=p||g<=u?this.hide():(E.Env.iOS&&"IMG"===b.nodeName&&(i=54,w=46),this.bottom?m<=u?(h=" mce-arrow-up",e=l.bottom+a.top+n-w):m<=p&&(h=" mce-arrow-down",e=l.top+a.top+n-c-8+i):m<=p?(h=" mce-arrow-down",e=l.top+a.top+n-c-8+i):m<=u&&g/2>l.bottom+a.top-f&&(h=" mce-arrow-up",e=l.bottom+a.top+n-w),void 0===e&&(e=n+f+5+w),s=s-d/2+a.left+t,l.left<0||l.right>a.width?s=a.left+t+(a.width-d)/2:o<=d?(h+=" mce-arrow-full",s=0):s<0&&l.left+d>o||o<s+d&&l.right-d<0?s=(o-d)/2:s<a.left+t?(h+=" mce-arrow-left",s=l.left+a.left+t):s+d>a.width+a.left+t&&(h+=" mce-arrow-right",s=l.right-d+a.left+t),E.Env.iOS&&"IMG"===b.nodeName&&(h=h.replace(/ ?mce-arrow-(up|down)/g,"")),r.className=r.className.replace(/ ?mce-arrow-[\w]+/g,"")+h,x.setStyles(r,{left:s,top:e}),this)},n.hide().renderTo(document.body),n}},!0),{_showButtons:n,_hideButtons:n,_setEmbed:n,_getEmbed:n}})}(window.tinymce); |