Electron: Allow to open DevTools from context menu (#4206)
This commit is contained in:
parent
4987c40e7d
commit
8548e96e01
@ -5,7 +5,7 @@ import contextMenu from 'electron-context-menu';
|
||||
import path from 'path';
|
||||
|
||||
import { initDeeplink } from './deeplink';
|
||||
import { IS_MAC_OS, IS_WINDOWS } from './utils';
|
||||
import { IS_MAC_OS, IS_PRODUCTION, IS_WINDOWS } from './utils';
|
||||
import { createWindow, setupCloseHandlers, setupElectronActionHandlers } from './window';
|
||||
|
||||
initDeeplink();
|
||||
@ -16,6 +16,7 @@ contextMenu({
|
||||
showSearchWithGoogle: false,
|
||||
showCopyImage: false,
|
||||
showSelectAll: true,
|
||||
showInspectElement: !IS_PRODUCTION,
|
||||
});
|
||||
|
||||
app.on('ready', () => {
|
||||
|
||||
@ -14,6 +14,7 @@ export const IS_WINDOWS = process.platform === 'win32';
|
||||
export const IS_LINUX = process.platform === 'linux';
|
||||
export const IS_PREVIEW = process.env.IS_PREVIEW === 'true';
|
||||
export const IS_FIRST_RUN = !fs.existsSync(`${app.getPath('userData')}/config.json`);
|
||||
export const IS_PRODUCTION = process.env.APP_ENV === 'production';
|
||||
|
||||
export const windows = new Set<BrowserWindow>();
|
||||
export const store: Store = new Store();
|
||||
|
||||
@ -12,8 +12,9 @@ import { processDeeplink } from './deeplink';
|
||||
import { captureLocalStorage, restoreLocalStorage } from './localStorage';
|
||||
import tray from './tray';
|
||||
import {
|
||||
checkIsWebContentsUrlAllowed, forceQuit, getAppTitle, getCurrentWindow, getLastWindow, hasExtraWindows,
|
||||
IS_FIRST_RUN, IS_MAC_OS, IS_PREVIEW, IS_WINDOWS, reloadWindows, store, TRAFFIC_LIGHT_POSITION, windows,
|
||||
checkIsWebContentsUrlAllowed, forceQuit, getAppTitle, getCurrentWindow, getLastWindow,
|
||||
hasExtraWindows, IS_FIRST_RUN, IS_MAC_OS, IS_PREVIEW, IS_PRODUCTION, IS_WINDOWS,
|
||||
reloadWindows, store, TRAFFIC_LIGHT_POSITION, windows,
|
||||
} from './utils';
|
||||
import windowStateKeeper from './windowState';
|
||||
|
||||
@ -61,7 +62,7 @@ export function createWindow(url?: string) {
|
||||
title: getAppTitle(),
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
devTools: process.env.APP_ENV !== 'production',
|
||||
devTools: !IS_PRODUCTION,
|
||||
},
|
||||
...(IS_MAC_OS && {
|
||||
titleBarStyle: 'hidden',
|
||||
@ -127,7 +128,7 @@ export function createWindow(url?: string) {
|
||||
window.webContents.once('dom-ready', async () => {
|
||||
processDeeplink();
|
||||
|
||||
if (process.env.APP_ENV === 'production') {
|
||||
if (IS_PRODUCTION) {
|
||||
setupAutoUpdates(windowState);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user