ブックマーク中に保存されたツリー構造が壊れている時の修復処理を修正
* [A] (no parent) * [B] (parent is A) * [C] (parent is C itself) * [D] (parent is A) * [E] (parent is A) このような状態において、D, Eの親のインデックスが-1より小さくなっていたのを、CをAの子としてツリーに組み込むようにした git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6542 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
878d7c0ed6
commit
0f91030813
@ -108,10 +108,12 @@ var TreeStyleTabBookmarksService = {
|
||||
if (aDefaultParentID === void(0))
|
||||
aDefaultParentID = -1;
|
||||
|
||||
/* Get array of parents. The index becomes to -1,
|
||||
if there is NO PARENT or the parent is THE TAB ITSELF. */
|
||||
var treeStructure = aIDs.map(function(aId, aIndex) {
|
||||
let id = this.getParentItem(aId);
|
||||
let index = aIDs.indexOf(id);
|
||||
return index > aIndex || index < -1 ? aDefaultParentID : index ;
|
||||
return index >= aIndex ? aDefaultParentID : index ;
|
||||
}, this);
|
||||
|
||||
/* Correct patterns like:
|
||||
@ -147,7 +149,8 @@ var TreeStyleTabBookmarksService = {
|
||||
return aPosition - offset;
|
||||
});
|
||||
|
||||
// smaller than -1 (-2, etc.) are invalid values.
|
||||
/* The final step, this validates all of values.
|
||||
Smaller than -1 is invalid, so it becomes to -1. */
|
||||
return treeStructure.map(function(aIndex) {
|
||||
return aIndex < -1 ? aDefaultParentID : aIndex ;
|
||||
}, this);
|
||||
|
Loading…
Reference in New Issue
Block a user