Prevent Delete annotation on delete key press

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
Latest

Detailed description of issue
Whenever I press the delete key on an annotation, the annotation dissapears (deletes) from the pdf. I want to prevent the deletion of the annotation while pressing the delete key on the annotation. I am handling the deletion on my end and dont want anything to happen on delete key press. I tried a way that I found in one of your threads but it is not working.

Expected behaviour
Annotation should not delete on press you delete key.(or any other key)

Does your issue happen with every document, or just one?
Every document

Code snippet

Hello y19mridul,

I see you added the NoDelete property, and you said this isnt working, are you redrawing the annotation after adding it?

it should be something like:

annotManager.addAnnotation(rectangleAnnot);
annotManager.redrawAnnotation(rectangleAnnot)

Best regards,
Tyler

But it does not resolve my doubt.
I basically want to delete annotations and perform delete actions, I just dont want it to happen on a delete key press. I want to disable the delete or backspace key press. Pressing these should not have any impact on the annotation’s deletion.

Hello y19mridul,

Thank you for the clarification, you can override the hotkey PDFJS Express WebViewer Namespace: Hotkeys
or hijack the browser’s onKeyDown event when backspace is pressed and prevent any action from being taken.

Best regards,
Tyler