You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
I don't understand your installation instructions. I installed it with npm install electron-editor-context-menu, but how do I actually put it in my electron app? You put this code in your readme but don't explain where it goes:
// 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);
});
Is this meant to go in my electron main.js file, or am I meant to call it as a script from my html file?
Thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I don't understand your installation instructions. I installed it with
npm install electron-editor-context-menu
, but how do I actually put it in my electron app? You put this code in your readme but don't explain where it goes:Is this meant to go in my electron
main.js
file, or am I meant to call it as a script from my html file?Thanks.
The text was updated successfully, but these errors were encountered: