Quickly search/open tag "virtual" page

I modified the script to be able to search with a tag picker. @raphwriter I think now you have what you wanted. Thanks for the idea :slight_smile:

```space-script
silverbullet.registerCommand({name: "Search Tag", 
                              hide: false, 
                              key: "Ctrl-Shift-t", 
                              mac: "Cmd-Shift-t"}, async () => {
  // Get all tags
  const allTags = await system.invokeFunction(
    "index.queryObjects",
    "tag")
  // Only keep one occurrence per tag
  const uniqueNames = new Set();
  const uniqueTags = allTags.filter(tag => {
      if (!uniqueNames.has(tag.name)) {
          uniqueNames.add(tag.name);
          return true; 
      }
      return false;
  });
  // Ask for tag selection
  const tag = await editor.filterBox(
    "Tags",
    uniqueTags.map((f) => {
      return {
        name: f.name,
        description: ""
      }
    }),
    "Select the tags to open it's virtual page",
  )  
  // Show tag page
  editor.navigate("📌 " + tag.name)  
});
```
4 Likes