This commit is contained in:
Andrew Gundersen 2022-01-18 16:58:56 -06:00
commit 5d74c67648
17 changed files with 101 additions and 212 deletions

View file

@ -21,28 +21,11 @@ function updateWindowPosition()
}
function createPreviewWin(_e, content)
function onNavBar(_e, cmd)
{
console.log("Creating preview window");
const preview = new BrowserWindow({
width: 500,
height: 300,
x: null,
y: null,
resizable: true,
frame: false,
webPreferences: { preload: path.join(__dirname, "/render/preload.js") }
});
preview.loadFile(path.join(__dirname, "preview.html"));
preview.webContents.on("did-finish-load", () => {
preview.webContents.send("preview-init", content);
});
cmd === "close" ? win.close() : win.minimize();
}
function createWin()
{
if (win) return;
@ -56,7 +39,6 @@ function createWin()
x: pos.x,
y: pos.y,
resizable: true,
backgroundColor: "#EBEBEB",
frame: false,
minWidth: 350,
minHeight: 500,
@ -92,6 +74,6 @@ function createWin()
});
}
ipcMain.on("preview", createPreviewWin);
ipcMain.on("nav-bar", onNavBar);
exports.createWin = createWin;