WordPress/wp-admin/js/post.min.js
desrosj 40a294d21e Build/Test Tools: Backport GitHub Action and build improvements to the 5.3 branch.
This backports several build and test tool improvements to the 5.3 branch. Most notably, this includes:

- The changes required to allow each workflow to be triggered by the `workflow_dispatch` event so that tests can be run on a schedule [50590].
- The ability to run PHPUnit tests from `src` instead of `build` [50441-50443].
- Splitting single site and multisite tests into parallel jobs [50379].
- Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
- Better branch and path scoping for GitHub Action workflows when running on `pull_request` [50432,50479].
- Several `devDependency` updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.3 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667.
Built from https://develop.svn.wordpress.org/branches/5.3@50605


git-svn-id: http://core.svn.wordpress.org/branches/5.3@50218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-26 19:23:55 +00:00

1 line
18 KiB
JavaScript

window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(a){var t=!1;window.commentsBox={st:0,get:function(t,e){var i=this.st;return this.st+=e=e||20,this.total=t,a("#commentsdiv .spinner").addClass("is-active"),e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),p:a("#post_ID").val(),start:i,number:e},a.post(ajaxurl,e,function(t){return t=wpAjax.parseAjaxResponse(t),a("#commentsdiv .widefat").show(),a("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(a("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,a("a[className*=':']").unbind(),void(commentsBox.st>commentsBox.total?a("#show-comments").hide():a("#show-comments").show().children("a").html(postL10n.showcomm))):void(1!=t?a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>"):a("#show-comments").html(postL10n.endcomm))}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(t){a(".inside","#postimagediv").html(t)},window.WPSetThumbnailID=function(t){var e=a('input[value="_thumbnail_id"]',"#list-table");0<e.length&&a("#meta\\["+e.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(t)},window.WPRemoveThumbnail=function(t){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:t,cookie:encodeURIComponent(document.cookie)},function(t){"0"==t?alert(setPostThumbnailL10n.error):WPSetThumbnailHTML(t)})},a(document).on("heartbeat-send.refresh-lock",function(t,e){var i=a("#active_post_lock").val(),n=a("#post_ID").val(),s={};n&&a("#post-lock-dialog").length&&(s.post_id=n,i&&(s.lock=i),e["wp-refresh-post-lock"]=s)}).on("heartbeat-tick.refresh-lock",function(t,e){var i,n;e["wp-refresh-post-lock"]&&((i=e["wp-refresh-post-lock"]).lock_error?(n=a("#post-lock-dialog")).length&&!n.is(":visible")&&(wp.autosave&&(a(document).one("heartbeat-tick",function(){wp.autosave.server.suspend(),n.removeClass("saving").addClass("saved"),a(window).off("beforeunload.edit-post")}),n.addClass("saving"),wp.autosave.server.triggerSave()),i.lock_error.avatar_src&&(e=a('<img class="avatar avatar-64 photo" width="64" height="64" alt="" />').attr("src",i.lock_error.avatar_src.replace(/&amp;/g,"&")),n.find("div.post-locked-avatar").empty().append(e)),n.show().find(".currently-editing").text(i.lock_error.text),n.find(".wp-tab-first").focus()):i.new_lock&&a("#active_post_lock").val(i.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){a("#edit-slug-box > *").length||t||a.post(ajaxurl,{action:"sample-permalink",post_id:a("#post_ID").val(),new_title:a("#title").val(),samplepermalinknonce:a("#samplepermalinknonce").val()},function(t){"-1"!=t&&a("#edit-slug-box").html(t)})})}(jQuery),function(s){var a,t;function i(){a=!1,window.clearTimeout(t),t=window.setTimeout(function(){a=!0},3e5)}s(document).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i,n=s("#wp-auth-check-wrap");(a||n.length&&!n.hasClass("hidden"))&&(i=s("#post_ID").val())&&s("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&s.each(e.replace,function(t,e){s("#"+t).val(e)}),e.heartbeatNonce&&(window.heartbeatSettings.nonce=e.heartbeatNonce))}).ready(function(){i()})}(jQuery),jQuery(document).ready(function(u){var d,e,i,n,s,a,o,l,t,p,c,r="",h=u("#content"),v=u(document),f=u("#post_ID").val()||0,m=u("#submitpost"),w=!0,b=u("#post-visibility-select"),g=u("#timestampdiv"),k=u("#post-status-select"),y=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac");function _(t){p.hasClass("wp-editor-expand")||(l?a.theme.resizeTo(null,o+t.pageY):h.height(Math.max(50,o+t.pageY)),t.preventDefault())}function x(){var t;p.hasClass("wp-editor-expand")||(t=l?(a.focus(),((t=parseInt(u("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||200<t)&&(t=30),parseInt(u("#content_ifr").css("height"),10)+t-28):(h.focus(),parseInt(h.css("height"),10)),v.off(".wp-editor-resize"),t&&50<t&&t<5e3&&setUserSetting("ed_size",t))}postboxes.add_postbox_toggles(pagenow),window.name="",u("#post-lock-dialog .notification-dialog").on("keydown",function(t){var e;9==t.which&&((e=u(t.target)).hasClass("wp-tab-first")&&t.shiftKey?(u(this).find(".wp-tab-last").focus(),t.preventDefault()):e.hasClass("wp-tab-last")&&!t.shiftKey&&(u(this).find(".wp-tab-first").focus(),t.preventDefault()))}).filter(":visible").find(".wp-tab-first").focus(),wp.heartbeat&&u("#post-lock-dialog").length&&wp.heartbeat.interval(15),i=m.find(":submit, a.submitdelete, #post-preview").on("click.edit-post",function(t){var e=u(this);e.hasClass("disabled")?t.preventDefault():e.hasClass("submitdelete")||e.is("#post-preview")||u("form#post").off("submit.edit-post").on("submit.edit-post",function(t){if(!t.isDefaultPrevented()){if(wp.autosave&&wp.autosave.server.suspend(),"undefined"!=typeof commentReply){if(!commentReply.discardCommentChanges())return!1;commentReply.close()}w=!1,u(window).off("beforeunload.edit-post"),i.addClass("disabled"),("publish"===e.attr("id")?m.find("#major-publishing-actions .spinner"):m.find("#minor-publishing .spinner")).addClass("is-active")}})}),u("#post-preview").on("click.post-preview",function(t){var e=u(this),i=u("form#post"),n=u("input#wp-preview"),s=e.attr("target")||"wp-preview",a=navigator.userAgent.toLowerCase();t.preventDefault(),e.hasClass("disabled")||(wp.autosave&&wp.autosave.server.tempBlockSave(),n.val("dopreview"),i.attr("target",s).submit().attr("target",""),-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")&&i.attr("action",function(t,e){return e+"?t="+(new Date).getTime()}),n.val(""))}),u("#title").on("keydown.editor-focus",function(t){var e;if(9===t.keyCode&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){if((e="undefined"!=typeof tinymce&&tinymce.get("content"))&&!e.isHidden())e.focus();else{if(!h.length)return;h.focus()}t.preventDefault()}}),u("#auto_draft").val()&&u("#title").blur(function(){var t;this.value&&!u("#edit-slug-box > *").length&&(u("form#post").one("submit",function(){t=!0}),window.setTimeout(function(){!t&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),v.on("autosave-disable-buttons.edit-post",function(){i.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||i.removeClass("disabled")}).on("before-autosave.edit-post",function(){u(".autosave-message").text(postL10n.savingText)}).on("after-autosave.edit-post",function(t,e){u(".autosave-message").text(e.message),u(document.body).hasClass("post-new-php")&&u(".submitbox .submitdelete").show()}),u(window).on("beforeunload.edit-post",function(){var t="undefined"!=typeof tinymce&&tinymce.get("content");if(t&&!t.isHidden()&&t.isDirty()||wp.autosave&&wp.autosave.server.postChanged())return postL10n.saveAlert}).on("unload.edit-post",function(t){if(w&&(!t.target||"#document"==t.target.nodeName)){var e=u("#post_ID").val(),t=u("#active_post_lock").val();if(e&&t){t={action:"wp-remove-post-lock",_wpnonce:u("#_wpnonce").val(),post_ID:e,active_post_lock:t};if(window.FormData&&window.navigator.sendBeacon){var i=new window.FormData;if(u.each(t,function(t,e){i.append(t,e)}),window.navigator.sendBeacon(ajaxurl,i))return}u.post({async:!1,data:t,url:ajaxurl})}}}),u("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():u(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),u(".categorydiv").each(function(){var t,s,e,i=u(this).attr("id").split("-");i.shift(),s=i.join("-"),e="category"==s?"cats":s+"_tab",u("a","#"+s+"-tabs").click(function(t){t.preventDefault();t=u(this).attr("href");u(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),u("#"+s+"-tabs").siblings(".tabs-panel").hide(),u(t).show(),"#"+s+"-all"==t?deleteUserSetting(e):setUserSetting(e,"pop")}),getUserSetting(e)&&u('a[href="#'+s+'-pop"]',"#"+s+"-tabs").click(),u("#new"+s).one("focus",function(){u(this).val("").removeClass("form-input-tip")}),u("#new"+s).keypress(function(t){13===t.keyCode&&(t.preventDefault(),u("#"+s+"-add-submit").click())}),u("#"+s+"-add-submit").click(function(){u("#new"+s).focus()}),t=function(t){return!!u("#new"+s).val()&&(t.data+="&"+u(":checked","#"+s+"checklist").serialize(),u("#"+s+"-add-submit").prop("disabled",!0),t)},i=function(t,e){var i,n=u("#new"+s+"_parent");u("#"+s+"-add-submit").prop("disabled",!1),"undefined"!=e.parsed.responses[0]&&(i=e.parsed.responses[0].supplemental.newcat_parent)&&(n.before(i),n.remove())},u("#"+s+"checklist").wpList({alt:"",response:s+"-ajax-response",addBefore:t,addAfter:i}),u("#"+s+"-add-toggle").click(function(t){t.preventDefault(),u("#"+s+"-adder").toggleClass("wp-hidden-children"),u('a[href="#'+s+'-all"]',"#"+s+"-tabs").click(),u("#new"+s).focus()}),u("#"+s+"checklist, #"+s+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var t=u(this),e=t.is(":checked"),i=t.val();i&&t.parents("#taxonomy-"+s).length&&u("#in-"+s+"-"+i+", #in-popular-"+s+"-"+i).prop("checked",e)})}),u("#postcustom").length&&u("#the-list").wpList({addBefore:function(t){return t.data+="&post_id="+u("#post_ID").val(),t},addAfter:function(){u("table#list-table").show()}}),u("#submitdiv").length&&(d=u("#timestamp").html(),e=u("#post-visibility-display").html(),n=function(){"public"!=b.find("input:radio:checked").val()?(u("#sticky").prop("checked",!1),u("#sticky-span").hide()):u("#sticky-span").show(),"password"!=b.find("input:radio:checked").val()?u("#password-span").hide():u("#password-span").show()},s=function(){if(!g.length)return!0;var t,e=u("#post_status"),i=u('option[value="publish"]',e),n=u("#aa").val(),s=u("#mm").val(),a=u("#jj").val(),o=u("#hh").val(),l=u("#mn").val(),p=new Date(n,s-1,a,o,l),c=new Date(u("#hidden_aa").val(),u("#hidden_mm").val()-1,u("#hidden_jj").val(),u("#hidden_hh").val(),u("#hidden_mn").val()),r=new Date(u("#cur_aa").val(),u("#cur_mm").val()-1,u("#cur_jj").val(),u("#cur_hh").val(),u("#cur_mn").val());return p.getFullYear()!=n||1+p.getMonth()!=s||p.getDate()!=a||p.getMinutes()!=l?(g.find(".timestamp-wrap").addClass("form-invalid"),!1):(g.find(".timestamp-wrap").removeClass("form-invalid"),r<p&&"future"!=u("#original_post_status").val()?(t=postL10n.publishOnFuture,u("#publish").val(postL10n.schedule)):p<=r&&"publish"!=u("#original_post_status").val()?(t=postL10n.publishOn,u("#publish").val(postL10n.publish)):(t=postL10n.publishOnPast,u("#publish").val(postL10n.update)),c.toUTCString()==p.toUTCString()?u("#timestamp").html(d):u("#timestamp").html("\n"+t+" <b>"+postL10n.dateFormat.replace("%1$s",u('option[value="'+s+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(a,10)).replace("%3$s",n).replace("%4$s",("00"+o).slice(-2)).replace("%5$s",("00"+l).slice(-2))+"</b> "),"private"==b.find("input:radio:checked").val()?(u("#publish").val(postL10n.update),0===i.length?e.append('<option value="publish">'+postL10n.privatelyPublished+"</option>"):i.html(postL10n.privatelyPublished),u('option[value="publish"]',e).prop("selected",!0),u("#misc-publishing-actions .edit-post-status").hide()):("future"==u("#original_post_status").val()||"draft"==u("#original_post_status").val()?i.length&&(i.remove(),e.val(u("#hidden_post_status").val())):i.html(postL10n.published),e.is(":hidden")&&u("#misc-publishing-actions .edit-post-status").show()),u("#post-status-display").text(wp.sanitize.stripTagsAndEncodeText(u("option:selected",e).text())),"private"==u("option:selected",e).val()||"publish"==u("option:selected",e).val()?u("#save-post").hide():(u("#save-post").show(),"pending"==u("option:selected",e).val()?u("#save-post").show().val(postL10n.savePending):u("#save-post").show().val(postL10n.saveDraft)),!0)},u("#visibility .edit-visibility").click(function(t){t.preventDefault(),b.is(":hidden")&&(n(),b.slideDown("fast",function(){b.find('input[type="radio"]').first().focus()}),u(this).hide())}),b.find(".cancel-post-visibility").click(function(t){b.slideUp("fast"),u("#visibility-radio-"+u("#hidden-post-visibility").val()).prop("checked",!0),u("#post_password").val(u("#hidden-post-password").val()),u("#sticky").prop("checked",u("#hidden-post-sticky").prop("checked")),u("#post-visibility-display").html(e),u("#visibility .edit-visibility").show().focus(),s(),t.preventDefault()}),b.find(".save-post-visibility").click(function(t){b.slideUp("fast"),u("#visibility .edit-visibility").show().focus(),s(),"public"!=b.find("input:radio:checked").val()&&u("#sticky").prop("checked",!1),r=u("#sticky").prop("checked")?"Sticky":"",u("#post-visibility-display").html(postL10n[b.find("input:radio:checked").val()+r]),t.preventDefault()}),b.find("input:radio").change(function(){n()}),g.siblings("a.edit-timestamp").click(function(t){g.is(":hidden")&&(g.slideDown("fast",function(){u("input, select",g.find(".timestamp-wrap")).first().focus()}),u(this).hide()),t.preventDefault()}),g.find(".cancel-timestamp").click(function(t){g.slideUp("fast").siblings("a.edit-timestamp").show().focus(),u("#mm").val(u("#hidden_mm").val()),u("#jj").val(u("#hidden_jj").val()),u("#aa").val(u("#hidden_aa").val()),u("#hh").val(u("#hidden_hh").val()),u("#mn").val(u("#hidden_mn").val()),s(),t.preventDefault()}),g.find(".save-timestamp").click(function(t){s()&&(g.slideUp("fast"),g.siblings("a.edit-timestamp").show().focus()),t.preventDefault()}),u("#post").on("submit",function(t){s()||(t.preventDefault(),g.show(),wp.autosave&&wp.autosave.enableButtons(),u("#publishing-action .spinner").removeClass("is-active"))}),k.siblings("a.edit-post-status").click(function(t){k.is(":hidden")&&(k.slideDown("fast",function(){k.find("select").focus()}),u(this).hide()),t.preventDefault()}),k.find(".save-post-status").click(function(t){k.slideUp("fast").siblings("a.edit-post-status").show().focus(),s(),t.preventDefault()}),k.find(".cancel-post-status").click(function(t){k.slideUp("fast").siblings("a.edit-post-status").show().focus(),u("#post_status").val(u("#hidden_post_status").val()),s(),t.preventDefault()})),u("#titlediv").on("click",".edit-slug",function(){!function(){var t,e,i,n=0,s=u("#post_name"),a=s.val(),o=u("#sample-permalink"),l=o.html(),p=u("#sample-permalink a").html(),c=u("#edit-slug-buttons"),r=c.html(),d=u("#editable-post-name-full");for(d.find("img").replaceWith(function(){return this.alt}),d=d.html(),o.html(p),e=u("#editable-post-name"),i=e.html(),c.html('<button type="button" class="save button button-small">'+postL10n.ok+'</button> <button type="button" class="cancel button-link">'+postL10n.cancel+"</button>"),c.children(".save").click(function(){var i=e.children("input").val();i!=u("#editable-post-name-full").text()?u.post(ajaxurl,{action:"sample-permalink",post_id:f,new_slug:i,new_title:u("#title").val(),samplepermalinknonce:u("#samplepermalinknonce").val()},function(t){var e=u("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),c.html(r),o.html(l),s.val(i),u(".edit-slug").focus(),wp.a11y.speak(postL10n.permalinkSaved)}):c.children(".cancel").click()}),c.children(".cancel").click(function(){u("#view-post-btn").show(),e.html(i),c.html(r),o.html(l),s.val(a),u(".edit-slug").focus()}),t=0;t<d.length;++t)"%"==d.charAt(t)&&n++;p=n>d.length/4?"":d,e.html('<input type="text" id="new-post-slug" value="'+p+'" autocomplete="off" />').children("input").keydown(function(t){var e=t.which;13===e&&(t.preventDefault(),c.children(".save").click()),27===e&&c.children(".cancel").click()}).keyup(function(){s.val(this.value)}).focus()}()}),window.wptitlehint=function(t){var e=u("#"+(t=t||"title")),i=u("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""!==this.value?i.addClass("screen-reader-text"):i.removeClass("screen-reader-text")})},wptitlehint(),t=u("#post-status-info"),p=u("#postdivrich"),!h.length||"ontouchstart"in window?u("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(a="undefined"!=typeof tinymce?tinymce.get("content"):a)&&!a.isHidden()?(l=!0,o=u("#content_ifr").height()-t.pageY):(l=!1,o=h.height()-t.pageY,h.blur()),v.on("mousemove.wp-editor-resize",_).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",x),t.preventDefault()}).on("mouseup.wp-editor-resize",x),"undefined"!=typeof tinymce&&(u("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&u(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),u(document).trigger("editor-classchange"))}),u("#page_template").on("change.set-editor-class",function(){var t,e,i=u(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),u(document).trigger("editor-classchange"))})),h.on("keydown.wp-autosave",function(t){83===t.which&&(t.shiftKey||t.altKey||y&&(!t.metaKey||t.ctrlKey)||!y&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault()))}),"auto-draft"===u("#original_post_status").val()&&window.history.replaceState&&u("#publish").on("click",function(){c=window.location.href,c+=-1!==c.indexOf("?")?"&":"?",c+="wp-post-new-reload=true",window.history.replaceState(null,null,c)})}),function(t,o){t(function(){var i,e=t("#content"),n=t("#wp-word-count").find(".word-count"),s=0;function a(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==s&&n.text(t),s=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(a,1e3))}),e.on("input keyup",_.debounce(a,1e3)),a()})}(jQuery,new wp.utils.WordCounter);