diff --git a/frontend/text-editor/src/editor/content/dom/Style.js b/frontend/text-editor/src/editor/content/dom/Style.js index f8866550ed..aaf9e19227 100644 --- a/frontend/text-editor/src/editor/content/dom/Style.js +++ b/frontend/text-editor/src/editor/content/dom/Style.js @@ -336,20 +336,22 @@ export function getStyle(element, styleName, styleUnit) { * @returns {HTMLElement} */ export function setStylesFromObject(element, allowedStyles, styleObject) { - if (element.tagName === "SPAN") - for (const [styleName, styleUnit] of allowedStyles) { - if (!(styleName in styleObject)) { - continue; - } - let styleValue = styleObject[styleName]; - if (!styleValue) continue; - - if (styleName === "font-family") { - styleValue = sanitizeFontFamily(styleValue); - } - - setStyle(element, styleName, styleValue, styleUnit); + for (const [styleName, styleUnit] of allowedStyles) { + if (!(styleName in styleObject)) { + continue; } + + let styleValue = styleObject[styleName]; + if (!styleValue) { + continue; + } + + if (styleName === "font-family") { + styleValue = sanitizeFontFamily(styleValue); + } + + setStyle(element, styleName, styleValue, styleUnit); + } return element; } diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index 410c7daa13..88583a1116 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -1961,7 +1961,8 @@ export class SelectionController extends EventTarget { this.setSelection(newTextSpan.firstChild, 0, newTextSpan.firstChild, 0); } // The styles are applied to the paragraph - else { + else + { const paragraph = this.startParagraph; setParagraphStyles(paragraph, newStyles); // Apply styles to child text spans.