mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: preload font for terminal
This commit is contained in:
1 parent
060a7e541e
commit
7d6b26f9b6
4 files changed
+61
-3
No files matched your search
@@ -33,6 +33,7 @@ import { DeploymentScaleDialog } from "./+workloads-deployments/deployment-scale
|
||||
import { CustomResources } from "./+custom-resources/custom-resources";
|
||||
import { crdRoute } from "./+custom-resources";
|
||||
import { isAllowedResource } from "../api/rbac";
|
||||
import { Terminal } from "./dock/terminal";
|
||||
|
||||
@observer
|
||||
export class App extends React.Component {
|
||||
@@ -41,6 +42,7 @@ export class App extends React.Component {
|
||||
static async init() {
|
||||
await i18nStore.init();
|
||||
await configStore.init();
|
||||
await Terminal.preloadFonts();
|
||||
render(<App/>, App.rootElem);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FitAddon } from "xterm-addon-fit";
|
||||
import { dockStore, TabId } from "./dock.store";
|
||||
import { TerminalApi } from "../../api/terminal-api";
|
||||
import { themeStore } from "../../theme.store";
|
||||
import { autobind } from "../../utils";
|
||||
import { autobind } from "../../utils/autobind";
|
||||
|
||||
export class Terminal {
|
||||
static spawningPool: HTMLElement;
|
||||
@@ -20,6 +20,13 @@ export class Terminal {
|
||||
Terminal.spawningPool = pool;
|
||||
}
|
||||
|
||||
static async preloadFonts(){
|
||||
var fontPath = require("../fonts/roboto-mono-nerd.ttf").default;
|
||||
var fontFace = new FontFace("RobotoMono", `url(${fontPath})`);
|
||||
await fontFace.load();
|
||||
document.fonts.add(fontFace);
|
||||
}
|
||||
|
||||
public xterm: XTerm;
|
||||
public fitAddon: FitAddon;
|
||||
public scrollPos = 0;
|
||||
@@ -67,7 +74,7 @@ export class Terminal {
|
||||
Terminal.spawningPool.appendChild(this.elem);
|
||||
}
|
||||
|
||||
init() {
|
||||
async init() {
|
||||
if (this.xterm) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user