mirror of
https://github.com/zadam/trilium.git
synced 2025-10-19 22:58:52 +02:00
feat(math): inherit attributes from selection
This commit is contained in:
parent
d49ce7c289
commit
7c30e2b4f6
@ -33,10 +33,18 @@ export default class MathCommand extends Command {
|
||||
{ equation, type, display }
|
||||
);
|
||||
} else {
|
||||
const selection = this.editor.model.document.selection;
|
||||
|
||||
// Create new model element
|
||||
mathtex = 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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user