Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(math): inherit attributes from selection
Elian Doran7c30e2b4f6ed
diff --git a/packages/ckeditor5-math/src/mathcommand.ts b/packages/ckeditor5-math/src/mathcommand.tsindex 63671f4374..b6126f42f3 100644--- a/packages/ckeditor5-math/src/mathcommand.ts+++ b/packages/ckeditor5-math/src/mathcommand.ts@@ -33,10 +33,18 @@ export default class MathCommand extends Command {{ equation, type, display });} else {+ const selection = this.editor.model.document.selection;+// Create new model elementmathtex = writer.createElement(display ? 'mathtex-display' : 'mathtex-inline',- { equation, type: outputType, display }+ {+ // Inherit all attributes from selection (e.g. color, background color, size).+ ...Object.fromEntries( selection.getAttributes() ),+ equation,+ type: outputType,+ display,+ });}model.insertContent( mathtex );