From 347698ac3d1753f41facce8f8670b6621a9585d8 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 20 Jan 2016 04:41:27 +0000 Subject: [PATCH] Quick Edit: on the Taxonomies screens, prevent a page reload when pressing Enter on a focused field. Merges [36260 to the 4.4 branch. Props afercia. Fixes #35401. Built from https://develop.svn.wordpress.org/branches/4.4@36355 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36322 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/inline-edit-tax.js | 2 ++ wp-admin/js/inline-edit-tax.min.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-admin/js/inline-edit-tax.js b/wp-admin/js/inline-edit-tax.js index a05dc0954f..b1090de44b 100644 --- a/wp-admin/js/inline-edit-tax.js +++ b/wp-admin/js/inline-edit-tax.js @@ -137,6 +137,8 @@ inlineEditTax = { } } ); + // Prevent submitting the form when pressing Enter on a focused field. + return false; }, revert : function() { diff --git a/wp-admin/js/inline-edit-tax.min.js b/wp-admin/js/inline-edit-tax.min.js index 14b3b8a7ac..c99a76b80f 100644 --- a/wp-admin/js/inline-edit-tax.min.js +++ b/wp-admin/js/inline-edit-tax.min.js @@ -1 +1 @@ -window.wp=window.wp||{};var inlineEditTax;!function(a,b){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("data-wp-lists").substr(5),b.what="#"+b.type+"-",a("#the-list").on("click","a.editinline",function(){return inlineEditTax.edit(this),!1}),c.keyup(function(a){return 27===a.which?inlineEditTax.revert():void 0}),a(".cancel",c).click(function(){return inlineEditTax.revert()}),a(".save",c).click(function(){return inlineEditTax.save(this)}),a("input, select",c).keydown(function(a){return 13===a.which?inlineEditTax.save(this):void 0}),a('#posts-filter input[type="submit"]').mousedown(function(){b.revert()})},toggle:function(b){var c=this;"none"===a(c.what+c.getId(b)).css("display")?c.revert():c.edit(b)},edit:function(b){var c,d,e,f=this;return f.revert(),"object"==typeof b&&(b=f.getId(b)),c=a("#inline-edit").clone(!0),d=a("#inline_"+b),a("td",c).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length),a(f.what+b).hide().after(c).after(''),e=a(".name",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="name"]',c).val(e),e=a(".slug",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="slug"]',c).val(e),a(c).attr("id","edit-"+b).addClass("inline-editor").show(),a(".ptitle",c).eq(0).focus(),!1},save:function(c){var d,e,f=a('input[name="taxonomy"]').val()||"";"object"==typeof c&&(c=this.getId(c)),a("table.widefat .spinner").addClass("is-active"),d={action:"inline-save-tax",tax_type:this.type,tax_ID:c,taxonomy:f},e=a("#edit-"+c).find(":input").serialize(),d=e+"&"+a.param(d),a.post(ajaxurl,d,function(d){var e,f,g,h=a("#edit-"+c+" .inline-edit-save .error");a("table.widefat .spinner").removeClass("is-active"),d?-1!==d.indexOf("