Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,24 @@ browser.runtime.onMessage.addListener(({ type, data }, sender) => {

return null
})

// =============================================================================
// Context Menu Logic

const sidebartabs = browser.menus.create({
title: 'Add to Sidebar',
contexts: ['page'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if I right click in a blank part of the page, I can add the page to the sidebar, but if I right click on the tab I cannot. If I right click on selected text I cannot.

Also, shouldn't I be able to right click on a link to add it to the sidebar? That was what I thought this was itnened to fix at first.

Please review the valid context menu types: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/ContextType

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm the link adding to sidebar sounds like a cool addition. I thought it was the page itself but will change to add both.

documentUrlPatterns: ['*://*/*'],
})

browser.menus.onClicked.addListener(function (info, tab) {
switch (info.menuItemId) {
case sidebartabs:
createSidebarItem({
title: tab.title,
iconUrl: tab.favIconUrl,
webviewUrl: tab.url,
})
break
}
})
5 changes: 4 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"tabs",
"webRequest",
"activeTab",
"https://icons.duckduckgo.com/"
"https://icons.duckduckgo.com/",
"menus",
"<all_urls>",
"contextMenus"
],
"web_accessible_resources": [
"icon.svg",
Expand Down