Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/web
File: viewer.js
if (this.#renderingDone && this.#textLayer) {
[13000] Fix | Delete
this.#textLayer.update({
[13001] Fix | Delete
viewport,
[13002] Fix | Delete
onBefore: this.hide.bind(this)
[13003] Fix | Delete
});
[13004] Fix | Delete
this.show();
[13005] Fix | Delete
return;
[13006] Fix | Delete
}
[13007] Fix | Delete
this.cancel();
[13008] Fix | Delete
this.#textLayer = new TextLayer({
[13009] Fix | Delete
textContentSource: this.pdfPage.streamTextContent(textContentParams || {
[13010] Fix | Delete
includeMarkedContent: true,
[13011] Fix | Delete
disableNormalization: true
[13012] Fix | Delete
}),
[13013] Fix | Delete
container: this.div,
[13014] Fix | Delete
viewport
[13015] Fix | Delete
});
[13016] Fix | Delete
const {
[13017] Fix | Delete
textDivs,
[13018] Fix | Delete
textContentItemsStr
[13019] Fix | Delete
} = this.#textLayer;
[13020] Fix | Delete
this.highlighter?.setTextMapping(textDivs, textContentItemsStr);
[13021] Fix | Delete
this.accessibilityManager?.setTextMapping(textDivs);
[13022] Fix | Delete
await this.#textLayer.render();
[13023] Fix | Delete
this.#finishRendering();
[13024] Fix | Delete
this.#onAppend?.(this.div);
[13025] Fix | Delete
this.highlighter?.enable();
[13026] Fix | Delete
this.accessibilityManager?.enable();
[13027] Fix | Delete
}
[13028] Fix | Delete
hide() {
[13029] Fix | Delete
if (!this.div.hidden && this.#renderingDone) {
[13030] Fix | Delete
this.highlighter?.disable();
[13031] Fix | Delete
this.div.hidden = true;
[13032] Fix | Delete
}
[13033] Fix | Delete
}
[13034] Fix | Delete
show() {
[13035] Fix | Delete
if (this.div.hidden && this.#renderingDone) {
[13036] Fix | Delete
this.div.hidden = false;
[13037] Fix | Delete
this.highlighter?.enable();
[13038] Fix | Delete
}
[13039] Fix | Delete
}
[13040] Fix | Delete
cancel() {
[13041] Fix | Delete
this.#textLayer?.cancel();
[13042] Fix | Delete
this.#textLayer = null;
[13043] Fix | Delete
this.highlighter?.disable();
[13044] Fix | Delete
this.accessibilityManager?.disable();
[13045] Fix | Delete
TextLayerBuilder.#removeGlobalSelectionListener(this.div);
[13046] Fix | Delete
}
[13047] Fix | Delete
#bindMouse(end) {
[13048] Fix | Delete
const {
[13049] Fix | Delete
div
[13050] Fix | Delete
} = this;
[13051] Fix | Delete
div.addEventListener("mousedown", evt => {
[13052] Fix | Delete
end.classList.add("active");
[13053] Fix | Delete
});
[13054] Fix | Delete
div.addEventListener("copy", event => {
[13055] Fix | Delete
if (!this.#enablePermissions) {
[13056] Fix | Delete
const selection = document.getSelection();
[13057] Fix | Delete
event.clipboardData.setData("text/plain", removeNullCharacters(normalizeUnicode(selection.toString())));
[13058] Fix | Delete
}
[13059] Fix | Delete
event.preventDefault();
[13060] Fix | Delete
event.stopPropagation();
[13061] Fix | Delete
});
[13062] Fix | Delete
TextLayerBuilder.#textLayers.set(div, end);
[13063] Fix | Delete
TextLayerBuilder.#enableGlobalSelectionListener();
[13064] Fix | Delete
}
[13065] Fix | Delete
static #removeGlobalSelectionListener(textLayerDiv) {
[13066] Fix | Delete
this.#textLayers.delete(textLayerDiv);
[13067] Fix | Delete
if (this.#textLayers.size === 0) {
[13068] Fix | Delete
this.#selectionChangeAbortController?.abort();
[13069] Fix | Delete
this.#selectionChangeAbortController = null;
[13070] Fix | Delete
}
[13071] Fix | Delete
}
[13072] Fix | Delete
static #enableGlobalSelectionListener() {
[13073] Fix | Delete
if (this.#selectionChangeAbortController) {
[13074] Fix | Delete
return;
[13075] Fix | Delete
}
[13076] Fix | Delete
this.#selectionChangeAbortController = new AbortController();
[13077] Fix | Delete
const {
[13078] Fix | Delete
signal
[13079] Fix | Delete
} = this.#selectionChangeAbortController;
[13080] Fix | Delete
const reset = (end, textLayer) => {
[13081] Fix | Delete
textLayer.append(end);
[13082] Fix | Delete
end.style.width = "";
[13083] Fix | Delete
end.style.height = "";
[13084] Fix | Delete
end.classList.remove("active");
[13085] Fix | Delete
};
[13086] Fix | Delete
document.addEventListener("pointerup", () => {
[13087] Fix | Delete
this.#textLayers.forEach(reset);
[13088] Fix | Delete
}, {
[13089] Fix | Delete
signal
[13090] Fix | Delete
});
[13091] Fix | Delete
var isFirefox, prevRange;
[13092] Fix | Delete
document.addEventListener("selectionchange", () => {
[13093] Fix | Delete
const selection = document.getSelection();
[13094] Fix | Delete
if (selection.rangeCount === 0) {
[13095] Fix | Delete
this.#textLayers.forEach(reset);
[13096] Fix | Delete
return;
[13097] Fix | Delete
}
[13098] Fix | Delete
const activeTextLayers = new Set();
[13099] Fix | Delete
for (let i = 0; i < selection.rangeCount; i++) {
[13100] Fix | Delete
const range = selection.getRangeAt(i);
[13101] Fix | Delete
for (const textLayerDiv of this.#textLayers.keys()) {
[13102] Fix | Delete
if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) {
[13103] Fix | Delete
activeTextLayers.add(textLayerDiv);
[13104] Fix | Delete
}
[13105] Fix | Delete
}
[13106] Fix | Delete
}
[13107] Fix | Delete
for (const [textLayerDiv, endDiv] of this.#textLayers) {
[13108] Fix | Delete
if (activeTextLayers.has(textLayerDiv)) {
[13109] Fix | Delete
endDiv.classList.add("active");
[13110] Fix | Delete
} else {
[13111] Fix | Delete
reset(endDiv, textLayerDiv);
[13112] Fix | Delete
}
[13113] Fix | Delete
}
[13114] Fix | Delete
isFirefox ??= getComputedStyle(this.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none";
[13115] Fix | Delete
if (isFirefox) {
[13116] Fix | Delete
return;
[13117] Fix | Delete
}
[13118] Fix | Delete
const range = selection.getRangeAt(0);
[13119] Fix | Delete
const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);
[13120] Fix | Delete
let anchor = modifyStart ? range.startContainer : range.endContainer;
[13121] Fix | Delete
if (anchor.nodeType === Node.TEXT_NODE) {
[13122] Fix | Delete
anchor = anchor.parentNode;
[13123] Fix | Delete
}
[13124] Fix | Delete
const parentTextLayer = anchor.parentElement.closest(".textLayer");
[13125] Fix | Delete
const endDiv = this.#textLayers.get(parentTextLayer);
[13126] Fix | Delete
if (endDiv) {
[13127] Fix | Delete
endDiv.style.width = parentTextLayer.style.width;
[13128] Fix | Delete
endDiv.style.height = parentTextLayer.style.height;
[13129] Fix | Delete
anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling);
[13130] Fix | Delete
}
[13131] Fix | Delete
prevRange = range.cloneRange();
[13132] Fix | Delete
}, {
[13133] Fix | Delete
signal
[13134] Fix | Delete
});
[13135] Fix | Delete
}
[13136] Fix | Delete
}
[13137] Fix | Delete
[13138] Fix | Delete
;// CONCATENATED MODULE: ./web/pdf_page_view.js
[13139] Fix | Delete
[13140] Fix | Delete
[13141] Fix | Delete
[13142] Fix | Delete
[13143] Fix | Delete
[13144] Fix | Delete
[13145] Fix | Delete
[13146] Fix | Delete
[13147] Fix | Delete
[13148] Fix | Delete
[13149] Fix | Delete
[13150] Fix | Delete
[13151] Fix | Delete
[13152] Fix | Delete
[13153] Fix | Delete
const DEFAULT_LAYER_PROPERTIES = null;
[13154] Fix | Delete
const LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotationLayer", 2], ["annotationEditorLayer", 3], ["xfaLayer", 3]]);
[13155] Fix | Delete
class PDFPageView {
[13156] Fix | Delete
#annotationMode = AnnotationMode.ENABLE_FORMS;
[13157] Fix | Delete
#hasRestrictedScaling = false;
[13158] Fix | Delete
#layerProperties = null;
[13159] Fix | Delete
#loadingId = null;
[13160] Fix | Delete
#previousRotation = null;
[13161] Fix | Delete
#renderError = null;
[13162] Fix | Delete
#renderingState = RenderingStates.INITIAL;
[13163] Fix | Delete
#textLayerMode = TextLayerMode.ENABLE;
[13164] Fix | Delete
#useThumbnailCanvas = {
[13165] Fix | Delete
directDrawing: true,
[13166] Fix | Delete
initialOptionalContent: true,
[13167] Fix | Delete
regularAnnotations: true
[13168] Fix | Delete
};
[13169] Fix | Delete
#viewportMap = new WeakMap();
[13170] Fix | Delete
#layers = [null, null, null, null];
[13171] Fix | Delete
constructor(options) {
[13172] Fix | Delete
const container = options.container;
[13173] Fix | Delete
const defaultViewport = options.defaultViewport;
[13174] Fix | Delete
this.id = options.id;
[13175] Fix | Delete
this.renderingId = "page" + this.id;
[13176] Fix | Delete
this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;
[13177] Fix | Delete
this.pdfPage = null;
[13178] Fix | Delete
this.pageLabel = null;
[13179] Fix | Delete
this.rotation = 0;
[13180] Fix | Delete
this.scale = options.scale || DEFAULT_SCALE;
[13181] Fix | Delete
this.viewport = defaultViewport;
[13182] Fix | Delete
this.pdfPageRotate = defaultViewport.rotation;
[13183] Fix | Delete
this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
[13184] Fix | Delete
this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;
[13185] Fix | Delete
this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS;
[13186] Fix | Delete
this.imageResourcesPath = options.imageResourcesPath || "";
[13187] Fix | Delete
this.maxCanvasPixels = options.maxCanvasPixels ?? AppOptions.get("maxCanvasPixels");
[13188] Fix | Delete
this.pageColors = options.pageColors || null;
[13189] Fix | Delete
this.eventBus = options.eventBus;
[13190] Fix | Delete
this.renderingQueue = options.renderingQueue;
[13191] Fix | Delete
this.l10n = options.l10n;
[13192] Fix | Delete
this.l10n ||= new genericl10n_GenericL10n();
[13193] Fix | Delete
this.renderTask = null;
[13194] Fix | Delete
this.resume = null;
[13195] Fix | Delete
this._isStandalone = !this.renderingQueue?.hasViewer();
[13196] Fix | Delete
this._container = container;
[13197] Fix | Delete
this._annotationCanvasMap = null;
[13198] Fix | Delete
this.annotationLayer = null;
[13199] Fix | Delete
this.annotationEditorLayer = null;
[13200] Fix | Delete
this.textLayer = null;
[13201] Fix | Delete
this.zoomLayer = null;
[13202] Fix | Delete
this.xfaLayer = null;
[13203] Fix | Delete
this.structTreeLayer = null;
[13204] Fix | Delete
this.drawLayer = null;
[13205] Fix | Delete
const div = document.createElement("div");
[13206] Fix | Delete
div.className = "page";
[13207] Fix | Delete
div.setAttribute("data-page-number", this.id);
[13208] Fix | Delete
div.setAttribute("role", "region");
[13209] Fix | Delete
div.setAttribute("data-l10n-id", "pdfjs-page-landmark");
[13210] Fix | Delete
div.setAttribute("data-l10n-args", JSON.stringify({
[13211] Fix | Delete
page: this.id
[13212] Fix | Delete
}));
[13213] Fix | Delete
this.div = div;
[13214] Fix | Delete
this.#setDimensions();
[13215] Fix | Delete
container?.append(div);
[13216] Fix | Delete
if (this._isStandalone) {
[13217] Fix | Delete
container?.style.setProperty("--scale-factor", this.scale * PixelsPerInch.PDF_TO_CSS_UNITS);
[13218] Fix | Delete
const {
[13219] Fix | Delete
optionalContentConfigPromise
[13220] Fix | Delete
} = options;
[13221] Fix | Delete
if (optionalContentConfigPromise) {
[13222] Fix | Delete
optionalContentConfigPromise.then(optionalContentConfig => {
[13223] Fix | Delete
if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
[13224] Fix | Delete
return;
[13225] Fix | Delete
}
[13226] Fix | Delete
this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
[13227] Fix | Delete
});
[13228] Fix | Delete
}
[13229] Fix | Delete
if (!options.l10n) {
[13230] Fix | Delete
this.l10n.translate(this.div);
[13231] Fix | Delete
}
[13232] Fix | Delete
}
[13233] Fix | Delete
}
[13234] Fix | Delete
#addLayer(div, name) {
[13235] Fix | Delete
const pos = LAYERS_ORDER.get(name);
[13236] Fix | Delete
const oldDiv = this.#layers[pos];
[13237] Fix | Delete
this.#layers[pos] = div;
[13238] Fix | Delete
if (oldDiv) {
[13239] Fix | Delete
oldDiv.replaceWith(div);
[13240] Fix | Delete
return;
[13241] Fix | Delete
}
[13242] Fix | Delete
for (let i = pos - 1; i >= 0; i--) {
[13243] Fix | Delete
const layer = this.#layers[i];
[13244] Fix | Delete
if (layer) {
[13245] Fix | Delete
layer.after(div);
[13246] Fix | Delete
return;
[13247] Fix | Delete
}
[13248] Fix | Delete
}
[13249] Fix | Delete
this.div.prepend(div);
[13250] Fix | Delete
}
[13251] Fix | Delete
get renderingState() {
[13252] Fix | Delete
return this.#renderingState;
[13253] Fix | Delete
}
[13254] Fix | Delete
set renderingState(state) {
[13255] Fix | Delete
if (state === this.#renderingState) {
[13256] Fix | Delete
return;
[13257] Fix | Delete
}
[13258] Fix | Delete
this.#renderingState = state;
[13259] Fix | Delete
if (this.#loadingId) {
[13260] Fix | Delete
clearTimeout(this.#loadingId);
[13261] Fix | Delete
this.#loadingId = null;
[13262] Fix | Delete
}
[13263] Fix | Delete
switch (state) {
[13264] Fix | Delete
case RenderingStates.PAUSED:
[13265] Fix | Delete
this.div.classList.remove("loading");
[13266] Fix | Delete
break;
[13267] Fix | Delete
case RenderingStates.RUNNING:
[13268] Fix | Delete
this.div.classList.add("loadingIcon");
[13269] Fix | Delete
this.#loadingId = setTimeout(() => {
[13270] Fix | Delete
this.div.classList.add("loading");
[13271] Fix | Delete
this.#loadingId = null;
[13272] Fix | Delete
}, 0);
[13273] Fix | Delete
break;
[13274] Fix | Delete
case RenderingStates.INITIAL:
[13275] Fix | Delete
case RenderingStates.FINISHED:
[13276] Fix | Delete
this.div.classList.remove("loadingIcon", "loading");
[13277] Fix | Delete
break;
[13278] Fix | Delete
}
[13279] Fix | Delete
}
[13280] Fix | Delete
#setDimensions() {
[13281] Fix | Delete
const {
[13282] Fix | Delete
viewport
[13283] Fix | Delete
} = this;
[13284] Fix | Delete
if (this.pdfPage) {
[13285] Fix | Delete
if (this.#previousRotation === viewport.rotation) {
[13286] Fix | Delete
return;
[13287] Fix | Delete
}
[13288] Fix | Delete
this.#previousRotation = viewport.rotation;
[13289] Fix | Delete
}
[13290] Fix | Delete
setLayerDimensions(this.div, viewport, true, false);
[13291] Fix | Delete
}
[13292] Fix | Delete
setPdfPage(pdfPage) {
[13293] Fix | Delete
if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) {
[13294] Fix | Delete
this._container?.style.setProperty("--hcm-highlight-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight"));
[13295] Fix | Delete
this._container?.style.setProperty("--hcm-highlight-selected-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "Highlight"));
[13296] Fix | Delete
}
[13297] Fix | Delete
this.pdfPage = pdfPage;
[13298] Fix | Delete
this.pdfPageRotate = pdfPage.rotate;
[13299] Fix | Delete
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
[13300] Fix | Delete
this.viewport = pdfPage.getViewport({
[13301] Fix | Delete
scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,
[13302] Fix | Delete
rotation: totalRotation
[13303] Fix | Delete
});
[13304] Fix | Delete
this.#setDimensions();
[13305] Fix | Delete
this.reset();
[13306] Fix | Delete
}
[13307] Fix | Delete
destroy() {
[13308] Fix | Delete
this.reset();
[13309] Fix | Delete
this.pdfPage?.cleanup();
[13310] Fix | Delete
}
[13311] Fix | Delete
get _textHighlighter() {
[13312] Fix | Delete
return shadow(this, "_textHighlighter", new TextHighlighter({
[13313] Fix | Delete
pageIndex: this.id - 1,
[13314] Fix | Delete
eventBus: this.eventBus,
[13315] Fix | Delete
findController: this.#layerProperties.findController
[13316] Fix | Delete
}));
[13317] Fix | Delete
}
[13318] Fix | Delete
#dispatchLayerRendered(name, error) {
[13319] Fix | Delete
this.eventBus.dispatch(name, {
[13320] Fix | Delete
source: this,
[13321] Fix | Delete
pageNumber: this.id,
[13322] Fix | Delete
error
[13323] Fix | Delete
});
[13324] Fix | Delete
}
[13325] Fix | Delete
async #renderAnnotationLayer() {
[13326] Fix | Delete
let error = null;
[13327] Fix | Delete
try {
[13328] Fix | Delete
await this.annotationLayer.render(this.viewport, "display");
[13329] Fix | Delete
} catch (ex) {
[13330] Fix | Delete
console.error(`#renderAnnotationLayer: "${ex}".`);
[13331] Fix | Delete
error = ex;
[13332] Fix | Delete
} finally {
[13333] Fix | Delete
this.#dispatchLayerRendered("annotationlayerrendered", error);
[13334] Fix | Delete
}
[13335] Fix | Delete
}
[13336] Fix | Delete
async #renderAnnotationEditorLayer() {
[13337] Fix | Delete
let error = null;
[13338] Fix | Delete
try {
[13339] Fix | Delete
await this.annotationEditorLayer.render(this.viewport, "display");
[13340] Fix | Delete
} catch (ex) {
[13341] Fix | Delete
console.error(`#renderAnnotationEditorLayer: "${ex}".`);
[13342] Fix | Delete
error = ex;
[13343] Fix | Delete
} finally {
[13344] Fix | Delete
this.#dispatchLayerRendered("annotationeditorlayerrendered", error);
[13345] Fix | Delete
}
[13346] Fix | Delete
}
[13347] Fix | Delete
async #renderDrawLayer() {
[13348] Fix | Delete
try {
[13349] Fix | Delete
await this.drawLayer.render("display");
[13350] Fix | Delete
} catch (ex) {
[13351] Fix | Delete
console.error(`#renderDrawLayer: "${ex}".`);
[13352] Fix | Delete
}
[13353] Fix | Delete
}
[13354] Fix | Delete
async #renderXfaLayer() {
[13355] Fix | Delete
let error = null;
[13356] Fix | Delete
try {
[13357] Fix | Delete
const result = await this.xfaLayer.render(this.viewport, "display");
[13358] Fix | Delete
if (result?.textDivs && this._textHighlighter) {
[13359] Fix | Delete
this.#buildXfaTextContentItems(result.textDivs);
[13360] Fix | Delete
}
[13361] Fix | Delete
} catch (ex) {
[13362] Fix | Delete
console.error(`#renderXfaLayer: "${ex}".`);
[13363] Fix | Delete
error = ex;
[13364] Fix | Delete
} finally {
[13365] Fix | Delete
if (this.xfaLayer?.div) {
[13366] Fix | Delete
this.l10n.pause();
[13367] Fix | Delete
this.#addLayer(this.xfaLayer.div, "xfaLayer");
[13368] Fix | Delete
this.l10n.resume();
[13369] Fix | Delete
}
[13370] Fix | Delete
this.#dispatchLayerRendered("xfalayerrendered", error);
[13371] Fix | Delete
}
[13372] Fix | Delete
}
[13373] Fix | Delete
async #renderTextLayer() {
[13374] Fix | Delete
if (!this.textLayer) {
[13375] Fix | Delete
return;
[13376] Fix | Delete
}
[13377] Fix | Delete
let error = null;
[13378] Fix | Delete
try {
[13379] Fix | Delete
await this.textLayer.render(this.viewport);
[13380] Fix | Delete
} catch (ex) {
[13381] Fix | Delete
if (ex instanceof AbortException) {
[13382] Fix | Delete
return;
[13383] Fix | Delete
}
[13384] Fix | Delete
console.error(`#renderTextLayer: "${ex}".`);
[13385] Fix | Delete
error = ex;
[13386] Fix | Delete
}
[13387] Fix | Delete
this.#dispatchLayerRendered("textlayerrendered", error);
[13388] Fix | Delete
this.#renderStructTreeLayer();
[13389] Fix | Delete
}
[13390] Fix | Delete
async #renderStructTreeLayer() {
[13391] Fix | Delete
if (!this.textLayer) {
[13392] Fix | Delete
return;
[13393] Fix | Delete
}
[13394] Fix | Delete
this.structTreeLayer ||= new StructTreeLayerBuilder();
[13395] Fix | Delete
const tree = await (!this.structTreeLayer.renderingDone ? this.pdfPage.getStructTree() : null);
[13396] Fix | Delete
const treeDom = this.structTreeLayer?.render(tree);
[13397] Fix | Delete
if (treeDom) {
[13398] Fix | Delete
this.l10n.pause();
[13399] Fix | Delete
this.canvas?.append(treeDom);
[13400] Fix | Delete
this.l10n.resume();
[13401] Fix | Delete
}
[13402] Fix | Delete
this.structTreeLayer?.show();
[13403] Fix | Delete
}
[13404] Fix | Delete
async #buildXfaTextContentItems(textDivs) {
[13405] Fix | Delete
const text = await this.pdfPage.getTextContent();
[13406] Fix | Delete
const items = [];
[13407] Fix | Delete
for (const item of text.items) {
[13408] Fix | Delete
items.push(item.str);
[13409] Fix | Delete
}
[13410] Fix | Delete
this._textHighlighter.setTextMapping(textDivs, items);
[13411] Fix | Delete
this._textHighlighter.enable();
[13412] Fix | Delete
}
[13413] Fix | Delete
_resetZoomLayer(removeFromDOM = false) {
[13414] Fix | Delete
if (!this.zoomLayer) {
[13415] Fix | Delete
return;
[13416] Fix | Delete
}
[13417] Fix | Delete
const zoomLayerCanvas = this.zoomLayer.firstChild;
[13418] Fix | Delete
this.#viewportMap.delete(zoomLayerCanvas);
[13419] Fix | Delete
zoomLayerCanvas.width = 0;
[13420] Fix | Delete
zoomLayerCanvas.height = 0;
[13421] Fix | Delete
if (removeFromDOM) {
[13422] Fix | Delete
this.zoomLayer.remove();
[13423] Fix | Delete
}
[13424] Fix | Delete
this.zoomLayer = null;
[13425] Fix | Delete
}
[13426] Fix | Delete
reset({
[13427] Fix | Delete
keepZoomLayer = false,
[13428] Fix | Delete
keepAnnotationLayer = false,
[13429] Fix | Delete
keepAnnotationEditorLayer = false,
[13430] Fix | Delete
keepXfaLayer = false,
[13431] Fix | Delete
keepTextLayer = false
[13432] Fix | Delete
} = {}) {
[13433] Fix | Delete
this.cancelRendering({
[13434] Fix | Delete
keepAnnotationLayer,
[13435] Fix | Delete
keepAnnotationEditorLayer,
[13436] Fix | Delete
keepXfaLayer,
[13437] Fix | Delete
keepTextLayer
[13438] Fix | Delete
});
[13439] Fix | Delete
this.renderingState = RenderingStates.INITIAL;
[13440] Fix | Delete
const div = this.div;
[13441] Fix | Delete
const childNodes = div.childNodes,
[13442] Fix | Delete
zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
[13443] Fix | Delete
annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null,
[13444] Fix | Delete
annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null,
[13445] Fix | Delete
xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null,
[13446] Fix | Delete
textLayerNode = keepTextLayer && this.textLayer?.div || null;
[13447] Fix | Delete
for (let i = childNodes.length - 1; i >= 0; i--) {
[13448] Fix | Delete
const node = childNodes[i];
[13449] Fix | Delete
switch (node) {
[13450] Fix | Delete
case zoomLayerNode:
[13451] Fix | Delete
case annotationLayerNode:
[13452] Fix | Delete
case annotationEditorLayerNode:
[13453] Fix | Delete
case xfaLayerNode:
[13454] Fix | Delete
case textLayerNode:
[13455] Fix | Delete
continue;
[13456] Fix | Delete
}
[13457] Fix | Delete
node.remove();
[13458] Fix | Delete
const layerIndex = this.#layers.indexOf(node);
[13459] Fix | Delete
if (layerIndex >= 0) {
[13460] Fix | Delete
this.#layers[layerIndex] = null;
[13461] Fix | Delete
}
[13462] Fix | Delete
}
[13463] Fix | Delete
div.removeAttribute("data-loaded");
[13464] Fix | Delete
if (annotationLayerNode) {
[13465] Fix | Delete
this.annotationLayer.hide();
[13466] Fix | Delete
}
[13467] Fix | Delete
if (annotationEditorLayerNode) {
[13468] Fix | Delete
this.annotationEditorLayer.hide();
[13469] Fix | Delete
}
[13470] Fix | Delete
if (xfaLayerNode) {
[13471] Fix | Delete
this.xfaLayer.hide();
[13472] Fix | Delete
}
[13473] Fix | Delete
if (textLayerNode) {
[13474] Fix | Delete
this.textLayer.hide();
[13475] Fix | Delete
}
[13476] Fix | Delete
this.structTreeLayer?.hide();
[13477] Fix | Delete
if (!zoomLayerNode) {
[13478] Fix | Delete
if (this.canvas) {
[13479] Fix | Delete
this.#viewportMap.delete(this.canvas);
[13480] Fix | Delete
this.canvas.width = 0;
[13481] Fix | Delete
this.canvas.height = 0;
[13482] Fix | Delete
delete this.canvas;
[13483] Fix | Delete
}
[13484] Fix | Delete
this._resetZoomLayer();
[13485] Fix | Delete
}
[13486] Fix | Delete
}
[13487] Fix | Delete
update({
[13488] Fix | Delete
scale = 0,
[13489] Fix | Delete
rotation = null,
[13490] Fix | Delete
optionalContentConfigPromise = null,
[13491] Fix | Delete
drawingDelay = -1
[13492] Fix | Delete
}) {
[13493] Fix | Delete
this.scale = scale || this.scale;
[13494] Fix | Delete
if (typeof rotation === "number") {
[13495] Fix | Delete
this.rotation = rotation;
[13496] Fix | Delete
}
[13497] Fix | Delete
if (optionalContentConfigPromise instanceof Promise) {
[13498] Fix | Delete
this._optionalContentConfigPromise = optionalContentConfigPromise;
[13499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function