mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Move the disableCreateObjectURL
option from the global PDFJS
object and into getDocument
instead
This commit is contained in:
parent
05c05bdef5
commit
1d03ad0060
11 changed files with 54 additions and 36 deletions
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
createObjectURL, createPromiseCapability, getFilenameFromUrl, PDFJS,
|
||||
createObjectURL, createPromiseCapability, getFilenameFromUrl,
|
||||
removeNullCharacters
|
||||
} from 'pdfjs-lib';
|
||||
|
||||
|
@ -74,9 +74,9 @@ class PDFAttachmentViewer {
|
|||
* @private
|
||||
*/
|
||||
_bindPdfLink(button, content, filename) {
|
||||
if (PDFJS.disableCreateObjectURL) {
|
||||
throw new Error('bindPdfLink: ' +
|
||||
'Unsupported "PDFJS.disableCreateObjectURL" value.');
|
||||
if (this.downloadManager.disableCreateObjectURL) {
|
||||
throw new Error(
|
||||
'bindPdfLink: Unsupported "disableCreateObjectURL" value.');
|
||||
}
|
||||
let blobUrl;
|
||||
button.onclick = function() {
|
||||
|
@ -141,7 +141,8 @@ class PDFAttachmentViewer {
|
|||
div.className = 'attachmentsItem';
|
||||
let button = document.createElement('button');
|
||||
button.textContent = filename;
|
||||
if (/\.pdf$/i.test(filename) && !PDFJS.disableCreateObjectURL) {
|
||||
if (/\.pdf$/i.test(filename) &&
|
||||
!this.downloadManager.disableCreateObjectURL) {
|
||||
this._bindPdfLink(button, item.content, filename);
|
||||
} else {
|
||||
this._bindLink(button, item.content, filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue