
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
electron-editor-context-menu
Advanced tools
In Electron, right-clicking in text editors does… nothing.
This module enables the menu you'd expect, with optional spell-checker integration.
npm install electron-editor-context-menu --save
// In the renderer process:
var remote = require('electron').remote;
// `remote.require` since `Menu` is a main-process module.
var buildEditorContextMenu = remote.require('electron-editor-context-menu');
window.addEventListener('contextmenu', function(e) {
// Only show the context menu in text editors.
if (!e.target.closest('textarea, input, [contenteditable="true"]')) return;
var menu = buildEditorContextMenu();
// The 'contextmenu' event is emitted after 'selectionchange' has fired but possibly before the
// visible selection has changed. Try to wait to show the menu until after that, otherwise the
// visible selection will update after the menu dismisses and look weird.
setTimeout(function() {
menu.popup(remote.getCurrentWindow());
}, 30);
});
Show spelling suggestions by passing a selection object when building the menu:
var selection = {
isMisspelled: true,
spellingSuggestions: [
'men',
'mean',
'menu'
]
};
var menu = buildEditorContextMenu(selection);
Get these suggestions when your spell-check provider runs
—Electron will poll it immediately before the 'contextmenu' event fires.
For a complete example using electron-spell-check-provider, see
here.
Created by Jeff Wear.
Thanks to https://github.com/atom/electron/pull/942#issuecomment-171445954 for the initial sketch of this.
Copyright 2016 Mixmax, Inc., licensed under the MIT License.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.