Cmd/Ctrl-click now opens page in new window
This commit is contained in:
+14
-1
@@ -604,10 +604,23 @@ export class Editor {
|
||||
this.editorView!.focus();
|
||||
}
|
||||
|
||||
async navigate(name: string, pos?: number | string, replaceState = false) {
|
||||
async navigate(
|
||||
name: string,
|
||||
pos?: number | string,
|
||||
replaceState = false,
|
||||
newWindow = false,
|
||||
) {
|
||||
if (!name) {
|
||||
name = this.indexPage;
|
||||
}
|
||||
|
||||
if (newWindow) {
|
||||
const win = window.open(`${location.origin}/${name}`, "_blank");
|
||||
if (win) {
|
||||
win.focus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
await this.pageNavigator.navigate(name, pos, replaceState);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,9 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
|
||||
name: string,
|
||||
pos: number | string,
|
||||
replaceState = false,
|
||||
newWindow = false,
|
||||
) => {
|
||||
await editor.navigate(name, pos, replaceState);
|
||||
await editor.navigate(name, pos, replaceState, newWindow);
|
||||
},
|
||||
"editor.reloadPage": async () => {
|
||||
await editor.reloadPage();
|
||||
|
||||
Reference in New Issue
Block a user