fix(ckeditor5-math): equation not maintaining styles (closes #7211)

This commit is contained in:
Elian Doran 2025-10-07 11:14:56 +03:00
parent 26e14aff7b
commit d6e9acc149
No known key found for this signature in database

View File

@ -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,