From bfc98702105dab8c54581e4f2395e7dc0989e99b Mon Sep 17 00:00:00 2001 From: Urban Widmark Date: Thu, 7 May 2026 15:59:42 +0200 Subject: [PATCH] Ensure a variant is set, otherwise font changes are ignored --- src/core/modes-utils.ts | 2 +- src/editor-mathfield/styling.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/modes-utils.ts b/src/core/modes-utils.ts index f472fffc0..658721204 100644 --- a/src/core/modes-utils.ts +++ b/src/core/modes-utils.ts @@ -134,7 +134,7 @@ export function variantString(atom: Atom): string { if (!style) return ''; let result = style.variant; - if (result === undefined) return 'normal'; + if (result === undefined) result = 'normal'; if ( ![ diff --git a/src/editor-mathfield/styling.ts b/src/editor-mathfield/styling.ts index 0fafedf37..337783f77 100644 --- a/src/editor-mathfield/styling.ts +++ b/src/editor-mathfield/styling.ts @@ -205,7 +205,7 @@ export function defaultInsertStyleHook( if (model.mode === 'math') { const atom = model.at(bias === 'right' ? info.after : info.before); - if (!atom) return mathfield.defaultStyle; + if (!atom) return { variant: 'normal', ...mathfield.defaultStyle }; // Merge inherited style with defaultStyle, where defaultStyle takes precedence return { ...atom.style, variant: 'normal', ...mathfield.defaultStyle }; }