[FIX] web_editor: remove unused variables
Some variables were defined but never used, causing eslint tests to break. Part-of: odoo/odoo#94516
This commit is contained in:
@@ -1086,13 +1086,11 @@ export class OdooEditor extends EventTarget {
|
||||
return;
|
||||
}
|
||||
|
||||
let currentIndex;
|
||||
let concurentSteps = [];
|
||||
index++;
|
||||
while (index < this._historySteps.length) {
|
||||
if (this._historySteps[index].previousStepId === newStep.previousStepId) {
|
||||
if (this._historySteps[index].id.localeCompare(newStep.id) === 1) {
|
||||
currentIndex = index;
|
||||
break;
|
||||
} else {
|
||||
concurentSteps = [this._historySteps[index].id];
|
||||
@@ -1101,13 +1099,11 @@ export class OdooEditor extends EventTarget {
|
||||
if (concurentSteps.includes(this._historySteps[index].previousStepId)) {
|
||||
concurentSteps.push(this._historySteps[index].id);
|
||||
} else {
|
||||
currentIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
currentIndex = typeof currentIndex !== 'undefined' ? currentIndex : index;
|
||||
|
||||
const stepsAfterNewStep = this._historySteps.slice(index);
|
||||
|
||||
@@ -1184,7 +1180,7 @@ export class OdooEditor extends EventTarget {
|
||||
}
|
||||
|
||||
clientRects = Array.from(range.getClientRects());
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Changes in the dom might prevent the range to be instantiated
|
||||
// (because of a removed node for example), in which case we ignore
|
||||
// the range.
|
||||
|
||||
@@ -533,16 +533,6 @@ function deleteTable(editor, table) {
|
||||
setSelection(p, 0);
|
||||
}
|
||||
|
||||
function getTextNodes(editor) {
|
||||
const selection = editor.document.getSelection();
|
||||
if (!selection.rangeCount || selection.getRangeAt(0).collapsed) {
|
||||
return null;
|
||||
}
|
||||
getDeepRange(editor.editable, { splitText: true, select: true, correctTripleClick: true });
|
||||
return getSelectedNodes(editor.editable)
|
||||
.filter(n => n.nodeType === Node.TEXT_NODE && n.nodeValue.trim().length);
|
||||
}
|
||||
|
||||
// This is a whitelist of the commands that are implemented by the
|
||||
// editor itself rather than the node prototypes. It might be
|
||||
// possible to switch the conditions and test if the method exist on
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @odoo-module **/
|
||||
import { UNBREAKABLE_ROLLBACK_CODE, UNREMOVABLE_ROLLBACK_CODE } from '../utils/constants.js';
|
||||
import { UNREMOVABLE_ROLLBACK_CODE } from '../utils/constants.js';
|
||||
import {
|
||||
boundariesOut,
|
||||
childNodeIndex,
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
isMediaElement,
|
||||
getDeepRange,
|
||||
isUnbreakable,
|
||||
isUnremovable
|
||||
} from './utils.js';
|
||||
|
||||
const NOT_A_NUMBER = /[^\d]/g;
|
||||
|
||||
@@ -717,7 +717,7 @@ export function getDeepRange(editable, { range, sel, splitText, select, correctT
|
||||
sel.addRange(range);
|
||||
try {
|
||||
sel.extend(end, endOffset);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Firefox yells not happy when setting selection on elem with contentEditable=false.
|
||||
}
|
||||
range = sel.getRangeAt(0);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<script src="../src/utils/DOMPurify.js"></script>
|
||||
<script src="lib/DOMPurify.js"></script>
|
||||
<script src="lib/mocha.js"></script>
|
||||
<script src="lib/chai.js"></script>
|
||||
<script>mocha.setup('bdd').fullTrace()</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
BasicEditor, customErrorMessage,
|
||||
BasicEditor,
|
||||
testEditor
|
||||
} from "../utils.js";
|
||||
import {CLIPBOARD_WHITELISTS} from "../../src/OdooEditor.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { applyInlineStyle } from '../../src/commands/commands.js';
|
||||
import { OdooEditor } from '../../src/OdooEditor.js';
|
||||
import { getTraversedNodes, setCursorStart } from '../../src/utils/utils.js';
|
||||
import { getTraversedNodes } from '../../src/utils/utils.js';
|
||||
import {
|
||||
BasicEditor,
|
||||
deleteBackward,
|
||||
|
||||
@@ -797,7 +797,6 @@ describe('Utils', () => {
|
||||
<p><br></p>
|
||||
</div></div>`),
|
||||
stepFunction: async editor => {
|
||||
const sel = document.getSelection();
|
||||
const element = editor.editable.querySelector('#target');
|
||||
ensureFocus(element);
|
||||
await nextTickFrame();
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { OdooEditor } from '../src/OdooEditor.js';
|
||||
import { sanitize } from '../src/utils/sanitize.js';
|
||||
import {
|
||||
closestElement,
|
||||
insertText as insertTextSel,
|
||||
} from '../src/utils/utils.js';
|
||||
import { closestElement } from '../src/utils/utils.js';
|
||||
|
||||
export const Direction = {
|
||||
BACKWARD: 'BACKWARD',
|
||||
@@ -156,7 +153,7 @@ export function setTestSelection(selection, doc = document) {
|
||||
domSelection.addRange(domRange);
|
||||
try {
|
||||
domSelection.extend(selection.focusNode, selection.focusOffset);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Firefox yells not happy when setting selection on elem with contentEditable=false.
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user