Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate separate link contexts #11

Open
pdf opened this issue Sep 14, 2017 · 0 comments
Open

Investigate separate link contexts #11

pdf opened this issue Sep 14, 2017 · 0 comments

Comments

@pdf
Copy link
Owner

pdf commented Sep 14, 2017

Mozilla reviewer (Rob W) writes:

here is one thing that you might want to change to improve the functionality.
in background.js, every context menu item matches many different contexts, and contextMenuHandler the following logic:
info.linkUrl || info.srcUrl || info.frameUrl || info.pageUrl

This may result in surprising behavior, for example if an image is embedded in a link. In this case, it is not possible to share the image, because the extension selects the link.

Consider creating splitting the menu in separate definitions, then up to three menu items can be shown at a given page.

browser.tabs.create({contexts: ["page", "frame"], title: "Share page", ....}) // use info.frameUrl || info.pageUrl in onclick.
browser.tabs.create({contexts: ["link"], title: "Share link", ....}) // use info.linkUrl in onclick
browser.tabs.create({contexts: ["video"], title: "Share video", ....}) // use info.srcUrl in onclick
browser.tabs.create({contexts: ["audio"], title: "Share audio", ....}) // use info.srcUrl in onclick
browser.tabs.create({contexts: ["image"], title: "Share image", ....}) // use info.srcUrl in onclick

If you use the above, then up to three menu items will be displayed (video, audio and image are mutually exclusive).

@pdf pdf added the enhancement label Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant