Bug 1747200 - Added call to ensureRowIsVisible to make sure that selected node is in view after showInFolder. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D135672
This commit is contained in:
@@ -324,28 +324,7 @@ PlacesController.prototype = {
|
||||
break;
|
||||
}
|
||||
case "placesCmd_showInFolder":
|
||||
// Open containing folder in left pane bookmark tree
|
||||
let currentNode = this._view.selectedNode;
|
||||
if (this._view.parentElement.id.includes("Panel")) {
|
||||
// We're in the sidebar - clear the search box first
|
||||
let searchBox = document.getElementById("search-box");
|
||||
searchBox.value = "";
|
||||
searchBox.doCommand();
|
||||
// And go to the node
|
||||
this._view.selectItems([currentNode.bookmarkGuid], true);
|
||||
} else {
|
||||
PlacesUtils.bookmarks
|
||||
.fetch(currentNode.bookmarkGuid, null, { includePath: true })
|
||||
.then(b => {
|
||||
let containers = b.path.map(obj => {
|
||||
return obj.guid;
|
||||
});
|
||||
// selectLeftPane looks for literal "AllBookmarks" as a "built-in"
|
||||
containers.splice(0, 0, "AllBookmarks");
|
||||
PlacesOrganizer.selectLeftPaneContainerByHierarchy(containers);
|
||||
this._view.selectItems([currentNode.bookmarkGuid], false);
|
||||
});
|
||||
}
|
||||
this.showInFolder(this._view.selectedNode.bookmarkGuid);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -1401,6 +1380,31 @@ PlacesController.prototype = {
|
||||
await this.ForgetAboutSite.removeDataFromDomain(host);
|
||||
}
|
||||
},
|
||||
|
||||
showInFolder(aBookmarkGuid) {
|
||||
// Open containing folder in left pane/sidebar bookmark tree
|
||||
if (this._view.parentElement.id.includes("Panel")) {
|
||||
// We're in the sidebar - clear the search box first
|
||||
let searchBox = document.getElementById("search-box");
|
||||
searchBox.value = "";
|
||||
searchBox.doCommand();
|
||||
|
||||
// And go to the node
|
||||
this._view.selectItems([aBookmarkGuid], true);
|
||||
} else {
|
||||
PlacesUtils.bookmarks
|
||||
.fetch(aBookmarkGuid, null, { includePath: true })
|
||||
.then(b => {
|
||||
let containers = b.path.map(obj => {
|
||||
return obj.guid;
|
||||
});
|
||||
// selectLeftPane looks for literal "AllBookmarks" as a "built-in"
|
||||
containers.splice(0, 0, "AllBookmarks");
|
||||
PlacesOrganizer.selectLeftPaneContainerByHierarchy(containers);
|
||||
this._view.selectItems([aBookmarkGuid], false);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -800,14 +800,23 @@
|
||||
for (let i = 0; i < nodesToOpen.length; i++) {
|
||||
nodesToOpen[i].containerOpen = true;
|
||||
}
|
||||
let firstValidTreeIndex = -1;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
var index = resultview.treeIndexForNode(nodes[i]);
|
||||
if (index == -1) {
|
||||
continue;
|
||||
}
|
||||
if (firstValidTreeIndex < 0 && index >= 0) {
|
||||
firstValidTreeIndex = index;
|
||||
}
|
||||
selection.rangedSelect(index, index, true);
|
||||
}
|
||||
selection.selectEventsSuppressed = false;
|
||||
|
||||
// Bring the first valid node into view if necessary
|
||||
if (firstValidTreeIndex >= 0) {
|
||||
this.ensureRowIsVisible(firstValidTreeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
buildContextMenu(aPopup) {
|
||||
|
||||
Reference in New Issue
Block a user