diff --git a/ts/editor/editor-toolbar/BoldButton.svelte b/ts/editor/editor-toolbar/BoldButton.svelte index 215e98430..d6b580b56 100644 --- a/ts/editor/editor-toolbar/BoldButton.svelte +++ b/ts/editor/editor-toolbar/BoldButton.svelte @@ -17,9 +17,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return match.remove(); } - const fontWeight = getComputedStyle(element).fontWeight; - const threshold = 700; - if (fontWeight && Number(fontWeight) >= threshold) { + const fontWeight = element.style.fontWeight; + if (fontWeight === "bold" || Number(fontWeight) >= 700) { return match.clear((): void => { if ( removeStyleProperties(element, "font-weight") && diff --git a/ts/editor/editor-toolbar/ItalicButton.svelte b/ts/editor/editor-toolbar/ItalicButton.svelte index d5bbb3004..c31b8e93b 100644 --- a/ts/editor/editor-toolbar/ItalicButton.svelte +++ b/ts/editor/editor-toolbar/ItalicButton.svelte @@ -17,8 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return match.remove(); } - const fontStyle = getComputedStyle(element).fontStyle; - if (["italic", "oblique"].includes(fontStyle)) { + if (["italic", "oblique"].includes(element.style.fontStyle)) { return match.clear((): void => { if ( removeStyleProperties(element, "font-style") &&