Fix zoom resizing, add multi page support, fix text box bugs, fix broken upload button
This commit is contained in:
parent
5b2140187f
commit
7ff5c8130d
3 changed files with 113 additions and 30 deletions
|
|
@ -138,12 +138,20 @@ export const LibraryHeader = ({ currentTab, onTabChange }: { currentTab: 'librar
|
|||
accept="application/pdf"
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
const uploader = document.querySelector('input[type="file"][multiple]') as HTMLInputElement
|
||||
if (uploader && uploader !== e.target) {
|
||||
uploader.files = e.target.files
|
||||
const event = new Event('change', { bubbles: true })
|
||||
uploader.dispatchEvent(event)
|
||||
onChange={async (e) => {
|
||||
if (e.target.files && e.target.files.length > 0) {
|
||||
const files = e.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
if (file.type === 'application/pdf') {
|
||||
try {
|
||||
await useLibrary.getState().uploadDocument(file);
|
||||
} catch (err) {
|
||||
console.error('Failed to upload', file.name, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
e.target.value = '';
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue