Move parsing of destination dictionaries to a helper function

This not only reduces code duplication, but it also allow us to easily support the same kind of URLs we currently do for Link annotations in the Outline as well.
This commit is contained in:
Jonas Jenwald 2016-09-30 16:08:03 +02:00
parent 6906623462
commit e64bc1fd13
4 changed files with 126 additions and 117 deletions

View file

@ -26,6 +26,8 @@
}
}(this, function (exports, pdfjsLib) {
var PDFJS = pdfjsLib.PDFJS;
var DEFAULT_TITLE = '\u2013';
/**
@ -82,7 +84,10 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
*/
_bindLink: function PDFOutlineViewer_bindLink(element, item) {
if (item.url) {
pdfjsLib.addLinkAttributes(element, { url: item.url });
pdfjsLib.addLinkAttributes(element, {
url: item.url,
target: (item.newWindow ? PDFJS.LinkTarget.BLANK : undefined),
});
return;
}
var linkService = this.linkService;