From 672b6491cd65e77f3305f80188c52627ed0541c1 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 9 Aug 2018 18:13:49 +0200 Subject: [PATCH] Fixed restoring DOM selection and another bug in `moveNodes` --- src/js/Node.js | 2 +- src/js/treemode.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/Node.js b/src/js/Node.js index 5e2ae53..1d0a94e 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -2044,7 +2044,7 @@ Node.onDragEnd = function (nodes, event) { ? (newIndex + nodes.length) : newIndex; - if (!sameParent || oldIndex !== newIndex) { + if (!sameParent || oldIndexRedo !== newIndex) { // only register this action if the node is actually moved to another place editor._onAction('moveNodes', { count: nodes.length, diff --git a/src/js/treemode.js b/src/js/treemode.js index 3ddfc00..0c5656f 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -730,9 +730,11 @@ treemode.getDomSelection = function () { path: node ? node.getInternalPath() : null, domName: domName, range: range, - paths: this.multiselection.nodes.map(function (node) { - return node.getInternalPath(); - }), + paths: this.multiselection.length > 0 + ? this.multiselection.nodes.map(function (node) { + return node.getInternalPath(); + }) + : null, scrollTop: this.scrollableContent ? this.scrollableContent.scrollTop : 0 }; };