mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 17:07:15 +00:00
fixed font loading in the web version
This commit is contained in:
parent
f6d4a51239
commit
08cc19946f
4 changed files with 10 additions and 7 deletions
|
@ -260,13 +260,13 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||
this.frontend.write('\r\n\r\n')
|
||||
}
|
||||
|
||||
setImmediate(() => {
|
||||
setImmediate(async () => {
|
||||
if (this.hasFocus) {
|
||||
this.frontend!.attach(this.content.nativeElement)
|
||||
await this.frontend!.attach(this.content.nativeElement)
|
||||
this.frontend!.configure()
|
||||
} else {
|
||||
this.focused$.pipe(first()).subscribe(() => {
|
||||
this.frontend!.attach(this.content.nativeElement)
|
||||
this.focused$.pipe(first()).subscribe(async () => {
|
||||
await this.frontend!.attach(this.content.nativeElement)
|
||||
this.frontend!.configure()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ export abstract class Frontend {
|
|||
}
|
||||
}
|
||||
|
||||
abstract attach (host: HTMLElement): void
|
||||
abstract async attach (host: HTMLElement): Promise<void>
|
||||
detach (host: HTMLElement): void { } // eslint-disable-line
|
||||
|
||||
abstract getSelection (): string
|
||||
|
|
|
@ -13,7 +13,7 @@ export class HTermFrontend extends Frontend {
|
|||
private configuredBackgroundColor = 'transparent'
|
||||
private zoom = 0
|
||||
|
||||
attach (host: HTMLElement): void {
|
||||
async attach (host: HTMLElement): Promise<void> {
|
||||
if (!this.initialized) {
|
||||
this.init()
|
||||
this.initialized = true
|
||||
|
|
|
@ -131,12 +131,15 @@ export class XTermFrontend extends Frontend {
|
|||
})
|
||||
}
|
||||
|
||||
attach (host: HTMLElement): void {
|
||||
async attach (host: HTMLElement): Promise<void> {
|
||||
this.configure()
|
||||
|
||||
this.xterm.open(host)
|
||||
this.opened = true
|
||||
|
||||
// Work around font loading bugs
|
||||
await new Promise(resolve => setTimeout(resolve, process.env.XWEB ? 1000 : 0))
|
||||
|
||||
if (this.enableWebGL) {
|
||||
this.xterm.loadAddon(new WebglAddon())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue