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
1 changed files with 10 additions and 5 deletions

View File

@ -20,17 +20,22 @@ class TextCommand {
}
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) {
case 'bold':
return '\\textbf';
return ['\\textbf'];
case 'italic':
return '\\textit';
return ['\\textit'];
case 'bold-italic':
return ['\\textit', '\\textbf'];
default:
return '\\text';
return ['\\text'];
}
}
}