Simple Page Ordering - Version 2.3.2

Version Description

  • Enhancement: Allow cancellation of drag operation by pressing escape key
  • Bug fix: Allow form input elements added to a row by plugins to be interacted with
Download this release

Release Info

Developer helen
Plugin Icon 128x128 Simple Page Ordering
Version 2.3.2
Comparing to
See all releases

Code changes from version 2.3.1 to 2.3.2

assets/js/simple-page-ordering.min.js CHANGED
@@ -1 +1 @@
1
- function update_simple_ordering_callback(e){if("children"!==e){var t=jQuery.parseJSON(e),r=t.new_pos;for(var n in r)if("next"!==n){var i=document.getElementById("inline_"+n);if(null!==i&&r.hasOwnProperty(n)){var a=i.querySelector(".menu_order");if(void 0!==r[n].menu_order){null!==a&&(a.innerHTML=r[n].menu_order);var l=i.querySelector(".post_parent");null!==l&&(l.innerHTML=r[n].post_parent);var o=null,s=i.querySelector(".post_title");null!==s&&(o=s.innerHTML);for(var d=0;d<r[n].depth;)o="&mdash; "+o,d++;var p=i.parentNode.querySelector(".row-title");null!==p&&null!==o&&(p.innerHTML=o)}else null!==a&&(a.innerHTML=r[n])}}t.next?jQuery.post(ajaxurl,{action:"simple_page_ordering",id:t.next.id,previd:t.next.previd,nextid:t.next.nextid,start:t.next.start,excluded:JSON.stringify(t.next.excluded)},update_simple_ordering_callback):(jQuery(".spo-updating-row").removeClass("spo-updating-row").find(".check-column").removeClass("spinner is-active"),sortable_post_table.removeClass("spo-updating").sortable("enable"))}else window.location.reload()}var sortable_post_table=jQuery(".wp-list-table tbody");sortable_post_table.sortable({items:"> tr",cursor:"move",axis:"y",containment:"table.widefat",cancel:".inline-edit-row",distance:2,opacity:.8,tolerance:"pointer",start:function(e,t){"undefined"!=typeof inlineEditPost&&inlineEditPost.revert(),t.placeholder.height(t.item.height()),t.placeholder.empty()},helper:function(e,t){for(var r=t.children(),n=0;n<r.length;n++){var i=jQuery(r[n]);i.width(i.width())}return t},stop:function(e,t){t.item.children().css("width","")},update:function(e,t){sortable_post_table.sortable("disable").addClass("spo-updating"),t.item.addClass("spo-updating-row"),t.item.find(".check-column").addClass("spinner is-active");var r=t.item[0].id.substr(5),n=!1,i=t.item.prev();i.length>0&&(n=i.attr("id").substr(5));var a=!1,l=t.item.next();l.length>0&&(a=l.attr("id").substr(5)),jQuery.post(ajaxurl,{action:"simple_page_ordering",id:r,previd:n,nextid:a},update_simple_ordering_callback);for(var o=document.querySelectorAll("tr.iedit"),s=o.length;s--;)0==s%2?jQuery(o[s]).addClass("alternate"):jQuery(o[s]).removeClass("alternate")}});
1
+ function update_simple_ordering_callback(e){if("children"!==e){var t=jQuery.parseJSON(e),r=t.new_pos;for(var n in r)if("next"!==n){var a=document.getElementById("inline_"+n);if(null!==a&&r.hasOwnProperty(n)){var o=a.querySelector(".menu_order");if(void 0!==r[n].menu_order){null!==o&&(o.innerHTML=r[n].menu_order);var l=a.querySelector(".post_parent");null!==l&&(l.innerHTML=r[n].post_parent);var i=null,s=a.querySelector(".post_title");null!==s&&(i=s.innerHTML);for(var d=0;d<r[n].depth;)i="&mdash; "+i,d++;var p=a.parentNode.querySelector(".row-title");null!==p&&null!==i&&(p.innerHTML=i)}else null!==o&&(o.innerHTML=r[n])}}t.next?jQuery.post(ajaxurl,{action:"simple_page_ordering",id:t.next.id,previd:t.next.previd,nextid:t.next.nextid,start:t.next.start,excluded:JSON.stringify(t.next.excluded)},update_simple_ordering_callback):(jQuery(".spo-updating-row").removeClass("spo-updating-row").find(".check-column").removeClass("spinner is-active"),sortable_post_table.removeClass("spo-updating").sortable("enable"))}else window.location.reload()}var sortable_post_table=jQuery(".wp-list-table tbody");sortable_post_table.sortable({items:"> tr",cursor:"move",axis:"y",containment:"table.widefat",cancel:"input, textarea, button, select, option, .inline-edit-row",distance:2,opacity:.8,tolerance:"pointer",create:function(){jQuery(document).keydown(function(e){var t=e.key||e.keyCode;"Escape"!==t&&"Esc"!==t&&27!==t||(sortable_post_table.sortable("option","preventUpdate",!0),sortable_post_table.sortable("cancel"))})},start:function(e,t){"undefined"!=typeof inlineEditPost&&inlineEditPost.revert(),t.placeholder.height(t.item.height()),t.placeholder.empty()},helper:function(e,t){for(var r=t.children(),n=0;n<r.length;n++){var a=jQuery(r[n]);a.width(a.width())}return t},stop:function(e,t){sortable_post_table.sortable("option","preventUpdate")&&sortable_post_table.sortable("option","preventUpdate",!1),t.item.children().css("width","")},update:function(e,t){if(sortable_post_table.sortable("option","preventUpdate"))sortable_post_table.sortable("option","preventUpdate",!1);else{sortable_post_table.sortable("disable").addClass("spo-updating"),t.item.addClass("spo-updating-row"),t.item.find(".check-column").addClass("spinner is-active");var r=t.item[0].id.substr(5),n=!1,a=t.item.prev();a.length>0&&(n=a.attr("id").substr(5));var o=!1,l=t.item.next();l.length>0&&(o=l.attr("id").substr(5)),jQuery.post(ajaxurl,{action:"simple_page_ordering",id:r,previd:n,nextid:o},update_simple_ordering_callback);for(var i=document.querySelectorAll("tr.iedit"),s=i.length;s--;)0==s%2?jQuery(i[s]).addClass("alternate"):jQuery(i[s]).removeClass("alternate")}}});
assets/js/src/simple-page-ordering.js CHANGED
@@ -68,10 +68,19 @@ sortable_post_table.sortable({
68
  cursor: 'move',
69
  axis: 'y',
70
  containment: 'table.widefat',
71
- cancel: '.inline-edit-row',
72
  distance: 2,
73
  opacity: .8,
74
  tolerance: 'pointer',
 
 
 
 
 
 
 
 
 
75
  start: function(e, ui){
76
  if ( typeof(inlineEditPost) !== 'undefined' ) {
77
  inlineEditPost.revert();
@@ -88,10 +97,19 @@ sortable_post_table.sortable({
88
  return ui;
89
  },
90
  stop: function(e, ui) {
 
 
 
 
91
  // remove fixed widths
92
  ui.item.children().css('width','');
93
  },
94
  update: function(e, ui) {
 
 
 
 
 
95
  sortable_post_table.sortable('disable').addClass('spo-updating');
96
  ui.item.addClass('spo-updating-row');
97
  ui.item.find('.check-column').addClass('spinner is-active');
68
  cursor: 'move',
69
  axis: 'y',
70
  containment: 'table.widefat',
71
+ cancel: 'input, textarea, button, select, option, .inline-edit-row',
72
  distance: 2,
73
  opacity: .8,
74
  tolerance: 'pointer',
75
+ create: function() {
76
+ jQuery( document ).keydown(function(e) {
77
+ var key = e.key || e.keyCode;
78
+ if ( 'Escape' === key || 'Esc' === key || 27 === key ) {
79
+ sortable_post_table.sortable( 'option', 'preventUpdate', true );
80
+ sortable_post_table.sortable( 'cancel' );
81
+ }
82
+ });
83
+ },
84
  start: function(e, ui){
85
  if ( typeof(inlineEditPost) !== 'undefined' ) {
86
  inlineEditPost.revert();
97
  return ui;
98
  },
99
  stop: function(e, ui) {
100
+ if ( sortable_post_table.sortable( 'option', 'preventUpdate') ) {
101
+ sortable_post_table.sortable( 'option', 'preventUpdate', false );
102
+ }
103
+
104
  // remove fixed widths
105
  ui.item.children().css('width','');
106
  },
107
  update: function(e, ui) {
108
+ if ( sortable_post_table.sortable( 'option', 'preventUpdate') ) {
109
+ sortable_post_table.sortable( 'option', 'preventUpdate', false );
110
+ return;
111
+ }
112
+
113
  sortable_post_table.sortable('disable').addClass('spo-updating');
114
  ui.item.addClass('spo-updating-row');
115
  ui.item.find('.check-column').addClass('spinner is-active');
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: 10up, jakemgold, welcher, helen, thinkoomph
3
  Donate link: http://10up.com/plugins/simple-page-ordering-wordpress/
4
  Tags: order, re-order, ordering, pages, page, manage, menu_order, hierarchical, ajax, drag-and-drop, admin
5
  Requires at least: 3.8
6
- Tested up to: 4.9.4
7
- Stable tag: 2.3.1
8
 
9
  Order your pages and other hierarchical post types with simple drag and drop right from the standard page list.
10
 
@@ -81,6 +81,10 @@ This feature is already built into WordPress natively, but a bit tucked away. If
81
 
82
  == Changelog ==
83
 
 
 
 
 
84
  = 2.3.1 =
85
  * Bug fix: Prevent rows with hidden columns from jumping around while dragging
86
 
3
  Donate link: http://10up.com/plugins/simple-page-ordering-wordpress/
4
  Tags: order, re-order, ordering, pages, page, manage, menu_order, hierarchical, ajax, drag-and-drop, admin
5
  Requires at least: 3.8
6
+ Tested up to: 5.0.3
7
+ Stable tag: 2.3.2
8
 
9
  Order your pages and other hierarchical post types with simple drag and drop right from the standard page list.
10
 
81
 
82
  == Changelog ==
83
 
84
+ = 2.3.2 =
85
+ * Enhancement: Allow cancellation of drag operation by pressing escape key
86
+ * Bug fix: Allow form input elements added to a row by plugins to be interacted with
87
+
88
  = 2.3.1 =
89
  * Bug fix: Prevent rows with hidden columns from jumping around while dragging
90
 
simple-page-ordering.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple Page Ordering
4
  Plugin URI: http://10up.com/plugins/simple-page-ordering-wordpress/
5
  Description: Order your pages and hierarchical post types using drag and drop on the built in page list. For further instructions, open the "Help" tab on the Pages screen.
6
- Version: 2.3.1
7
  Author: Jake Goldman, 10up
8
  Author URI: http://10up.com
9
  License: GPLv2 or later
3
  Plugin Name: Simple Page Ordering
4
  Plugin URI: http://10up.com/plugins/simple-page-ordering-wordpress/
5
  Description: Order your pages and hierarchical post types using drag and drop on the built in page list. For further instructions, open the "Help" tab on the Pages screen.
6
+ Version: 2.3.2
7
  Author: Jake Goldman, 10up
8
  Author URI: http://10up.com
9
  License: GPLv2 or later