mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
Equation improvements (#7174)
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -59,12 +59,12 @@ export default class MathEditing extends Plugin {
|
||||
allowWhere: '$text',
|
||||
isInline: true,
|
||||
isObject: true,
|
||||
allowAttributes: [ 'equation', 'type', 'display' ]
|
||||
allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor', 'fontBackgroundColor' ]
|
||||
} );
|
||||
|
||||
schema.register( 'mathtex-display', {
|
||||
inheritAllFrom: '$blockObject',
|
||||
allowAttributes: [ 'equation', 'type', 'display' ]
|
||||
allowAttributes: [ 'equation', 'type', 'display', 'fontSize', 'fontColor' ]
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user