Confirm before deleting annotation

瀏覽次數:59 次
跳到第一則未讀訊息

Matt Parizeau

未讀,
2014年6月25日 下午3:15:102014/6/25
收件者:pdfnet-w...@googlegroups.com
Q:

I was wondering if it’s possible to prevent the deletion of annotations on pressing the delete key. I need to raise a dialog to confirm deletion rather than deleting the annotation directly.

A:

You can use the following code to insert your own confirmation dialog:

$(document).on('viewerLoaded', function() {
   
var deleteKey = 46;
   
var originalKeyDown = window.Tools.AnnotationEditTool.prototype.keyDown;

    window
.Tools.AnnotationEditTool.prototype.keyDown = function(e) {

       
if (e.which === deleteKey && !window.utils.isEditableElement($(e.target))) {
           
if (myConfirmationFunction()) {
                originalKeyDown
.apply(this, arguments);
           
}
       
}
   
};
});
回覆所有人
回覆作者
轉寄
0 則新訊息