mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
proof of concept, file URL to open window using will-navigate
This commit is contained in:
+9
-5
@@ -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
@@ -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}>
|
||||
|
||||
@@ -177,6 +177,14 @@ html, body, #main {
|
||||
|
||||
.menu-label {
|
||||
color: #bbb;
|
||||
|
||||
a {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #3273dc;
|
||||
}
|
||||
}
|
||||
|
||||
p.menu-label {
|
||||
|
||||
Reference in New Issue
Block a user