Skip to content

Commit ebdad77

Browse files
committed
Fix unknown variable after upgrade from v2.13.216
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 258e860 commit ebdad77

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/workersrc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ const canDownload = urlParams.get('canDownload')
4242
// "PDFViewerApplication" and "PDFViewerApplicationOptions" are globally set and
4343
// before "PDFViewerApplication.initialize" is executed.
4444
function initializeCustomPDFViewerApplication() {
45+
const head = document.getElementsByTagName('head')[0]
46+
4547
// Preferences override options, so they must be disabled for
4648
// "externalLinkTarget" to take effect.
4749
PDFViewerApplicationOptions.set('disablePreferences', true)
48-
PDFViewerApplicationOptions.set('externalLinkTarget', pdfjsLib.LinkTarget.BLANK)
50+
// TODO https://github.com/mozilla/pdf.js/pull/14424#issuecomment-1092947792
51+
PDFViewerApplicationOptions.set('externalLinkTarget', 2)
4952
PDFViewerApplicationOptions.set('isEvalSupported', false)
50-
PDFViewerApplicationOptions.set('workerSrc', document.getElementsByTagName('head')[0].getAttribute('data-workersrc'))
51-
PDFViewerApplicationOptions.set('cMapUrl', document.getElementsByTagName('head')[0].getAttribute('data-cmapurl'))
53+
PDFViewerApplicationOptions.set('workerSrc', head.getAttribute('data-workersrc'))
54+
PDFViewerApplicationOptions.set('cMapUrl', head.getAttribute('data-cmapurl'))
5255
PDFViewerApplicationOptions.set('enablePermissions', true)
5356

5457
if (canDownload === '0') {

0 commit comments

Comments
 (0)