-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Feature: Support manual redaction #2433
base: main
Are you sure you want to change the base?
Feature: Support manual redaction #2433
Conversation
- Add redact.html which contains the nav-bar, file chooser, outer container and print container (used by PDF.JS viewer) and lastly the footer. - Add redact.css which is used specifically to style redaction operation and the redaction page (except for PDF.js viewer). - Add viewer-redact.css which is used to style PDF.js viewer that's used in the page (Changed the background to correspond with Stirling's themes). - Add redact.js which contains the redaction related logic.
- Add submit button. - Add hidden redactions input. - Rename fileSelector from pdf-upload to fileInput.
- Scale x, y, width and height to match PDF page points accurately.
- Fix formula for redaction points and dimensions as x, y, height and width should be the original width rather than the width after adjusting it to the zoom level (zoom level is mainly used for correct display positioning, while scale factor is used for correct positioning in the actual PDF).
- Slightly refactor redact.js for more readability and to reduce code duplication.
…ion-based Redaction mode buttons - Now, when one button is clicked, the other is automatically deselected, ensuring only one mode can be active at a time.
- Support page-based redactions by providing page numbers, page ranges and functions.
- Rename pageNumbers's input id to be more meaningful
🚀 PR Test DeploymentYour PR has been deployed for testing! 🔗 Test URL: http://185.252.234.121:2433 This deployment will be automatically cleaned up when the PR is closed. |
Hi, this feature is absolutely fantastic, great work! I just have questions about presentation. |
Hi, before I explain anything let's take a look at what we need first to implement this feature (redaction):
Let's address each point, as for :
as for:
This might not be a problem for either, the sign implementation nor the viewer.mjs as for zooming:
We will still have to modify the code and ensure the presentation doesn't lose any quality in the process of zooming in (you can try zooming in the sign - after extracting the canvas and its container out of the form card of course so that it would be bigger - you will find that it loses quality in the process, that's something we have to take into account as well), in other words, we will have to reinvent the wheel to some degree to get the same functionality that's made and ready to use in viewer.mjs These are the main reasons why I went with viewer.mjs rather than sign's implementation, I believe the sign's implementation is superb and really fits the use case of sign and other pages as well, in the case of this feature I didn't feel like it would be a great fit for this use case. Another thing I had in mind, is that we might add extra features to the manual redact page, such as displaying on the right the selected text for redaction for example, and on click the page would be displayed or that the user could simply remove it from that list/catalogue on the right side of the screen, also providing faster access to other pages through the ready made page preview on the left of the screen (I am not sure if that's what it's called), we can also modify the page preview to correspond to changes on the actual page (if the user decided to redact some text with a green rectangle, then a green rectangle would appear in the page preview in an approximate location), etc. We could also modify the look and feel of the toolbar later on to correspond more to the Stirling's look and feel. As for the icons' size, I can try and making them bigger if you think they would be easier to use, along with the toolbar, either way, I think we would need to come out with better icons for redactions because I don't find the icons that I used to be intuitive enough so that beginners could use it without heading to a guide/tutorial (I couldn't really find any icons to denote the usage of these buttons/features, so I had to come up with a custom solution that can relate even 1% to their intention). Also, given this new UI for redactions we could later on incorporate auto redactions as well, so that we would've a complete redaction feature that would support all kinds of redactions, while at the same time, we still keep the auto redaction page because it's more lightweight and has specific usage so that users that need it can simply use it directly without the extra complexity of the current page. Anyway, if you have any feedback, questions or any ideas, please, let me know. Also, regarding:
Thanks! |
Hi there. Thanks for your reply, that all makes perfect sense! If you could make those icons bigger that would help straight away and if there's anything else you feel you could do to bring that page a little closer visually to the UI of other pages it would be much appreciated. I don't know how much can be done about the top toolbar in the pdfjs viewer, would it be possible to pull that functionality out into a custom toolbar, one similar to the one we have in multitool perhaps? If that is possible it would make a world of difference on bringing the presentation more in line with our existing design. I shall try to find you some icons that will be appropriate for these functions and send them across. Thanks again for your contributions! |
Sure thing! I think this might provide a better user-experience, so you have a point!
Sure, I can try this again, might look better than the current one given the bigger icons, etc
All I know that we can customize the styling of it, but not pull our the functionality itself into a separate one, not to mention that if we managed to somehow pull it out and make it work:
But as for styling it, I was actually thinking of styling it to match the rest of the designs actually as you mentioned, but I thought I would push the feature first in case we needed to deliver it earlier than expected. But yeah, I bringing the toolbar and icons as close as possible to existing design should be the next step (after making the icons bigger), so basically I should be starting with the size of the icons then proceed to the toolbar and the tools as well.
Appreciate that a lot! this would be of great help! Thank you! |
…into feature-manual-redaction
- Increase toolbar's height. - Change the toolbar's color. - Change the color of the tools in the toolbar to match Multi tool's design. - Adjust height and width of tool buttons to match.
- Add a container redactions palette as the label didn't occupy the full width nor height and it was not in alignment with the other buttons
- Style toolbar buttons to be similar to multi tool buttons in design
/deploypr |
🚀 PR Test DeploymentYour PR has been deployed for testing! 🔗 Test URL: http://185.252.234.121:2433 This deployment will be automatically cleaned up when the PR is closed. |
Note: Zoom bar and Sidebar were intentionally set to be dark, as the light version of them didn't look good in my opinion. Also, does the project follow any specific naming conventions in the frontend? (mainly css) if yes, then let me know so that I could rename my classes/ids. If there's no styling conventions yet in general, then I recommend we start setting them for the frontend and the backend for more consistency in the long term |
Hi mate, the new UI looks great thanks for making the changes. https://fonts.google.com/icons?selected=Material+Symbols+Outlined:text_select_start:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=text+selec&icon.size=24&icon.color=%23e8eaed As for the area based selection I think this is the slightly better choice of icon https://fonts.google.com/icons?selected=Material+Symbols+Outlined:pageless:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=area&icon.size=24&icon.color=%23e8eaed as it still conveys the box idea but is a bit more obviously an icon than just a square. As with the other icon I don't think the custom eraser version is necessary. I don't think the save icon is clear for applying text base redaction. I think perhaps this is abetter icon https://fonts.google.com/icons?selected=Material+Symbols+Outlined:approval:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=apply&icon.size=24&icon.color=%23e8eaed or perhaps just a simple check https://fonts.google.com/icons?selected=Material+Symbols+Outlined:check:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=tick&icon.size=24&icon.color=%23e8eaed Could you move the "redact" button that downloads the completed file to your toolbar and use this icon for it instead of the word "redact" please? https://fonts.google.com/icons?selected=Material+Symbols+Outlined:download:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=download&icon.size=24&icon.color=%23e8eaed |
A further potential improvement would be to have the "apply redaction" button (currently save Icon) appear next to selected text in the page, similar to the delete/colour selection toolbar you have implemented already, this saves the user scrolling up to the top of the page to apply redactions and also makes functionality a little more clear. Additionally there is a minor bug with the delete/colour select toolbar. Currently it is quite easy for a redaction box/text selection to appear over the toolbar for nearby redactions making the buttons impossible to click Great progress so far. It's looking good! |
Makes perfect sense
Sure
I agree, this seems much clearer
I feel like the first icon you mentioned fits our use case perfectly, but I might go with the second one as it would be more intuitive to almost all the users
To make sure I understand, let's visualize them as follows:
Sure thing! |
This is actually a fantastic improvement! I might take a look at it but I think this might take some time but that's okay
Great observation! I will take a look it |
Yes I think that will just help to make it really obvious that button is related to the text selection feature and only activates when in that mode. I think maybe consider trying green for that button to make it clearer it's a "confirm" action. Feel free to go with your gut on what feels clear and looks good on that though as it may look off in practice. |
Yeah I don't think it's necessary to the feature, just a nice UI upgrade, so perhaps that could be a suggestion for additional improvements in a new branch after release if you feel it may be a bigger job. |
- Add download button that calls a hidden submitBtn. - Add a loading spinner that gets triggered on downloadBtn click after 100 ms (100 ms is enough time for the submitBtn to be disabled), why this approach? this is a workaround, so that we would not modify downloader.js
- Fix a bug that caused redaction overlay to be behind other redaction boxes when there's overlapping between them.
I added the download button as you instructed, and I also added a loading spinner for a better user experience as the processing on the server side might take some time for any reason (especially when the conversion option is checked), so a feedback for the user would be provided as the user might think that the page froze. (This spinner entirely revolves around whether the hidden submission button is disabled or not, there are other ways but they would require applying modifications to downloader.js, and I preferred to not modify downloader.js). As for the "check" button, I added it and made it not displayed unless text selection mode is activated, but I didn't really add it next to the text selection box, why? I attempted to add it next to the text selection button but this would keep shifting the buttons each time it's pressed which I felt might not be pleasant to the user (there's the option of moving the text selection button to the end, but look wise, it looked better next to the drawing button as it is), so I moved the check button to the right of the color palette and made it green, this way it would be visible to the user and catch their attention even though it's 2 buttons away from the text-selection button. This way the user knows that the text selection's position will never change, this way, it would be a familiar position/placement for the user making it easier in the long term for the user's muscle memory (as it remembers the exact position with minimum mental calculations), at the same time, if we ever needed to add any temporary buttons related to specific features, the user now would know where to find them. (Especially if we were to add undo/redo buttons) As for:
I successfully fixed
I agree, it's really a nice UI upgrade, I might work on it in a new branch as I feel like this one might take some time. I also wanted to say thanks for your notes! they were helpful! |
Description
Manual Redaction:
Text Selection-based redaction:
ctrl + s
shortcut or by pressing on apply/save/disk icon in the toolbar.delete/trash
icon or by using the shortcutdelete
.color palette
icon and choosing the color they want.Draw/Area-based redaction:
ctrl + s
shortcut or by pressing on apply/save/disk icon in the toolbar.delete/trash
icon or by using the shortcutdelete
(requires temporarily turning off drawing mode).color palette
icon and choosing the color they want.Page-based redaction:
Redaction modes:
There are three modes of redaction/operation currently supported
How to use:
Text Selection-based redaction: click on this icon in the toolbar to enable
text-selection redaction mode
then select the text you want to redact then pressctrl + s
or click on the disk/save icon .Draw/Area-based redaction: click on this icon in the toolbar to enable
draw/area-based redaction
thenleft mouse click (LMB)
on the starting point of the rectangle, then once you are satisfied with the rectangle's placement/dimensions thenleft mouse click (LMB)
again to apply the redaction.Left mouse click (LMB)
then move mouse to the right then bottom thenLeft mouse click (LMB)
.Page-based redactions:: Insert the page number(s), range(s) and/or functions (separated by
,
) then select your preferred color and click onRedact
to submit.Color Customizations:
Left mouse click LMB
) then clicking on color palette (highlighted in red in the picture) then select your preferred color.Deletions:
Left mouse click LMB
) then clicking on the trash icon (highlighted in red in the picture) .Card in the home page:
Closes #465
Checklist