From 6a9fd6b827d1fb9f4ff4de2d90a61e6d7a4ed9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Wed, 18 May 2022 09:56:50 +0000 Subject: [PATCH] [FIX] web_editor: fix some linting errors closes odoo/odoo#91786 X-original-commit: 46094420d70bfef0e9834a1ed7ef60beab1ccb22 Signed-off-by: David Monjoie (dmo) --- .../static/lib/odoo-editor/src/commands/commands.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js index 60852a4eb38..68f0ebbb834 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js @@ -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;