Skip to content
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

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
0a13573
Support text selection redaction in the browser
omar-ahmed42 Dec 9, 2024
f1aaa67
Add en_GB translation for manual redaction
omar-ahmed42 Dec 9, 2024
47d55a2
Add manual redaction - tool header
omar-ahmed42 Dec 9, 2024
5e81a09
Fix: Selection box alignment issue at low zoom levels
omar-ahmed42 Dec 9, 2024
776acbf
Use ctrl + S instead of ctrl shift to apply redaction on selected text
omar-ahmed42 Dec 9, 2024
641cbfd
Prevent Redaction wrappers from being selected
omar-ahmed42 Dec 9, 2024
008e26d
Add submit btn and hidden redactions input
omar-ahmed42 Dec 10, 2024
722026e
Assign values for redactionsInput
omar-ahmed42 Dec 10, 2024
70046a3
Update messages_en_GB.properties
omar-ahmed42 Dec 10, 2024
a25d244
Scale x, y, width and height to match PDF page points
omar-ahmed42 Dec 10, 2024
39ddec5
Add manual PDF area-based redaction and supporting classes
omar-ahmed42 Dec 10, 2024
4c40f1d
Fix incorrect y position calculation while adding rect to pdf
omar-ahmed42 Dec 10, 2024
29198c8
Fix formula for redaction points and dimensions
omar-ahmed42 Dec 10, 2024
5ed9a4b
Add support for drawing-based redaction
omar-ahmed42 Dec 10, 2024
04d2e82
Add buttons for text selection and shape drawing
omar-ahmed42 Dec 10, 2024
fa1d2bc
Add redaction mode selection using redactions buttons
omar-ahmed42 Dec 10, 2024
a53492a
Refactor redact.js slightly for more readability
omar-ahmed42 Dec 10, 2024
46fea6a
Remove an unused import
omar-ahmed42 Dec 10, 2024
276fa8e
Refactor code and clear drawing on entering a different canvas/textLayer
omar-ahmed42 Dec 10, 2024
572a54f
Fix a bug that caused redaction areas to be empty after delete operation
omar-ahmed42 Dec 10, 2024
cb350bc
Use correct color for toolbar icons
omar-ahmed42 Dec 10, 2024
c0e260d
Implement mutual exclusivity for Draw-based Redaction and Text Select…
omar-ahmed42 Dec 10, 2024
a64de02
Support pdf to image option
omar-ahmed42 Dec 11, 2024
29d88d2
Add escape shortcut to cancel current drawing
omar-ahmed42 Dec 11, 2024
cfd8c96
Add delete shortcut to delete redacted element
omar-ahmed42 Dec 11, 2024
857e459
Support page-based redactions
omar-ahmed42 Dec 11, 2024
ebc9216
Move redaction tools to the side of the zoom scale
omar-ahmed42 Dec 11, 2024
60da7d4
Rename pageNumbers's input id
omar-ahmed42 Dec 11, 2024
f32b0f1
Support color choosing for page-based redaction
omar-ahmed42 Dec 11, 2024
3dc7bad
Support customization per redaction area
omar-ahmed42 Dec 11, 2024
2f90705
Fix a bug that caused color to always be black
omar-ahmed42 Dec 11, 2024
d8a8d49
Remove unnecessary code
omar-ahmed42 Dec 11, 2024
e81c47c
Add documentation for manual redaction
omar-ahmed42 Dec 11, 2024
ac305ac
Add manual redaction card to home page
omar-ahmed42 Dec 11, 2024
112c6ba
Add a button to apply redaction on selected text
omar-ahmed42 Dec 11, 2024
0fe94ad
Use black as default redaction color for color palettes
omar-ahmed42 Dec 11, 2024
05dd59c
Merge branch 'main' into feature-manual-redaction
omar-ahmed42 Dec 12, 2024
e79a496
Merge branch 'main' into feature-manual-redaction
Frooodle Dec 13, 2024
fdc72d1
Merge branch 'main' of https://github.com/Stirling-Tools/Stirling-PDF…
omar-ahmed42 Dec 14, 2024
a643268
Adjust toolbar and buttons to be bigger
omar-ahmed42 Dec 14, 2024
2314f9a
Add Stirling logo to the toolbar
omar-ahmed42 Dec 14, 2024
605742d
Style and customize the toolbar
omar-ahmed42 Dec 15, 2024
f7275cd
Add a container redactions palette
omar-ahmed42 Dec 15, 2024
33669ac
Style toolbar buttons
omar-ahmed42 Dec 15, 2024
4408ea5
Remove unused classes
omar-ahmed42 Dec 15, 2024
f7906dd
Add manual redaction to the nav bar
omar-ahmed42 Dec 15, 2024
f14a350
Remove eraser icon
omar-ahmed42 Dec 15, 2024
1a392c6
Use new more fitting icons
omar-ahmed42 Dec 15, 2024
7f6c808
Display apply redaction btn in text mode only
omar-ahmed42 Dec 15, 2024
6e33b9d
Add download button and loading spinner
omar-ahmed42 Dec 15, 2024
d6e26cb
Fix hidden redaction overlay due to overlapping with redaction box
omar-ahmed42 Dec 16, 2024
89e0623
Hide nav bar, footer and form on file selection
omar-ahmed42 Dec 16, 2024
5d94c9b
Rename properties popup
omar-ahmed42 Dec 17, 2024
f03040f
Hide input fields in the initial form (in manual redaction) to avoid …
omar-ahmed42 Dec 17, 2024
09e8a84
Bring back nav bar
omar-ahmed42 Dec 18, 2024
7cc0029
Disable scroll Y by hiding overflow Y
omar-ahmed42 Dec 18, 2024
0f645f8
Update viewer height to avoid overflow
omar-ahmed42 Dec 18, 2024
0945469
Add button for pdf to image conversion
omar-ahmed42 Dec 19, 2024
1367e32
Adjust toolbar's z-index to uncover navbar
omar-ahmed42 Dec 19, 2024
5b87a8f
Change page based redaction icon
omar-ahmed42 Dec 21, 2024
2b5394e
Fix old redactions applying to new uploads
omar-ahmed42 Dec 21, 2024
da175d3
Disable page rotation shortcut
omar-ahmed42 Dec 21, 2024
cffef23
Fix incorrect redaction placement bug on rotated pdfs
omar-ahmed42 Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add escape shortcut to cancel current drawing
  • Loading branch information
omar-ahmed42 committed Dec 11, 2024
commit 29d88d2c8c2237ad11ecbbc2e12fe7c94e0878a5
13 changes: 13 additions & 0 deletions src/main/resources/static/js/redact.js
Original file line number Diff line number Diff line change
@@ -174,6 +174,11 @@ window.addEventListener("load", (e) => {
_clearDrawing();
});

window.addEventListener("cancel-drawing", (e) => {
_clearDrawing();
canvas.style.cursor = "default";
});

function setMousePosition(e) {
let ev = e || window.event; //Moz || IE
if (ev.pageX) {
@@ -183,6 +188,14 @@ window.addEventListener("load", (e) => {
}
}

window.onkeydown = (e) => {
if (e.key === "Escape" && redactionMode === RedactionModes.DRAWING) {
window.dispatchEvent(
new CustomEvent("cancel-drawing", { bubbles: true })
);
}
};

canvas.onpointerenter = (e) => {
window.dispatchEvent(
new CustomEvent("drawing-entered", {