Disambiguate account/local folders sample bookmarks extension (#1435)

* Disambiguate account/local folders in the UI for sample bookmarks extension

* Code-review markups

* Fix lint issues
This commit is contained in:
ljjlee
2025-04-03 12:05:22 +02:00
committed by GitHub
parent 6116518873
commit b0f55f9d15

View File

@@ -40,7 +40,19 @@ function dumpNode(bookmarkNode, query) {
const anchor = $('<a>');
anchor.attr('href', bookmarkNode.url);
anchor.text(bookmarkNode.title);
// Chrome may have multiple top-level folder nodes with the same title. To
// disambiguate them, include a suffix depending on the value of the
// syncing property.
//
// folderType is set for top-level folders in the tree, and not for child
// folders. In Chrome versions prior to milestone 134, folderType is never
// set.
let title_text = bookmarkNode.title;
if (bookmarkNode.folderType) {
title_text += bookmarkNode.syncing ? ' (Account)' : ' (Local)';
}
anchor.text(title_text);
/*
* When clicking on a bookmark in the extension, a new tab is fired with