From 4c5a4f3bb1fdea26b2c06990075da05945ffbb29 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:53:00 +0800 Subject: [PATCH] directly open the menu instead of sending a message --- scripts/GUI/entrypoints/menu.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/GUI/entrypoints/menu.js b/scripts/GUI/entrypoints/menu.js index a44446b..5b40618 100644 --- a/scripts/GUI/entrypoints/menu.js +++ b/scripts/GUI/entrypoints/menu.js @@ -2,13 +2,13 @@ import Menu from '/scripts/GUI/menus.js'; import texts from "/scripts/mapping/read.js"; export default class MenuEntry { - /* Create all entries. */ + /* 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}); }; - /* + /* Enable the sidebar. */ enable () { @@ -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(); }; } \ No newline at end of file