File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { css, type Component } from "dreamland/core";
22import type { Tab } from "../Tab" ;
33import { browser } from "../Browser" ;
44import { trimUrl } from "../components/UrlInput" ;
5+ import { createMenu } from "../components/Menu" ;
56
67export const NewTabPage : Component <
78 {
@@ -23,7 +24,24 @@ export const NewTabPage: Component<
2324 > </ input >
2425 < div class = "suggestions" >
2526 { browser . globalhistory . slice ( 0 , 5 ) . map ( ( entry ) => (
26- < div class = "suggestion" on :click = { ( ) => browser . newTab ( entry . url ) } >
27+ < div
28+ class = "suggestion"
29+ on :contextmenu = { ( e : MouseEvent ) => {
30+ createMenu ( e . clientX , e . clientY , [
31+ {
32+ label : "Open" ,
33+ action : ( ) => browser . activetab . pushNavigate ( entry . url ) ,
34+ } ,
35+ {
36+ label : "Open in New Tab" ,
37+ action : ( ) => browser . newTab ( entry . url ) ,
38+ } ,
39+ ] ) ;
40+ e . preventDefault ( ) ;
41+ e . stopPropagation ( ) ;
42+ } }
43+ on :click = { ( ) => browser . newTab ( entry . url ) }
44+ >
2745 < div class = "suggestioninner" >
2846 < div class = "circle" >
2947 < img src = { entry . favicon || "/vite.svg" } alt = "favicon" />
You can’t perform that action at this time.
0 commit comments