WordPress/wp-admin/js/inline-edit-post.min.js
desrosj a68590b382 Build/Test Tools: Support NodeJS 14.x in the 4.8 branch.
This updates the 4.8 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.8, 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,50192] to the 4.8 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.8@50203


git-svn-id: http://core.svn.wordpress.org/branches/4.8@49877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:10:38 +00:00

1 line
7.0 KiB
JavaScript

var inlineEditPost;window.wp=window.wp||{},function(u,n){inlineEditPost={init:function(){var i=this,t=u("#inline-edit"),e=u("#bulk-edit");i.type=u("table.widefat").hasClass("pages")?"page":"post",i.what="#post-",t.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),e.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),u(".cancel",t).click(function(){return inlineEditPost.revert()}),u(".save",t).click(function(){return inlineEditPost.save(this)}),u("td",t).keydown(function(t){if(13===t.which&&!u(t.target).hasClass("cancel"))return inlineEditPost.save(this)}),u(".cancel",e).click(function(){return inlineEditPost.revert()}),u('#inline-edit .inline-edit-private input[value="private"]').click(function(){var t=u("input.inline-edit-password-input");u(this).prop("checked")?t.val("").prop("disabled",!0):t.prop("disabled",!1)}),u("#the-list").on("click","a.editinline",function(t){t.preventDefault(),inlineEditPost.edit(this)}),u("#bulk-edit").find("fieldset:first").after(u("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(u("#inline-edit label.inline-edit-tags").clone()),u('select[name="_status"] option[value="future"]',e).remove(),u("#doaction, #doaction2").click(function(t){var e;i.whichBulkButtonId=u(this).attr("id"),e=i.whichBulkButtonId.substr(2),"edit"===u('select[name="'+e+'"]').val()?(t.preventDefault(),i.setBulk()):0<u("form#posts-filter tr.inline-editor").length&&i.revert()})},toggle:function(t){var e=this;"none"===u(e.what+e.getId(t)).css("display")?e.revert():e.edit(t)},setBulk:function(){var i="",t=this.type,n=!0;if(this.revert(),u("#bulk-edit td").attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("table.widefat tbody").prepend(u("#bulk-edit")).prepend('<tr class="hidden"></tr>'),u("#bulk-edit").addClass("inline-editor").show(),u('tbody th.check-column input[type="checkbox"]').each(function(){var t,e;u(this).prop("checked")&&(n=!1,t=u(this).val(),e=u("#inline_"+t+" .post_title").html()||inlineEditL10n.notitle,i+='<div id="ttle'+t+'"><a id="_'+t+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+e+"</div>")}),n)return this.revert();u("#bulk-titles").html(i),u("#bulk-titles a").click(function(){var t=u(this).attr("id").substr(1);u('table.widefat input[value="'+t+'"]').prop("checked",!1),u("#ttle"+t).remove()}),"post"===t&&u("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t,e){u(e).autocomplete("instance")||u(e).wpTagsSuggest()}),u("html, body").animate({scrollTop:0},"fast")},edit:function(n){var t,a,e,i,s,l,o,r,d,c=this,p=!0;for(c.revert(),"object"==typeof n&&(n=c.getId(n)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order","page_template"],"page"===c.type&&t.push("post_parent"),a=u("#inline-edit").clone(!0),u("td",a).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u(c.what+n).removeClass("is-expanded").hide().after(a).after('<tr class="hidden"></tr>'),e=u("#inline_"+n),u(':input[name="post_author"] option[value="'+u(".post_author",e).text()+'"]',a).val()||u(':input[name="post_author"]',a).prepend('<option value="'+u(".post_author",e).text()+'">'+u("#"+c.type+"-"+n+" .author").text()+"</option>"),1===u(':input[name="post_author"] option',a).length&&u("label.inline-edit-author",a).hide(),r=0;r<t.length;r++)(d=u("."+t[r],e)).find("img").replaceWith(function(){return this.alt}),d=d.text(),u(':input[name="'+t[r]+'"]',a).val(d);if("open"===u(".comment_status",e).text()&&u('input[name="comment_status"]',a).prop("checked",!0),"open"===u(".ping_status",e).text()&&u('input[name="ping_status"]',a).prop("checked",!0),"sticky"===u(".sticky",e).text()&&u('input[name="sticky"]',a).prop("checked",!0),u(".post_category",e).each(function(){var t,e=u(this).text();e&&(t=u(this).attr("id").replace("_"+n,""),u("ul."+t+"-checklist :checkbox",a).val(e.split(",")))}),u(".tags_input",e).each(function(){var t=u(this),e=u(this).attr("id").replace("_"+n,""),i=u("textarea.tax_input_"+e,a),e=inlineEditL10n.comma;t.find("img").replaceWith(function(){return this.alt}),(t=t.text())&&(","!==e&&(t=t.replace(/,/g,e)),i.val(t)),i.wpTagsSuggest()}),"future"!==(i=u("._status",e).text())&&u('select[name="_status"] option[value="future"]',a).remove(),c=u(".inline-edit-password-input").prop("disabled",!1),"private"===i&&(u('input[name="keep_private"]',a).prop("checked",!0),c.val("").prop("disabled",!0)),0<(s=u('select[name="post_parent"] option[value="'+n+'"]',a)).length){for(l=s[0].className.split("-")[1],o=s;p&&0!==(o=o.next("option")).length;)o[0].className.split("-")[1]<=l?p=!1:(o.remove(),o=s);s.remove()}return u(a).attr("id","edit-"+n).addClass("inline-editor").show(),u(".ptitle",a).focus(),!1},save:function(i){var t=u(".post_status_page").val()||"";return"object"==typeof i&&(i=this.getId(i)),u("table.widefat .spinner").addClass("is-active"),t={action:"inline-save",post_type:typenow,post_ID:i,edit_date:"true",post_status:t},t=u("#edit-"+i).find(":input").serialize()+"&"+u.param(t),u.post(ajaxurl,t,function(t){var e=u("#edit-"+i+" .inline-edit-save .error");u("table.widefat .spinner").removeClass("is-active"),u(".ac_results").hide(),t?-1!==t.indexOf("<tr")?(u(inlineEditPost.what+i).siblings("tr.hidden").addBack().remove(),u("#edit-"+i).before(t).remove(),u(inlineEditPost.what+i).hide().fadeIn(400,function(){u(this).find(".editinline").focus(),n.a11y.speak(inlineEditL10n.saved)})):(t=t.replace(/<.[^<>]*?>/g,""),e.html(t).show(),n.a11y.speak(e.text())):(e.html(inlineEditL10n.error).show(),n.a11y.speak(inlineEditL10n.error))},"html"),!1},revert:function(){var t=u(".widefat"),e=u(".inline-editor",t).attr("id");return e&&(u(".spinner",t).removeClass("is-active"),u(".ac_results").hide(),"bulk-edit"===e?(u("#bulk-edit",t).removeClass("inline-editor").hide().siblings(".hidden").remove(),u("#bulk-titles").empty(),u("#inlineedit").append(u("#bulk-edit")),u("#"+inlineEditPost.whichBulkButtonId).focus()):(u("#"+e).siblings("tr.hidden").addBack().remove(),e=e.substr(e.lastIndexOf("-")+1),u(this.what+e).show().find(".editinline").focus())),!1},getId:function(t){t=u(t).closest("tr").attr("id").split("-");return t[t.length-1]}},u(document).ready(function(){inlineEditPost.init()}),u(document).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var n=e["wp-check-locked-posts"]||{};u("#the-list tr").each(function(t,e){var i=e.id,e=u(e);n.hasOwnProperty(i)?e.hasClass("wp-locked")||(i=n[i],e.find(".column-title .locked-text").text(i.text),e.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(i=u('<img class="avatar avatar-18 photo" width="18" height="18" alt="" />').attr("src",i.avatar_src.replace(/&amp;/g,"&")),e.find(".column-title .locked-avatar").empty().append(i)),e.addClass("wp-locked")):e.hasClass("wp-locked")&&e.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];u("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)}).ready(function(){void 0!==n&&n.heartbeat&&n.heartbeat.interval(15)})}(jQuery,window.wp);