-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF annotation support #787
PDF annotation support #787
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this and it works quite well. Thanks a lot for you contribution!
However from design perspective, this description is not really visible.
Also please make sure to translate all text that you added. See https://docs.nextcloud.com/server/latest/developer_manual/basics/front-end/l10n.html#javascript
Also @gpsrenewablesit can you please fix DCO, see https://github.com/nextcloud/files_pdfviewer/pull/787/checks?check_run_id=15161520585. Otherwise we cannot merge this. Thank you! :) |
0480aee
to
07f2d25
Compare
Hello there, We hope that the reviewing process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR reviewing process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well in my testing, thank you! :)
What's the state of this? Can we get this approved? |
@danxuliu still needs to review... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the very long delay and thanks for your contribution!
In order to ask for some changes in the review I had to implement them by myself, as I was not sure if/how they could be done (and some were quite tricky...). However, as I had already implemented them for testing purposes I cleaned up my own code and ended commiting the changes too rather than just asking for them :-)
Due to that I also took the freedom to rework the commit history rather than asking for that (as, for example, the commits that fixed the minimum version or the translated strings should be squashed with the original commit, and the upload code could be set in the component since the beginning instead of moving it from the worker in an additional commit); I hope that is fine for you, but please accept my apologies if not.
Besides that, I have rebased the pull request on latest master to solve the conflicts.
I will now force push the branch with those changes.
7be9854
to
bc72b57
Compare
There is something I would like to ask @nextcloud/designers about :-) In PDF.js UI the Save button (which has a Download icon) always downloads the PDF file. Here, on the other hand, the Save button uploads the changed file with the annotations to Nextcloud. This could be a surprising behaviour (specially for Firefox users, as Firefox uses PDF.js to show PDF files). Should a different button, maybe one with an upload icon, be used instead? Should Save still be used as caption? And if an additional button to upload the file is used, should the download button be shown as well with its regular behaviour? Before this pull request the Save button was always hidden (as the file could be saved/downloaded using the button in the top bar from the viewer or the public page, depending on the case). However, if annotations are made and the user downloads the file through those means the downloaded file would not contain the annotations, it would still be the original file in the server. The user would need to first upload it and, then, download it to get the annotations. Which, obviously, changes the original file in the server and may not be desirable 🤷 On the other hand... if the download button inside the PDF viewer behaves differently than the download button in the file list or the public page buttons that could be confusing as well (and intercepting the clicks (or any other activation) on the top bar buttons to download the annotated file instead of the original file while not modifying the file in the server could be difficult, although I have not actually checked). Thanks! |
bc72b57
to
ab4351b
Compare
I'd say that we should change the save icon to a normal save icon and keep the caption (or maybe make it more explicit and change that to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danxuliu I tested this and it works fine generally but I don't know why and if it is caused by this PR but somehow the pdf viewer has two scrollbars now:
The Viewer provides several useful helper functions for DAV, but they can not be used (or at least I did not find out how) from the PDF viewer. Therefore, for now they were just copied over. The original file is written in TypeScript, but as it was not extensively typed and TypeScript is not currently supported in the PDF viewer for simplicity it was adjusted and converted to JavaScript. The file was copied from "src/utils/davUtils.ts" of repository "https://github.com/nextcloud/viewer" at commit "854e63d33a8fd304a6c4ea6704f0f68c6308f4b8". Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Mishel Shaji <[email protected]>
In Nextcloud the background of disabled buttons does not change when hovered. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The "Save" button was always enabled, but saving and uploading the file would be needed only if there is an unsaved annotation. Therefore now the button is initially disabled, and it is enabled only when an annotation is added; once the file is saved the button is disabled and it will be enabled again once a new annotation is added. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The "Download / Save" button uses a "Download" icon by default. For clarity, and to differentiate from the default PDF.js behaviour that downloads the file with the added annotations rather than saving it in place, the button now uses a "Save" icon instead. Like other icons used in Nextcloud, the "Save" icon was copied from Material Icons, which are licensed under the Apache License Version 2.0: https://fonts.google.com/icons?selected=Material+Icons:save: Signed-off-by: Daniel Calviño Sánchez <[email protected]>
f914dca
to
78b6fbe
Compare
I have replaced the default "Download" icon with a "Save" icon from Material Icons. If the button title was changed it should be "Save to XXX", where XXX is the Nextcloud name configured in the theme. That is probably easy to do, but... something for the future ;-) (but feel free to change that if you know how to, of course :-) ).
I have not been able to reproduce neither on this branch nor in master 🤷 Could you check if you also have that in master? If you do then it would be unrelated to this pull request, so please merge if the icon change is fine (I would like to avoid another rebase due to conflicts caused by dependency updates :-P ). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that we should change the save icon to a normal save icon and keep the caption (or maybe make it more explicit and change that to
Save to Nextcloud
.) Then we should be fine :)I have replaced the default "Download" icon with a "Save" icon from Material Icons. If the button title was changed it should be "Save to XXX", where XXX is the Nextcloud name configured in the theme. That is probably easy to do, but... something for the future ;-) (but feel free to change that if you know how to, of course :-) ).
Tested and looks good to me :)
I tested this and it works fine generally but I don't know why and if it is caused by this PR but somehow the pdf viewer has two scrollbars now:
I have not been able to reproduce neither on this branch nor in master 🤷 Could you check if you also have that in master? If you do then it would be unrelated to this pull request, so please merge if the icon change is fine (I would like to avoid another rebase due to conflicts caused by dependency updates :-P ).
Yes, could also reproduce on master. So merging 👍
🎉🎉🎉🎉🎉 |
It will be released with Nextcloud 28 (Hub 7) |
@szaimen You mean 28? We are on 27.1.3 already. Would love to see it as an app update already in NC27 |
Sorry, made a typo. Meant 28 (hub 7) |
I have enabled the annotation toolbar within the PDF viewer interface. This toolbar includes various annotation tools, such as freehand drawing and text boxes. Clicking the save button will save the updated PDF document to Nextcloud.
After the update
Changes after update
Similar Issues
Close #719
Close #647