feat: view PDF files inline#31
Conversation
- App reads file structure on startup
- App adds sample structure on load
- Redesigned FoldersView
- Uploaded files are saved to `/uploads` folder
- Selectede files in the sidebar show on center
- TipTap files show with editor
- other files show a placeholder view
|
@sehyod very cool! This looks to share some commits with #29. In the future, could we break the PRs up so that the drag and drop zone is separate from the PDF viewer? That way PRs are more isolated and it's easier to collaborate and stack PRs from separate developers. Could you say more about the implementation strategy here? Any issues with library selection or concerns about resource utilization or leakage? I got it running and it looks nice. I was a bit nervous about having this feature now as it's not high priority but it looks simple lightweight and useful so let's keep it! |
|
@hammer Thank you! I branched out from the I will write a proper description with explanations about the choices before I mark the PR as ready for review. For now, I have put this PR on hold because I needed to fix the scrolling issue first (#35). Otherwise, only the first page of the pdf files was visible. |
|
My first notes about the PR are that:
|
I think the right behavior would be to open a new tab within the application for the linked PDF. |
cguedes
left a comment
There was a problem hiding this comment.
Added notes as comment before.
cguedes
left a comment
There was a problem hiding this comment.
Added notes as comment before.
Like with an |
|
@cguedes no, as in the comments at #1 (comment):
|
|
Sure, in a new tab (maybe in split view). |
|
Ah I see yeah not sure we want to grow a full web browser! Would it be better to send the user to their OS browser? |
|
Thank you for your comments! I have tackled comments about the code. For the issue with links, I will investigate it but the library we are using simply creates hyperlinks and I'm not sure we can customize this. |

This PR adds a PDF viewer component, as mentioned in #28
To make this PR, I explored https://github.com/allenai/pdf-component-library and the library it's built upon: https://github.com/wojtekmaj/react-pdf.
With
pdf-component-library, I wasn't able to properly render a PDF: the best I was able to do was displaying the raw text of the pdf, but all styling would be gone. Moreover, there is no documentation for the library and it doesn't seem maintained anymore (latest commit was in December).On the other hand,

react-pdf's doc looks more exhaustive and the library is still maintained (latest commit is from yesterday). With this library, I was able to properly render PDF files:For these reasons, I have decided to go with
react-pdf, althoughpdf-component-libraryoffers more possibilities, like thumbnails and annotations. I think it's fine to go withreact-pdffor the MVP.