Skip to content

Commit

Permalink
Merge pull request #12524 from Snuffleupagus/pr-12333-followup
Browse files Browse the repository at this point in the history
A couple of small (viewer) tweaks of tooltip-only Annotations (PR 12333 follow-up)
  • Loading branch information
timvandermeij authored Oct 24, 2020
2 parents 180f35e + 9f8d980 commit da73537
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class LinkAnnotationElement extends AnnotationElement {
}
return false;
};
if (destination) {
if (destination || destination === /* isTooltipOnly = */ "") {
link.className = "internalLink";
}
}
Expand Down
13 changes: 8 additions & 5 deletions web/pdf_link_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,22 @@ class PDFLinkService {
*/
getDestinationHash(dest) {
if (typeof dest === "string") {
return this.getAnchorUrl("#" + escape(dest));
}
if (Array.isArray(dest)) {
if (dest.length > 0) {
return this.getAnchorUrl("#" + escape(dest));
}
} else if (Array.isArray(dest)) {
const str = JSON.stringify(dest);
return this.getAnchorUrl("#" + escape(str));
if (str.length > 0) {
return this.getAnchorUrl("#" + escape(str));
}
}
return this.getAnchorUrl("");
}

/**
* Prefix the full url on anchor links to make sure that links are resolved
* relative to the current URL instead of the one defined in <base href>.
* @param {string} anchor The anchor hash, including the #.
* @param {string} anchor - The anchor hash, including the #.
* @returns {string} The hyperlink to the PDF object.
*/
getAnchorUrl(anchor) {
Expand Down

0 comments on commit da73537

Please sign in to comment.