Nested Pages - Version 3.1.19

Version Description

  • Fixes dragging/sorting bug introduced in WordPress version 5.9.
Download this release

Release Info

Developer kylephillips
Plugin Icon 128x128 Nested Pages
Version 3.1.19
Comparing to
See all releases

Code changes from version 3.1.18 to 3.1.19

app/NestedPages.php CHANGED
@@ -12,7 +12,7 @@ class NestedPages
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
- $np_version = '3.1.18';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
+ $np_version = '3.1.19';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
assets/js/lib/jquery.mjs.nestedSortable.js CHANGED
@@ -1,26 +1,24 @@
1
  /*
2
  * jQuery UI Nested Sortable
3
- * v 2.0 / 29 oct 2012
4
- * http://mjsarfatti.com/sandbox/nestedSortable
5
  *
6
  * Depends on:
7
  * jquery.ui.sortable.js 1.10+
8
  *
9
- * Copyright (c) 2010-2013 Manuele J Sarfatti
10
  * Licensed under the MIT License
11
  * http://www.opensource.org/licenses/mit-license.php
12
  */
13
  (function( factory ) {
14
  "use strict";
15
 
16
- var define = window.define;
17
-
18
  if ( typeof define === "function" && define.amd ) {
19
 
20
  // AMD. Register as an anonymous module.
21
  define([
22
  "jquery",
23
- "jquery-ui/sortable"
24
  ], factory );
25
  } else {
26
 
@@ -264,6 +262,12 @@
264
  childLevels = this._getChildLevels(this.helper);
265
  newList = document.createElement(o.listType);
266
 
 
 
 
 
 
 
267
  //Rearrange
268
  for (i = this.items.length - 1; i >= 0; i--) {
269
 
@@ -340,7 +344,7 @@
340
  .addClass(o.expandedClass);
341
 
342
  self.refreshPositions();
343
- self._trigger("expand", event, self._uiHash());
344
  }, o.expandOnHover);
345
  }
346
  }
@@ -708,11 +712,19 @@
708
  function _recursiveItems(item) {
709
  var id = ($(item).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[-=_](.+)/)),
710
  currentItem;
 
 
 
 
 
 
711
  if (id) {
712
  currentItem = {
713
  "id": id[2]
714
  };
715
 
 
 
716
  if ($(item).children(o.listType).children(o.items).length > 0) {
717
  currentItem.children = [];
718
  $(item).children(o.listType).children(o.items).each(function() {
@@ -744,7 +756,7 @@
744
  }
745
 
746
  $(this.element).children(o.items).each(function() {
747
- left = _recursiveArray(this, sDepth + 1, left);
748
  });
749
 
750
  ret = ret.sort(function(a, b) { return (a.left - b.left); });
@@ -766,9 +778,9 @@
766
  depth--;
767
  }
768
 
769
- id = ($(item).attr(o.attribute || "id")).match(o.expression || (/(.+)[-=_](.+)/));
770
 
771
- if (depth === sDepth + 1) {
772
  pid = o.rootID;
773
  } else {
774
  parentItem = ($(item).parent(o.listType)
@@ -779,13 +791,15 @@
779
  }
780
 
781
  if (id) {
782
- ret.push({
783
- "item_id": id[2],
784
- "parent_id": pid,
785
- "depth": depth,
786
- "left": _left,
787
- "right": right
788
- });
 
 
789
  }
790
 
791
  _left = right + 1;
@@ -805,7 +819,7 @@
805
 
806
  var o = this.options,
807
  childrenList = $(item).children(o.listType),
808
- hasChildren = childrenList.is(':not(:empty)');
809
 
810
  var doNotClear =
811
  o.doNotClear ||
@@ -814,13 +828,10 @@
814
 
815
  if (o.isTree) {
816
  replaceClass(item, o.branchClass, o.leafClass, doNotClear);
817
-
818
- if (doNotClear && hasChildren) {
819
- replaceClass(item, o.collapsedClass, o.expandedClass);
820
- }
821
  }
822
 
823
  if (!doNotClear) {
 
824
  childrenList.remove();
825
  }
826
  },
@@ -899,4 +910,4 @@
899
  $.ui.sortable.prototype.options,
900
  $.mjs.nestedSortable.prototype.options
901
  );
902
- }));
1
  /*
2
  * jQuery UI Nested Sortable
3
+ * v 2.1a / 2016-02-04
4
+ * https://github.com/ilikenwf/nestedSortable
5
  *
6
  * Depends on:
7
  * jquery.ui.sortable.js 1.10+
8
  *
9
+ * Copyright (c) 2010-2016 Manuele J Sarfatti and contributors
10
  * Licensed under the MIT License
11
  * http://www.opensource.org/licenses/mit-license.php
12
  */
13
  (function( factory ) {
14
  "use strict";
15
 
 
 
16
  if ( typeof define === "function" && define.amd ) {
17
 
18
  // AMD. Register as an anonymous module.
19
  define([
20
  "jquery",
21
+ "jquery-ui/ui/sortable"
22
  ], factory );
23
  } else {
24
 
262
  childLevels = this._getChildLevels(this.helper);
263
  newList = document.createElement(o.listType);
264
 
265
+ // dragDirection object is required by jquery.ui.sortable.js 1.13+
266
+ this.dragDirection = {
267
+ vertical: this._getDragVerticalDirection(),
268
+ horizontal: this._getDragHorizontalDirection()
269
+ };
270
+
271
  //Rearrange
272
  for (i = this.items.length - 1; i >= 0; i--) {
273
 
344
  .addClass(o.expandedClass);
345
 
346
  self.refreshPositions();
347
+ self._trigger("expand", event, [self._uiHash(), itemElement]);
348
  }, o.expandOnHover);
349
  }
350
  }
712
  function _recursiveItems(item) {
713
  var id = ($(item).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[-=_](.+)/)),
714
  currentItem;
715
+
716
+ var data = $(item).data();
717
+ if (data.nestedSortableItem) {
718
+ delete data.nestedSortableItem; // Remove the nestedSortableItem object from the data
719
+ }
720
+
721
  if (id) {
722
  currentItem = {
723
  "id": id[2]
724
  };
725
 
726
+ currentItem = $.extend({}, currentItem, data); // Combine the two objects
727
+
728
  if ($(item).children(o.listType).children(o.items).length > 0) {
729
  currentItem.children = [];
730
  $(item).children(o.listType).children(o.items).each(function() {
756
  }
757
 
758
  $(this.element).children(o.items).each(function() {
759
+ left = _recursiveArray(this, sDepth, left);
760
  });
761
 
762
  ret = ret.sort(function(a, b) { return (a.left - b.left); });
778
  depth--;
779
  }
780
 
781
+ id = ($(item).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[-=_](.+)/));
782
 
783
+ if (depth === sDepth) {
784
  pid = o.rootID;
785
  } else {
786
  parentItem = ($(item).parent(o.listType)
791
  }
792
 
793
  if (id) {
794
+ var data = $(item).children('div').data();
795
+ var itemObj = $.extend( data, {
796
+ "id":id[2],
797
+ "parent_id":pid,
798
+ "depth":depth,
799
+ "left":_left,
800
+ "right":right
801
+ } );
802
+ ret.push( itemObj );
803
  }
804
 
805
  _left = right + 1;
819
 
820
  var o = this.options,
821
  childrenList = $(item).children(o.listType),
822
+ hasChildren = childrenList.has('li').length;
823
 
824
  var doNotClear =
825
  o.doNotClear ||
828
 
829
  if (o.isTree) {
830
  replaceClass(item, o.branchClass, o.leafClass, doNotClear);
 
 
 
 
831
  }
832
 
833
  if (!doNotClear) {
834
+ childrenList.parent().removeClass(o.expandedClass);
835
  childrenList.remove();
836
  }
837
  },
910
  $.ui.sortable.prototype.options,
911
  $.mjs.nestedSortable.prototype.options
912
  );
913
+ }));
nestedpages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
- Version: 3.1.18
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
+ Version: 3.1.19
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: kylephillips
3
  Donate link: https://github.com/sponsors/kylephillips/
4
  Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
5
  Requires at least: 3.8
6
- Tested up to: 5.8
7
  Requires PHP: 5.4
8
  Stable tag: 3.1.18
9
  License: GPLv2 or later
@@ -105,6 +105,9 @@ No. The menu synchronization currently only works within the pages post type.
105
 
106
  == Changelog ==
107
 
 
 
 
108
  = 3.1.18 =
109
  * Fixes issue where some custom blocks were not duplicating when cloning a post.
110
 
3
  Donate link: https://github.com/sponsors/kylephillips/
4
  Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
5
  Requires at least: 3.8
6
+ Tested up to: 5.9
7
  Requires PHP: 5.4
8
  Stable tag: 3.1.18
9
  License: GPLv2 or later
105
 
106
  == Changelog ==
107
 
108
+ = 3.1.19 =
109
+ * Fixes dragging/sorting bug introduced in WordPress version 5.9.
110
+
111
  = 3.1.18 =
112
  * Fixes issue where some custom blocks were not duplicating when cloning a post.
113