Open eyeseast opened 1 year ago
To get a bounding box for selected text:
var selection = window.getSelection();
var getRange = selection.getRangeAt(0);
getRect = getRange.getBoundingClientRect();
via StackOverflow
Easy! From here, we can use @floating-ui
to provide a pop-up menu, and then pass the rect to either the annotation layer or redaction layer.
If a user selects some in-line text, offer a prompt to let them add a note box around that text, or redact it. This saves a few steps from having to go into editing or annotation flow.
From Pinpoint:
https://github.com/MuckRock/documentcloud-frontend/assets/25778/0774ada9-521a-44b1-a82a-b377314949ce
From DocumentCloud:
https://github.com/MuckRock/documentcloud-frontend/assets/25778/11082d2d-4714-4747-8c67-c58ae9da2c18