Use array of class names instead of string

This commit is contained in:
Matt Bierner
2020-06-22 15:24:07 -07:00
parent adb27e5fd0
commit 5c375ef21c

View File

@@ -1217,26 +1217,28 @@ class EditorClassName extends ComputedEditorOption<EditorOption.editorClassName,
}
public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: string): string {
let className = 'monaco-editor';
const classNames = ['monaco-editor'];
if (options.get(EditorOption.extraEditorClassName)) {
className += ' ' + options.get(EditorOption.extraEditorClassName);
classNames.push(options.get(EditorOption.extraEditorClassName));
}
if (env.extraEditorClassName) {
className += ' ' + env.extraEditorClassName;
classNames.push(env.extraEditorClassName);
}
if (options.get(EditorOption.mouseStyle) === 'default') {
className += ' mouse-default';
classNames.push('mouse-default');
} else if (options.get(EditorOption.mouseStyle) === 'copy') {
className += ' mouse-copy';
classNames.push('mouse-copy');
}
if (options.get(EditorOption.showUnused)) {
className += ' showUnused';
classNames.push('showUnused');
}
if (options.get(EditorOption.showDeprecated)) {
className += ' showDeprecated';
classNames.push('showDeprecated');
}
return className;
return classNames.join(' ');
}
}