Version Description
- Released 2022-02-14
- Fixing sortable script with newer versions of jQuery sortable.
Download this release
Release Info
| Developer | ronalfy |
| Plugin | |
| Version | 2.5.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.5.0 to 2.5.1
- class-reorder.php +2 -2
- index.php +1 -1
- readme.txt +8 -4
- scripts/jquery.mjs.nestedSortable.js +22 -29
class-reorder.php
CHANGED
|
@@ -334,9 +334,9 @@ final class MN_Reorder {
|
|
| 334 |
*/
|
| 335 |
public function print_scripts() {
|
| 336 |
wp_enqueue_script( 'jquery-ui-touch-punch', REORDER_URL . '/scripts/jquery.ui.touch-punch.js', array( 'jquery-ui-sortable' ), '0.2.3', true );
|
| 337 |
-
wp_register_script( 'reorder_nested', REORDER_URL . '/scripts/jquery.mjs.nestedSortable.js', array( 'jquery-ui-touch-punch' ), '2.0.
|
| 338 |
|
| 339 |
-
wp_enqueue_script( 'reorder_posts', REORDER_URL . '/scripts/sort.js', array( 'reorder_nested' ), '
|
| 340 |
wp_localize_script( 'reorder_posts', 'reorder_posts', array(
|
| 341 |
'action' => 'post_sort',
|
| 342 |
'expand' => esc_js( __( 'Expand', 'metronet-reorder-posts' ) ),
|
| 334 |
*/
|
| 335 |
public function print_scripts() {
|
| 336 |
wp_enqueue_script( 'jquery-ui-touch-punch', REORDER_URL . '/scripts/jquery.ui.touch-punch.js', array( 'jquery-ui-sortable' ), '0.2.3', true );
|
| 337 |
+
wp_register_script( 'reorder_nested', REORDER_URL . '/scripts/jquery.mjs.nestedSortable.js', array( 'jquery-ui-touch-punch' ), '2.0.1', true );
|
| 338 |
|
| 339 |
+
wp_enqueue_script( 'reorder_posts', REORDER_URL . '/scripts/sort.js', array( 'reorder_nested' ), '20210214', true );
|
| 340 |
wp_localize_script( 'reorder_posts', 'reorder_posts', array(
|
| 341 |
'action' => 'post_sort',
|
| 342 |
'expand' => esc_js( __( 'Expand', 'metronet-reorder-posts' ) ),
|
index.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: Reorder Posts
|
| 4 |
Plugin URI: https://wordpress.org/plugins/metronet-reorder-posts/
|
| 5 |
Description: Easily reorder posts and pages in WordPress
|
| 6 |
-
Version: 2.5.
|
| 7 |
Author: Ryan Hellyer, Ronald Huereca, Scott Basgaard
|
| 8 |
Author URI: https://github.com/ronalfy/reorder-posts
|
| 9 |
Text Domain: metronet-reorder-posts
|
| 3 |
Plugin Name: Reorder Posts
|
| 4 |
Plugin URI: https://wordpress.org/plugins/metronet-reorder-posts/
|
| 5 |
Description: Easily reorder posts and pages in WordPress
|
| 6 |
+
Version: 2.5.1
|
| 7 |
Author: Ryan Hellyer, Ronald Huereca, Scott Basgaard
|
| 8 |
Author URI: https://github.com/ronalfy/reorder-posts
|
| 9 |
Text Domain: metronet-reorder-posts
|
readme.txt
CHANGED
|
@@ -3,9 +3,9 @@ Contributors: ryanhellyer, ronalfy, scottbasgaard
|
|
| 3 |
Author URI: https://github.com/ronalfy/reorder-posts
|
| 4 |
Plugin URL: https://wordpress.org/plugins/metronet-reorder-posts/
|
| 5 |
Requires at Least: 3.7
|
| 6 |
-
Tested up to:
|
| 7 |
Tags: reorder, reorder posts
|
| 8 |
-
Stable tag: 2.5.
|
| 9 |
License: GPLv3 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
|
@@ -129,6 +129,10 @@ No, but there is an add-on for this plugin called <a href="https://wordpress.org
|
|
| 129 |
|
| 130 |
== Changelog ==
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
= 2.5.0 =
|
| 133 |
* Released 2020-11-18
|
| 134 |
* Fixing sortable script with newer versions of jQuery.
|
|
@@ -243,5 +247,5 @@ No, but there is an add-on for this plugin called <a href="https://wordpress.org
|
|
| 243 |
|
| 244 |
== Upgrade Notice ==
|
| 245 |
|
| 246 |
-
= 2.5.
|
| 247 |
-
Fixing sortable script with newer versions of jQuery.
|
| 3 |
Author URI: https://github.com/ronalfy/reorder-posts
|
| 4 |
Plugin URL: https://wordpress.org/plugins/metronet-reorder-posts/
|
| 5 |
Requires at Least: 3.7
|
| 6 |
+
Tested up to: 6.0
|
| 7 |
Tags: reorder, reorder posts
|
| 8 |
+
Stable tag: 2.5.1
|
| 9 |
License: GPLv3 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
| 129 |
|
| 130 |
== Changelog ==
|
| 131 |
|
| 132 |
+
= 2.5.1 =
|
| 133 |
+
* Released 2022-02-14
|
| 134 |
+
* Fixing sortable script with newer versions of jQuery sortable.
|
| 135 |
+
|
| 136 |
= 2.5.0 =
|
| 137 |
* Released 2020-11-18
|
| 138 |
* Fixing sortable script with newer versions of jQuery.
|
| 247 |
|
| 248 |
== Upgrade Notice ==
|
| 249 |
|
| 250 |
+
= 2.5.1 =
|
| 251 |
+
Fixing sortable script with newer versions of jQuery sortable causing errors when sorting.
|
scripts/jquery.mjs.nestedSortable.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
* v 2.0.0 / 2016-03-30 "Not April Fools"
|
| 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 |
|
|
@@ -18,7 +8,7 @@
|
|
| 18 |
// AMD. Register as an anonymous module.
|
| 19 |
define([
|
| 20 |
"jquery",
|
| 21 |
-
"jquery-ui/sortable"
|
| 22 |
], factory );
|
| 23 |
} else {
|
| 24 |
|
|
@@ -262,6 +252,12 @@
|
|
| 262 |
childLevels = this._getChildLevels(this.helper);
|
| 263 |
newList = document.createElement(o.listType);
|
| 264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
//Rearrange
|
| 266 |
for (i = this.items.length - 1; i >= 0; i--) {
|
| 267 |
|
|
@@ -338,7 +334,7 @@
|
|
| 338 |
.addClass(o.expandedClass);
|
| 339 |
|
| 340 |
self.refreshPositions();
|
| 341 |
-
self._trigger("expand", event, self._uiHash());
|
| 342 |
}, o.expandOnHover);
|
| 343 |
}
|
| 344 |
}
|
|
@@ -772,7 +768,7 @@
|
|
| 772 |
depth--;
|
| 773 |
}
|
| 774 |
|
| 775 |
-
id = ($(item).attr(o.attribute || "id")).match(o.expression || (/(.+)[-=_](.+)/));
|
| 776 |
|
| 777 |
if (depth === sDepth) {
|
| 778 |
pid = o.rootID;
|
|
@@ -785,15 +781,15 @@
|
|
| 785 |
}
|
| 786 |
|
| 787 |
if (id) {
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
}
|
| 798 |
|
| 799 |
_left = right + 1;
|
|
@@ -813,7 +809,7 @@
|
|
| 813 |
|
| 814 |
var o = this.options,
|
| 815 |
childrenList = $(item).children(o.listType),
|
| 816 |
-
hasChildren = childrenList.
|
| 817 |
|
| 818 |
var doNotClear =
|
| 819 |
o.doNotClear ||
|
|
@@ -822,13 +818,10 @@
|
|
| 822 |
|
| 823 |
if (o.isTree) {
|
| 824 |
replaceClass(item, o.branchClass, o.leafClass, doNotClear);
|
| 825 |
-
|
| 826 |
-
if (doNotClear && hasChildren) {
|
| 827 |
-
replaceClass(item, o.collapsedClass, o.expandedClass);
|
| 828 |
-
}
|
| 829 |
}
|
| 830 |
|
| 831 |
if (!doNotClear) {
|
|
|
|
| 832 |
childrenList.remove();
|
| 833 |
}
|
| 834 |
},
|
| 1 |
+
// From: https://github.com/ilikenwf/nestedSortable/blob/master/jquery.mjs.nestedSortable.js
|
| 2 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
(function( factory ) {
|
| 4 |
"use strict";
|
| 5 |
|
| 8 |
// AMD. Register as an anonymous module.
|
| 9 |
define([
|
| 10 |
"jquery",
|
| 11 |
+
"jquery-ui/ui/sortable"
|
| 12 |
], factory );
|
| 13 |
} else {
|
| 14 |
|
| 252 |
childLevels = this._getChildLevels(this.helper);
|
| 253 |
newList = document.createElement(o.listType);
|
| 254 |
|
| 255 |
+
// dragDirection object is required by jquery.ui.sortable.js 1.13+
|
| 256 |
+
this.dragDirection = {
|
| 257 |
+
vertical: this._getDragVerticalDirection(),
|
| 258 |
+
horizontal: this._getDragHorizontalDirection()
|
| 259 |
+
};
|
| 260 |
+
|
| 261 |
//Rearrange
|
| 262 |
for (i = this.items.length - 1; i >= 0; i--) {
|
| 263 |
|
| 334 |
.addClass(o.expandedClass);
|
| 335 |
|
| 336 |
self.refreshPositions();
|
| 337 |
+
self._trigger("expand", event, [self._uiHash(), itemElement]);
|
| 338 |
}, o.expandOnHover);
|
| 339 |
}
|
| 340 |
}
|
| 768 |
depth--;
|
| 769 |
}
|
| 770 |
|
| 771 |
+
id = ($(item).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[-=_](.+)/));
|
| 772 |
|
| 773 |
if (depth === sDepth) {
|
| 774 |
pid = o.rootID;
|
| 781 |
}
|
| 782 |
|
| 783 |
if (id) {
|
| 784 |
+
var data = $(item).children('div').data();
|
| 785 |
+
var itemObj = $.extend( data, {
|
| 786 |
+
"id":id[2],
|
| 787 |
+
"parent_id":pid,
|
| 788 |
+
"depth":depth,
|
| 789 |
+
"left":_left,
|
| 790 |
+
"right":right
|
| 791 |
+
} );
|
| 792 |
+
ret.push( itemObj );
|
| 793 |
}
|
| 794 |
|
| 795 |
_left = right + 1;
|
| 809 |
|
| 810 |
var o = this.options,
|
| 811 |
childrenList = $(item).children(o.listType),
|
| 812 |
+
hasChildren = childrenList.has('li').length;
|
| 813 |
|
| 814 |
var doNotClear =
|
| 815 |
o.doNotClear ||
|
| 818 |
|
| 819 |
if (o.isTree) {
|
| 820 |
replaceClass(item, o.branchClass, o.leafClass, doNotClear);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 821 |
}
|
| 822 |
|
| 823 |
if (!doNotClear) {
|
| 824 |
+
childrenList.parent().removeClass(o.expandedClass);
|
| 825 |
childrenList.remove();
|
| 826 |
}
|
| 827 |
},
|
