Adding right click listener for URLs and Text Selections (#3197)

* Adds right-click listener

For urls and text selections

* Fixes build-release on windows

Should still be bash compatible too

* Update context menu line

Responding to feedback from @JaredPotter
This commit is contained in:
Gabe Stocco 2019-04-10 12:06:21 -07:00 committed by Scott Nonnenberg
parent 5c66c3ddc8
commit 851c1a0e47
3 changed files with 83 additions and 1 deletions

View file

@ -283,6 +283,20 @@ window.Signal.Backup = require('./js/modules/backup');
window.Signal.Debug = require('./js/modules/debug');
window.Signal.Logs = require('./js/modules/logs');
// Add right-click listener for selected text and urls
const contextMenu = require('electron-context-menu');
contextMenu({
showInspectElement: false,
shouldShowMenu: (event, params) => {
if(!params.isEditable && params.mediaType === 'none' && ( params.linkURL.length !== 0 || params.selectionText.length !== 0 )) {
return params.linkURL || params.selectionText;
}
return false;
},
});
// We pull this in last, because the native module involved appears to be sensitive to
// /tmp mounted as noexec on Linux.
require('./js/spell_check');