File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import platformAdapter from "@/utils/platformAdapter";
11
11
import { Get } from "@/api/axiosRequest" ;
12
12
import { useAppStore } from "@/stores/appStore" ;
13
13
import { useConnectStore } from "@/stores/connectStore" ;
14
+ import { OpenURLWithBrowser } from "@/utils" ;
14
15
15
16
interface DocumentListProps {
16
17
onSelectDocument : ( id : string ) => void ;
@@ -236,10 +237,14 @@ export const DocumentList: React.FC<DocumentListProps> = ({
236
237
onMouseEnter = { ( ) => onMouseEnter ( index , hit . document ) }
237
238
onItemClick = { ( ) => {
238
239
if ( hit . document ?. on_opened ) {
239
- platformAdapter . invokeBackend ( "open" , {
240
+ return platformAdapter . invokeBackend ( "open" , {
240
241
onOpened : hit . document . on_opened ,
241
242
} ) ;
242
243
}
244
+
245
+ if ( hit . document ?. url ) {
246
+ OpenURLWithBrowser ( hit . document . url ) ;
247
+ }
243
248
} }
244
249
showListRight = { viewMode === "list" }
245
250
/>
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { useKeyboardNavigation } from "@/hooks/useKeyboardNavigation";
16
16
import { SearchSource } from "./SearchSource" ;
17
17
import DropdownListItem from "./DropdownListItem" ;
18
18
import platformAdapter from "@/utils/platformAdapter" ;
19
+ import { OpenURLWithBrowser } from "@/utils" ;
19
20
20
21
type ISearchData = Record < string , QueryHits [ ] > ;
21
22
@@ -82,7 +83,13 @@ function DropdownList({
82
83
} ,
83
84
onItemClick : ( item : SearchDocument ) => {
84
85
if ( item ?. on_opened ) {
85
- platformAdapter . invokeBackend ( "open" , { onOpened : item . on_opened } ) ;
86
+ return platformAdapter . invokeBackend ( "open" , {
87
+ onOpened : item . on_opened ,
88
+ } ) ;
89
+ }
90
+
91
+ if ( item ?. url ) {
92
+ OpenURLWithBrowser ( item . url ) ;
86
93
}
87
94
} ,
88
95
goToTwoPage : ( item : SearchDocument ) => {
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { useEffect } from "react";
2
2
import { Outlet , useLocation } from "react-router-dom" ;
3
3
import { useTranslation } from "react-i18next" ;
4
4
import { useAsyncEffect , useEventListener , useMount } from "ahooks" ;
5
- import { isString } from "lodash-es" ;
5
+ import { isArray , isString } from "lodash-es" ;
6
6
import { error } from "@tauri-apps/plugin-log" ;
7
7
8
8
import { useAppStore } from "@/stores/appStore" ;
@@ -130,6 +130,8 @@ export default function Layout() {
130
130
"list_extensions"
131
131
) ;
132
132
133
+ if ( ! isArray ( result ) ) return ;
134
+
133
135
const disabledExtensions = result [ 1 ] . filter ( ( item ) => ! item . enabled ) ;
134
136
135
137
setDisabledExtensions ( disabledExtensions . map ( ( item ) => item . id ) ) ;
Original file line number Diff line number Diff line change 1
1
// manual modification
2
2
import { createTauriAdapter } from "./tauriAdapter" ;
3
- //import { createWebAdapter } from './webAdapter';
4
-
5
3
let platformAdapter = createTauriAdapter ( ) ;
6
- //let platformAdapter = createWebAdapter();
4
+
5
+ // import { createWebAdapter } from "./webAdapter";
6
+ // let platformAdapter = createWebAdapter();
7
7
8
8
export default platformAdapter ;
You can’t perform that action at this time.
0 commit comments