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/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
target: el
[7000] Fix | Delete
}) => !(el instanceof HTMLButtonElement) && self.#container.contains(document.activeElement)
[7001] Fix | Delete
}], [["Escape", "mac+Escape"], proto.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], proto.translateSelectedEditors, {
[7002] Fix | Delete
args: [-small, 0],
[7003] Fix | Delete
checker: arrowChecker
[7004] Fix | Delete
}], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto.translateSelectedEditors, {
[7005] Fix | Delete
args: [-big, 0],
[7006] Fix | Delete
checker: arrowChecker
[7007] Fix | Delete
}], [["ArrowRight", "mac+ArrowRight"], proto.translateSelectedEditors, {
[7008] Fix | Delete
args: [small, 0],
[7009] Fix | Delete
checker: arrowChecker
[7010] Fix | Delete
}], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto.translateSelectedEditors, {
[7011] Fix | Delete
args: [big, 0],
[7012] Fix | Delete
checker: arrowChecker
[7013] Fix | Delete
}], [["ArrowUp", "mac+ArrowUp"], proto.translateSelectedEditors, {
[7014] Fix | Delete
args: [0, -small],
[7015] Fix | Delete
checker: arrowChecker
[7016] Fix | Delete
}], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto.translateSelectedEditors, {
[7017] Fix | Delete
args: [0, -big],
[7018] Fix | Delete
checker: arrowChecker
[7019] Fix | Delete
}], [["ArrowDown", "mac+ArrowDown"], proto.translateSelectedEditors, {
[7020] Fix | Delete
args: [0, small],
[7021] Fix | Delete
checker: arrowChecker
[7022] Fix | Delete
}], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto.translateSelectedEditors, {
[7023] Fix | Delete
args: [0, big],
[7024] Fix | Delete
checker: arrowChecker
[7025] Fix | Delete
}]]));
[7026] Fix | Delete
}
[7027] Fix | Delete
constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors, highlightColors, enableHighlightFloatingButton, mlManager) {
[7028] Fix | Delete
this.#container = container;
[7029] Fix | Delete
this.#viewer = viewer;
[7030] Fix | Delete
this.#altTextManager = altTextManager;
[7031] Fix | Delete
this._eventBus = eventBus;
[7032] Fix | Delete
this._eventBus._on("editingaction", this.#boundOnEditingAction);
[7033] Fix | Delete
this._eventBus._on("pagechanging", this.#boundOnPageChanging);
[7034] Fix | Delete
this._eventBus._on("scalechanging", this.#boundOnScaleChanging);
[7035] Fix | Delete
this._eventBus._on("rotationchanging", this.#boundOnRotationChanging);
[7036] Fix | Delete
this.#addSelectionListener();
[7037] Fix | Delete
this.#addKeyboardManager();
[7038] Fix | Delete
this.#annotationStorage = pdfDocument.annotationStorage;
[7039] Fix | Delete
this.#filterFactory = pdfDocument.filterFactory;
[7040] Fix | Delete
this.#pageColors = pageColors;
[7041] Fix | Delete
this.#highlightColors = highlightColors || null;
[7042] Fix | Delete
this.#enableHighlightFloatingButton = enableHighlightFloatingButton;
[7043] Fix | Delete
this.#mlManager = mlManager || null;
[7044] Fix | Delete
this.viewParameters = {
[7045] Fix | Delete
realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
[7046] Fix | Delete
rotation: 0
[7047] Fix | Delete
};
[7048] Fix | Delete
this.isShiftKeyDown = false;
[7049] Fix | Delete
}
[7050] Fix | Delete
destroy() {
[7051] Fix | Delete
this.#removeKeyboardManager();
[7052] Fix | Delete
this.#removeFocusManager();
[7053] Fix | Delete
this._eventBus._off("editingaction", this.#boundOnEditingAction);
[7054] Fix | Delete
this._eventBus._off("pagechanging", this.#boundOnPageChanging);
[7055] Fix | Delete
this._eventBus._off("scalechanging", this.#boundOnScaleChanging);
[7056] Fix | Delete
this._eventBus._off("rotationchanging", this.#boundOnRotationChanging);
[7057] Fix | Delete
for (const layer of this.#allLayers.values()) {
[7058] Fix | Delete
layer.destroy();
[7059] Fix | Delete
}
[7060] Fix | Delete
this.#allLayers.clear();
[7061] Fix | Delete
this.#allEditors.clear();
[7062] Fix | Delete
this.#editorsToRescale.clear();
[7063] Fix | Delete
this.#activeEditor = null;
[7064] Fix | Delete
this.#selectedEditors.clear();
[7065] Fix | Delete
this.#commandManager.destroy();
[7066] Fix | Delete
this.#altTextManager?.destroy();
[7067] Fix | Delete
this.#highlightToolbar?.hide();
[7068] Fix | Delete
this.#highlightToolbar = null;
[7069] Fix | Delete
if (this.#focusMainContainerTimeoutId) {
[7070] Fix | Delete
clearTimeout(this.#focusMainContainerTimeoutId);
[7071] Fix | Delete
this.#focusMainContainerTimeoutId = null;
[7072] Fix | Delete
}
[7073] Fix | Delete
if (this.#translationTimeoutId) {
[7074] Fix | Delete
clearTimeout(this.#translationTimeoutId);
[7075] Fix | Delete
this.#translationTimeoutId = null;
[7076] Fix | Delete
}
[7077] Fix | Delete
this.#removeSelectionListener();
[7078] Fix | Delete
}
[7079] Fix | Delete
async mlGuess(data) {
[7080] Fix | Delete
return this.#mlManager?.guess(data) || null;
[7081] Fix | Delete
}
[7082] Fix | Delete
get hasMLManager() {
[7083] Fix | Delete
return !!this.#mlManager;
[7084] Fix | Delete
}
[7085] Fix | Delete
get hcmFilter() {
[7086] Fix | Delete
return shadow(this, "hcmFilter", this.#pageColors ? this.#filterFactory.addHCMFilter(this.#pageColors.foreground, this.#pageColors.background) : "none");
[7087] Fix | Delete
}
[7088] Fix | Delete
get direction() {
[7089] Fix | Delete
return shadow(this, "direction", getComputedStyle(this.#container).direction);
[7090] Fix | Delete
}
[7091] Fix | Delete
get highlightColors() {
[7092] Fix | Delete
return shadow(this, "highlightColors", this.#highlightColors ? new Map(this.#highlightColors.split(",").map(pair => pair.split("=").map(x => x.trim()))) : null);
[7093] Fix | Delete
}
[7094] Fix | Delete
get highlightColorNames() {
[7095] Fix | Delete
return shadow(this, "highlightColorNames", this.highlightColors ? new Map(Array.from(this.highlightColors, e => e.reverse())) : null);
[7096] Fix | Delete
}
[7097] Fix | Delete
setMainHighlightColorPicker(colorPicker) {
[7098] Fix | Delete
this.#mainHighlightColorPicker = colorPicker;
[7099] Fix | Delete
}
[7100] Fix | Delete
editAltText(editor) {
[7101] Fix | Delete
this.#altTextManager?.editAltText(this, editor);
[7102] Fix | Delete
}
[7103] Fix | Delete
onPageChanging({
[7104] Fix | Delete
pageNumber
[7105] Fix | Delete
}) {
[7106] Fix | Delete
this.#currentPageIndex = pageNumber - 1;
[7107] Fix | Delete
}
[7108] Fix | Delete
focusMainContainer() {
[7109] Fix | Delete
this.#container.focus();
[7110] Fix | Delete
}
[7111] Fix | Delete
findParent(x, y) {
[7112] Fix | Delete
for (const layer of this.#allLayers.values()) {
[7113] Fix | Delete
const {
[7114] Fix | Delete
x: layerX,
[7115] Fix | Delete
y: layerY,
[7116] Fix | Delete
width,
[7117] Fix | Delete
height
[7118] Fix | Delete
} = layer.div.getBoundingClientRect();
[7119] Fix | Delete
if (x >= layerX && x <= layerX + width && y >= layerY && y <= layerY + height) {
[7120] Fix | Delete
return layer;
[7121] Fix | Delete
}
[7122] Fix | Delete
}
[7123] Fix | Delete
return null;
[7124] Fix | Delete
}
[7125] Fix | Delete
disableUserSelect(value = false) {
[7126] Fix | Delete
this.#viewer.classList.toggle("noUserSelect", value);
[7127] Fix | Delete
}
[7128] Fix | Delete
addShouldRescale(editor) {
[7129] Fix | Delete
this.#editorsToRescale.add(editor);
[7130] Fix | Delete
}
[7131] Fix | Delete
removeShouldRescale(editor) {
[7132] Fix | Delete
this.#editorsToRescale.delete(editor);
[7133] Fix | Delete
}
[7134] Fix | Delete
onScaleChanging({
[7135] Fix | Delete
scale
[7136] Fix | Delete
}) {
[7137] Fix | Delete
this.commitOrRemove();
[7138] Fix | Delete
this.viewParameters.realScale = scale * PixelsPerInch.PDF_TO_CSS_UNITS;
[7139] Fix | Delete
for (const editor of this.#editorsToRescale) {
[7140] Fix | Delete
editor.onScaleChanging();
[7141] Fix | Delete
}
[7142] Fix | Delete
}
[7143] Fix | Delete
onRotationChanging({
[7144] Fix | Delete
pagesRotation
[7145] Fix | Delete
}) {
[7146] Fix | Delete
this.commitOrRemove();
[7147] Fix | Delete
this.viewParameters.rotation = pagesRotation;
[7148] Fix | Delete
}
[7149] Fix | Delete
#getAnchorElementForSelection({
[7150] Fix | Delete
anchorNode
[7151] Fix | Delete
}) {
[7152] Fix | Delete
return anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentElement : anchorNode;
[7153] Fix | Delete
}
[7154] Fix | Delete
highlightSelection(methodOfCreation = "") {
[7155] Fix | Delete
const selection = document.getSelection();
[7156] Fix | Delete
if (!selection || selection.isCollapsed) {
[7157] Fix | Delete
return;
[7158] Fix | Delete
}
[7159] Fix | Delete
const {
[7160] Fix | Delete
anchorNode,
[7161] Fix | Delete
anchorOffset,
[7162] Fix | Delete
focusNode,
[7163] Fix | Delete
focusOffset
[7164] Fix | Delete
} = selection;
[7165] Fix | Delete
const text = selection.toString();
[7166] Fix | Delete
const anchorElement = this.#getAnchorElementForSelection(selection);
[7167] Fix | Delete
const textLayer = anchorElement.closest(".textLayer");
[7168] Fix | Delete
const boxes = this.getSelectionBoxes(textLayer);
[7169] Fix | Delete
if (!boxes) {
[7170] Fix | Delete
return;
[7171] Fix | Delete
}
[7172] Fix | Delete
selection.empty();
[7173] Fix | Delete
if (this.#mode === AnnotationEditorType.NONE) {
[7174] Fix | Delete
this._eventBus.dispatch("showannotationeditorui", {
[7175] Fix | Delete
source: this,
[7176] Fix | Delete
mode: AnnotationEditorType.HIGHLIGHT
[7177] Fix | Delete
});
[7178] Fix | Delete
this.showAllEditors("highlight", true, true);
[7179] Fix | Delete
}
[7180] Fix | Delete
for (const layer of this.#allLayers.values()) {
[7181] Fix | Delete
if (layer.hasTextLayer(textLayer)) {
[7182] Fix | Delete
layer.createAndAddNewEditor({
[7183] Fix | Delete
x: 0,
[7184] Fix | Delete
y: 0
[7185] Fix | Delete
}, false, {
[7186] Fix | Delete
methodOfCreation,
[7187] Fix | Delete
boxes,
[7188] Fix | Delete
anchorNode,
[7189] Fix | Delete
anchorOffset,
[7190] Fix | Delete
focusNode,
[7191] Fix | Delete
focusOffset,
[7192] Fix | Delete
text
[7193] Fix | Delete
});
[7194] Fix | Delete
break;
[7195] Fix | Delete
}
[7196] Fix | Delete
}
[7197] Fix | Delete
}
[7198] Fix | Delete
#displayHighlightToolbar() {
[7199] Fix | Delete
const selection = document.getSelection();
[7200] Fix | Delete
if (!selection || selection.isCollapsed) {
[7201] Fix | Delete
return;
[7202] Fix | Delete
}
[7203] Fix | Delete
const anchorElement = this.#getAnchorElementForSelection(selection);
[7204] Fix | Delete
const textLayer = anchorElement.closest(".textLayer");
[7205] Fix | Delete
const boxes = this.getSelectionBoxes(textLayer);
[7206] Fix | Delete
if (!boxes) {
[7207] Fix | Delete
return;
[7208] Fix | Delete
}
[7209] Fix | Delete
this.#highlightToolbar ||= new HighlightToolbar(this);
[7210] Fix | Delete
this.#highlightToolbar.show(textLayer, boxes, this.direction === "ltr");
[7211] Fix | Delete
}
[7212] Fix | Delete
addToAnnotationStorage(editor) {
[7213] Fix | Delete
if (!editor.isEmpty() && this.#annotationStorage && !this.#annotationStorage.has(editor.id)) {
[7214] Fix | Delete
this.#annotationStorage.setValue(editor.id, editor);
[7215] Fix | Delete
}
[7216] Fix | Delete
}
[7217] Fix | Delete
#selectionChange() {
[7218] Fix | Delete
const selection = document.getSelection();
[7219] Fix | Delete
if (!selection || selection.isCollapsed) {
[7220] Fix | Delete
if (this.#selectedTextNode) {
[7221] Fix | Delete
this.#highlightToolbar?.hide();
[7222] Fix | Delete
this.#selectedTextNode = null;
[7223] Fix | Delete
this.#dispatchUpdateStates({
[7224] Fix | Delete
hasSelectedText: false
[7225] Fix | Delete
});
[7226] Fix | Delete
}
[7227] Fix | Delete
return;
[7228] Fix | Delete
}
[7229] Fix | Delete
const {
[7230] Fix | Delete
anchorNode
[7231] Fix | Delete
} = selection;
[7232] Fix | Delete
if (anchorNode === this.#selectedTextNode) {
[7233] Fix | Delete
return;
[7234] Fix | Delete
}
[7235] Fix | Delete
const anchorElement = this.#getAnchorElementForSelection(selection);
[7236] Fix | Delete
const textLayer = anchorElement.closest(".textLayer");
[7237] Fix | Delete
if (!textLayer) {
[7238] Fix | Delete
if (this.#selectedTextNode) {
[7239] Fix | Delete
this.#highlightToolbar?.hide();
[7240] Fix | Delete
this.#selectedTextNode = null;
[7241] Fix | Delete
this.#dispatchUpdateStates({
[7242] Fix | Delete
hasSelectedText: false
[7243] Fix | Delete
});
[7244] Fix | Delete
}
[7245] Fix | Delete
return;
[7246] Fix | Delete
}
[7247] Fix | Delete
this.#highlightToolbar?.hide();
[7248] Fix | Delete
this.#selectedTextNode = anchorNode;
[7249] Fix | Delete
this.#dispatchUpdateStates({
[7250] Fix | Delete
hasSelectedText: true
[7251] Fix | Delete
});
[7252] Fix | Delete
if (this.#mode !== AnnotationEditorType.HIGHLIGHT && this.#mode !== AnnotationEditorType.NONE) {
[7253] Fix | Delete
return;
[7254] Fix | Delete
}
[7255] Fix | Delete
if (this.#mode === AnnotationEditorType.HIGHLIGHT) {
[7256] Fix | Delete
this.showAllEditors("highlight", true, true);
[7257] Fix | Delete
}
[7258] Fix | Delete
this.#highlightWhenShiftUp = this.isShiftKeyDown;
[7259] Fix | Delete
if (!this.isShiftKeyDown) {
[7260] Fix | Delete
const pointerup = e => {
[7261] Fix | Delete
if (e.type === "pointerup" && e.button !== 0) {
[7262] Fix | Delete
return;
[7263] Fix | Delete
}
[7264] Fix | Delete
window.removeEventListener("pointerup", pointerup);
[7265] Fix | Delete
window.removeEventListener("blur", pointerup);
[7266] Fix | Delete
if (e.type === "pointerup") {
[7267] Fix | Delete
this.#onSelectEnd("main_toolbar");
[7268] Fix | Delete
}
[7269] Fix | Delete
};
[7270] Fix | Delete
window.addEventListener("pointerup", pointerup);
[7271] Fix | Delete
window.addEventListener("blur", pointerup);
[7272] Fix | Delete
}
[7273] Fix | Delete
}
[7274] Fix | Delete
#onSelectEnd(methodOfCreation = "") {
[7275] Fix | Delete
if (this.#mode === AnnotationEditorType.HIGHLIGHT) {
[7276] Fix | Delete
this.highlightSelection(methodOfCreation);
[7277] Fix | Delete
} else if (this.#enableHighlightFloatingButton) {
[7278] Fix | Delete
this.#displayHighlightToolbar();
[7279] Fix | Delete
}
[7280] Fix | Delete
}
[7281] Fix | Delete
#addSelectionListener() {
[7282] Fix | Delete
document.addEventListener("selectionchange", this.#boundSelectionChange);
[7283] Fix | Delete
}
[7284] Fix | Delete
#removeSelectionListener() {
[7285] Fix | Delete
document.removeEventListener("selectionchange", this.#boundSelectionChange);
[7286] Fix | Delete
}
[7287] Fix | Delete
#addFocusManager() {
[7288] Fix | Delete
window.addEventListener("focus", this.#boundFocus);
[7289] Fix | Delete
window.addEventListener("blur", this.#boundBlur);
[7290] Fix | Delete
}
[7291] Fix | Delete
#removeFocusManager() {
[7292] Fix | Delete
window.removeEventListener("focus", this.#boundFocus);
[7293] Fix | Delete
window.removeEventListener("blur", this.#boundBlur);
[7294] Fix | Delete
}
[7295] Fix | Delete
blur() {
[7296] Fix | Delete
this.isShiftKeyDown = false;
[7297] Fix | Delete
if (this.#highlightWhenShiftUp) {
[7298] Fix | Delete
this.#highlightWhenShiftUp = false;
[7299] Fix | Delete
this.#onSelectEnd("main_toolbar");
[7300] Fix | Delete
}
[7301] Fix | Delete
if (!this.hasSelection) {
[7302] Fix | Delete
return;
[7303] Fix | Delete
}
[7304] Fix | Delete
const {
[7305] Fix | Delete
activeElement
[7306] Fix | Delete
} = document;
[7307] Fix | Delete
for (const editor of this.#selectedEditors) {
[7308] Fix | Delete
if (editor.div.contains(activeElement)) {
[7309] Fix | Delete
this.#lastActiveElement = [editor, activeElement];
[7310] Fix | Delete
editor._focusEventsAllowed = false;
[7311] Fix | Delete
break;
[7312] Fix | Delete
}
[7313] Fix | Delete
}
[7314] Fix | Delete
}
[7315] Fix | Delete
focus() {
[7316] Fix | Delete
if (!this.#lastActiveElement) {
[7317] Fix | Delete
return;
[7318] Fix | Delete
}
[7319] Fix | Delete
const [lastEditor, lastActiveElement] = this.#lastActiveElement;
[7320] Fix | Delete
this.#lastActiveElement = null;
[7321] Fix | Delete
lastActiveElement.addEventListener("focusin", () => {
[7322] Fix | Delete
lastEditor._focusEventsAllowed = true;
[7323] Fix | Delete
}, {
[7324] Fix | Delete
once: true
[7325] Fix | Delete
});
[7326] Fix | Delete
lastActiveElement.focus();
[7327] Fix | Delete
}
[7328] Fix | Delete
#addKeyboardManager() {
[7329] Fix | Delete
window.addEventListener("keydown", this.#boundKeydown);
[7330] Fix | Delete
window.addEventListener("keyup", this.#boundKeyup);
[7331] Fix | Delete
}
[7332] Fix | Delete
#removeKeyboardManager() {
[7333] Fix | Delete
window.removeEventListener("keydown", this.#boundKeydown);
[7334] Fix | Delete
window.removeEventListener("keyup", this.#boundKeyup);
[7335] Fix | Delete
}
[7336] Fix | Delete
#addCopyPasteListeners() {
[7337] Fix | Delete
document.addEventListener("copy", this.#boundCopy);
[7338] Fix | Delete
document.addEventListener("cut", this.#boundCut);
[7339] Fix | Delete
document.addEventListener("paste", this.#boundPaste);
[7340] Fix | Delete
}
[7341] Fix | Delete
#removeCopyPasteListeners() {
[7342] Fix | Delete
document.removeEventListener("copy", this.#boundCopy);
[7343] Fix | Delete
document.removeEventListener("cut", this.#boundCut);
[7344] Fix | Delete
document.removeEventListener("paste", this.#boundPaste);
[7345] Fix | Delete
}
[7346] Fix | Delete
addEditListeners() {
[7347] Fix | Delete
this.#addKeyboardManager();
[7348] Fix | Delete
this.#addCopyPasteListeners();
[7349] Fix | Delete
}
[7350] Fix | Delete
removeEditListeners() {
[7351] Fix | Delete
this.#removeKeyboardManager();
[7352] Fix | Delete
this.#removeCopyPasteListeners();
[7353] Fix | Delete
}
[7354] Fix | Delete
copy(event) {
[7355] Fix | Delete
event.preventDefault();
[7356] Fix | Delete
this.#activeEditor?.commitOrRemove();
[7357] Fix | Delete
if (!this.hasSelection) {
[7358] Fix | Delete
return;
[7359] Fix | Delete
}
[7360] Fix | Delete
const editors = [];
[7361] Fix | Delete
for (const editor of this.#selectedEditors) {
[7362] Fix | Delete
const serialized = editor.serialize(true);
[7363] Fix | Delete
if (serialized) {
[7364] Fix | Delete
editors.push(serialized);
[7365] Fix | Delete
}
[7366] Fix | Delete
}
[7367] Fix | Delete
if (editors.length === 0) {
[7368] Fix | Delete
return;
[7369] Fix | Delete
}
[7370] Fix | Delete
event.clipboardData.setData("application/pdfjs", JSON.stringify(editors));
[7371] Fix | Delete
}
[7372] Fix | Delete
cut(event) {
[7373] Fix | Delete
this.copy(event);
[7374] Fix | Delete
this.delete();
[7375] Fix | Delete
}
[7376] Fix | Delete
paste(event) {
[7377] Fix | Delete
event.preventDefault();
[7378] Fix | Delete
const {
[7379] Fix | Delete
clipboardData
[7380] Fix | Delete
} = event;
[7381] Fix | Delete
for (const item of clipboardData.items) {
[7382] Fix | Delete
for (const editorType of this.#editorTypes) {
[7383] Fix | Delete
if (editorType.isHandlingMimeForPasting(item.type)) {
[7384] Fix | Delete
editorType.paste(item, this.currentLayer);
[7385] Fix | Delete
return;
[7386] Fix | Delete
}
[7387] Fix | Delete
}
[7388] Fix | Delete
}
[7389] Fix | Delete
let data = clipboardData.getData("application/pdfjs");
[7390] Fix | Delete
if (!data) {
[7391] Fix | Delete
return;
[7392] Fix | Delete
}
[7393] Fix | Delete
try {
[7394] Fix | Delete
data = JSON.parse(data);
[7395] Fix | Delete
} catch (ex) {
[7396] Fix | Delete
warn(`paste: "${ex.message}".`);
[7397] Fix | Delete
return;
[7398] Fix | Delete
}
[7399] Fix | Delete
if (!Array.isArray(data)) {
[7400] Fix | Delete
return;
[7401] Fix | Delete
}
[7402] Fix | Delete
this.unselectAll();
[7403] Fix | Delete
const layer = this.currentLayer;
[7404] Fix | Delete
try {
[7405] Fix | Delete
const newEditors = [];
[7406] Fix | Delete
for (const editor of data) {
[7407] Fix | Delete
const deserializedEditor = layer.deserialize(editor);
[7408] Fix | Delete
if (!deserializedEditor) {
[7409] Fix | Delete
return;
[7410] Fix | Delete
}
[7411] Fix | Delete
newEditors.push(deserializedEditor);
[7412] Fix | Delete
}
[7413] Fix | Delete
const cmd = () => {
[7414] Fix | Delete
for (const editor of newEditors) {
[7415] Fix | Delete
this.#addEditorToLayer(editor);
[7416] Fix | Delete
}
[7417] Fix | Delete
this.#selectEditors(newEditors);
[7418] Fix | Delete
};
[7419] Fix | Delete
const undo = () => {
[7420] Fix | Delete
for (const editor of newEditors) {
[7421] Fix | Delete
editor.remove();
[7422] Fix | Delete
}
[7423] Fix | Delete
};
[7424] Fix | Delete
this.addCommands({
[7425] Fix | Delete
cmd,
[7426] Fix | Delete
undo,
[7427] Fix | Delete
mustExec: true
[7428] Fix | Delete
});
[7429] Fix | Delete
} catch (ex) {
[7430] Fix | Delete
warn(`paste: "${ex.message}".`);
[7431] Fix | Delete
}
[7432] Fix | Delete
}
[7433] Fix | Delete
keydown(event) {
[7434] Fix | Delete
if (!this.isShiftKeyDown && event.key === "Shift") {
[7435] Fix | Delete
this.isShiftKeyDown = true;
[7436] Fix | Delete
}
[7437] Fix | Delete
if (this.#mode !== AnnotationEditorType.NONE && !this.isEditorHandlingKeyboard) {
[7438] Fix | Delete
AnnotationEditorUIManager._keyboardManager.exec(this, event);
[7439] Fix | Delete
}
[7440] Fix | Delete
}
[7441] Fix | Delete
keyup(event) {
[7442] Fix | Delete
if (this.isShiftKeyDown && event.key === "Shift") {
[7443] Fix | Delete
this.isShiftKeyDown = false;
[7444] Fix | Delete
if (this.#highlightWhenShiftUp) {
[7445] Fix | Delete
this.#highlightWhenShiftUp = false;
[7446] Fix | Delete
this.#onSelectEnd("main_toolbar");
[7447] Fix | Delete
}
[7448] Fix | Delete
}
[7449] Fix | Delete
}
[7450] Fix | Delete
onEditingAction({
[7451] Fix | Delete
name
[7452] Fix | Delete
}) {
[7453] Fix | Delete
switch (name) {
[7454] Fix | Delete
case "undo":
[7455] Fix | Delete
case "redo":
[7456] Fix | Delete
case "delete":
[7457] Fix | Delete
case "selectAll":
[7458] Fix | Delete
this[name]();
[7459] Fix | Delete
break;
[7460] Fix | Delete
case "highlightSelection":
[7461] Fix | Delete
this.highlightSelection("context_menu");
[7462] Fix | Delete
break;
[7463] Fix | Delete
}
[7464] Fix | Delete
}
[7465] Fix | Delete
#dispatchUpdateStates(details) {
[7466] Fix | Delete
const hasChanged = Object.entries(details).some(([key, value]) => this.#previousStates[key] !== value);
[7467] Fix | Delete
if (hasChanged) {
[7468] Fix | Delete
this._eventBus.dispatch("annotationeditorstateschanged", {
[7469] Fix | Delete
source: this,
[7470] Fix | Delete
details: Object.assign(this.#previousStates, details)
[7471] Fix | Delete
});
[7472] Fix | Delete
if (this.#mode === AnnotationEditorType.HIGHLIGHT && details.hasSelectedEditor === false) {
[7473] Fix | Delete
this.#dispatchUpdateUI([[AnnotationEditorParamsType.HIGHLIGHT_FREE, true]]);
[7474] Fix | Delete
}
[7475] Fix | Delete
}
[7476] Fix | Delete
}
[7477] Fix | Delete
#dispatchUpdateUI(details) {
[7478] Fix | Delete
this._eventBus.dispatch("annotationeditorparamschanged", {
[7479] Fix | Delete
source: this,
[7480] Fix | Delete
details
[7481] Fix | Delete
});
[7482] Fix | Delete
}
[7483] Fix | Delete
setEditingState(isEditing) {
[7484] Fix | Delete
if (isEditing) {
[7485] Fix | Delete
this.#addFocusManager();
[7486] Fix | Delete
this.#addCopyPasteListeners();
[7487] Fix | Delete
this.#dispatchUpdateStates({
[7488] Fix | Delete
isEditing: this.#mode !== AnnotationEditorType.NONE,
[7489] Fix | Delete
isEmpty: this.#isEmpty(),
[7490] Fix | Delete
hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),
[7491] Fix | Delete
hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),
[7492] Fix | Delete
hasSelectedEditor: false
[7493] Fix | Delete
});
[7494] Fix | Delete
} else {
[7495] Fix | Delete
this.#removeFocusManager();
[7496] Fix | Delete
this.#removeCopyPasteListeners();
[7497] Fix | Delete
this.#dispatchUpdateStates({
[7498] Fix | Delete
isEditing: false
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function