1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: refresh terminal font after changing in the preferences / keep cluster iframe accessible in DOM while not active/focused

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2022-05-25 14:06:53 +03:00
parent 51d3e2e7a1
commit 22a0befacd
3 changed files with 13 additions and 4 deletions

View File

@ -45,7 +45,6 @@ export class ClusterFrameHandler {
iframe.id = `cluster-frame-${cluster.id}`;
iframe.name = cluster.contextName;
iframe.style.display = "none";
iframe.setAttribute("src", getClusterFrameUrl(clusterId));
iframe.addEventListener("load", action(() => {
logger.info(`[LENS-VIEW]: frame for clusterId=${clusterId} has loaded`);
@ -95,7 +94,7 @@ export class ClusterFrameHandler {
ipcRenderer.send(clusterVisibilityHandler);
for (const { frame: view } of this.views.values()) {
view.style.display = "none";
view.classList.add("hidden");
}
const cluster = clusterId
@ -113,9 +112,9 @@ export class ClusterFrameHandler {
return undefined;
},
(view) => {
(view: LensView) => {
logger.info(`[LENS-VIEW]: cluster id=${clusterId} should now be visible`);
view.frame.style.display = "flex";
view.frame.classList.remove("hidden");
ipcRenderer.send(clusterVisibilityHandler, clusterId);
},
);

View File

@ -35,7 +35,15 @@
background-color: var(--mainBackground);
iframe {
display: flex;
flex: 1;
// when updating font settings in the "Preferences -> Terminal" cluster's iframe
// must be accessible in DOM (e.g. elem.getBoundingClientRect() must work)
&.hidden {
opacity: 0;
pointer-events: none;
}
}
}
}

View File

@ -208,12 +208,14 @@ export class Terminal {
logger.info(`[TERMINAL]: set fontSize to ${fontSize}`);
this.xterm.options.fontSize = fontSize;
this.fit();
};
setFontFamily = (fontFamily: string) => {
logger.info(`[TERMINAL]: set fontFamily to ${fontFamily}`);
this.xterm.options.fontFamily = fontFamily;
this.fit();
// provide css-variable within `:root {}`
document.documentElement.style.setProperty("--font-terminal", fontFamily);