Skip to content

Commit 218a9da

Browse files
author
Dave Conway-Jones
committed
add flag to disable palette manager, add quit confirmation dialog
1 parent d88c9ec commit 218a9da

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Runtimes are created in the `dist` directory under the `electron-node-red` proje
7272
Generally you can just add the required parameter to the command
7373

7474
```bash
75-
yarn && yarn dist -w // for windows
75+
yarn && yarn dist -w // for windows (see below for building on Mac Catalina)
7676
yarn && yarn dist -l // for linux
7777
yarn && yarn dist -m // for mac
7878
```

main.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ if (pkg.hasOwnProperty("NRelectron")) { options = pkg["NRelectron"] }
66

77
// Some settings you can edit if you don't set them in package.json
88
//console.log(options)
9-
const editable = options.editable || true; // set this to false to create a run only application - no editor/no console
9+
const editable = options.editable || true; // set this to false to create a run only application - no editor/no console
1010
const allowLoadSave = options.allowLoadSave || false; // set to true to allow import and export of flow file
1111
const showMap = options.showMap || false; // set to true to add Worldmap to the menu
12-
const kioskMode = options.kioskMode || false; // set to true to start in kiosk mode
12+
const kioskMode = options.kioskMode || false; // set to true to start in kiosk mode
13+
const addNodes = options.addNodes || true; // set to false to block installing extra nodes
1314
let flowfile = options.flowFile || 'electronflow.json'; // default Flows file name - loaded at start
1415

1516
const urldash = "/ui/#/0"; // url for the dashboard page
@@ -112,7 +113,7 @@ var settings = {
112113
httpNodeRoot: "/",
113114
userDir: userdir,
114115
flowFile: flowfile,
115-
editorTheme: { projects:{ enabled:false } }, // enable projects feature
116+
editorTheme: { projects:{ enabled:false }, palette: { editable:addNodes } }, // enable projects feature
116117
functionGlobalContext: { }, // enables global context - add extras ehre if you need them
117118
logging: {
118119
websock: {
@@ -354,6 +355,19 @@ function createWindow() {
354355
option.height = w.height;
355356
})
356357

358+
mainWindow.on('close', function(e) {
359+
const choice = require('electron').dialog.showMessageBoxSync(this, {
360+
type: 'question',
361+
icon: nrIcon,
362+
buttons: ['Yes', 'No'],
363+
title: 'Confirm',
364+
message: 'Are you sure you want to quit?'
365+
});
366+
if (choice === 1) {
367+
e.preventDefault();
368+
}
369+
});
370+
357371
mainWindow.on('closed', () => {
358372
mainWindow = null;
359373
});

package-template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"allowLoadSave": false,
1010
"showMap": false,
1111
"kioskMode": false,
12+
"addNodes": true,
1213
"flowFile": "electronflow.json",
1314
"start": "editor"
1415
},

0 commit comments

Comments
 (0)