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
length
[7000] Fix | Delete
} = await pdfDocument.getDownloadInfo();
[7001] Fix | Delete
contentLength = length;
[7002] Fix | Delete
}
[7003] Fix | Delete
return {
[7004] Fix | Delete
...info,
[7005] Fix | Delete
baseURL: baseUrl,
[7006] Fix | Delete
filesize: contentLength,
[7007] Fix | Delete
filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
[7008] Fix | Delete
metadata: metadata?.getRaw(),
[7009] Fix | Delete
authors: metadata?.get("dc:creator"),
[7010] Fix | Delete
numPages: pdfDocument.numPages,
[7011] Fix | Delete
URL: url
[7012] Fix | Delete
};
[7013] Fix | Delete
}
[7014] Fix | Delete
class GenericScripting {
[7015] Fix | Delete
constructor(sandboxBundleSrc) {
[7016] Fix | Delete
this._ready = new Promise((resolve, reject) => {
[7017] Fix | Delete
const sandbox = import( /*webpackIgnore: true*/sandboxBundleSrc);
[7018] Fix | Delete
sandbox.then(pdfjsSandbox => {
[7019] Fix | Delete
resolve(pdfjsSandbox.QuickJSSandbox());
[7020] Fix | Delete
}).catch(reject);
[7021] Fix | Delete
});
[7022] Fix | Delete
}
[7023] Fix | Delete
async createSandbox(data) {
[7024] Fix | Delete
const sandbox = await this._ready;
[7025] Fix | Delete
sandbox.create(data);
[7026] Fix | Delete
}
[7027] Fix | Delete
async dispatchEventInSandbox(event) {
[7028] Fix | Delete
const sandbox = await this._ready;
[7029] Fix | Delete
setTimeout(() => sandbox.dispatchEvent(event), 0);
[7030] Fix | Delete
}
[7031] Fix | Delete
async destroySandbox() {
[7032] Fix | Delete
const sandbox = await this._ready;
[7033] Fix | Delete
sandbox.nukeSandbox();
[7034] Fix | Delete
}
[7035] Fix | Delete
}
[7036] Fix | Delete
[7037] Fix | Delete
;// CONCATENATED MODULE: ./web/genericcom.js
[7038] Fix | Delete
[7039] Fix | Delete
[7040] Fix | Delete
[7041] Fix | Delete
[7042] Fix | Delete
[7043] Fix | Delete
[7044] Fix | Delete
function initCom(app) {}
[7045] Fix | Delete
class Preferences extends BasePreferences {
[7046] Fix | Delete
async _writeToStorage(prefObj) {
[7047] Fix | Delete
localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));
[7048] Fix | Delete
}
[7049] Fix | Delete
async _readFromStorage(prefObj) {
[7050] Fix | Delete
return {
[7051] Fix | Delete
prefs: JSON.parse(localStorage.getItem("pdfjs.preferences"))
[7052] Fix | Delete
};
[7053] Fix | Delete
}
[7054] Fix | Delete
}
[7055] Fix | Delete
class ExternalServices extends BaseExternalServices {
[7056] Fix | Delete
async createL10n() {
[7057] Fix | Delete
return new genericl10n_GenericL10n(AppOptions.get("locale"));
[7058] Fix | Delete
}
[7059] Fix | Delete
createScripting() {
[7060] Fix | Delete
return new GenericScripting(AppOptions.get("sandboxBundleSrc"));
[7061] Fix | Delete
}
[7062] Fix | Delete
}
[7063] Fix | Delete
class MLManager {
[7064] Fix | Delete
async guess() {
[7065] Fix | Delete
return null;
[7066] Fix | Delete
}
[7067] Fix | Delete
}
[7068] Fix | Delete
[7069] Fix | Delete
;// CONCATENATED MODULE: ./web/alt_text_manager.js
[7070] Fix | Delete
[7071] Fix | Delete
class AltTextManager {
[7072] Fix | Delete
#boundUpdateUIState = this.#updateUIState.bind(this);
[7073] Fix | Delete
#boundSetPosition = this.#setPosition.bind(this);
[7074] Fix | Delete
#boundOnClick = this.#onClick.bind(this);
[7075] Fix | Delete
#currentEditor = null;
[7076] Fix | Delete
#cancelButton;
[7077] Fix | Delete
#dialog;
[7078] Fix | Delete
#eventBus;
[7079] Fix | Delete
#hasUsedPointer = false;
[7080] Fix | Delete
#optionDescription;
[7081] Fix | Delete
#optionDecorative;
[7082] Fix | Delete
#overlayManager;
[7083] Fix | Delete
#saveButton;
[7084] Fix | Delete
#textarea;
[7085] Fix | Delete
#uiManager;
[7086] Fix | Delete
#previousAltText = null;
[7087] Fix | Delete
#svgElement = null;
[7088] Fix | Delete
#rectElement = null;
[7089] Fix | Delete
#container;
[7090] Fix | Delete
#telemetryData = null;
[7091] Fix | Delete
constructor({
[7092] Fix | Delete
dialog,
[7093] Fix | Delete
optionDescription,
[7094] Fix | Delete
optionDecorative,
[7095] Fix | Delete
textarea,
[7096] Fix | Delete
cancelButton,
[7097] Fix | Delete
saveButton
[7098] Fix | Delete
}, container, overlayManager, eventBus) {
[7099] Fix | Delete
this.#dialog = dialog;
[7100] Fix | Delete
this.#optionDescription = optionDescription;
[7101] Fix | Delete
this.#optionDecorative = optionDecorative;
[7102] Fix | Delete
this.#textarea = textarea;
[7103] Fix | Delete
this.#cancelButton = cancelButton;
[7104] Fix | Delete
this.#saveButton = saveButton;
[7105] Fix | Delete
this.#overlayManager = overlayManager;
[7106] Fix | Delete
this.#eventBus = eventBus;
[7107] Fix | Delete
this.#container = container;
[7108] Fix | Delete
dialog.addEventListener("close", this.#close.bind(this));
[7109] Fix | Delete
dialog.addEventListener("contextmenu", event => {
[7110] Fix | Delete
if (event.target !== this.#textarea) {
[7111] Fix | Delete
event.preventDefault();
[7112] Fix | Delete
}
[7113] Fix | Delete
});
[7114] Fix | Delete
cancelButton.addEventListener("click", this.#finish.bind(this));
[7115] Fix | Delete
saveButton.addEventListener("click", this.#save.bind(this));
[7116] Fix | Delete
optionDescription.addEventListener("change", this.#boundUpdateUIState);
[7117] Fix | Delete
optionDecorative.addEventListener("change", this.#boundUpdateUIState);
[7118] Fix | Delete
this.#overlayManager.register(dialog);
[7119] Fix | Delete
}
[7120] Fix | Delete
get _elements() {
[7121] Fix | Delete
return shadow(this, "_elements", [this.#optionDescription, this.#optionDecorative, this.#textarea, this.#saveButton, this.#cancelButton]);
[7122] Fix | Delete
}
[7123] Fix | Delete
#createSVGElement() {
[7124] Fix | Delete
if (this.#svgElement) {
[7125] Fix | Delete
return;
[7126] Fix | Delete
}
[7127] Fix | Delete
const svgFactory = new DOMSVGFactory();
[7128] Fix | Delete
const svg = this.#svgElement = svgFactory.createElement("svg");
[7129] Fix | Delete
svg.setAttribute("width", "0");
[7130] Fix | Delete
svg.setAttribute("height", "0");
[7131] Fix | Delete
const defs = svgFactory.createElement("defs");
[7132] Fix | Delete
svg.append(defs);
[7133] Fix | Delete
const mask = svgFactory.createElement("mask");
[7134] Fix | Delete
defs.append(mask);
[7135] Fix | Delete
mask.setAttribute("id", "alttext-manager-mask");
[7136] Fix | Delete
mask.setAttribute("maskContentUnits", "objectBoundingBox");
[7137] Fix | Delete
let rect = svgFactory.createElement("rect");
[7138] Fix | Delete
mask.append(rect);
[7139] Fix | Delete
rect.setAttribute("fill", "white");
[7140] Fix | Delete
rect.setAttribute("width", "1");
[7141] Fix | Delete
rect.setAttribute("height", "1");
[7142] Fix | Delete
rect.setAttribute("x", "0");
[7143] Fix | Delete
rect.setAttribute("y", "0");
[7144] Fix | Delete
rect = this.#rectElement = svgFactory.createElement("rect");
[7145] Fix | Delete
mask.append(rect);
[7146] Fix | Delete
rect.setAttribute("fill", "black");
[7147] Fix | Delete
this.#dialog.append(svg);
[7148] Fix | Delete
}
[7149] Fix | Delete
async editAltText(uiManager, editor) {
[7150] Fix | Delete
if (this.#currentEditor || !editor) {
[7151] Fix | Delete
return;
[7152] Fix | Delete
}
[7153] Fix | Delete
this.#createSVGElement();
[7154] Fix | Delete
this.#hasUsedPointer = false;
[7155] Fix | Delete
for (const element of this._elements) {
[7156] Fix | Delete
element.addEventListener("click", this.#boundOnClick);
[7157] Fix | Delete
}
[7158] Fix | Delete
const {
[7159] Fix | Delete
altText,
[7160] Fix | Delete
decorative
[7161] Fix | Delete
} = editor.altTextData;
[7162] Fix | Delete
if (decorative === true) {
[7163] Fix | Delete
this.#optionDecorative.checked = true;
[7164] Fix | Delete
this.#optionDescription.checked = false;
[7165] Fix | Delete
} else {
[7166] Fix | Delete
this.#optionDecorative.checked = false;
[7167] Fix | Delete
this.#optionDescription.checked = true;
[7168] Fix | Delete
}
[7169] Fix | Delete
this.#previousAltText = this.#textarea.value = altText?.trim() || "";
[7170] Fix | Delete
this.#updateUIState();
[7171] Fix | Delete
this.#currentEditor = editor;
[7172] Fix | Delete
this.#uiManager = uiManager;
[7173] Fix | Delete
this.#uiManager.removeEditListeners();
[7174] Fix | Delete
this.#eventBus._on("resize", this.#boundSetPosition);
[7175] Fix | Delete
try {
[7176] Fix | Delete
await this.#overlayManager.open(this.#dialog);
[7177] Fix | Delete
this.#setPosition();
[7178] Fix | Delete
} catch (ex) {
[7179] Fix | Delete
this.#close();
[7180] Fix | Delete
throw ex;
[7181] Fix | Delete
}
[7182] Fix | Delete
}
[7183] Fix | Delete
#setPosition() {
[7184] Fix | Delete
if (!this.#currentEditor) {
[7185] Fix | Delete
return;
[7186] Fix | Delete
}
[7187] Fix | Delete
const dialog = this.#dialog;
[7188] Fix | Delete
const {
[7189] Fix | Delete
style
[7190] Fix | Delete
} = dialog;
[7191] Fix | Delete
const {
[7192] Fix | Delete
x: containerX,
[7193] Fix | Delete
y: containerY,
[7194] Fix | Delete
width: containerW,
[7195] Fix | Delete
height: containerH
[7196] Fix | Delete
} = this.#container.getBoundingClientRect();
[7197] Fix | Delete
const {
[7198] Fix | Delete
innerWidth: windowW,
[7199] Fix | Delete
innerHeight: windowH
[7200] Fix | Delete
} = window;
[7201] Fix | Delete
const {
[7202] Fix | Delete
width: dialogW,
[7203] Fix | Delete
height: dialogH
[7204] Fix | Delete
} = dialog.getBoundingClientRect();
[7205] Fix | Delete
const {
[7206] Fix | Delete
x,
[7207] Fix | Delete
y,
[7208] Fix | Delete
width,
[7209] Fix | Delete
height
[7210] Fix | Delete
} = this.#currentEditor.getClientDimensions();
[7211] Fix | Delete
const MARGIN = 10;
[7212] Fix | Delete
const isLTR = this.#uiManager.direction === "ltr";
[7213] Fix | Delete
const xs = Math.max(x, containerX);
[7214] Fix | Delete
const xe = Math.min(x + width, containerX + containerW);
[7215] Fix | Delete
const ys = Math.max(y, containerY);
[7216] Fix | Delete
const ye = Math.min(y + height, containerY + containerH);
[7217] Fix | Delete
this.#rectElement.setAttribute("width", `${(xe - xs) / windowW}`);
[7218] Fix | Delete
this.#rectElement.setAttribute("height", `${(ye - ys) / windowH}`);
[7219] Fix | Delete
this.#rectElement.setAttribute("x", `${xs / windowW}`);
[7220] Fix | Delete
this.#rectElement.setAttribute("y", `${ys / windowH}`);
[7221] Fix | Delete
let left = null;
[7222] Fix | Delete
let top = Math.max(y, 0);
[7223] Fix | Delete
top += Math.min(windowH - (top + dialogH), 0);
[7224] Fix | Delete
if (isLTR) {
[7225] Fix | Delete
if (x + width + MARGIN + dialogW < windowW) {
[7226] Fix | Delete
left = x + width + MARGIN;
[7227] Fix | Delete
} else if (x > dialogW + MARGIN) {
[7228] Fix | Delete
left = x - dialogW - MARGIN;
[7229] Fix | Delete
}
[7230] Fix | Delete
} else if (x > dialogW + MARGIN) {
[7231] Fix | Delete
left = x - dialogW - MARGIN;
[7232] Fix | Delete
} else if (x + width + MARGIN + dialogW < windowW) {
[7233] Fix | Delete
left = x + width + MARGIN;
[7234] Fix | Delete
}
[7235] Fix | Delete
if (left === null) {
[7236] Fix | Delete
top = null;
[7237] Fix | Delete
left = Math.max(x, 0);
[7238] Fix | Delete
left += Math.min(windowW - (left + dialogW), 0);
[7239] Fix | Delete
if (y > dialogH + MARGIN) {
[7240] Fix | Delete
top = y - dialogH - MARGIN;
[7241] Fix | Delete
} else if (y + height + MARGIN + dialogH < windowH) {
[7242] Fix | Delete
top = y + height + MARGIN;
[7243] Fix | Delete
}
[7244] Fix | Delete
}
[7245] Fix | Delete
if (top !== null) {
[7246] Fix | Delete
dialog.classList.add("positioned");
[7247] Fix | Delete
if (isLTR) {
[7248] Fix | Delete
style.left = `${left}px`;
[7249] Fix | Delete
} else {
[7250] Fix | Delete
style.right = `${windowW - left - dialogW}px`;
[7251] Fix | Delete
}
[7252] Fix | Delete
style.top = `${top}px`;
[7253] Fix | Delete
} else {
[7254] Fix | Delete
dialog.classList.remove("positioned");
[7255] Fix | Delete
style.left = "";
[7256] Fix | Delete
style.top = "";
[7257] Fix | Delete
}
[7258] Fix | Delete
}
[7259] Fix | Delete
#finish() {
[7260] Fix | Delete
if (this.#overlayManager.active === this.#dialog) {
[7261] Fix | Delete
this.#overlayManager.close(this.#dialog);
[7262] Fix | Delete
}
[7263] Fix | Delete
}
[7264] Fix | Delete
#close() {
[7265] Fix | Delete
this.#currentEditor._reportTelemetry(this.#telemetryData || {
[7266] Fix | Delete
action: "alt_text_cancel",
[7267] Fix | Delete
alt_text_keyboard: !this.#hasUsedPointer
[7268] Fix | Delete
});
[7269] Fix | Delete
this.#telemetryData = null;
[7270] Fix | Delete
this.#removeOnClickListeners();
[7271] Fix | Delete
this.#uiManager?.addEditListeners();
[7272] Fix | Delete
this.#eventBus._off("resize", this.#boundSetPosition);
[7273] Fix | Delete
this.#currentEditor.altTextFinish();
[7274] Fix | Delete
this.#currentEditor = null;
[7275] Fix | Delete
this.#uiManager = null;
[7276] Fix | Delete
}
[7277] Fix | Delete
#updateUIState() {
[7278] Fix | Delete
this.#textarea.disabled = this.#optionDecorative.checked;
[7279] Fix | Delete
}
[7280] Fix | Delete
#save() {
[7281] Fix | Delete
const altText = this.#textarea.value.trim();
[7282] Fix | Delete
const decorative = this.#optionDecorative.checked;
[7283] Fix | Delete
this.#currentEditor.altTextData = {
[7284] Fix | Delete
altText,
[7285] Fix | Delete
decorative
[7286] Fix | Delete
};
[7287] Fix | Delete
this.#telemetryData = {
[7288] Fix | Delete
action: "alt_text_save",
[7289] Fix | Delete
alt_text_description: !!altText,
[7290] Fix | Delete
alt_text_edit: !!this.#previousAltText && this.#previousAltText !== altText,
[7291] Fix | Delete
alt_text_decorative: decorative,
[7292] Fix | Delete
alt_text_keyboard: !this.#hasUsedPointer
[7293] Fix | Delete
};
[7294] Fix | Delete
this.#finish();
[7295] Fix | Delete
}
[7296] Fix | Delete
#onClick(evt) {
[7297] Fix | Delete
if (evt.detail === 0) {
[7298] Fix | Delete
return;
[7299] Fix | Delete
}
[7300] Fix | Delete
this.#hasUsedPointer = true;
[7301] Fix | Delete
this.#removeOnClickListeners();
[7302] Fix | Delete
}
[7303] Fix | Delete
#removeOnClickListeners() {
[7304] Fix | Delete
for (const element of this._elements) {
[7305] Fix | Delete
element.removeEventListener("click", this.#boundOnClick);
[7306] Fix | Delete
}
[7307] Fix | Delete
}
[7308] Fix | Delete
destroy() {
[7309] Fix | Delete
this.#uiManager = null;
[7310] Fix | Delete
this.#finish();
[7311] Fix | Delete
this.#svgElement?.remove();
[7312] Fix | Delete
this.#svgElement = this.#rectElement = null;
[7313] Fix | Delete
}
[7314] Fix | Delete
}
[7315] Fix | Delete
[7316] Fix | Delete
;// CONCATENATED MODULE: ./web/annotation_editor_params.js
[7317] Fix | Delete
[7318] Fix | Delete
class AnnotationEditorParams {
[7319] Fix | Delete
constructor(options, eventBus) {
[7320] Fix | Delete
this.eventBus = eventBus;
[7321] Fix | Delete
this.#bindListeners(options);
[7322] Fix | Delete
}
[7323] Fix | Delete
#bindListeners({
[7324] Fix | Delete
editorFreeTextFontSize,
[7325] Fix | Delete
editorFreeTextColor,
[7326] Fix | Delete
editorInkColor,
[7327] Fix | Delete
editorInkThickness,
[7328] Fix | Delete
editorInkOpacity,
[7329] Fix | Delete
editorStampAddImage,
[7330] Fix | Delete
editorFreeHighlightThickness,
[7331] Fix | Delete
editorHighlightShowAll
[7332] Fix | Delete
}) {
[7333] Fix | Delete
const dispatchEvent = (typeStr, value) => {
[7334] Fix | Delete
this.eventBus.dispatch("switchannotationeditorparams", {
[7335] Fix | Delete
source: this,
[7336] Fix | Delete
type: AnnotationEditorParamsType[typeStr],
[7337] Fix | Delete
value
[7338] Fix | Delete
});
[7339] Fix | Delete
};
[7340] Fix | Delete
editorFreeTextFontSize.addEventListener("input", function () {
[7341] Fix | Delete
dispatchEvent("FREETEXT_SIZE", this.valueAsNumber);
[7342] Fix | Delete
});
[7343] Fix | Delete
editorFreeTextColor.addEventListener("input", function () {
[7344] Fix | Delete
dispatchEvent("FREETEXT_COLOR", this.value);
[7345] Fix | Delete
});
[7346] Fix | Delete
editorInkColor.addEventListener("input", function () {
[7347] Fix | Delete
dispatchEvent("INK_COLOR", this.value);
[7348] Fix | Delete
});
[7349] Fix | Delete
editorInkThickness.addEventListener("input", function () {
[7350] Fix | Delete
dispatchEvent("INK_THICKNESS", this.valueAsNumber);
[7351] Fix | Delete
});
[7352] Fix | Delete
editorInkOpacity.addEventListener("input", function () {
[7353] Fix | Delete
dispatchEvent("INK_OPACITY", this.valueAsNumber);
[7354] Fix | Delete
});
[7355] Fix | Delete
editorStampAddImage.addEventListener("click", () => {
[7356] Fix | Delete
dispatchEvent("CREATE");
[7357] Fix | Delete
});
[7358] Fix | Delete
editorFreeHighlightThickness.addEventListener("input", function () {
[7359] Fix | Delete
dispatchEvent("HIGHLIGHT_THICKNESS", this.valueAsNumber);
[7360] Fix | Delete
});
[7361] Fix | Delete
editorHighlightShowAll.addEventListener("click", function () {
[7362] Fix | Delete
const checked = this.getAttribute("aria-pressed") === "true";
[7363] Fix | Delete
this.setAttribute("aria-pressed", !checked);
[7364] Fix | Delete
dispatchEvent("HIGHLIGHT_SHOW_ALL", !checked);
[7365] Fix | Delete
});
[7366] Fix | Delete
this.eventBus._on("annotationeditorparamschanged", evt => {
[7367] Fix | Delete
for (const [type, value] of evt.details) {
[7368] Fix | Delete
switch (type) {
[7369] Fix | Delete
case AnnotationEditorParamsType.FREETEXT_SIZE:
[7370] Fix | Delete
editorFreeTextFontSize.value = value;
[7371] Fix | Delete
break;
[7372] Fix | Delete
case AnnotationEditorParamsType.FREETEXT_COLOR:
[7373] Fix | Delete
editorFreeTextColor.value = value;
[7374] Fix | Delete
break;
[7375] Fix | Delete
case AnnotationEditorParamsType.INK_COLOR:
[7376] Fix | Delete
editorInkColor.value = value;
[7377] Fix | Delete
break;
[7378] Fix | Delete
case AnnotationEditorParamsType.INK_THICKNESS:
[7379] Fix | Delete
editorInkThickness.value = value;
[7380] Fix | Delete
break;
[7381] Fix | Delete
case AnnotationEditorParamsType.INK_OPACITY:
[7382] Fix | Delete
editorInkOpacity.value = value;
[7383] Fix | Delete
break;
[7384] Fix | Delete
case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
[7385] Fix | Delete
editorFreeHighlightThickness.value = value;
[7386] Fix | Delete
break;
[7387] Fix | Delete
case AnnotationEditorParamsType.HIGHLIGHT_FREE:
[7388] Fix | Delete
editorFreeHighlightThickness.disabled = !value;
[7389] Fix | Delete
break;
[7390] Fix | Delete
case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
[7391] Fix | Delete
editorHighlightShowAll.setAttribute("aria-pressed", value);
[7392] Fix | Delete
break;
[7393] Fix | Delete
}
[7394] Fix | Delete
}
[7395] Fix | Delete
});
[7396] Fix | Delete
}
[7397] Fix | Delete
}
[7398] Fix | Delete
[7399] Fix | Delete
;// CONCATENATED MODULE: ./web/caret_browsing.js
[7400] Fix | Delete
[7401] Fix | Delete
const PRECISION = 1e-1;
[7402] Fix | Delete
class CaretBrowsingMode {
[7403] Fix | Delete
#mainContainer;
[7404] Fix | Delete
#toolBarHeight;
[7405] Fix | Delete
#viewerContainer;
[7406] Fix | Delete
constructor(mainContainer, viewerContainer, toolbarContainer) {
[7407] Fix | Delete
this.#mainContainer = mainContainer;
[7408] Fix | Delete
this.#viewerContainer = viewerContainer;
[7409] Fix | Delete
this.#toolBarHeight = toolbarContainer?.getBoundingClientRect().height ?? 0;
[7410] Fix | Delete
}
[7411] Fix | Delete
#isOnSameLine(rect1, rect2) {
[7412] Fix | Delete
const top1 = rect1.y;
[7413] Fix | Delete
const bot1 = rect1.bottom;
[7414] Fix | Delete
const mid1 = rect1.y + rect1.height / 2;
[7415] Fix | Delete
const top2 = rect2.y;
[7416] Fix | Delete
const bot2 = rect2.bottom;
[7417] Fix | Delete
const mid2 = rect2.y + rect2.height / 2;
[7418] Fix | Delete
return top1 <= mid2 && mid2 <= bot1 || top2 <= mid1 && mid1 <= bot2;
[7419] Fix | Delete
}
[7420] Fix | Delete
#isUnderOver(rect, x, y, isUp) {
[7421] Fix | Delete
const midY = rect.y + rect.height / 2;
[7422] Fix | Delete
return (isUp ? y >= midY : y <= midY) && rect.x - PRECISION <= x && x <= rect.right + PRECISION;
[7423] Fix | Delete
}
[7424] Fix | Delete
#isVisible(rect) {
[7425] Fix | Delete
return rect.top >= this.#toolBarHeight && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
[7426] Fix | Delete
}
[7427] Fix | Delete
#getCaretPosition(selection, isUp) {
[7428] Fix | Delete
const {
[7429] Fix | Delete
focusNode,
[7430] Fix | Delete
focusOffset
[7431] Fix | Delete
} = selection;
[7432] Fix | Delete
const range = document.createRange();
[7433] Fix | Delete
range.setStart(focusNode, focusOffset);
[7434] Fix | Delete
range.setEnd(focusNode, focusOffset);
[7435] Fix | Delete
const rect = range.getBoundingClientRect();
[7436] Fix | Delete
return [rect.x, isUp ? rect.top : rect.bottom];
[7437] Fix | Delete
}
[7438] Fix | Delete
static #caretPositionFromPoint(x, y) {
[7439] Fix | Delete
if (!document.caretPositionFromPoint) {
[7440] Fix | Delete
const {
[7441] Fix | Delete
startContainer: offsetNode,
[7442] Fix | Delete
startOffset: offset
[7443] Fix | Delete
} = document.caretRangeFromPoint(x, y);
[7444] Fix | Delete
return {
[7445] Fix | Delete
offsetNode,
[7446] Fix | Delete
offset
[7447] Fix | Delete
};
[7448] Fix | Delete
}
[7449] Fix | Delete
return document.caretPositionFromPoint(x, y);
[7450] Fix | Delete
}
[7451] Fix | Delete
#setCaretPositionHelper(selection, caretX, select, element, rect) {
[7452] Fix | Delete
rect ||= element.getBoundingClientRect();
[7453] Fix | Delete
if (caretX <= rect.x + PRECISION) {
[7454] Fix | Delete
if (select) {
[7455] Fix | Delete
selection.extend(element.firstChild, 0);
[7456] Fix | Delete
} else {
[7457] Fix | Delete
selection.setPosition(element.firstChild, 0);
[7458] Fix | Delete
}
[7459] Fix | Delete
return;
[7460] Fix | Delete
}
[7461] Fix | Delete
if (rect.right - PRECISION <= caretX) {
[7462] Fix | Delete
const {
[7463] Fix | Delete
lastChild
[7464] Fix | Delete
} = element;
[7465] Fix | Delete
if (select) {
[7466] Fix | Delete
selection.extend(lastChild, lastChild.length);
[7467] Fix | Delete
} else {
[7468] Fix | Delete
selection.setPosition(lastChild, lastChild.length);
[7469] Fix | Delete
}
[7470] Fix | Delete
return;
[7471] Fix | Delete
}
[7472] Fix | Delete
const midY = rect.y + rect.height / 2;
[7473] Fix | Delete
let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);
[7474] Fix | Delete
let parentElement = caretPosition.offsetNode?.parentElement;
[7475] Fix | Delete
if (parentElement && parentElement !== element) {
[7476] Fix | Delete
const elementsAtPoint = document.elementsFromPoint(caretX, midY);
[7477] Fix | Delete
const savedVisibilities = [];
[7478] Fix | Delete
for (const el of elementsAtPoint) {
[7479] Fix | Delete
if (el === element) {
[7480] Fix | Delete
break;
[7481] Fix | Delete
}
[7482] Fix | Delete
const {
[7483] Fix | Delete
style
[7484] Fix | Delete
} = el;
[7485] Fix | Delete
savedVisibilities.push([el, style.visibility]);
[7486] Fix | Delete
style.visibility = "hidden";
[7487] Fix | Delete
}
[7488] Fix | Delete
caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);
[7489] Fix | Delete
parentElement = caretPosition.offsetNode?.parentElement;
[7490] Fix | Delete
for (const [el, visibility] of savedVisibilities) {
[7491] Fix | Delete
el.style.visibility = visibility;
[7492] Fix | Delete
}
[7493] Fix | Delete
}
[7494] Fix | Delete
if (parentElement !== element) {
[7495] Fix | Delete
if (select) {
[7496] Fix | Delete
selection.extend(element.firstChild, 0);
[7497] Fix | Delete
} else {
[7498] Fix | Delete
selection.setPosition(element.firstChild, 0);
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function