mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +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 }
|
{ equation, type, display }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
const selection = this.editor.model.document.selection;
|
||||||
|
|
||||||
// Create new model element
|
// Create new model element
|
||||||
mathtex = writer.createElement(
|
mathtex = writer.createElement(
|
||||||
display ? 'mathtex-display' : 'mathtex-inline',
|
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 );
|
model.insertContent( mathtex );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user