[FIX] web_editor: fix some linting errors

closes odoo/odoo#91786

X-original-commit: 46094420d70bfef0e9834a1ed7ef60beab1ccb22
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2022-05-20 13:15:30 +02:00
parent a3ee176405
commit 6a9fd6b827
@@ -302,11 +302,11 @@ export function applyInlineStyle(editor, applyStyle, style, shouldApply=true) {
const [
normalizedStartContainer,
normalizedStartOffset
] = getNormalizedCursorPosition(startContainer, startOffset)
] = getNormalizedCursorPosition(startContainer, startOffset);
const [
normalizedEndContainer,
normalizedEndOffset
] = getNormalizedCursorPosition(endContainer, endOffset)
] = getNormalizedCursorPosition(endContainer, endOffset);
const selectedTextNodes = getSelectedNodes(editor.editable).filter(node => {
const atLeastOneCharFromNodeInSelection = !(
(node === normalizedEndContainer && normalizedEndOffset === 0) ||
@@ -326,7 +326,7 @@ export function applyInlineStyle(editor, applyStyle, style, shouldApply=true) {
ancestor = ancestor.parentElement;
}
}
} else{
} else {
isApplied = isFormat[style] && isFormat[style](node);
}
return shouldApply ? !isApplied : isApplied;
@@ -364,7 +364,7 @@ export function applyInlineStyle(editor, applyStyle, style, shouldApply=true) {
newParent.appendChild(textNode);
}
applyStyle(textNode.parentElement);
changedElements.push(textNode.parentElement)
changedElements.push(textNode.parentElement);
}
if (selectedTextNodes[0] && selectedTextNodes[0].textContent === '\u200B') {
setSelection(selectedTextNodes[0], 0);
@@ -403,7 +403,8 @@ const styles = {
switchDirection: {
is: editable => isSelectionFormat(editable, 'switchDirection'),
},
}
};
export function toggleFormat(editor, format) {
const selection = editor.document.getSelection();
if (!selection.rangeCount) return;