我想在上下文菜單中顯示一個菜單項,如果用戶在選擇或上右鍵單擊它們右鍵單擊圖像。如何在兩種情況下顯示相同的上下文菜單項
目前我正在使用此代碼,但不幸的是它顯示菜單項兩次如果我右鍵單擊作爲用戶選擇的一部分的圖像。
contextMenu.Item({
label: contextMenuItemLabel,
contentScriptFile: contextMenuItemContentScriptFiles,
context: contextMenu.SelectionContext(),
onMessage: function (posted) { someFunction(posted) }
});
contextMenu.Item({
label: contextMenuItemLabel,
contentScriptFile: contextMenuItemContentScriptFiles,
context: contextMenu.SelectorContext("img"),
onMessage: function (posted) { someFunction(posted) }
});
你能告訴我現在如何做到這一點,如果你知道它 - 我花了這麼多時間在這個。
謝謝。