简体   繁体   中英

Chrome Extensions: nested folders

If use this code:

chrome.bookmarks.getTree(function(addNode)
{
    var rootNodeId = addNode[0].children[1].id;
    chrome.bookmarks.create({parentId:rootNodeId, title:'root'}, function(node)
    {
        chrome.bookmarks.create({parentId:node.id, title:'child1'});
        chrome.bookmarks.create({parentId:node.id, title:'child2'});
    });
});

to get nested folders they are created but they behave not as normal folders. First of all i don't get the little triangle in front of the root folder and if i'm in a subfolder by double clicking and then go back (with browswer arrow) i get to the folder the root folder is contained and not as it should in the root folder.

Any ideas what's wrong with that or is this a bug?

Thanks in advance, drakon

//EDIT If i set a breakpoint for the chrome.bookmarks.create line it works as expected. I'm really confused..

//EDIT Seems to be a bug of chrome -> press F5 lets the entrys appear.

The code you pasted above does what it is expected.

  1. You are getting the root node of the "Other bookmarks" folder
  2. You are creating a folder called "root"
  3. You are creating two child folders inside your parent "root" folder that you already created.

I believe the arrow thing you are seeing is a bug in Chrome, please report it since it should always see that arrow.

Perhaps you are missing some code cause the above works as I explained.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM