PDF Embed API: lock annotations

Copy link to clipboard
Copied
Is there a way to disable the "Edit" and "Delete" options on annotations not created by the current user? In other words, can I lock annotations made by other users on the PDF while allowing edit and delete options for my own annotations? So edit/delete allowed if the annotation's creator.name === user.Profile.name.
Copy link to clipboard
Copied
There is no "lock" attribute but it is something that I've submitted as a feature request. However, you can immediately unselect a selected annotation if the annotation belongs to another user. I show that functionality at this CodePen. It's a simulation of a real-time collaboration environment where the left user can add annotations and they show up on the right but the right user can't delete them and neither can delete the one made by Akira Tanaka.

Copy link to clipboard
Copied
This sounds like a great workaround - thank you for sharing! Ideally users would be able to reply to each others annotations though, which wouldn't be possible with an unselect annotation on select of the annotation. I'll have to decide with feature is more critical for now until the lock capability hopefully exists in the future 🙂
Copy link to clipboard
Copied
I implemented this fix to directly deselect annotations once clicked, however this resulted in a problem in case of large comments. Comments are truncated with "..." and there is now no way to see the whole comment by the user.
Copy link to clipboard
Copied
In that case, my approach would be to allow the user to select annotations by any other user and listen for ANNOTATION_DELETED. If the annotation that triggered the event did not belong to the user who triggered the event, add the annotation back in. Same with ANNOTATION_UPDATED, but you update the annotation back to what it originally was. You'd probably want to use ANNOTATION_SELECTED to capture the original state of the annotation prior to the update.

