From d6e9acc149d44bfc17edd1b5522789f4d4ddf6ea Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 7 Oct 2025 11:14:56 +0300 Subject: [PATCH] fix(ckeditor5-math): equation not maintaining styles (closes #7211) --- packages/ckeditor5-math/src/mathcommand.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-math/src/mathcommand.ts b/packages/ckeditor5-math/src/mathcommand.ts index b6126f42f..e91350e1f 100644 --- a/packages/ckeditor5-math/src/mathcommand.ts +++ b/packages/ckeditor5-math/src/mathcommand.ts @@ -30,7 +30,12 @@ export default class MathCommand extends Command { mathtex = writer.createElement( display ? 'mathtex-display' : 'mathtex-inline', - { equation, type, display } + { + ...Object.fromEntries(selection.getAttributes()), + equation, + type, + display + } ); } else { const selection = this.editor.model.document.selection; @@ -40,7 +45,7 @@ export default class MathCommand extends Command { display ? 'mathtex-display' : 'mathtex-inline', { // Inherit all attributes from selection (e.g. color, background color, size). - ...Object.fromEntries( selection.getAttributes() ), + ...Object.fromEntries(selection.getAttributes()), equation, type: outputType, display,