windingwind / zotero-plugin-toolkit

Toolkit for Zotero Plugin Developers.
https://www.npmjs.com/package/zotero-plugin-toolkit
MIT License
115 stars 13 forks source link

fix: `getVisibility` attribute for menu subentry is not working #51

Closed jiaojiaodubai closed 6 months ago

jiaojiaodubai commented 6 months ago

test case:

ztoolkit.Menu.register(
  "item",
  {
    tag: "menu",
    label: "topMenuItem",
    children: [
      {
        tag: "menuitem",
        label: "subentry",
        getVisibility: (_elem, _ev) => ZoteroPane.getSelectedItems().some(item => item.itemType == "journalArticle"),
        oncommand: `alert('visible: ${ZoteroPane.getSelectedItems().some(item => item.itemType == "journalArticle")}')`,
      },
    ],
  }
);