[api-minor] Add an option to PDFJS for specifying the |target| attribute of external links

Replaces `PDFJS.openExternalLinksInNewWindow` with a more generic configuration option.
*Note:* `PDFJS.openExternalLinksInNewWindow = true;` is equal to `PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK;`.
This commit is contained in:
Jonas Jenwald 2015-04-19 12:27:51 +02:00
parent d89fde05b0
commit 9ab896e307
3 changed files with 62 additions and 5 deletions

View file

@ -15,7 +15,7 @@
* limitations under the License.
*/
/* globals PDFJS, Util, AnnotationType, AnnotationBorderStyleType, warn,
CustomStyle */
CustomStyle, isExternalLinkTargetSet, LinkTargetStringMap */
'use strict';
@ -261,8 +261,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
var link = document.createElement('a');
link.href = link.title = item.url || '';
if (item.url && PDFJS.openExternalLinksInNewWindow) {
link.target = '_blank';
if (item.url && isExternalLinkTargetSet()) {
link.target = LinkTargetStringMap[PDFJS.externalLinkTarget];
}
container.appendChild(link);