mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
added custom confirm dialog as js confirm in electron on windows causes all text fields to be disabled
This commit is contained in:
parent
0c0f059ec4
commit
094f6cb5ec
10 changed files with 56 additions and 19 deletions
|
|
@ -22,6 +22,27 @@ ipcMain.handle('alert', async(event, message) => {
|
|||
});
|
||||
});
|
||||
|
||||
// add support for showing a confirm window via ipc
|
||||
ipcMain.handle('confirm', async(event, message) => {
|
||||
|
||||
// show confirm dialog
|
||||
const result = await dialog.showMessageBox(mainWindow, {
|
||||
type: "question",
|
||||
title: "Confirm",
|
||||
message: message,
|
||||
cancelId: 0, // esc key should press cancel button
|
||||
defaultId: 1, // enter key should press ok button
|
||||
buttons: [
|
||||
"Cancel", // 0
|
||||
"OK", // 1
|
||||
],
|
||||
});
|
||||
|
||||
// check if user clicked OK
|
||||
return result.response === 1;
|
||||
|
||||
});
|
||||
|
||||
// add support for showing a prompt window via ipc
|
||||
ipcMain.handle('prompt', async(event, message) => {
|
||||
return await electronPrompt({
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ contextBridge.exposeInMainWorld('electron', {
|
|||
return await ipcRenderer.invoke('alert', message);
|
||||
},
|
||||
|
||||
// show a confirm dialog in electron browser window, this fixes a bug where confirm breaks input fields on windows
|
||||
confirm: async function(message) {
|
||||
return await ipcRenderer.invoke('confirm', message);
|
||||
},
|
||||
|
||||
// add support for using "prompt" in electron browser window
|
||||
prompt: async function(message) {
|
||||
return await ipcRenderer.invoke('prompt', message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue