代码拉取完成,页面将自动刷新
const { app, BrowserWindow, BrowserView, ipcMain, Menu } = require('electron')
const path = require('path')
function createWindow() {
const editorWindow = new BrowserWindow({
width: 1400,
height: 1000,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
webSecurity: false,
webviewTag: true
// preload: path.join(__dirname, 'preload.js')
}
})
editorWindow.loadURL('http://localhost:8080/editor.html');
const runtimeView = new BrowserView()
editorWindow.setBrowserView(runtimeView)
runtimeView.setBounds({ x: 206, y: 2, width: 600, height: 600 })
runtimeView.webContents.loadURL('http://localhost:8080/index.html?mode=edit');
runtimeView.webContents.openDevTools();
editorWindow.webContents.openDevTools()
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
// window.addEventListener('contextmenu', (event) => {
// event.preventDefault();
// const contextMenu = createContextMenu();
// contextMenu.popup({
// window: remote.getCurrentWindow()
// });
// }, false);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。