MDL-53293 tool_lp: Destroy dragdrop instance before re-creating
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 10 May 2016 07:27:46 +0000 (15:27 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 11 May 2016 00:19:39 +0000 (08:19 +0800)
admin/tool/lp/amd/build/dragdrop-reorder.min.js
admin/tool/lp/amd/src/dragdrop-reorder.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js
admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js

index 77c33ba..48751b5 100644 (file)
Binary files a/admin/tool/lp/amd/build/dragdrop-reorder.min.js and b/admin/tool/lp/amd/build/dragdrop-reorder.min.js differ
index 433604d..d14c9dd 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 define(['core/str', 'core/yui'], function(str, Y) {
-
     // Private variables and functions.
 
+    /**
+     * Store the current instance of the core drag drop.
+     *
+     * @property dragDropInstance M.tool_lp.dragdrop_reorder
+     */
+    var dragDropInstance = null;
+
     /**
      * Translate the drophit event from YUI
      * into simple drag and drop nodes.
@@ -70,7 +76,10 @@ define(['core/str', 'core/yui'], function(str, Y) {
                     var context = {
                         callback: callback
                     };
-                    M.tool_lp.dragdrop_reorder({
+                    if (dragDropInstance) {
+                        dragDropInstance.destroy();
+                    }
+                    dragDropInstance = M.tool_lp.dragdrop_reorder({
                         group: group,
                         dragHandleText: dragHandleText,
                         sameNodeText: sameNodeText,
index caebb22..159ec86 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js differ
index f91699e..47c197c 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js differ
index caebb22..159ec86 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js differ
index c2feccb..3624631 100644 (file)
@@ -63,5 +63,5 @@ Y.extend(DRAGREORDER, M.core.dragdrop, {
 
 M.tool_lp = M.tool_lp || {};
 M.tool_lp.dragdrop_reorder = function(params) {
-    new DRAGREORDER(params);
+    return new DRAGREORDER(params);
 };