proof of concept, file URL to open window using will-navigate

This commit is contained in:
sawka
2022-08-17 13:32:02 -07:00
parent c6e29c3314
commit 1914719ad1
3 changed files with 18 additions and 6 deletions
+9 -5
View File
@@ -45,14 +45,18 @@ function getMods(input : any) {
return {meta: input.meta, shift: input.shift, ctrl: input.ctrl, alt: input.alt};
}
function cancelNav(event : any, url : any) {
console.log("cancel navigation", url);
function shNavHandler(event : any, url : any) {
console.log("navigation", url);
event.preventDefault();
if (url == "file:///remotes.html") {
createRemotesWindow();
}
}
function createRemotesWindow() {
if (RemotesWindow != null) {
console.log("remotes exists");
RemotesWindow.focus();
return;
}
console.log("create remotes window");
@@ -68,10 +72,10 @@ function createRemotesWindow() {
win.on("close", () => {
RemotesWindow = null;
});
win.webContents.on("will-navigate", cancelNav);
win.webContents.on("will-navigate", shNavHandler);
}
function createWindow() {
function createWindow() {
let win = new electron.BrowserWindow({
width: 1800,
height: 1200,
@@ -129,7 +133,7 @@ function createWindow() {
return;
}
});
win.webContents.on("will-navigate", cancelNav);
win.webContents.on("will-navigate", shNavHandler);
return win;
}
+1 -1
View File
@@ -912,7 +912,7 @@ class MainSideBar extends React.Component<{}, {}> {
</ul>
<div className="spacer"></div>
<p className="menu-label">
Remotes
<a href="/remotes.html">Remotes</a>
</p>
<ul className="menu-list">
<For each="remote" of={remotes}>
+8
View File
@@ -177,6 +177,14 @@ html, body, #main {
.menu-label {
color: #bbb;
a {
color: #bbb;
}
a:hover {
color: #3273dc;
}
}
p.menu-label {