mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 21:28:40 +00:00
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:
committed by
Scott Nonnenberg
parent
5c66c3ddc8
commit
851c1a0e47
14
preload.js
14
preload.js
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user