[FIX] web_editor: Fix linting errors
X-original-commit: 554f4871d913cc24decfff07b55f8d7bf80f89db Part-of: odoo/odoo#84891
This commit is contained in:
@@ -1791,7 +1791,7 @@ export class OdooEditor extends EventTarget {
|
||||
}
|
||||
stepIndex--;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// TOOLBAR
|
||||
// =======
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
isMediaElement,
|
||||
getDeepRange,
|
||||
isUnbreakable,
|
||||
isUnremovable
|
||||
} from './utils.js';
|
||||
|
||||
const NOT_A_NUMBER = /[^\d]/g;
|
||||
@@ -51,11 +52,11 @@ export function areSimilarElements(node, node2) {
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (node.tagName == 'LI' && node.classList.contains('oe-nested')) {
|
||||
if (node.tagName === 'LI' && node.classList.contains('oe-nested')) {
|
||||
return (
|
||||
node.lastElementChild &&
|
||||
node2.firstElementChild &&
|
||||
getListMode(node.lastElementChild) == getListMode(node2.firstElementChild)
|
||||
getListMode(node.lastElementChild) === getListMode(node2.firstElementChild)
|
||||
);
|
||||
}
|
||||
if (['UL', 'OL'].includes(node.tagName)) {
|
||||
@@ -113,7 +114,7 @@ class Sanitize {
|
||||
}
|
||||
|
||||
// Remove empty blocks in <li>
|
||||
if (node.nodeName == 'P' && node.parentElement.tagName == 'LI') {
|
||||
if (node.nodeName === 'P' && node.parentElement.tagName === 'LI') {
|
||||
const next = node.nextSibling;
|
||||
const pnode = node.parentElement;
|
||||
if (isEmptyBlock(node)) {
|
||||
|
||||
@@ -1096,6 +1096,7 @@ export function isContentTextNode(node) {
|
||||
* will always return 'true' while it is sometimes invisible.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @param {boolean} areBlocksAlwaysVisible
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isVisible(node, areBlocksAlwaysVisible = true) {
|
||||
@@ -1459,7 +1460,7 @@ export function clearEmpty(node) {
|
||||
}
|
||||
|
||||
export function setTagName(el, newTagName) {
|
||||
if (el.tagName == newTagName) {
|
||||
if (el.tagName === newTagName) {
|
||||
return el;
|
||||
}
|
||||
var n = document.createElement(newTagName);
|
||||
@@ -1598,6 +1599,7 @@ export function prepareUpdate(...args) {
|
||||
* @param {HTMLElement} el
|
||||
* @param {number} offset
|
||||
* @param {number} direction @see DIRECTIONS.LEFT @see DIRECTIONS.RIGHT
|
||||
* @param {CTYPES} leftCType
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getState(el, offset, direction, leftCType) {
|
||||
|
||||
@@ -2251,7 +2251,7 @@ X[]
|
||||
it('should insert line breaks outside the edges of an anchor', async () => {
|
||||
const pressEnter = editor => {
|
||||
editor.document.execCommand('insertParagraph');
|
||||
}
|
||||
};
|
||||
await testEditor(BasicEditor, {
|
||||
contentBefore: '<div>ab<a>[]cd</a></div>',
|
||||
stepFunction: pressEnter,
|
||||
@@ -2729,7 +2729,7 @@ X[]
|
||||
contentAfter: '<p>a<span><span style="color: tomato;">[b</span><span><span style="color: tomato;">c]</span>d</span>e</span>f</p>',
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('setTagName', () => {
|
||||
describe('to paragraph', () => {
|
||||
|
||||
Reference in New Issue
Block a user