MCPcopy Index your code
hub / github.com/hokein/electron-sample-apps / initContextMenu

Function initContextMenu

mini-code-editor/editor.js:105–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103}
104
105function initContextMenu() {
106 menu = new Menu();
107 menu.append(new MenuItem({
108 label: 'Copy',
109 click: function() {
110 clipboard.writeText(editor.getSelection(), 'copy');
111 }
112 }));
113 menu.append(new MenuItem({
114 label: 'Cut',
115 click: function() {
116 clipboard.writeText(editor.getSelection(), 'copy');
117 editor.replaceSelection('');
118 }
119 }));
120 menu.append(new MenuItem({
121 label: 'Paste',
122 click: function() {
123 editor.replaceSelection(clipboard.readText('copy'));
124 }
125 }));
126
127 window.addEventListener('contextmenu', function(ev) {
128 ev.preventDefault();
129 menu.popup(remote.getCurrentWindow(), ev.x, ev.y);
130 }, false);
131}
132
133
134onload = function() {

Callers 1

editor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected