mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Remove a few eslint-disable
statements in the web/
folder
These cases could be easily re-written to avoid having to disable ESLint rules.
This commit is contained in:
parent
33c97570f5
commit
a2d15ceb84
3 changed files with 24 additions and 33 deletions
|
@ -18,19 +18,13 @@ import { getPdfFilenameFromUrl } from "pdfjs-lib";
|
|||
async function docProperties(pdfDocument) {
|
||||
const url = "",
|
||||
baseUrl = url.split("#", 1)[0];
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { info, metadata, contentDispositionFilename, contentLength } =
|
||||
const { info, metadata, contentDispositionFilename, contentLength } =
|
||||
await pdfDocument.getMetadata();
|
||||
|
||||
if (!contentLength) {
|
||||
const { length } = await pdfDocument.getDownloadInfo();
|
||||
contentLength = length;
|
||||
}
|
||||
|
||||
return {
|
||||
...info,
|
||||
baseURL: baseUrl,
|
||||
filesize: contentLength,
|
||||
filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,
|
||||
filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
|
||||
metadata: metadata?.getRaw(),
|
||||
authors: metadata?.get("dc:creator"),
|
||||
|
|
|
@ -886,9 +886,8 @@ class PDFFindController {
|
|||
const { promise, resolve } = Promise.withResolvers();
|
||||
this._extractTextPromises[i] = promise;
|
||||
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
deferred = deferred.then(() => {
|
||||
return this._pdfDocument
|
||||
deferred = deferred.then(() =>
|
||||
this._pdfDocument
|
||||
.getPage(i + 1)
|
||||
.then(pdfPage => pdfPage.getTextContent(textOptions))
|
||||
.then(
|
||||
|
@ -921,8 +920,8 @@ class PDFFindController {
|
|||
this._hasDiacritics[i] = false;
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
});
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -260,27 +260,25 @@ window.print = function () {
|
|||
ensureOverlay().then(function () {
|
||||
overlayManager.closeIfActive(dialog);
|
||||
});
|
||||
return; // eslint-disable-line no-unsafe-finally
|
||||
} else {
|
||||
const activeServiceOnEntry = activeService;
|
||||
activeService
|
||||
.renderPages()
|
||||
.then(() => activeServiceOnEntry.performPrint())
|
||||
.catch(() => {
|
||||
// Ignore any error messages.
|
||||
})
|
||||
.then(() => {
|
||||
// aborts acts on the "active" print request, so we need to check
|
||||
// whether the print request (activeServiceOnEntry) is still active.
|
||||
// Without the check, an unrelated print request (created after
|
||||
// aborting this print request while the pages were being generated)
|
||||
// would be aborted.
|
||||
if (activeServiceOnEntry.active) {
|
||||
abort();
|
||||
}
|
||||
});
|
||||
}
|
||||
const activeServiceOnEntry = activeService;
|
||||
activeService
|
||||
.renderPages()
|
||||
.then(function () {
|
||||
return activeServiceOnEntry.performPrint();
|
||||
})
|
||||
.catch(function () {
|
||||
// Ignore any error messages.
|
||||
})
|
||||
.then(function () {
|
||||
// aborts acts on the "active" print request, so we need to check
|
||||
// whether the print request (activeServiceOnEntry) is still active.
|
||||
// Without the check, an unrelated print request (created after aborting
|
||||
// this print request while the pages were being generated) would be
|
||||
// aborted.
|
||||
if (activeServiceOnEntry.active) {
|
||||
abort();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue