Merge pull request #12524 from Snuffleupagus/pr-12333-followup

A couple of small (viewer) tweaks of tooltip-only Annotations (PR 12333 follow-up)
This commit is contained in:
Tim van der Meij 2020-10-24 16:06:01 +02:00 committed by GitHub
commit da73537fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -348,7 +348,7 @@ class LinkAnnotationElement extends AnnotationElement {
} }
return false; return false;
}; };
if (destination) { if (destination || destination === /* isTooltipOnly = */ "") {
link.className = "internalLink"; link.className = "internalLink";
} }
} }

View File

@ -235,11 +235,14 @@ class PDFLinkService {
*/ */
getDestinationHash(dest) { getDestinationHash(dest) {
if (typeof dest === "string") { if (typeof dest === "string") {
return this.getAnchorUrl("#" + escape(dest)); if (dest.length > 0) {
} return this.getAnchorUrl("#" + escape(dest));
if (Array.isArray(dest)) { }
} else if (Array.isArray(dest)) {
const str = JSON.stringify(dest); const str = JSON.stringify(dest);
return this.getAnchorUrl("#" + escape(str)); if (str.length > 0) {
return this.getAnchorUrl("#" + escape(str));
}
} }
return this.getAnchorUrl(""); return this.getAnchorUrl("");
} }
@ -247,7 +250,7 @@ class PDFLinkService {
/** /**
* Prefix the full url on anchor links to make sure that links are resolved * 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>. * 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. * @returns {string} The hyperlink to the PDF object.
*/ */
getAnchorUrl(anchor) { getAnchorUrl(anchor) {