5
0
mirror of git://git.proxmox.com/git/pve-xtermjs.git synced 2025-03-11 20:58:41 +03:00

fix #5063: load WebGL addon in try block

since under certain circumstances (e.g. using safari < 16) the addon
constructor already throws an exception, not only the loading later.

To allow falling back to the canvas renderer, move it into the try
block after WebGL detection.

This should fix the xterm.js console on Apple's iOS.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-12-11 11:19:56 +01:00 committed by Thomas Lamprecht
parent e2e62fc673
commit de938aa06c

View File

@ -99,7 +99,6 @@ var terminalContainer = document.getElementById('terminal-container');
document.getElementById('status_bar').addEventListener('click', hideMsg);
document.getElementById('connect_btn').addEventListener('click', startGuest);
const fitAddon = new FitAddon.FitAddon();
const webglAddon = new WebglAddon.WebglAddon();
createTerminal();
@ -157,6 +156,7 @@ function createTerminal() {
let loadedWebgl = false;
try {
if (detectWebgl()) {
const webglAddon = new WebglAddon.WebglAddon();
term.loadAddon(webglAddon);
loadedWebgl = true;
}