Commit acb78df5849d6055ea5fc04006d5881b6629c6fd
Add context menu for electron
Charles Lehner authored on 8/2/2016, 1:37:16 AMDominic Tarr committed on 10/24/2016, 8:30:53 PM
Parent: 606c0def1d798cea50ee2571dcc88c642948db9e
Files changed
modules/tabs.js | changed |
modules/tabs.js | ||
---|---|---|
@@ -180,8 +180,25 @@ | ||
180 | 180 … | else |
181 | 181 … | errorsContent.appendChild(el) |
182 | 182 … | }) |
183 | 183 … | |
184 … | + if (process.versions.electron) { | |
185 … | + window.addEventListener('contextmenu', function (ev) { | |
186 … | + ev.preventDefault() | |
187 … | + var remote = require('remote') | |
188 … | + var Menu = remote.require('menu') | |
189 … | + var MenuItem = remote.require('menu-item') | |
190 … | + var menu = new Menu() | |
191 … | + menu.append(new MenuItem({ | |
192 … | + label: 'Inspect Element', | |
193 … | + click: function () { | |
194 … | + remote.getCurrentWindow().inspectElement(ev.x, ev.y) | |
195 … | + } | |
196 … | + })) | |
197 … | + menu.popup(remote.getCurrentWindow()) | |
198 … | + }) | |
199 … | + } | |
200 … | + | |
184 | 201 … | return tabs |
185 | 202 … | } |
186 | 203 … | |
187 | 204 … |
Built with git-ssb-web