docs: enable contextIsolation in fiddles (#39613)
This commit is contained in:
parent
2e79f34c84
commit
9280b79112
61 changed files with 206 additions and 233 deletions
|
@ -1,5 +1,6 @@
|
|||
// Modules to control application life and create native browser window
|
||||
const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron/main')
|
||||
const path = require('node:path')
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
|
@ -11,8 +12,7 @@ function createWindow () {
|
|||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -59,17 +59,11 @@ app.on('activate', function () {
|
|||
}
|
||||
})
|
||||
|
||||
ipcMain.on('open-file-dialog', event => {
|
||||
dialog.showOpenDialog(
|
||||
{
|
||||
properties: ['openFile', 'openDirectory']
|
||||
},
|
||||
files => {
|
||||
if (files) {
|
||||
event.sender.send('selected-directory', files)
|
||||
}
|
||||
}
|
||||
)
|
||||
ipcMain.handle('open-file-dialog', async () => {
|
||||
const options = {
|
||||
properties: ['openFile', 'openDirectory']
|
||||
}
|
||||
return (await dialog.showOpenDialog(options)).filePaths
|
||||
})
|
||||
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue