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:
Родитель
30908451b4
Коммит
8943bcd3c3
|
@ -122,7 +122,8 @@ function preprocess(inFilename, outFilename, defines) {
|
|||
let line;
|
||||
let state = STATE_NONE;
|
||||
const stack = [];
|
||||
const control = /^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
|
||||
const control =
|
||||
/^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
|
||||
|
||||
while ((line = readLine()) !== null) {
|
||||
++lineNumber;
|
||||
|
|
|
@ -36,7 +36,8 @@ exports.parseAdobeCMap = function (content) {
|
|||
if (m) {
|
||||
result.usecmap = m[1];
|
||||
}
|
||||
const re = /(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
|
||||
const re =
|
||||
/(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
|
||||
while ((m = re.exec(body))) {
|
||||
const lines = m[3].toLowerCase().split("\n");
|
||||
|
||||
|
|
12
gulpfile.js
12
gulpfile.js
|
@ -756,8 +756,8 @@ gulp.task("cmaps", function (done) {
|
|||
}
|
||||
});
|
||||
|
||||
const compressCmaps = require("./external/cmapscompress/compress.js")
|
||||
.compressCmaps;
|
||||
const compressCmaps =
|
||||
require("./external/cmapscompress/compress.js").compressCmaps;
|
||||
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
|
||||
done();
|
||||
});
|
||||
|
@ -1415,7 +1415,8 @@ function buildLibHelper(bundleDefines, inputStream, outputDir) {
|
|||
babelPluginReplaceNonWebPackRequire,
|
||||
],
|
||||
}).code;
|
||||
const removeCjsSrc = /^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
|
||||
const removeCjsSrc =
|
||||
/^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
|
||||
content = content.replace(removeCjsSrc, (all, prefix, interop, suffix) => {
|
||||
return prefix + suffix;
|
||||
});
|
||||
|
@ -2176,9 +2177,8 @@ gulp.task(
|
|||
let reason = process.env.PDFJS_UPDATE_REASON;
|
||||
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
|
||||
if (typeof reason === "string") {
|
||||
const reasonParts = /^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(
|
||||
reason
|
||||
);
|
||||
const reasonParts =
|
||||
/^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(reason);
|
||||
|
||||
if (reasonParts) {
|
||||
reason =
|
||||
|
|
|
@ -1589,11 +1589,8 @@ class WidgetAnnotation extends Annotation {
|
|||
"Expected `_defaultAppearanceData` to have been set."
|
||||
);
|
||||
}
|
||||
const {
|
||||
localResources,
|
||||
appearanceResources,
|
||||
acroFormResources,
|
||||
} = this._fieldResources;
|
||||
const { localResources, appearanceResources, acroFormResources } =
|
||||
this._fieldResources;
|
||||
|
||||
const fontName =
|
||||
this.data.defaultAppearanceData &&
|
||||
|
|
|
@ -3205,9 +3205,8 @@ class PartialEvaluator {
|
|||
// text-extraction. For simple fonts, containing encoding information,
|
||||
// use a fallback ToUnicode map to improve this (fixes issue8229.pdf).
|
||||
if (!properties.composite && properties.hasEncoding) {
|
||||
properties.fallbackToUnicode = this._buildSimpleFontToUnicode(
|
||||
properties
|
||||
);
|
||||
properties.fallbackToUnicode =
|
||||
this._buildSimpleFontToUnicode(properties);
|
||||
}
|
||||
|
||||
return Promise.resolve(properties.toUnicode);
|
||||
|
|
|
@ -999,12 +999,14 @@ class Font {
|
|||
map[+charCode] = GlyphMapForStandardFonts[charCode];
|
||||
}
|
||||
if (/Arial-?Black/i.test(name)) {
|
||||
const SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
|
||||
const SupplementalGlyphMapForArialBlack =
|
||||
getSupplementalGlyphMapForArialBlack();
|
||||
for (const charCode in SupplementalGlyphMapForArialBlack) {
|
||||
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
|
||||
}
|
||||
} else if (/Calibri/i.test(name)) {
|
||||
const SupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri();
|
||||
const SupplementalGlyphMapForCalibri =
|
||||
getSupplementalGlyphMapForCalibri();
|
||||
for (const charCode in SupplementalGlyphMapForCalibri) {
|
||||
map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
|
||||
}
|
||||
|
@ -1801,22 +1803,7 @@ class Font {
|
|||
// glyf table cannot be empty -- redoing the glyf and loca tables
|
||||
// to have single glyph with one point
|
||||
const simpleGlyph = new Uint8Array([
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
49,
|
||||
0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0,
|
||||
]);
|
||||
for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
|
||||
itemEncode(locaData, j, simpleGlyph.length);
|
||||
|
@ -2707,9 +2694,8 @@ class Font {
|
|||
return charCode | 0;
|
||||
}
|
||||
}
|
||||
newMapping.charCodeToGlyphId[
|
||||
newMapping.nextAvailableFontCharCode
|
||||
] = glyphId;
|
||||
newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
|
||||
glyphId;
|
||||
return newMapping.nextAvailableFontCharCode++;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,9 +117,8 @@ function mapStyle(styleStr) {
|
|||
style.transform = newValue;
|
||||
}
|
||||
} else {
|
||||
style[
|
||||
key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())
|
||||
] = newValue;
|
||||
style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] =
|
||||
newValue;
|
||||
}
|
||||
}
|
||||
return style;
|
||||
|
|
|
@ -3070,13 +3070,8 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
|
|||
this.stepper.init(this.operatorList);
|
||||
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
|
||||
}
|
||||
const {
|
||||
canvasContext,
|
||||
viewport,
|
||||
transform,
|
||||
imageLayer,
|
||||
background,
|
||||
} = this.params;
|
||||
const { canvasContext, viewport, transform, imageLayer, background } =
|
||||
this.params;
|
||||
|
||||
this.gfx = new CanvasGraphics(
|
||||
canvasContext,
|
||||
|
|
|
@ -141,15 +141,13 @@ class PDFFetchStreamReader {
|
|||
const getResponseHeader = name => {
|
||||
return response.headers.get(name);
|
||||
};
|
||||
const {
|
||||
allowRangeRequests,
|
||||
suggestedLength,
|
||||
} = validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: this._stream.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
const { allowRangeRequests, suggestedLength } =
|
||||
validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: this._stream.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
this._isRangeSupported = allowRangeRequests;
|
||||
// Setting right content length.
|
||||
|
|
|
@ -305,15 +305,13 @@ class PDFNetworkStreamFullRequestReader {
|
|||
const getResponseHeader = name => {
|
||||
return fullRequestXhr.getResponseHeader(name);
|
||||
};
|
||||
const {
|
||||
allowRangeRequests,
|
||||
suggestedLength,
|
||||
} = validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: this._manager.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
const { allowRangeRequests, suggestedLength } =
|
||||
validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: this._manager.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
if (allowRangeRequests) {
|
||||
this._isRangeSupported = true;
|
||||
|
|
|
@ -330,15 +330,13 @@ class PDFNodeStreamFullReader extends BaseFullReader {
|
|||
// here: https://nodejs.org/api/http.html#http_message_headers.
|
||||
return this._readableStream.headers[name.toLowerCase()];
|
||||
};
|
||||
const {
|
||||
allowRangeRequests,
|
||||
suggestedLength,
|
||||
} = validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: stream.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
const { allowRangeRequests, suggestedLength } =
|
||||
validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
isHttp: stream.isHttp,
|
||||
rangeChunkSize: this._rangeChunkSize,
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
this._isRangeSupported = allowRangeRequests;
|
||||
// Setting right content length.
|
||||
|
|
|
@ -52,14 +52,7 @@ if (
|
|||
|
||||
const convertImgDataToPng = (function () {
|
||||
const PNG_HEADER = new Uint8Array([
|
||||
0x89,
|
||||
0x50,
|
||||
0x4e,
|
||||
0x47,
|
||||
0x0d,
|
||||
0x0a,
|
||||
0x1a,
|
||||
0x0a,
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
||||
]);
|
||||
const CHUNK_WRAPPER_SIZE = 12;
|
||||
|
||||
|
|
|
@ -75,8 +75,12 @@ function getAscent(fontFamily, ctx) {
|
|||
ctx.strokeStyle = "red";
|
||||
ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
|
||||
ctx.strokeText("g", 0, 0);
|
||||
let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE)
|
||||
.data;
|
||||
let pixels = ctx.getImageData(
|
||||
0,
|
||||
0,
|
||||
DEFAULT_FONT_SIZE,
|
||||
DEFAULT_FONT_SIZE
|
||||
).data;
|
||||
descent = 0;
|
||||
for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
|
||||
if (pixels[i] > 0) {
|
||||
|
|
|
@ -284,7 +284,8 @@ class Util extends PDFObject {
|
|||
seconds: oDate.getSeconds(),
|
||||
};
|
||||
|
||||
const patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\.)/g;
|
||||
const patterns =
|
||||
/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\.)/g;
|
||||
return cFormat.replace(patterns, function (match, pattern) {
|
||||
if (pattern in handlers) {
|
||||
return handlers[pattern](data);
|
||||
|
@ -517,7 +518,8 @@ class Util extends PDFObject {
|
|||
|
||||
// escape the string
|
||||
const escapedFormat = cFormat.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
||||
const patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;
|
||||
const patterns =
|
||||
/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;
|
||||
const actions = [];
|
||||
|
||||
const re = escapedFormat.replace(
|
||||
|
|
|
@ -100,6 +100,7 @@ if (
|
|||
if (isReadableStreamSupported) {
|
||||
return;
|
||||
}
|
||||
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
|
||||
globalThis.ReadableStream =
|
||||
require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
|
||||
})();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ function rewriteWebArchiveUrl(url) {
|
|||
// Web Archive URLs need to be transformed to add `if_` after the ID.
|
||||
// Without this, an HTML page containing an iframe with the PDF file
|
||||
// will be served instead (issue 8920).
|
||||
var webArchiveRegex = /(^https?:\/\/web\.archive\.org\/web\/)(\d+)(\/https?:\/\/.+)/g;
|
||||
var webArchiveRegex =
|
||||
/(^https?:\/\/web\.archive\.org\/web\/)(\d+)(\/https?:\/\/.+)/g;
|
||||
var urlParts = webArchiveRegex.exec(url);
|
||||
if (urlParts) {
|
||||
return urlParts[1] + (urlParts[2] + "if_") + urlParts[3];
|
||||
|
|
|
@ -422,7 +422,8 @@ var Driver = (function DriverClosure() {
|
|||
loadingTask.promise.then(
|
||||
doc => {
|
||||
task.pdfDoc = doc;
|
||||
task.optionalContentConfigPromise = doc.getOptionalContentConfig();
|
||||
task.optionalContentConfigPromise =
|
||||
doc.getOptionalContentConfig();
|
||||
|
||||
this._nextPage(task, failure);
|
||||
},
|
||||
|
@ -600,9 +601,8 @@ var Driver = (function DriverClosure() {
|
|||
}
|
||||
annotationLayerCanvas.width = viewport.width;
|
||||
annotationLayerCanvas.height = viewport.height;
|
||||
var annotationLayerContext = annotationLayerCanvas.getContext(
|
||||
"2d"
|
||||
);
|
||||
var annotationLayerContext =
|
||||
annotationLayerCanvas.getContext("2d");
|
||||
annotationLayerContext.clearRect(
|
||||
0,
|
||||
0,
|
||||
|
|
|
@ -843,8 +843,8 @@ function unitTestPostHandler(req, res) {
|
|||
}
|
||||
|
||||
async function startBrowser(browserName, startUrl = "") {
|
||||
const revisions = require("puppeteer/lib/cjs/puppeteer/revisions.js")
|
||||
.PUPPETEER_REVISIONS;
|
||||
const revisions =
|
||||
require("puppeteer/lib/cjs/puppeteer/revisions.js").PUPPETEER_REVISIONS;
|
||||
const wantedRevision =
|
||||
browserName === "chrome" ? revisions.chromium : revisions.firefox;
|
||||
|
||||
|
|
|
@ -230,24 +230,10 @@ describe("annotation", function () {
|
|||
|
||||
it("should process quadpoints in the standard order", function () {
|
||||
rect = [10, 10, 20, 20];
|
||||
dict.set("QuadPoints", [
|
||||
10,
|
||||
20,
|
||||
20,
|
||||
20,
|
||||
10,
|
||||
10,
|
||||
20,
|
||||
10,
|
||||
11,
|
||||
19,
|
||||
19,
|
||||
19,
|
||||
11,
|
||||
11,
|
||||
19,
|
||||
11,
|
||||
]);
|
||||
dict.set(
|
||||
"QuadPoints",
|
||||
[10, 20, 20, 20, 10, 10, 20, 10, 11, 19, 19, 19, 11, 11, 19, 11]
|
||||
);
|
||||
expect(getQuadPoints(dict, rect)).toEqual([
|
||||
[
|
||||
{ x: 10, y: 20 },
|
||||
|
|
|
@ -1066,12 +1066,8 @@ describe("api", function () {
|
|||
});
|
||||
|
||||
it("gets metadata", async function () {
|
||||
const {
|
||||
info,
|
||||
metadata,
|
||||
contentDispositionFilename,
|
||||
contentLength,
|
||||
} = await pdfDocument.getMetadata();
|
||||
const { info, metadata, contentDispositionFilename, contentLength } =
|
||||
await pdfDocument.getMetadata();
|
||||
|
||||
expect(info.Title).toEqual("Basic API Test");
|
||||
// Custom, non-standard, information dictionary entries.
|
||||
|
@ -1096,12 +1092,8 @@ describe("api", function () {
|
|||
buildGetDocumentParams("tracemonkey.pdf")
|
||||
);
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const {
|
||||
info,
|
||||
metadata,
|
||||
contentDispositionFilename,
|
||||
contentLength,
|
||||
} = await pdfDoc.getMetadata();
|
||||
const { info, metadata, contentDispositionFilename, contentLength } =
|
||||
await pdfDoc.getMetadata();
|
||||
|
||||
expect(info.Creator).toEqual("TeX");
|
||||
expect(info.Producer).toEqual("pdfeTeX-1.21a");
|
||||
|
@ -1132,12 +1124,8 @@ describe("api", function () {
|
|||
it("gets metadata, with missing PDF header (bug 1606566)", async function () {
|
||||
const loadingTask = getDocument(buildGetDocumentParams("bug1606566.pdf"));
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const {
|
||||
info,
|
||||
metadata,
|
||||
contentDispositionFilename,
|
||||
contentLength,
|
||||
} = await pdfDoc.getMetadata();
|
||||
const { info, metadata, contentDispositionFilename, contentLength } =
|
||||
await pdfDoc.getMetadata();
|
||||
|
||||
// The following are PDF.js specific, non-standard, properties.
|
||||
expect(info.PDFFormatVersion).toEqual(null);
|
||||
|
@ -1445,13 +1433,12 @@ describe("api", function () {
|
|||
docBaseUrl: "qwerty.pdf",
|
||||
})
|
||||
);
|
||||
const invalidDocBaseUrlPromise = invalidDocBaseUrlLoadingTask.promise.then(
|
||||
function (pdfDoc) {
|
||||
const invalidDocBaseUrlPromise =
|
||||
invalidDocBaseUrlLoadingTask.promise.then(function (pdfDoc) {
|
||||
return pdfDoc.getPage(1).then(function (pdfPage) {
|
||||
return pdfPage.getAnnotations();
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
const [
|
||||
defaultAnnotations,
|
||||
|
@ -1804,7 +1791,8 @@ describe("api", function () {
|
|||
});
|
||||
|
||||
it("multiple render() on the same canvas", async function () {
|
||||
const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
|
||||
const optionalContentConfigPromise =
|
||||
pdfDocument.getOptionalContentConfig();
|
||||
|
||||
const viewport = page.getViewport({ scale: 1 });
|
||||
const canvasAndCtx = CanvasFactory.create(
|
||||
|
|
|
@ -27,9 +27,8 @@ function getTopLeftPixel(canvasContext) {
|
|||
}
|
||||
|
||||
describe("custom canvas rendering", function () {
|
||||
const transparentGetDocumentParams = buildGetDocumentParams(
|
||||
"transparent.pdf"
|
||||
);
|
||||
const transparentGetDocumentParams =
|
||||
buildGetDocumentParams("transparent.pdf");
|
||||
|
||||
let CanvasFactory;
|
||||
let loadingTask;
|
||||
|
|
24
web/app.js
24
web/app.js
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче