mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
[api-minor] Add support for URLs in the document outline
Re: issue 5089. (Note that since there are other outline features that we currently don't support, e.g. bold/italic text and custom colours, I thus think we can keep the referenced issue open.)
This commit is contained in:
parent
e60fde73ca
commit
0030a82dc3
8 changed files with 67 additions and 20 deletions
|
@ -31,9 +31,7 @@
|
|||
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
|
||||
var AnnotationType = sharedUtil.AnnotationType;
|
||||
var Util = sharedUtil.Util;
|
||||
var isExternalLinkTargetSet = sharedUtil.isExternalLinkTargetSet;
|
||||
var LinkTargetStringMap = sharedUtil.LinkTargetStringMap;
|
||||
var removeNullCharacters = sharedUtil.removeNullCharacters;
|
||||
var addLinkAttributes = sharedUtil.addLinkAttributes;
|
||||
var warn = sharedUtil.warn;
|
||||
var CustomStyle = displayDOMUtils.CustomStyle;
|
||||
|
||||
|
@ -233,17 +231,7 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
|
|||
this.container.className = 'linkAnnotation';
|
||||
|
||||
var link = document.createElement('a');
|
||||
link.href = link.title = (this.data.url ?
|
||||
removeNullCharacters(this.data.url) : '');
|
||||
|
||||
if (this.data.url && isExternalLinkTargetSet()) {
|
||||
link.target = LinkTargetStringMap[PDFJS.externalLinkTarget];
|
||||
}
|
||||
|
||||
// Strip referrer from the URL.
|
||||
if (this.data.url) {
|
||||
link.rel = PDFJS.externalLinkRel;
|
||||
}
|
||||
addLinkAttributes(link, { url: this.data.url });
|
||||
|
||||
if (!this.data.url) {
|
||||
if (this.data.action) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue