diff --git a/browser/locales/en-US/pdfviewer/viewer.properties b/browser/locales/en-US/pdfviewer/viewer.properties --- a/browser/locales/en-US/pdfviewer/viewer.properties +++ b/browser/locales/en-US/pdfviewer/viewer.properties @@ -249,12 +249,10 @@ printing_not_supported=Warning: Printing is not fully supported by this browser. printing_not_ready=Warning: The PDF is not fully loaded for printing. web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts. # Editor -editor_none.title=Disable Annotation Editing -editor_none_label=Disable Editing editor_free_text.title=Add FreeText Annotation editor_free_text_label=FreeText Annotation editor_ink.title=Add Ink Annotation editor_ink_label=Ink Annotation diff --git a/toolkit/components/pdfjs/content/build/pdf.js b/toolkit/components/pdfjs/content/build/pdf.js --- a/toolkit/components/pdfjs/content/build/pdf.js +++ b/toolkit/components/pdfjs/content/build/pdf.js @@ -1361,11 +1361,11 @@ source.contentDispositionFilename = pdfDataRangeTransport.contentDispositionFilename; } const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", { docId, - apiVersion: '2.16.71', + apiVersion: '3.0.11', source: { data: source.data, url: source.url, password: source.password, disableAutoFetch: source.disableAutoFetch, @@ -1602,10 +1602,14 @@ getData() { return this._transport.getData(); } + saveDocument() { + return this._transport.saveDocument(); + } + getDownloadInfo() { return this._transport.downloadInfoCapability.promise; } cleanup(keepLoadedFonts = false) { @@ -1622,14 +1626,10 @@ get loadingTask() { return this._transport.loadingTask; } - saveDocument() { - return this._transport.saveDocument(); - } - getFieldObjects() { return this._transport.getFieldObjects(); } hasJSActions() { @@ -1727,11 +1727,10 @@ canvasContext, viewport, intent = "display", annotationMode = _util.AnnotationMode.ENABLE, transform = null, - imageLayer = null, canvasFactory = null, background = null, optionalContentConfigPromise = null, annotationCanvasMap = null, pageColors = null, @@ -1814,11 +1813,10 @@ callback: complete, params: { canvasContext, viewport, transform, - imageLayer, background }, objs: this.objs, commonObjs: this.commonObjs, annotationCanvasMap, @@ -2458,11 +2456,10 @@ } } exports.PDFWorker = PDFWorker; -; class WorkerTransport { #docStats = null; #pageCache = new Map(); #pagePromises = new Map(); @@ -2961,10 +2958,25 @@ getData() { return this.messageHandler.sendWithPromise("GetData", null); } + saveDocument() { + if (this.annotationStorage.size <= 0) { + (0, _util.warn)("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead."); + } + + return this.messageHandler.sendWithPromise("SaveDocument", { + isPureXfa: !!this._htmlForXfa, + numPages: this._numPages, + annotationStorage: this.annotationStorage.serializable, + filename: this._fullReader?.filename ?? null + }).finally(() => { + this.annotationStorage.resetModified(); + }); + } + getPage(pageNumber) { if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) { return Promise.reject(new Error("Invalid page request.")); } @@ -3006,21 +3018,10 @@ pageIndex, intent }); } - saveDocument() { - return this.messageHandler.sendWithPromise("SaveDocument", { - isPureXfa: !!this._htmlForXfa, - numPages: this._numPages, - annotationStorage: this.annotationStorage.serializable, - filename: this._fullReader?.filename ?? null - }).finally(() => { - this.annotationStorage.resetModified(); - }); - } - getFieldObjects() { return this._getFieldObjectsPromise ||= this.messageHandler.sendWithPromise("GetFieldObjects", null); } hasJSActions() { @@ -3307,14 +3308,13 @@ const { canvasContext, viewport, transform, - imageLayer, background } = this.params; - this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, imageLayer, optionalContentConfig, this.annotationCanvasMap, this.pageColors); + this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, optionalContentConfig, this.annotationCanvasMap, this.pageColors); this.gfx.beginDrawing({ transform, viewport, transparency, background @@ -3408,13 +3408,13 @@ } } } -const version = '2.16.71'; +const version = '3.0.11'; exports.version = version; -const build = '518115fdd'; +const build = '54d3b6449'; exports.build = build; /***/ }), /* 5 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -3453,16 +3453,26 @@ getRawValue(key) { return this._storage.get(key); } - removeKey(key) { + remove(key) { this._storage.delete(key); if (this._storage.size === 0) { this.resetModified(); } + + if (typeof this.onAnnotationEditor === "function") { + for (const value of this._storage.values()) { + if (value instanceof _editor.AnnotationEditor) { + return; + } + } + + this.onAnnotationEditor(null); + } } setValue(key, value) { const obj = this._storage.get(key); @@ -3542,20 +3552,10 @@ } return clone; } - get hasAnnotationEditors() { - for (const value of this._storage.values()) { - if (value instanceof _editor.AnnotationEditor) { - return true; - } - } - - return false; - } - static getHash(map) { if (!map) { return ""; } @@ -4384,10 +4384,14 @@ mode }); } updateParams(type, value) { + if (!this.#editorTypes) { + return; + } + for (const editor of this.#selectedEditors) { editor.updateParams(type, value); } for (const editorType of this.#editorTypes) { @@ -6657,22 +6661,21 @@ const LINE_JOIN_STYLES = ["miter", "round", "bevel"]; const NORMAL_CLIP = {}; const EO_CLIP = {}; class CanvasGraphics { - constructor(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig, annotationCanvasMap, pageColors) { + constructor(canvasCtx, commonObjs, objs, canvasFactory, optionalContentConfig, annotationCanvasMap, pageColors) { this.ctx = canvasCtx; this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height); this.stateStack = []; this.pendingClip = null; this.pendingEOFill = false; this.res = null; this.xobjs = null; this.commonObjs = commonObjs; this.objs = objs; this.canvasFactory = canvasFactory; - this.imageLayer = imageLayer; this.groupStack = []; this.processingType3 = null; this.baseTransform = null; this.baseTransformStack = []; this.groupLevel = 0; @@ -6765,14 +6768,10 @@ } this.ctx.transform(...viewport.transform); this.viewportScale = viewport.scale; this.baseTransform = (0, _display_utils.getCurrentTransform)(this.ctx); - - if (this.imageLayer) { - this.imageLayer.beginLayout(); - } } executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { const argsArray = operatorList.argsArray; const fnArray = operatorList.fnArray; @@ -6859,14 +6858,10 @@ cache.clear(); } this._cachedBitmapsMap.clear(); - - if (this.imageLayer) { - this.imageLayer.endLayout(); - } } _scaleImage(img, inverseTransform) { const width = img.width; const height = img.height; @@ -8318,23 +8313,11 @@ } const scaled = this._scaleImage(imgToPaint, (0, _display_utils.getCurrentTransformInverse)(ctx)); ctx.imageSmoothingEnabled = getImageSmoothingEnabled((0, _display_utils.getCurrentTransform)(ctx), imgData.interpolate); - const [rWidth, rHeight] = drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height); - - if (this.imageLayer) { - const position = this.getCanvasPosition(0, -height); - this.imageLayer.appendImage({ - imgData, - left: position[0], - top: position[1], - width: rWidth, - height: rHeight - }); - } - + drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height); this.compose(); this.restore(); } paintInlineImageXObjectGroup(imgData, map) { @@ -8352,22 +8335,10 @@ for (const entry of map) { ctx.save(); ctx.transform(...entry.transform); ctx.scale(1, -1); drawImageAtIntegerCoords(ctx, tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); - - if (this.imageLayer) { - const position = this.getCanvasPosition(entry.x, entry.y); - this.imageLayer.appendImage({ - imgData, - left: position[0], - top: position[1], - width: w, - height: h - }); - } - ctx.restore(); } this.compose(); } @@ -8536,15 +8507,10 @@ ctx.setLineDash(savedDashes); ctx.lineDashOffset = savedDashOffset; } } - getCanvasPosition(x, y) { - const transform = (0, _display_utils.getCurrentTransform)(this.ctx); - return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; - } - isContentVisible() { for (let i = this.markedContentStack.length - 1; i >= 0; i--) { if (!this.markedContentStack[i].visible) { return false; } @@ -10554,11 +10520,11 @@ } remove(editor) { this.#uiManager.removeEditor(editor); this.detach(editor); - this.annotationStorage.removeKey(editor.id); + this.annotationStorage.remove(editor.id); editor.div.style.display = "none"; setTimeout(() => { editor.div.style.display = ""; editor.div.remove(); editor.isAttachedToDOM = false; @@ -12763,14 +12729,17 @@ for (const [actionName, detail] of Object.entries(storedData)) { const action = commonActions[actionName]; if (action) { - action({ - detail, + const eventProxy = { + detail: { + [actionName]: detail + }, target: element - }); + }; + action(eventProxy); delete storedData[actionName]; } } } @@ -13311,11 +13280,19 @@ if (this.renderForms) { const storedData = storage.getValue(id, { value: this.data.fieldValue }); - const textContent = storedData.formattedValue || storedData.value || ""; + let textContent = storedData.formattedValue || storedData.value || ""; + const maxLen = storage.getValue(id, { + charLimit: this.data.maxLen + }).charLimit; + + if (maxLen && textContent.length > maxLen) { + textContent = textContent.slice(0, maxLen); + } + const elementData = { userValue: textContent, formattedValue: null, valueOnFocus: "" }; @@ -13343,10 +13320,14 @@ element.name = this.data.fieldName; element.tabIndex = DEFAULT_TAB_INDEX; this._setRequired(element, this.data.required); + if (maxLen) { + element.maxLength = maxLen; + } + element.addEventListener("input", event => { storage.setValue(id, { value: event.target.value }); this.setPropertyOnSiblings(element, "value", event.target.value, "value"); @@ -13402,12 +13383,50 @@ }); }, selRange(event) { event.target.setSelectionRange(...event.detail.selRange); + }, + + charLimit: event => { + const { + charLimit + } = event.detail; + const { + target + } = event; + + if (charLimit === 0) { + target.removeAttribute("maxLength"); + return; + } + + target.setAttribute("maxLength", charLimit); + let value = elementData.userValue; + + if (!value || value.length <= charLimit) { + return; + } + + value = value.slice(0, charLimit); + target.value = elementData.userValue = value; + storage.setValue(id, { + value + }); + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id, + name: "Keystroke", + value, + willCommit: true, + commitKey: 1, + selStart: target.selectionStart, + selEnd: target.selectionEnd + } + }); } - }; this._dispatchEventFromSandbox(actions, jsEvent); }); element.addEventListener("keydown", event => { @@ -13546,17 +13565,13 @@ if (blurListener) { element.addEventListener("blur", blurListener); } - if (this.data.maxLen !== null) { - element.maxLength = this.data.maxLen; - } - if (this.data.comb) { const fieldWidth = this.data.rect[2] - this.data.rect[0]; - const combWidth = fieldWidth / this.data.maxLen; + const combWidth = fieldWidth / maxLen; element.classList.add("comb"); element.style.letterSpacing = `calc(${combWidth}px * var(--scale-factor) - 1ch)`; } } else { element = document.createElement("div"); @@ -15136,17 +15151,14 @@ exports.TextLayerRenderTask = void 0; exports.renderTextLayer = renderTextLayer; var _util = __w_pdfjs_require__(1); -var _display_utils = __w_pdfjs_require__(8); - const MAX_TEXT_DIVS_TO_RENDER = 100000; const DEFAULT_FONT_SIZE = 30; const DEFAULT_FONT_ASCENT = 0.8; const ascentCache = new Map(); -const AllWhitespaceRegexp = /^\s+$/g; function getAscent(fontFamily, ctx) { const cachedAscent = ascentCache.get(fontFamily); if (cachedAscent) { @@ -15203,23 +15215,11 @@ return DEFAULT_FONT_ASCENT; } function appendText(task, geom, styles, ctx) { const textDiv = document.createElement("span"); - const textDivProperties = task._enhanceTextSelection ? { - angle: 0, - canvasWidth: 0, - hasText: geom.str !== "", - hasEOL: geom.hasEOL, - originalTransform: null, - paddingBottom: 0, - paddingLeft: 0, - paddingRight: 0, - paddingTop: 0, - scale: 1, - fontSize: 0 - } : { + const textDivProperties = { angle: 0, canvasWidth: 0, hasText: geom.str !== "", hasEOL: geom.hasEOL, fontSize: 0 @@ -15265,11 +15265,11 @@ textDivProperties.angle = angle * (180 / Math.PI); } let shouldScaleText = false; - if (geom.str.length > 1 || task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str)) { + if (geom.str.length > 1) { shouldScaleText = true; } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) { const absScaleX = Math.abs(geom.transform[0]), absScaleY = Math.abs(geom.transform[3]); @@ -15289,41 +15289,10 @@ task._textDivProperties.set(textDiv, textDivProperties); if (task._textContentStream) { task._layoutText(textDiv); } - - if (task._enhanceTextSelection && textDivProperties.hasText) { - let angleCos = 1, - angleSin = 0; - - if (angle !== 0) { - angleCos = Math.cos(angle); - angleSin = Math.sin(angle); - } - - const divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; - const divHeight = fontHeight; - let m, b; - - if (angle !== 0) { - m = [angleCos, angleSin, -angleSin, angleCos, left, top]; - b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); - } else { - b = [left, top, left + divWidth, top + divHeight]; - } - - task._bounds.push({ - left: b[0], - top: b[1], - right: b[2], - bottom: b[3], - div: textDiv, - size: [divWidth, divHeight], - m - }); - } } function render(task) { if (task._canceled) { return; @@ -15347,304 +15316,26 @@ task._renderingDone = true; capability.resolve(); } -function findPositiveMin(ts, offset, count) { - let result = 0; - - for (let i = 0; i < count; i++) { - const t = ts[offset++]; - - if (t > 0) { - result = result ? Math.min(t, result) : t; - } - } - - return result; -} - -function expand(task) { - const bounds = task._bounds; - const viewport = task._viewport; - const expanded = expandBounds(viewport.width, viewport.height, bounds); - - for (let i = 0; i < expanded.length; i++) { - const div = bounds[i].div; - - const divProperties = task._textDivProperties.get(div); - - if (divProperties.angle === 0) { - divProperties.paddingLeft = bounds[i].left - expanded[i].left; - divProperties.paddingTop = bounds[i].top - expanded[i].top; - divProperties.paddingRight = expanded[i].right - bounds[i].right; - divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; - - task._textDivProperties.set(div, divProperties); - - continue; - } - - const e = expanded[i], - b = bounds[i]; - const m = b.m, - c = m[0], - s = m[1]; - const points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; - const ts = new Float64Array(64); - - for (let j = 0, jj = points.length; j < jj; j++) { - const t = _util.Util.applyTransform(points[j], m); - - ts[j + 0] = c && (e.left - t[0]) / c; - ts[j + 4] = s && (e.top - t[1]) / s; - ts[j + 8] = c && (e.right - t[0]) / c; - ts[j + 12] = s && (e.bottom - t[1]) / s; - ts[j + 16] = s && (e.left - t[0]) / -s; - ts[j + 20] = c && (e.top - t[1]) / c; - ts[j + 24] = s && (e.right - t[0]) / -s; - ts[j + 28] = c && (e.bottom - t[1]) / c; - ts[j + 32] = c && (e.left - t[0]) / -c; - ts[j + 36] = s && (e.top - t[1]) / -s; - ts[j + 40] = c && (e.right - t[0]) / -c; - ts[j + 44] = s && (e.bottom - t[1]) / -s; - ts[j + 48] = s && (e.left - t[0]) / s; - ts[j + 52] = c && (e.top - t[1]) / -c; - ts[j + 56] = s && (e.right - t[0]) / s; - ts[j + 60] = c && (e.bottom - t[1]) / -c; - } - - const boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); - divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; - divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; - divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; - divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; - - task._textDivProperties.set(div, divProperties); - } -} - -function expandBounds(width, height, boxes) { - const bounds = boxes.map(function (box, i) { - return { - x1: box.left, - y1: box.top, - x2: box.right, - y2: box.bottom, - index: i, - x1New: undefined, - x2New: undefined - }; - }); - expandBoundsLTR(width, bounds); - const expanded = new Array(boxes.length); - - for (const b of bounds) { - const i = b.index; - expanded[i] = { - left: b.x1New, - top: 0, - right: b.x2New, - bottom: 0 - }; - } - - boxes.map(function (box, i) { - const e = expanded[i], - b = bounds[i]; - b.x1 = box.top; - b.y1 = width - e.right; - b.x2 = box.bottom; - b.y2 = width - e.left; - b.index = i; - b.x1New = undefined; - b.x2New = undefined; - }); - expandBoundsLTR(height, bounds); - - for (const b of bounds) { - const i = b.index; - expanded[i].top = b.x1New; - expanded[i].bottom = b.x2New; - } - - return expanded; -} - -function expandBoundsLTR(width, bounds) { - bounds.sort(function (a, b) { - return a.x1 - b.x1 || a.index - b.index; - }); - const fakeBoundary = { - x1: -Infinity, - y1: -Infinity, - x2: 0, - y2: Infinity, - index: -1, - x1New: 0, - x2New: 0 - }; - const horizon = [{ - start: -Infinity, - end: Infinity, - boundary: fakeBoundary - }]; - - for (const boundary of bounds) { - let i = 0; - - while (i < horizon.length && horizon[i].end <= boundary.y1) { - i++; - } - - let j = horizon.length - 1; - - while (j >= 0 && horizon[j].start >= boundary.y2) { - j--; - } - - let horizonPart, affectedBoundary; - let q, - k, - maxXNew = -Infinity; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - let xNew; - - if (affectedBoundary.x2 > boundary.x1) { - xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; - } else if (affectedBoundary.x2New === undefined) { - xNew = (affectedBoundary.x2 + boundary.x1) / 2; - } else { - xNew = affectedBoundary.x2New; - } - - if (xNew > maxXNew) { - maxXNew = xNew; - } - } - - boundary.x1New = maxXNew; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New === undefined) { - if (affectedBoundary.x2 > boundary.x1) { - if (affectedBoundary.index > boundary.index) { - affectedBoundary.x2New = affectedBoundary.x2; - } - } else { - affectedBoundary.x2New = maxXNew; - } - } else if (affectedBoundary.x2New > maxXNew) { - affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); - } - } - - const changedHorizon = []; - let lastBoundary = null; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - const useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; - - if (lastBoundary === useBoundary) { - changedHorizon.at(-1).end = horizonPart.end; - } else { - changedHorizon.push({ - start: horizonPart.start, - end: horizonPart.end, - boundary: useBoundary - }); - lastBoundary = useBoundary; - } - } - - if (horizon[i].start < boundary.y1) { - changedHorizon[0].start = boundary.y1; - changedHorizon.unshift({ - start: horizon[i].start, - end: boundary.y1, - boundary: horizon[i].boundary - }); - } - - if (boundary.y2 < horizon[j].end) { - changedHorizon.at(-1).end = boundary.y2; - changedHorizon.push({ - start: boundary.y2, - end: horizon[j].end, - boundary: horizon[j].boundary - }); - } - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New !== undefined) { - continue; - } - - let used = false; - - for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { - used = horizon[k].boundary === affectedBoundary; - } - - for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { - used = horizon[k].boundary === affectedBoundary; - } - - for (k = 0; !used && k < changedHorizon.length; k++) { - used = changedHorizon[k].boundary === affectedBoundary; - } - - if (!used) { - affectedBoundary.x2New = maxXNew; - } - } - - Array.prototype.splice.apply(horizon, [i, j - i + 1, ...changedHorizon]); - } - - for (const horizonPart of horizon) { - const affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New === undefined) { - affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); - } - } -} - class TextLayerRenderTask { constructor({ textContent, textContentStream, container, viewport, textDivs, - textContentItemsStr, - enhanceTextSelection + textContentItemsStr }) { - if (enhanceTextSelection) { - (0, _display_utils.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."); - } - this._textContent = textContent; this._textContentStream = textContentStream; this._container = container; this._document = container.ownerDocument; this._viewport = viewport; this._textDivs = textDivs || []; this._textContentItemsStr = textContentItemsStr || []; - this._enhanceTextSelection = !!enhanceTextSelection; this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled; this._reader = null; this._layoutTextLastFontSize = null; this._layoutTextLastFontFamily = null; this._layoutTextCtx = null; @@ -15655,13 +15346,11 @@ this._renderTimer = null; this._bounds = []; this._devicePixelRatio = globalThis.devicePixelRatio || 1; this._capability.promise.finally(() => { - if (!this._enhanceTextSelection) { - this._textDivProperties = null; - } + this._textDivProperties = null; if (this._layoutTextCtx) { this._layoutTextCtx.canvas.width = 0; this._layoutTextCtx.canvas.height = 0; this._layoutTextCtx = null; @@ -15739,29 +15428,19 @@ const { width } = this._layoutTextCtx.measureText(textDiv.textContent); if (width > 0) { - const scale = this._devicePixelRatio * textDivProperties.canvasWidth / width; - - if (this._enhanceTextSelection) { - textDivProperties.scale = scale; - } - - transform = `scaleX(${scale})`; + transform = `scaleX(${this._devicePixelRatio * textDivProperties.canvasWidth / width})`; } } if (textDivProperties.angle !== 0) { transform = `rotate(${textDivProperties.angle}deg) ${transform}`; } if (transform.length > 0) { - if (this._enhanceTextSelection) { - textDivProperties.originalTransform = transform; - } - textDiv.style.transform = transform; } if (textDivProperties.hasText) { this._container.append(textDiv); @@ -15830,78 +15509,10 @@ }, timeout); } }, this._capability.reject); } - expandTextDivs(expandDivs = false) { - if (!this._enhanceTextSelection || !this._renderingDone) { - return; - } - - if (this._bounds !== null) { - expand(this); - this._bounds = null; - } - - const transformBuf = [], - paddingBuf = []; - - for (let i = 0, ii = this._textDivs.length; i < ii; i++) { - const div = this._textDivs[i]; - - const divProps = this._textDivProperties.get(div); - - if (!divProps.hasText) { - continue; - } - - if (expandDivs) { - transformBuf.length = 0; - paddingBuf.length = 0; - - if (divProps.originalTransform) { - transformBuf.push(divProps.originalTransform); - } - - if (divProps.paddingTop > 0) { - paddingBuf.push(`${divProps.paddingTop}px`); - transformBuf.push(`translateY(${-divProps.paddingTop}px)`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingRight > 0) { - paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingBottom > 0) { - paddingBuf.push(`${divProps.paddingBottom}px`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingLeft > 0) { - paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`); - transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`); - } else { - paddingBuf.push(0); - } - - div.style.padding = paddingBuf.join(" "); - - if (transformBuf.length) { - div.style.transform = transformBuf.join(" "); - } - } else { - div.style.padding = null; - div.style.transform = divProps.originalTransform; - } - } - } - } exports.TextLayerRenderTask = TextLayerRenderTask; function renderTextLayer(renderParameters) { @@ -15909,12 +15520,11 @@ textContent: renderParameters.textContent, textContentStream: renderParameters.textContentStream, container: renderParameters.container, viewport: renderParameters.viewport, textDivs: renderParameters.textDivs, - textContentItemsStr: renderParameters.textContentItemsStr, - enhanceTextSelection: renderParameters.enhanceTextSelection + textContentItemsStr: renderParameters.textContentItemsStr }); task._render(renderParameters.timeout); return task; @@ -16226,14 +15836,14 @@ var _svg = __w_pdfjs_require__(30); var _xfa_layer = __w_pdfjs_require__(28); -const pdfjsVersion = '2.16.71'; -const pdfjsBuild = '518115fdd'; +const pdfjsVersion = '3.0.11'; +const pdfjsBuild = '54d3b6449'; ; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/build/pdf.scripting.js b/toolkit/components/pdfjs/content/build/pdf.scripting.js --- a/toolkit/components/pdfjs/content/build/pdf.scripting.js +++ b/toolkit/components/pdfjs/content/build/pdf.scripting.js @@ -434,11 +434,10 @@ this.buttonFitBounds = data.buttonFitBounds; this.buttonPosition = data.buttonPosition; this.buttonScaleHow = data.buttonScaleHow; this.ButtonScaleWhen = data.buttonScaleWhen; this.calcOrderIndex = data.calcOrderIndex; - this.charLimit = data.charLimit; this.comb = data.comb; this.commitOnSelChange = data.commitOnSelChange; this.currentValueIndices = data.currentValueIndices; this.defaultStyle = data.defaultStyle; this.defaultValue = data.defaultValue; @@ -472,10 +471,11 @@ this.userName = data.userName; this._actions = (0, _common.createActionsMap)(data.actions); this._browseForFileToSubmit = data.browseForFileToSubmit || null; this._buttonCaption = null; this._buttonIcon = null; + this._charLimit = data.charLimit; this._children = null; this._currentValueIndices = data.currentValueIndices || 0; this._document = data.doc; this._fieldPath = data.fieldPath; this._fillColor = data.fillColor || ["T"]; @@ -552,10 +552,22 @@ set bgColor(color) { this.fillColor = color; } + get charLimit() { + return this._charLimit; + } + + set charLimit(limit) { + if (typeof limit !== "number") { + throw new Error("Invalid argument value"); + } + + this._charLimit = Math.max(0, Math.floor(limit)); + } + get numItems() { if (!this._isChoice) { throw new Error("Not a choice widget"); } @@ -5070,13 +5082,13 @@ } })); var _initialization = __w_pdfjs_require__(1); -const pdfjsVersion = '2.16.71'; -const pdfjsBuild = '518115fdd'; +const pdfjsVersion = '3.0.11'; +const pdfjsBuild = '54d3b6449'; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/build/pdf.worker.js b/toolkit/components/pdfjs/content/build/pdf.worker.js --- a/toolkit/components/pdfjs/content/build/pdf.worker.js +++ b/toolkit/components/pdfjs/content/build/pdf.worker.js @@ -115,11 +115,11 @@ let terminated = false; let cancelXHRs = null; const WorkerTasks = []; const verbosity = (0, _util.getVerbosityLevel)(); const apiVersion = docParams.apiVersion; - const workerVersion = '2.16.71'; + const workerVersion = '3.0.11'; if (apiVersion !== workerVersion) { throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); } @@ -7024,16 +7024,16 @@ dict, key: "MaxLen" }); if (!Number.isInteger(maximumLength) || maximumLength < 0) { - maximumLength = null; + maximumLength = 0; } this.data.maxLen = maximumLength; this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); - this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; + this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0; this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL); } _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) { const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen); @@ -45550,11 +45550,12 @@ throw new _util.FormatError("Invalid outline item encountered."); } const data = { url: null, - dest: null + dest: null, + action: null }; Catalog.parseDestDictionary({ destDict: outlineDict, resultObj: data, docBaseUrl: this.pdfManager.docBaseUrl @@ -45568,10 +45569,11 @@ if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); } const outlineItem = { + action: data.action, dest: data.dest, url: data.url, unsafeUrl: data.unsafeUrl, newWindow: data.newWindow, title: (0, _util.stringToPDFString)(title), @@ -63433,13 +63435,13 @@ } })); var _worker = __w_pdfjs_require__(1); -const pdfjsVersion = '2.16.71'; -const pdfjsBuild = '518115fdd'; +const pdfjsVersion = '3.0.11'; +const pdfjsBuild = '54d3b6449'; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/web/images/toolbarButton-editorNone.svg b/toolkit/components/pdfjs/content/web/images/toolbarButton-editorNone.svg deleted file mode 100644 --- a/toolkit/components/pdfjs/content/web/images/toolbarButton-editorNone.svg +++ /dev/null @@ -1,4 +0,0 @@ - - \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/web/viewer.html b/toolkit/components/pdfjs/content/web/viewer.html --- a/toolkit/components/pdfjs/content/web/viewer.html +++ b/toolkit/components/pdfjs/content/web/viewer.html @@ -271,17 +271,14 @@
diff --git a/toolkit/components/pdfjs/content/web/viewer.css b/toolkit/components/pdfjs/content/web/viewer.css --- a/toolkit/components/pdfjs/content/web/viewer.css +++ b/toolkit/components/pdfjs/content/web/viewer.css @@ -698,11 +698,11 @@ } } :root { - --focus-outline: solid 2px red; + --focus-outline: solid 2px blue; --hover-outline: dashed 2px blue; --freetext-line-height: 1.35; --freetext-padding: 2px; --editorInk-editing-cursor: url(images/toolbarButton-editorInk.svg) 0 16; } @@ -1031,11 +1031,10 @@ --dialog-button-hover-bg-color: rgba(12, 12, 13, 0.3); --loading-icon: url(images/loading.svg); --treeitem-expanded-icon: url(images/treeitem-expanded.svg); --treeitem-collapsed-icon: url(images/treeitem-collapsed.svg); - --toolbarButton-editorNone-icon: url(images/toolbarButton-editorNone.svg); --toolbarButton-editorFreeText-icon: url(images/toolbarButton-editorFreeText.svg); --toolbarButton-editorInk-icon: url(images/toolbarButton-editorInk.svg); --toolbarButton-menuArrow-icon: url(images/toolbarButton-menuArrow.svg); --toolbarButton-sidebarToggle-icon: url(images/toolbarButton-sidebarToggle.svg); --toolbarButton-secondaryToolbarToggle-icon: url(images/toolbarButton-secondaryToolbarToggle.svg); @@ -1831,14 +1830,10 @@ #presentationMode::before, #secondaryPresentationMode::before { mask-image: var(--toolbarButton-presentationMode-icon); } -#editorNone::before { - mask-image: var(--toolbarButton-editorNone-icon); -} - #editorFreeText::before { mask-image: var(--toolbarButton-editorFreeText-icon); } #editorInk::before { diff --git a/toolkit/components/pdfjs/content/web/viewer.js b/toolkit/components/pdfjs/content/web/viewer.js --- a/toolkit/components/pdfjs/content/web/viewer.js +++ b/toolkit/components/pdfjs/content/web/viewer.js @@ -97,12 +97,11 @@ exports.SidebarView = SidebarView; const RendererType = null; exports.RendererType = RendererType; const TextLayerMode = { DISABLE: 0, - ENABLE: 1, - ENABLE_ENHANCE: 2 + ENABLE: 1 }; exports.TextLayerMode = TextLayerMode; const ScrollMode = { UNKNOWN: -1, VERTICAL: 0, @@ -1622,10 +1621,12 @@ _saveInProgress: false, _docStats: null, _wheelUnusedTicks: 0, _idleCallbacks: new Set(), _PDFBug: null, + _hasAnnotationEditors: false, + _title: document.title, _printAnnotationStoragePromise: null, async initialize(appConfig) { this.preferences = this.externalServices.createPreferences(); this.appConfig = appConfig; @@ -2063,16 +2064,18 @@ } this.setTitle(title); }, - setTitle(title) { + setTitle(title = this._title) { + this._title = title; + if (this.isViewerEmbedded) { return; } - document.title = title; + document.title = `${this._hasAnnotationEditors ? "* " : ""}${title}`; }, get _docFilename() { return this._contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(this.url); }, @@ -2130,14 +2133,16 @@ this.metadata = null; this._contentDispositionFilename = null; this._contentLength = null; this._saveInProgress = false; this._docStats = null; + this._hasAnnotationEditors = false; this._cancelIdleCallbacks(); promises.push(this.pdfScriptingManager.destroyPromise); + this.setTitle(); this.pdfSidebar.reset(); this.pdfOutlineViewer.reset(); this.pdfAttachmentViewer.reset(); this.pdfLayerViewer.reset(); this.pdfHistory?.reset(); @@ -2282,11 +2287,11 @@ } finally { await this.pdfScriptingManager.dispatchDidSave(); this._saveInProgress = false; } - if (this.pdfDocument?.annotationStorage.hasAnnotationEditors) { + if (this._hasAnnotationEditors) { this.externalServices.reportTelemetry({ type: "editing", data: { type: "save" } @@ -2695,11 +2700,11 @@ pdfTitle = metadataTitle; } } if (pdfTitle) { - this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || document.title}`); + this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`); } else if (this._contentDispositionFilename) { this.setTitle(this._contentDispositionFilename); } if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) { @@ -2846,16 +2851,21 @@ annotationStorage.onResetModified = () => { window.removeEventListener("beforeunload", beforeUnload); }; annotationStorage.onAnnotationEditor = typeStr => { - this.externalServices.reportTelemetry({ - type: "editing", - data: { - type: typeStr - } - }); + this._hasAnnotationEditors = !!typeStr; + this.setTitle(); + + if (typeStr) { + this.externalServices.reportTelemetry({ + type: "editing", + data: { + type: typeStr + } + }); + } }; }, setInitialView(storedHash, { rotation, @@ -2952,11 +2962,11 @@ printService.layout(); this.externalServices.reportTelemetry({ type: "print" }); - if (this.pdfDocument?.annotationStorage.hasAnnotationEditors) { + if (this._hasAnnotationEditors) { this.externalServices.reportTelemetry({ type: "editing", data: { type: "print" } @@ -3414,12 +3424,18 @@ } function webViewerResize() { const { pdfDocument, - pdfViewer + pdfViewer, + pdfRenderingQueue } = PDFViewerApplication; + + if (pdfRenderingQueue.printing && window.matchMedia("print").matches) { + return; + } + pdfViewer.updateContainerHeightCss(); if (!pdfDocument) { return; } @@ -4626,10 +4642,11 @@ exports.PasswordPrompt = void 0; var _pdfjsLib = __webpack_require__(5); class PasswordPrompt { + #activeCapability = null; #updateCallback = null; #reason = null; constructor(options, overlayManager, l10n, isViewerEmbedded = false) { this.dialog = options.dialog; @@ -4639,22 +4656,34 @@ this.cancelButton = options.cancelButton; this.overlayManager = overlayManager; this.l10n = l10n; this._isViewerEmbedded = isViewerEmbedded; this.submitButton.addEventListener("click", this.#verify.bind(this)); - this.cancelButton.addEventListener("click", this.#cancel.bind(this)); + this.cancelButton.addEventListener("click", this.close.bind(this)); this.input.addEventListener("keydown", e => { if (e.keyCode === 13) { this.#verify(); } }); this.overlayManager.register(this.dialog, true); this.dialog.addEventListener("close", this.#cancel.bind(this)); } async open() { - await this.overlayManager.open(this.dialog); + if (this.#activeCapability) { + await this.#activeCapability.promise; + } + + this.#activeCapability = (0, _pdfjsLib.createPromiseCapability)(); + + try { + await this.overlayManager.open(this.dialog); + } catch (ex) { + this.#activeCapability = null; + throw ex; + } + const passwordIncorrect = this.#reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD; if (!this._isViewerEmbedded || passwordIncorrect) { this.input.focus(); } @@ -4676,10 +4705,11 @@ } } #cancel() { this.#invokeCallback(new Error("PasswordPrompt cancelled.")); + this.#activeCapability.resolve(); } #invokeCallback(password) { if (!this.#updateCallback) { return; @@ -4689,11 +4719,15 @@ this.input.value = ""; this.#updateCallback(password); this.#updateCallback = null; } - setUpdateCallback(updateCallback, reason) { + async setUpdateCallback(updateCallback, reason) { + if (this.#activeCapability) { + await this.#activeCapability.promise; + } + this.#updateCallback = updateCallback; this.#reason = reason; } } @@ -7213,10 +7247,11 @@ } _bindLink(element, { url, newWindow, + action, dest }) { const { linkService } = this; @@ -7224,10 +7259,21 @@ if (url) { linkService.addLinkAttributes(element, url, newWindow); return; } + if (action) { + element.href = linkService.getAnchorUrl(""); + + element.onclick = () => { + linkService.executeNamedAction(action); + return false; + }; + + return; + } + element.href = linkService.getDestinationHash(dest); element.onclick = evt => { this._updateCurrentTreeItem(evt.target.parentNode); @@ -7545,10 +7591,11 @@ this.#args.annotationEditorMode = pdfViewer.annotationEditorMode; } try { await promise; + pdfViewer.focus(); return true; } catch (reason) { this.#removeFullscreenChangeListeners(); this.#notifyStateChange(_ui_utils.PresentationModeState.NORMAL); } @@ -9782,11 +9829,11 @@ constructor(options) { if (this.constructor === BaseViewer) { throw new Error("Cannot initialize BaseViewer."); } - const viewerVersion = '2.16.71'; + const viewerVersion = '3.0.11'; if (_pdfjsLib.version !== viewerVersion) { throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`); } @@ -10959,21 +11006,19 @@ createTextLayerBuilder({ textLayerDiv, pageIndex, viewport, - enhanceTextSelection = false, eventBus, highlighter, accessibilityManager = null }) { return new _text_layer_builder.TextLayerBuilder({ textLayerDiv, eventBus, pageIndex, viewport, - enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection, highlighter, accessibilityManager }); } @@ -11966,10 +12011,11 @@ let error = null; try { await this.annotationLayer.render(this.viewport, "display"); } catch (ex) { + console.error(`_renderAnnotationLayer: "${ex}".`); error = ex; } finally { this.eventBus.dispatch("annotationlayerrendered", { source: this, pageNumber: this.id, @@ -11982,10 +12028,11 @@ let error = null; try { await this.annotationEditorLayer.render(this.viewport, "display"); } catch (ex) { + console.error(`_renderAnnotationEditorLayer: "${ex}".`); error = ex; } finally { this.eventBus.dispatch("annotationeditorlayerrendered", { source: this, pageNumber: this.id, @@ -12002,10 +12049,11 @@ if (this.textHighlighter) { this._buildXfaTextContentItems(result.textDivs); } } catch (ex) { + console.error(`_renderXfaLayer: "${ex}".`); error = ex; } finally { this.eventBus.dispatch("xfalayerrendered", { source: this, pageNumber: this.id, @@ -12376,11 +12424,10 @@ textLayer = this.textLayerFactory.createTextLayerBuilder({ textLayerDiv, pageIndex: this.id - 1, viewport: this.viewport, - enhanceTextSelection: this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, eventBus: this.eventBus, highlighter: this.textHighlighter, accessibilityManager: this._accessibilityManager }); } @@ -12488,16 +12535,14 @@ }, function (reason) { return finishPaintTask(reason); }); if (this.xfaLayerFactory) { - if (!this.xfaLayer) { - this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder({ - pageDiv: div, - pdfPage - }); - } + this.xfaLayer ||= this.xfaLayerFactory.createXfaLayerBuilder({ + pageDiv: div, + pdfPage + }); this._renderXfaLayer(); } if (this.structTreeLayerFactory && this.textLayer && this.canvas) { @@ -13276,20 +13321,17 @@ })); exports.TextLayerBuilder = void 0; var _pdfjsLib = __webpack_require__(5); -const EXPAND_DIVS_TIMEOUT = 300; - class TextLayerBuilder { constructor({ textLayerDiv, eventBus, pageIndex, viewport, highlighter = null, - enhanceTextSelection = false, accessibilityManager = null }) { this.textLayerDiv = textLayerDiv; this.eventBus = eventBus; this.textContent = null; @@ -13299,25 +13341,19 @@ this.pageNumber = pageIndex + 1; this.viewport = viewport; this.textDivs = []; this.textLayerRenderTask = null; this.highlighter = highlighter; - this.enhanceTextSelection = enhanceTextSelection; this.accessibilityManager = accessibilityManager; - - this._bindMouse(); - } - - _finishRendering() { + this.#bindMouse(); + } + + #finishRendering() { this.renderingDone = true; - - if (!this.enhanceTextSelection) { - const endOfContent = document.createElement("div"); - endOfContent.className = "endOfContent"; - this.textLayerDiv.append(endOfContent); - } - + const endOfContent = document.createElement("div"); + endOfContent.className = "endOfContent"; + this.textLayerDiv.append(endOfContent); this.eventBus.dispatch("textlayerrendered", { source: this, pageNumber: this.pageNumber, numTextDivs: this.textDivs.length }); @@ -13338,18 +13374,15 @@ textContentStream: this.textContentStream, container: textLayerFrag, viewport: this.viewport, textDivs: this.textDivs, textContentItemsStr: this.textContentItemsStr, - timeout, - enhanceTextSelection: this.enhanceTextSelection + timeout }); this.textLayerRenderTask.promise.then(() => { this.textLayerDiv.append(textLayerFrag); - - this._finishRendering(); - + this.#finishRendering(); this.highlighter?.enable(); this.accessibilityManager?.enable(); }, function (reason) {}); } @@ -13371,33 +13404,22 @@ setTextContent(textContent) { this.cancel(); this.textContent = textContent; } - _bindMouse() { + #bindMouse() { const div = this.textLayerDiv; - let expandDivsTimer = null; div.addEventListener("mousedown", evt => { - if (this.enhanceTextSelection && this.textLayerRenderTask) { - this.textLayerRenderTask.expandTextDivs(true); - return; - } - const end = div.querySelector(".endOfContent"); if (!end) { return; } end.classList.add("active"); }); div.addEventListener("mouseup", () => { - if (this.enhanceTextSelection && this.textLayerRenderTask) { - this.textLayerRenderTask.expandTextDivs(false); - return; - } - const end = div.querySelector(".endOfContent"); if (!end) { return; } @@ -13875,42 +13897,43 @@ eventName: "download" }, { element: options.viewBookmark, eventName: null }, { - element: options.editorNoneButton, - eventName: "switchannotationeditormode", - eventDetails: { - mode: _pdfjsLib.AnnotationEditorType.NONE - } - }, { element: options.editorFreeTextButton, eventName: "switchannotationeditormode", eventDetails: { - mode: _pdfjsLib.AnnotationEditorType.FREETEXT + get mode() { + const { + classList + } = options.editorFreeTextButton; + return classList.contains("toggled") ? _pdfjsLib.AnnotationEditorType.NONE : _pdfjsLib.AnnotationEditorType.FREETEXT; + } + } }, { element: options.editorInkButton, eventName: "switchannotationeditormode", eventDetails: { - mode: _pdfjsLib.AnnotationEditorType.INK + get mode() { + const { + classList + } = options.editorInkButton; + return classList.contains("toggled") ? _pdfjsLib.AnnotationEditorType.NONE : _pdfjsLib.AnnotationEditorType.INK; + } + } }]; this.items = { numPages: options.numPages, pageNumber: options.pageNumber, scaleSelect: options.scaleSelect, customScaleOption: options.customScaleOption, previous: options.previous, next: options.next, zoomIn: options.zoomIn, - zoomOut: options.zoomOut, - editorNoneButton: options.editorNoneButton, - editorFreeTextButton: options.editorFreeTextButton, - editorFreeTextParamsToolbar: options.editorFreeTextParamsToolbar, - editorInkButton: options.editorInkButton, - editorInkParamsToolbar: options.editorInkParamsToolbar + zoomOut: options.zoomOut }; this.#bindListeners(options); this.reset(); } @@ -14011,21 +14034,17 @@ this.#bindEditorToolsListener(options); } #bindEditorToolsListener({ - editorNoneButton, editorFreeTextButton, editorFreeTextParamsToolbar, editorInkButton, editorInkParamsToolbar }) { const editorModeChanged = (evt, disableButtons = false) => { const editorButtons = [{ - mode: _pdfjsLib.AnnotationEditorType.NONE, - button: editorNoneButton - }, { mode: _pdfjsLib.AnnotationEditorType.FREETEXT, button: editorFreeTextButton, toolbar: editorFreeTextParamsToolbar }, { mode: _pdfjsLib.AnnotationEditorType.INK, @@ -14040,14 +14059,11 @@ } of editorButtons) { const checked = mode === evt.mode; button.classList.toggle("toggled", checked); button.setAttribute("aria-checked", checked); button.disabled = disableButtons; - - if (toolbar) { - toolbar.classList.toggle("hidden", !checked); - } + toolbar?.classList.toggle("hidden", !checked); } }; this.eventBus._on("annotationeditormodechanged", editorModeChanged); @@ -15196,12 +15212,12 @@ var _pdf_link_service = __webpack_require__(3); var _app = __webpack_require__(4); -const pdfjsVersion = '2.16.71'; -const pdfjsBuild = '518115fdd'; +const pdfjsVersion = '3.0.11'; +const pdfjsBuild = '54d3b6449'; const AppConstants = null; exports.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplication = _app.PDFViewerApplication; window.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplicationOptions = _app_options.AppOptions; @@ -15232,11 +15248,10 @@ zoomIn: document.getElementById("zoomIn"), zoomOut: document.getElementById("zoomOut"), viewFind: document.getElementById("viewFind"), openFile: null, print: document.getElementById("print"), - editorNoneButton: document.getElementById("editorNone"), editorFreeTextButton: document.getElementById("editorFreeText"), editorFreeTextParamsToolbar: document.getElementById("editorFreeTextParamsToolbar"), editorInkButton: document.getElementById("editorInk"), editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"), presentationModeButton: document.getElementById("presentationMode"), diff --git a/toolkit/components/pdfjs/moz.yaml b/toolkit/components/pdfjs/moz.yaml --- a/toolkit/components/pdfjs/moz.yaml +++ b/toolkit/components/pdfjs/moz.yaml @@ -18,12 +18,12 @@ # Usually different from repository url url: https://github.com/mozilla/pdf.js # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: 518115fddc6db2c28752b8e9369c79377f521592 (2022-08-15T17:33:41Z). - revision: 518115fddc6db2c28752b8e9369c79377f521592 + release: 54d3b644973f91969deb7067a5c37e45f64ff535 (2022-08-31T09:18:08Z). + revision: 54d3b644973f91969deb7067a5c37e45f64ff535 # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ # Multiple licenses can be specified (as a YAML list) # A "LICENSE" file must exist containing the full license text