fixed the color scheme preview not updating

This commit is contained in:
Eugene Pankov 2021-05-23 18:25:43 +02:00
parent 72e667d59d
commit c19e131d8c
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -1,5 +1,5 @@
import { Component, Input, ChangeDetectionStrategy } from '@angular/core' import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'
import { ConfigService, getCSSFontFamily } from 'terminus-core' import { BaseComponent, ConfigService, getCSSFontFamily } from 'terminus-core'
import { TerminalColorScheme } from '../api/interfaces' import { TerminalColorScheme } from '../api/interfaces'
/** @hidden */ /** @hidden */
@ -9,11 +9,19 @@ import { TerminalColorScheme } from '../api/interfaces'
styles: [require('./colorSchemePreview.component.scss')], styles: [require('./colorSchemePreview.component.scss')],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class ColorSchemePreviewComponent { export class ColorSchemePreviewComponent extends BaseComponent {
@Input() scheme: TerminalColorScheme @Input() scheme: TerminalColorScheme
@Input() fontPreview = false @Input() fontPreview = false
constructor (public config: ConfigService) {} constructor (
public config: ConfigService,
changeDetector: ChangeDetectorRef,
) {
super()
this.subscribeUntilDestroyed(config.changed$, () => {
changeDetector.markForCheck()
})
}
getPreviewFontFamily (): string { getPreviewFontFamily (): string {
return getCSSFontFamily(this.config.store) return getCSSFontFamily(this.config.store)