MCPcopy Index your code
hub / github.com/nwutils/nw-sample-apps / initContextMenu

Function initContextMenu

mini-code-edit/editor.js:110–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108}
109
110function initContextMenu() {
111 menu = new gui.Menu();
112 menu.append(new gui.MenuItem({
113 label: 'Copy',
114 click: function() {
115 clipboard.set(editor.getSelection());
116 }
117 }));
118 menu.append(new gui.MenuItem({
119 label: 'Cut',
120 click: function() {
121 clipboard.set(editor.getSelection());
122 editor.replaceSelection('');
123 }
124 }));
125 menu.append(new gui.MenuItem({
126 label: 'Paste',
127 click: function() {
128 editor.replaceSelection(clipboard.get());
129 }
130 }));
131
132 document.getElementById("editor").addEventListener('contextmenu',
133 function(ev) {
134 ev.preventDefault();
135 menu.popup(ev.x, ev.y);
136 return false;
137 });
138}
139
140
141onload = function() {

Callers 1

editor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected