[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user