mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix demo again
This commit is contained in:
@@ -25,7 +25,9 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
|
||||
public activate(terminal: Terminal): void {
|
||||
const core = (terminal as any)._core;
|
||||
if (!terminal.element) {
|
||||
this.register(core.onWillOpen(() => this.activate(terminal)));
|
||||
this.register(toDisposable(() => {
|
||||
core.onWillOpen(() => this.activate(terminal));
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,9 @@ export class WebglAddon extends Disposable implements ITerminalAddon {
|
||||
}
|
||||
const core = (terminal as any)._core;
|
||||
if (!terminal.element) {
|
||||
this.register(core.onWillOpen(() => this.activate(terminal)));
|
||||
this.register(toDisposable(() => {
|
||||
core.onWillOpen(() => this.activate(terminal));
|
||||
}));
|
||||
return;
|
||||
}
|
||||
this._terminal = terminal;
|
||||
|
||||
+10
-5
@@ -271,11 +271,16 @@ function createTerminal(): void {
|
||||
socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/';
|
||||
|
||||
addons.fit.instance!.fit();
|
||||
typedTerm.loadAddon(addons.webgl.instance);
|
||||
setTimeout(() => {
|
||||
addTextureAtlas(addons.webgl.instance.textureAtlas);
|
||||
addons.webgl.instance.onChangeTextureAtlas(e => addTextureAtlas(e));
|
||||
}, 0);
|
||||
try { // try-catch to allow the demo to load if webgl is not supported
|
||||
typedTerm.loadAddon(addons.webgl.instance);
|
||||
setTimeout(() => {
|
||||
addTextureAtlas(addons.webgl.instance.textureAtlas);
|
||||
addons.webgl.instance.onChangeTextureAtlas(e => addTextureAtlas(e));
|
||||
}, 0);
|
||||
}
|
||||
catch {
|
||||
addons.webgl.instance = undefined;
|
||||
}
|
||||
|
||||
term.open(terminalContainer);
|
||||
term.focus();
|
||||
|
||||
Reference in New Issue
Block a user