@@ -2,15 +2,13 @@ import { TooltipButton } from "@/components/tooltip-button"
22import { FilePlus } from "lucide-react"
33import { useTranslations } from 'next-intl'
44import { open } from '@tauri-apps/plugin-dialog' ;
5- import { readTextFile , readFile } from "@tauri-apps/plugin-fs" ;
5+ import { readTextFile } from "@tauri-apps/plugin-fs" ;
66import useTagStore from "@/stores/tag" ;
77import useMarkStore from "@/stores/mark" ;
88import { insertMark } from "@/db/marks" ;
9- import { getDocument } from 'pdfjs-dist'
10- import "pdfjs-dist/build/pdf.worker.mjs" ;
119
1210const textFileExtensions = [ 'txt' , 'md' , 'csv' ] ;
13- const fileExtensions = [ 'pdf' ]
11+ const fileExtensions : string [ ] = [ ]
1412
1513export function ControlFile ( ) {
1614 const t = useTranslations ( ) ;
@@ -40,29 +38,6 @@ export function ControlFile() {
4038 await fetchTags ( )
4139 getCurrentTag ( )
4240 }
43- if ( ext === 'pdf' ) {
44- const file = await readFile ( path )
45- getDocument ( file ) . promise . then ( pdf => {
46- const numPages = pdf . numPages ;
47- for ( let i = 1 ; i <= numPages ; i ++ ) {
48- pdf . getPage ( i ) . then ( page => {
49- page . getTextContent ( ) . then ( content => {
50- const text = content . items . map ( item => {
51- if ( 'str' in item ) {
52- return item . str
53- }
54- return ''
55- } ) . join ( '' ) ;
56- if ( ! text ) return
57- insertMark ( { tagId : currentTagId , type : 'file' , desc : text , content : text } )
58- fetchMarks ( )
59- fetchTags ( )
60- getCurrentTag ( )
61- } ) ;
62- } ) ;
63- }
64- } )
65- }
6641 }
6742
6843 return (
0 commit comments