New window command
parent
880c67d6cd
commit
d9aa6ef1c4
|
@ -123,6 +123,10 @@ export function openUrl(url: string, existingWindow = false): Promise<void> {
|
|||
return syscall("editor.openUrl", url, existingWindow);
|
||||
}
|
||||
|
||||
export function newWindow(): Promise<void> {
|
||||
return syscall("editor.newWindow");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is calling the `go()` method from the History Web API.
|
||||
* @param delta Position in history to move to relative to the current page,
|
||||
|
|
|
@ -72,6 +72,12 @@ functions:
|
|||
path: "./editor.ts:toggleDarkMode"
|
||||
command:
|
||||
name: "Editor: Toggle Dark Mode"
|
||||
newWindow:
|
||||
path: editor.ts:newWindowCommand
|
||||
command:
|
||||
name: "Editor: New Window"
|
||||
key: "Ctrl-n"
|
||||
mac: "Cmd-n"
|
||||
|
||||
openCommandPalette:
|
||||
path: editor.ts:openCommandPalette
|
||||
|
|
|
@ -97,3 +97,7 @@ export function redoCommand() {
|
|||
export function deleteLineCommand() {
|
||||
return editor.deleteLine();
|
||||
}
|
||||
|
||||
export function newWindowCommand() {
|
||||
return editor.newWindow();
|
||||
}
|
||||
|
|
|
@ -81,6 +81,13 @@ export function editorSyscalls(client: Client): SysCallMapping {
|
|||
location.href = url;
|
||||
}
|
||||
},
|
||||
"editor.newWindow": () => {
|
||||
globalThis.open(
|
||||
location.href,
|
||||
"rnd" + Math.random(),
|
||||
`width=${globalThis.innerWidth},heigh=${globalThis.innerHeight}`,
|
||||
);
|
||||
},
|
||||
"editor.goHistory": (_ctx, delta: number) => {
|
||||
window.history.go(delta);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue