apply styles on start and to the terminal iframe (fixes #134)

This commit is contained in:
Eugene Pankov 2017-07-20 23:08:46 +02:00
parent ed0bfb39f3
commit 5f5772501b
2 changed files with 3 additions and 6 deletions

View File

@ -13,7 +13,6 @@ export class ThemesService {
this.applyCurrentTheme() this.applyCurrentTheme()
config.changed$.subscribe(() => { config.changed$.subscribe(() => {
this.applyCurrentTheme() this.applyCurrentTheme()
document.querySelector('style#custom-css').innerHTML = config.store.appearance.css
}) })
} }
@ -32,6 +31,7 @@ export class ThemesService {
document.querySelector('head').appendChild(this.styleElement) document.querySelector('head').appendChild(this.styleElement)
} }
this.styleElement.textContent = theme.css this.styleElement.textContent = theme.css
document.querySelector('style#custom-css').innerHTML = this.config.store.appearance.css
} }
applyCurrentTheme (): void { applyCurrentTheme (): void {

View File

@ -21,7 +21,6 @@ export class TerminalTabComponent extends BaseTabComponent {
@ViewChild('content') content @ViewChild('content') content
@HostBinding('style.background-color') backgroundColor: string @HostBinding('style.background-color') backgroundColor: string
hterm: any hterm: any
configSubscription: Subscription
sessionCloseSubscription: Subscription sessionCloseSubscription: Subscription
hotkeysSubscription: Subscription hotkeysSubscription: Subscription
bell$ = new Subject() bell$ = new Subject()
@ -48,9 +47,6 @@ export class TerminalTabComponent extends BaseTabComponent {
super() super()
this.decorators = this.decorators || [] this.decorators = this.decorators || []
this.title = 'Terminal' this.title = 'Terminal'
this.configSubscription = config.changed$.subscribe(() => {
this.configure()
})
this.resize$.first().subscribe(async (resizeEvent) => { this.resize$.first().subscribe(async (resizeEvent) => {
this.session = this.sessions.addSession( this.session = this.sessions.addSession(
Object.assign({}, this.sessionOptions, resizeEvent) Object.assign({}, this.sessionOptions, resizeEvent)
@ -99,6 +95,7 @@ export class TerminalTabComponent extends BaseTabComponent {
ngOnInit () { ngOnInit () {
this.focused$.subscribe(() => { this.focused$.subscribe(() => {
this.configure()
setTimeout(() => { setTimeout(() => {
this.hterm.scrollPort_.resize() this.hterm.scrollPort_.resize()
this.hterm.scrollPort_.focus() this.hterm.scrollPort_.focus()
@ -294,6 +291,7 @@ export class TerminalTabComponent extends BaseTabComponent {
} }
` `
} }
css += config.appearance.css
preferenceManager.set('user-css', dataurl.convert({ preferenceManager.set('user-css', dataurl.convert({
data: css, data: css,
mimetype: 'text/css', mimetype: 'text/css',
@ -322,7 +320,6 @@ export class TerminalTabComponent extends BaseTabComponent {
this.decorators.forEach(decorator => { this.decorators.forEach(decorator => {
decorator.detach(this) decorator.detach(this)
}) })
this.configSubscription.unsubscribe()
this.hotkeysSubscription.unsubscribe() this.hotkeysSubscription.unsubscribe()
if (this.sessionCloseSubscription) { if (this.sessionCloseSubscription) {
this.sessionCloseSubscription.unsubscribe() this.sessionCloseSubscription.unsubscribe()