1
1
import TranslateRoundedIcon from '@mui/icons-material/TranslateRounded' ;
2
+ import { atom , useAtom , useAtomValue , useSetAtom } from 'jotai' ;
2
3
import SyncRoundedIcon from '@mui/icons-material/SyncRounded' ;
3
4
import { Select , Button , MenuItem } from '@mui/material' ;
4
5
import { appWindow } from '@tauri-apps/api/window' ;
5
6
import { useTranslation } from 'react-i18next' ;
6
7
import { emit } from '@tauri-apps/api/event' ;
7
8
import 'flag-icons/css/flag-icons.min.css' ;
8
- import { atom , useAtom , useAtomValue } from 'jotai' ;
9
9
import { nanoid } from 'nanoid' ;
10
10
import React from 'react' ;
11
11
import * as ocrs from '../../../../interfaces_ocr' ;
@@ -16,10 +16,12 @@ import { useEffect } from 'react';
16
16
17
17
export const ocrInterfaceAtom = atom ( 'tesseract' ) ;
18
18
export const ocrLanguageAtom = atom ( 'en' ) ;
19
+ export const ocrStartFlagAtom = atom ( ) ;
19
20
20
21
export default function OcrController ( ) {
21
22
const [ ocrInterface , setOcrInterface ] = useAtom ( ocrInterfaceAtom ) ;
22
23
const [ ocrLanguage , setOcrLanguage ] = useAtom ( ocrLanguageAtom ) ;
24
+ const setOcrStartFlag = useSetAtom ( ocrStartFlagAtom ) ;
23
25
const resultText = useAtomValue ( resultTextAtom ) ;
24
26
const { t } = useTranslation ( ) ;
25
27
@@ -84,6 +86,9 @@ export default function OcrController() {
84
86
variant = 'outlined'
85
87
sx = { { width : 160 , textTransform : 'none' } }
86
88
startIcon = { < SyncRoundedIcon /> }
89
+ onClick = { ( ) => {
90
+ setOcrStartFlag ( nanoid ( ) ) ;
91
+ } }
87
92
>
88
93
{ t ( 'ocr.recognize' ) }
89
94
</ Button >
0 commit comments