mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-22 14:48:28 +00:00
parent
537dc01fd1
commit
1de9eec356
@ -117,7 +117,8 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
goBack: onGoBack,
|
||||
goForward: onGoForward,
|
||||
getCurrentUrl: getCurrentUrl,
|
||||
clearAppData: clearAppData
|
||||
clearAppData: clearAppData,
|
||||
disableDevTools: options.disableDevTools
|
||||
};
|
||||
|
||||
createMenu(menuOptions);
|
||||
|
@ -9,8 +9,9 @@ import {Menu, shell, clipboard} from 'electron';
|
||||
* @param goForward
|
||||
* @param getCurrentUrl
|
||||
* @param clearAppData
|
||||
* @param disableDevTools
|
||||
*/
|
||||
function createMenu({nativefierVersion, appQuit, zoomIn, zoomOut, goBack, goForward, getCurrentUrl, clearAppData}) {
|
||||
function createMenu({nativefierVersion, appQuit, zoomIn, zoomOut, goBack, goForward, getCurrentUrl, clearAppData, disableDevTools}) {
|
||||
if (Menu.getApplicationMenu()) {
|
||||
return;
|
||||
}
|
||||
@ -187,6 +188,12 @@ function createMenu({nativefierVersion, appQuit, zoomIn, zoomOut, goBack, goForw
|
||||
}
|
||||
];
|
||||
|
||||
if (disableDevTools) {
|
||||
// remove last item (dev tools) from menu > view
|
||||
const submenu = template[1].submenu;
|
||||
submenu.splice(submenu.length - 1, 1);
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
template.unshift({
|
||||
label: 'Electron',
|
||||
|
10
docs/api.md
10
docs/api.md
@ -33,6 +33,8 @@
|
||||
- [[full-screen]](#full-screen)
|
||||
- [[maximize]](#maximize)
|
||||
- [[verbose]](#verbose)
|
||||
- [[disable-context-menu]](#disable-context-menu)
|
||||
- [[disable-dev-tools]](#disable-dev-tools)
|
||||
- [Programmatic API](#programmatic-api)
|
||||
|
||||
## Command Line
|
||||
@ -317,6 +319,14 @@ Shows detailed logs in the console.
|
||||
|
||||
Disable the context menu
|
||||
|
||||
#### [disable-dev-tools]
|
||||
|
||||
```
|
||||
--disable-dev-tools
|
||||
```
|
||||
|
||||
Disable the Chrome developer tools
|
||||
|
||||
## Programmatic API
|
||||
|
||||
You can use the Nativefier programmatic API as well.
|
||||
|
@ -113,7 +113,8 @@ function selectAppArgs(options) {
|
||||
fullScreen: options.fullScreen,
|
||||
hideWindowFrame: options.hideWindowFrame,
|
||||
maximize: options.maximize,
|
||||
disableContextMenu: options.disableContextMenu
|
||||
disableContextMenu: options.disableContextMenu,
|
||||
disableDevTools: options.disableDevTools
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ if (require.main === module) {
|
||||
.option('--hide-window-frame', 'disable window frame and controls')
|
||||
.option('--verbose', 'if verbose logs should be displayed')
|
||||
.option('--disable-context-menu', 'disable the context menu')
|
||||
.option('--disable-dev-tools', 'disable developer tools')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
|
@ -63,6 +63,7 @@ function optionsFactory(inpOptions, callback) {
|
||||
hideWindowFrame: inpOptions.hideWindowFrame,
|
||||
verbose: inpOptions.verbose,
|
||||
disableContextMenu: inpOptions.disableContextMenu,
|
||||
disableDevTools: inpOptions.disableDevTools,
|
||||
// workaround for electron-packager#375
|
||||
tmpdir: false
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user