]> git.proxmox.com Git - pve-xtermjs.git/commitdiff
implement terminal settings for 3.x
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 10 Apr 2018 12:01:56 +0000 (14:01 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Wed, 11 Apr 2018 12:32:15 +0000 (14:32 +0200)
since xtermjs 3.0, the display is not via html anymore, but a canvas
so we cannot use css overrides anymore

this enables us to let the user set a fontsize/family/etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/www/main.js
src/www/util.js

index 4aa856c0c259d4bf5cbcb872ca1a4ede3e174550..461b6e6f9a4c9179c265a306e589988e823734fa 100644 (file)
@@ -70,7 +70,7 @@ Terminal.applyAddon(fit);
 createTerminal();
 
 function createTerminal() {
-    term = new Terminal();
+    term = new Terminal(getTerminalSettings());
 
     term.on('resize', function (size) {
        if (state === states.connected) {
index b2c40e392a47577fa65b2a8116f7c043c4641c2d..fc6ef07bb6aea6bb1ddbe2a8218939f5a95510e4 100644 (file)
@@ -179,3 +179,17 @@ function API2Request(reqOpts) {
        throw "unknown method";
     }
 }
+
+function getTerminalSettings() {
+    var res = {};
+    var settings = ['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'];
+    if(localStorage) {
+       settings.forEach(function(setting) {
+           var val = localStorage.getItem('pve-xterm-' + setting);
+           if (val !== undefined && val !== null) {
+               res[setting] = val;
+           }
+       });
+    }
+    return res;
+}