File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
1
export const ContextMenuId = {
2
2
OpenInSideTrakt : 'open-in-side-trakt' ,
3
+ AddToSearchHistory : 'add-to-search-history' ,
3
4
} as const ;
4
5
5
6
export type ContextMenuIds = ( typeof ContextMenuId ) [ keyof typeof ContextMenuId ] ;
@@ -16,4 +17,9 @@ export const ContextMenus: Record<ContextMenuIds, ContextMenu> = {
16
17
title : 'Open in side trakt' ,
17
18
contexts : [ 'selection' ] ,
18
19
} ,
20
+ [ ContextMenuId . AddToSearchHistory ] : {
21
+ id : ContextMenuId . AddToSearchHistory ,
22
+ title : 'Add to search history' ,
23
+ contexts : [ 'selection' ] ,
24
+ } ,
19
25
} as const ;
Original file line number Diff line number Diff line change @@ -18,14 +18,15 @@ runtime?.onInstalled.addListener(async () => {
18
18
19
19
context . onClicked . addListener ( async info => {
20
20
if ( ! context || ! runtime ) return ;
21
- if ( info . menuItemId !== ContextMenuId . OpenInSideTrakt ) return ;
22
21
if ( ! info ?. selectionText ) return ;
23
22
24
23
await storage . local . set ( RouterStorageKey . LastRoute , {
25
24
name : Route . Search ,
26
25
query : { search : info . selectionText } ,
27
26
} satisfies Partial < RouteLocationNormalized > ) ;
28
27
28
+ if ( info . menuItemId !== ContextMenuId . OpenInSideTrakt ) return ;
29
+
29
30
if ( action ?. openPopup ) {
30
31
await action . openPopup ( ) ;
31
32
} else {
You can’t perform that action at this time.
0 commit comments