diff --git a/content/treestyletab/bookmarksOverlay.js b/content/treestyletab/bookmarksOverlay.js index d42c3489..1ecc21bf 100644 --- a/content/treestyletab/bookmarksOverlay.js +++ b/content/treestyletab/bookmarksOverlay.js @@ -151,9 +151,11 @@ var TreeStyleTabBookmarksService = { /* The final step, this validates all of values. Smaller than -1 is invalid, so it becomes to -1. */ - return treeStructure.map(function(aIndex) { + treeStructure = treeStructure.map(function(aIndex) { return aIndex < -1 ? aDefaultParentID : aIndex ; }, this); + Application.console.log(treeStructure); + return treeStructure; }, // based on PlacesUtils.getURLsForContainerNode() diff --git a/content/treestyletab/bookmarksOverlayEditable.js b/content/treestyletab/bookmarksOverlayEditable.js index ef5d1743..6b060b51 100644 --- a/content/treestyletab/bookmarksOverlayEditable.js +++ b/content/treestyletab/bookmarksOverlayEditable.js @@ -147,7 +147,11 @@ var TreeStyleTabBookmarksServiceEditable = { var currentIndex = items.indexOf(aCurrentItem); var selected = treeStructure[currentIndex]; - if (selected > -1) selected = items[selected]; + if (selected > -1) { + let offset = treeStructure.lastIndexOf(-1, currentIndex); + let subStructure = treeStructure.slice(offset); + selected = items[selected + offset]; + } var fragment = document.createDocumentFragment(); items.forEach(function(aId, aIndex) {