directly open the menu instead of sending a message

This commit is contained in:
buzz-lightsnack-2007 2024-04-28 14:53:00 +08:00
parent 94c1789a2b
commit 4c5a4f3bb1

View file

@ -5,7 +5,7 @@ export default class MenuEntry {
/* Create all entries. */
constructor() {
// Add the context menu.
this.menu = new Menu({title: (new texts(`entry_contextMenu`)).localized, contexts: [`all`], events: {"onClicked": MenuEntry.onclick}, hidden: true});
this.menu = new Menu({title: (new texts(`entry_contextMenu`)).localized, contexts: [`all`], events: {"onClicked": this.onclick}, hidden: true});
};
/*
@ -25,8 +25,7 @@ export default class MenuEntry {
/*
The onclick event
*/
static onclick() {
// Send the message to open the side panel.
chrome.runtime.sendMessage({"action": "popup_open"});
onclick() {
this.menu.trigger();
};
}