Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of small (viewer) tweaks of tooltip-only Annotations (PR 12333 follow-up) #12524

Merged
merged 1 commit into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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