Skip to content

Commit 7247d12

Browse files
committed
[frontend] chore: bump dreamlandjs
1 parent 71d1d62 commit 7247d12

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

frontend/src/browser.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { scramjet } from "./main";
66
import iconAdd from "@ktibow/iconset-ion/add";
77
import { Shell } from "./components/Shell";
88
import { createMenu } from "./components/Menu";
9-
import { createDelegate } from "./delegate";
109
import { StatefulClass } from "./StatefulClass";
1110
import { Tab } from "./Tab";
11+
import { createDelegate } from "dreamland/utils";
1212

1313
export const pushTab = createDelegate<Tab>();
1414
export const popTab = createDelegate<Tab>();
@@ -86,7 +86,9 @@ export class Browser extends StatefulClass {
8686
addTab={() => this.newTab("title")}
8787
/>
8888
<Omnibox
89-
tabUrl={use(this.activetab.url)}
89+
tabUrl={use(this.activetab)
90+
.zip(use(this.activetab.url))
91+
.map(([a]) => use(a.url))}
9092
goBack={() => {
9193
this.activetab.history.go(-1);
9294
}}
@@ -96,7 +98,14 @@ export class Browser extends StatefulClass {
9698
refresh={() => {
9799
this.activetab.frame.reload();
98100
}}
99-
navigate={(url) => this.navigate(url)}
101+
navigate={(url: string) => {
102+
if (URL.canParse(url)) {
103+
this.activetab.history.push(new URL(url), undefined, true);
104+
} else {
105+
const search = `https://google.com/search?q=${encodeURIComponent(url)}`;
106+
this.activetab.history.push(new URL(search), undefined, true);
107+
}
108+
}}
100109
/>
101110
{shell}
102111
</div>

frontend/src/delegate.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)