feat: add mtext bold-italic use case

This commit is contained in:
Alexandre Nunes 2020-09-17 11:29:03 -03:00
parent b003619f6a
commit 0e69847439

@ -20,17 +20,22 @@ class TextCommand {
} }
apply(value: string) { apply(value: string) {
return `${this._command}{${value}}`; return this._commands.reduce((acc, command, index) => {
if (index === 0) return `${command}{${value}}`;
return `${command}{${acc}}`;
}, '');
} }
private get _command(): string { private get _commands(): string[] {
switch (this._mathvariant) { switch (this._mathvariant) {
case 'bold': case 'bold':
return '\\textbf'; return ['\\textbf'];
case 'italic': case 'italic':
return '\\textit'; return ['\\textit'];
case 'bold-italic':
return ['\\textit', '\\textbf'];
default: default:
return '\\text'; return ['\\text'];
} }
} }
} }