WordPress/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js
desrosj c6169ea341 Build/Test Tools: Support NodeJS 14.x in the 4.1 branch.
This updates the 4.1 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 change also introduces a `packager-lock.json` file to the branch.

In addition to backporting the package updates that happened after branching 4.1, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [31425,31504,31557,31648-31650,32356-32357,32988,33726,35363,35513,35521,35538-35541,35859,36861-36865,37017,37019-37020,37212,37612,38111,39110,39113,39115-39117,39478,41835,42460-42461,42463,42887,43320,43323,43977,44219,44233,45321,45765,46404,46408-46409,47404,47867,47872-47873,48705,49636,49933,49937,49939,50126,50176,50185] to the 4.1 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.1@50216


git-svn-id: http://core.svn.wordpress.org/branches/4.1@49884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:30:35 +00:00

1 line
8.5 KiB
JavaScript

tinymce.ui.FloatPanel.zIndex=100100,tinymce.PluginManager.add("wordpress",function(i){var d,e,t,a=tinymce.DOM,n=0;function o(n){var e,o=0,t="hide"===n;!(e=i.theme.panel?i.theme.panel.find(".toolbar:not(.menubar)"):e)||e.length<2||"hide"===n&&!e[1].visible()||(!n&&e[1].visible()&&(n="hide"),tinymce.each(e,function(e,t){0<t&&("hide"===n?(e.hide(),o+=30):(e.show(),o-=30))}),o&&!t&&(tinymce.Env.iOS||(t=i.getContentAreaContainer().firstChild,a.setStyle(t,"height",t.clientHeight+o)),"hide"===n?(setUserSetting("hidetb","0"),d&&d.active(!1)):(setUserSetting("hidetb","1"),d&&d.active(!0))),i.fire("wp-toolbar-toggle"))}function r(){a.hide(a.select("#wp_editbtns, #wp_gallerybtns"))}return void 0!==window.jQuery&&window.jQuery(document).triggerHandler("tinymce-editor-setup",[i]),i.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){(d=this).active("1"===getUserSetting("hidetb"))}}),i.on("PostRender",function(){i.getParam("wordpress_adv_hidden",!0)&&"0"===getUserSetting("hidetb","0")&&o("hide")}),i.addCommand("WP_Adv",function(){o()}),i.on("focus",function(){window.wpActiveEditor=i.id}),i.on("BeforeSetContent",function(e){var n;e.content&&(-1!==e.content.indexOf("\x3c!--more")&&(n=i.editorManager.i18n.translate("Read more..."),e.content=e.content.replace(/<!--more(.*?)-->/g,function(e,t){return'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="more" data-wp-more-text="'+t+'" class="wp-more-tag mce-wp-more" title="'+n+'" data-mce-resize="false" data-mce-placeholder="1" />'})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=i.editorManager.i18n.translate("Page break"),e.content=e.content.replace(/<!--nextpage-->/g,'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" title="'+n+'" data-mce-resize="false" data-mce-placeholder="1" />')),-1!==e.content.indexOf('<?"')&&(e.content=e.content.replace(/<\?"/g,"")))}),i.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}))}),i.on("ResolveName",function(e){var t;"IMG"===e.target.nodeName&&(t=i.dom.getAttrib(e.target,"data-wp-more"))&&(e.name=t)}),i.addCommand("WP_More",function(e){var t,n="wp-more-tag",o=i.dom,d=i.selection.getNode();n+=" mce-wp-"+(e=e||"more"),t="more"===e?"Read more...":"Next page",t=i.editorManager.i18n.translate(t),e='<img src="'+tinymce.Env.transparentSrc+'" title="'+t+'" class="'+n+'" data-wp-more="'+e+'" data-mce-resize="false" data-mce-placeholder="1" />',"BODY"===d.nodeName||"P"===d.nodeName&&"BODY"===d.parentNode.nodeName?i.insertContent(e):(d=o.getParent(d,function(e){return!(!e.parentNode||"BODY"!==e.parentNode.nodeName)},i.getBody()))&&("P"===d.nodeName?d.appendChild(o.create("p",null,e).firstChild):o.insertAfter(o.create("p",null,e),d),i.nodeChanged())}),i.addCommand("WP_Code",function(){i.formatter.toggle("code")}),i.addCommand("WP_Page",function(){i.execCommand("WP_More","nextpage")}),i.addCommand("WP_Help",function(){i.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",title:"Keyboard Shortcuts",width:450,height:420,classes:"wp-help",buttons:{text:"Close",onclick:"close"}})}),i.addCommand("WP_Medialib",function(){"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(i.id)}),i.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){i.execCommand("WP_More","more")}}),i.addButton("wp_page",{tooltip:"Page break",onclick:function(){i.execCommand("WP_More","nextpage")}}),i.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),i.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&i.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),i.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){i.execCommand("WP_More","more")}}),i.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){i.execCommand("WP_More","nextpage")}}),i.on("BeforeExecCommand",function(e){!tinymce.Env.webkit||"InsertUnorderedList"!==e.command&&"InsertOrderedList"!==e.command||(t=t||i.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;}"),i.getDoc().head.appendChild(t))}),i.on("ExecCommand",function(e){tinymce.Env.webkit&&t&&("InsertUnorderedList"===e.command||"InsertOrderedList"===e.command)&&i.dom.remove(t)}),i.on("init",function(){var e=tinymce.Env,t=["mceContentBody"],n=i.getDoc(),o=i.dom;tinymce.Env.iOS&&o.addClass(n.documentElement,"ios"),"rtl"===i.getParam("directionality")&&(t.push("rtl"),o.setAttrib(n.documentElement,"dir","rtl")),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"),tinymce.each(t,function(e){e&&o.addClass(n.body,e)}),i.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|address)( [^>]*)?>/gi,"<$1$2>"),e.content=e.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,"</$1>"))}),void 0!==window.jQuery&&window.jQuery(document).triggerHandler("tinymce-editor-init",[i]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&o.bind(n,"dragstart dragend dragover drop",function(e){void 0!==window.jQuery&&window.jQuery(document).trigger(new window.jQuery.Event(e))}),i.getParam("wp_paste_filters",!0)&&(tinymce.Env.webkit||i.on("PastePreProcess",function(e){e.content=e.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),e.content=e.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2")}),i.on("PastePostProcess",function(e){tinymce.each(o.select("p",e.node),function(e){o.isEmpty(e)&&o.remove(e)})}))}),void 0!==window.jQuery&&i.on("keyup",function(e){e=e.keyCode||e.charCode;e!==n&&(13!==e&&8!==n&&46!==n||window.jQuery(document).triggerHandler("wpcountwords",[i.getContent({format:"raw"})]),n=e)}),i.on("SaveContent",function(e){i.inline||!i.isHidden()?(e.content=e.content.replace(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g,"<p>&nbsp;</p>"),i.getParam("wpautop",!0)&&void 0!==window.switchEditors&&(e.content=window.switchEditors.pre_wpautop(e.content))):e.content=e.element.value}),i.on("BeforeSetContent",function(e){e.content&&(e.content=e.content.replace(/<p>(?:&nbsp;|\u00a0|\uFEFF| )+<\/p>/gi,"<p></p>"))}),i.on("preInit",function(){i.schema.addValidElements("@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b"),tinymce.Env.iOS&&(i.settings.height=300)}),e="alt+shift",i.addShortcut(e+"+c","","JustifyCenter"),i.addShortcut(e+"+r","","JustifyRight"),i.addShortcut(e+"+l","","JustifyLeft"),i.addShortcut(e+"+j","","JustifyFull"),i.addShortcut(e+"+q","","mceBlockQuote"),i.addShortcut(e+"+u","","InsertUnorderedList"),i.addShortcut(e+"+o","","InsertOrderedList"),i.addShortcut(e+"+n","","mceSpellCheck"),i.addShortcut(e+"+s","","unlink"),i.addShortcut(e+"+m","","WP_Medialib"),i.addShortcut(e+"+z","","WP_Adv"),i.addShortcut(e+"+t","","WP_More"),i.addShortcut(e+"+d","","Strikethrough"),i.addShortcut(e+"+h","","WP_Help"),i.addShortcut(e+"+p","","WP_Page"),i.addShortcut(e+"+x","","WP_Code"),i.addShortcut("ctrl+s","",function(){"undefined"!=typeof wp&&wp.autosave&&wp.autosave.server.triggerSave()}),i.on("init",function(){i.dom.bind(i.getWin(),"scroll",function(){r()}),i.dom.bind(i.getBody(),"dragstart",function(){r()})}),i.on("BeforeExecCommand",function(){r()}),i.on("SaveContent",function(){r()}),i.on("MouseDown",function(e){"IMG"!==e.target.nodeName&&r()}),i.on("keydown",function(e){e.which!==tinymce.util.VK.DELETE&&e.which!==tinymce.util.VK.BACKSPACE||r()}),{_showButtons:function(e,t){var n=i.dom.getViewPort(i.getWin()),o=a.getPos(i.getContentAreaContainer()),d=i.dom.getPos(e),e=Math.max(d.x-n.x,0)+o.x,o=Math.max(d.y-n.y,0)+o.y;a.setStyles(t,{top:o+5+"px",left:e+5+"px",display:"block"})},_hideButtons:r,_setEmbed:function(e){return e.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(e,t){return'<img width="300" height="200" src="'+tinymce.Env.transparentSrc+'" class="wp-oembed" alt="'+t+'" title="'+t+'" data-mce-resize="false" data-mce-placeholder="1" />'})},_getEmbed:function(e){return e.replace(/<img[^>]+>/g,function(e){var t;return-1===e.indexOf('class="wp-oembed')||(t=e.match(/alt="([^\"]+)"/))[1]&&(e="[embed]"+t[1]+"[/embed]"),e})}}});