Remove Facebook tracking from copied links #1169
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #248 and fixes #286. The actual code to clean the URL is copied from PR #226 (same functionality for clicked links). As mentioned in the linked issues, this makes use of code changes in sindresorhus/electron-context-menu#44.
Ideally the menu item would be replaced in a neater way, but that requires upstream changes. For now, this code change takes advantage of the fact that the default menu items can be exposed through the
prepend
function and then thetransform
functionality is used to change the URL as needed.I considered two ways to change the functionality: use of the
menu
option or some new functionality in the library that replaces default menu items. The first approach cannot be done because we cannot read the default list of menu items, so we would need to duplicate code. Even if that is done, the type definition forActions
has nocopyLink
. The second approach is cleaner: some new functionality that allows for replacement of default items. I think that this should be possible once sindresorhus/electron-context-menu#70 is addressed.A summary of these issues has been put in place while this hacky solution is used.