Skip to content

Build your personal knowledge base with Trilium Notes

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

Elian Dorand6e9acc149d4
diff --git a/packages/ckeditor5-math/src/mathcommand.ts b/packages/ckeditor5-math/src/mathcommand.ts
index b6126f42f3..e91350e1f2 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,