1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Account for formatting changes in Prettier version 2.3.0

With the exception of one tweaked `eslint-disable` comment, in `web/generic_scripting.js`, this patch was generated automatically using `gulp lint --fix`.

Please find additional information at:
 - https://github.com/prettier/prettier/releases/tag/2.3.0
 - https://prettier.io/blog/2021/05/09/2.3.0.html
This commit is contained in:
Jonas Jenwald 2021-05-16 10:58:34 +02:00
parent 30908451b4
commit 8943bcd3c3
28 changed files with 127 additions and 192 deletions

View file

@ -1497,12 +1497,8 @@ const PDFViewerApplication = {
* @private
*/
async _initializeMetadata(pdfDocument) {
const {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDocument.getMetadata();
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the metadata resolved.
@ -1782,7 +1778,8 @@ const PDFViewerApplication = {
forceRendering() {
this.pdfRenderingQueue.printing = !!this.printService;
this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible;
this.pdfRenderingQueue.isThumbnailViewEnabled =
this.pdfSidebar.isThumbnailViewVisible;
this.pdfRenderingQueue.renderHighestPriority();
},
@ -1818,8 +1815,8 @@ const PDFViewerApplication = {
const pagesOverview = this.pdfViewer.getPagesOverview();
const printContainer = this.appConfig.printContainer;
const printResolution = AppOptions.get("printResolution");
const optionalContentConfigPromise = this.pdfViewer
.optionalContentConfigPromise;
const optionalContentConfigPromise =
this.pdfViewer.optionalContentConfigPromise;
const printService = PDFPrintServiceFactory.instance.createPrintService(
this.pdfDocument,
@ -2422,7 +2419,8 @@ function webViewerUpdateViewarea(evt) {
location.pdfOpenParams
);
PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;
PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href;
PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =
href;
// Show/hide the loading indicator in the page number input element.
const currentPage = PDFViewerApplication.pdfViewer.getPageView(
@ -2684,10 +2682,8 @@ function setZoomDisabledTimeout() {
}
function webViewerWheel(evt) {
const {
pdfViewer,
supportedMouseWheelZoomModifierKeys,
} = PDFViewerApplication;
const { pdfViewer, supportedMouseWheelZoomModifierKeys } =
PDFViewerApplication;
if (pdfViewer.isInPresentationMode) {
return;

View file

@ -184,9 +184,8 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) {
)[chrome.i18n.getUILanguage?.()];
if (i18nFileAccessLabel) {
document.getElementById(
"chrome-file-access-label"
).textContent = i18nFileAccessLabel;
document.getElementById("chrome-file-access-label").textContent =
i18nFileAccessLabel;
}
const link = document.getElementById("chrome-link-to-extensions-page");

View file

@ -18,14 +18,9 @@ import { getPdfFilenameFromUrl, loadScript } from "pdfjs-lib";
async function docPropertiesLookup(pdfDocument) {
const url = "",
baseUrl = url.split("#")[0];
/* eslint-disable prefer-const */
let {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDocument.getMetadata();
/* eslint-enable prefer-const */
// eslint-disable-next-line prefer-const
let { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
if (!contentLength) {
const { length } = await pdfDocument.getDownloadInfo();

View file

@ -181,7 +181,8 @@ class PDFLayerViewer extends BaseTreeViewer {
return;
}
// Fetch the default optional content configuration...
const optionalContentConfig = await this._pdfDocument.getOptionalContentConfig();
const optionalContentConfig =
await this._pdfDocument.getOptionalContentConfig();
this.eventBus.dispatch("optionalcontentconfig", {
source: this,

View file

@ -365,10 +365,14 @@ class PDFPageView {
const width = this.viewport.width;
const height = this.viewport.height;
const div = this.div;
target.style.width = target.parentNode.style.width = div.style.width =
Math.floor(width) + "px";
target.style.height = target.parentNode.style.height = div.style.height =
Math.floor(height) + "px";
target.style.width =
target.parentNode.style.width =
div.style.width =
Math.floor(width) + "px";
target.style.height =
target.parentNode.style.height =
div.style.height =
Math.floor(height) + "px";
// The canvas may have been originally rotated; rotate relative to that.
const relativeRotation =
this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
@ -579,17 +583,18 @@ class PDFPageView {
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(
div,
pdfPage,
/* annotationStorage = */ null,
this.imageResourcesPath,
this.renderInteractiveForms,
this.l10n,
/* enableScripting */ null,
/* hasJSActionsPromise = */ null,
/* mouseState = */ null
);
this.annotationLayer =
this.annotationLayerFactory.createAnnotationLayerBuilder(
div,
pdfPage,
/* annotationStorage = */ null,
this.imageResourcesPath,
this.renderInteractiveForms,
this.l10n,
/* enableScripting */ null,
/* hasJSActionsPromise = */ null,
/* mouseState = */ null
);
}
this._renderAnnotationLayer();
}
@ -632,9 +637,8 @@ class PDFPageView {
});
};
this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(
pdfPage
);
this.structTreeLayer =
this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
}
div.setAttribute("data-loaded", true);

View file

@ -313,9 +313,8 @@ class PDFThumbnailView {
// the `draw` and `setImage` methods (fixes issue 8233).
// NOTE: To primarily avoid increasing memory usage too much, but also to
// reduce downsizing overhead, we purposely limit the up-scaling factor.
const { ctx, canvas, transform } = this._getPageDrawContext(
DRAW_UPSCALE_FACTOR
);
const { ctx, canvas, transform } =
this._getPageDrawContext(DRAW_UPSCALE_FACTOR);
const drawViewport = this.viewport.clone({
scale: DRAW_UPSCALE_FACTOR * this.scale,
});

View file

@ -317,13 +317,8 @@ class TextLayerBuilder {
if (!this.renderingDone) {
return;
}
const {
findController,
matches,
pageIdx,
textContentItemsStr,
textDivs,
} = this;
const { findController, matches, pageIdx, textContentItemsStr, textDivs } =
this;
let clearedUntilDivIdx = -1;
// Clear all current matches.