Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/desktop/src/lib/trpc/routers/window.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import fs from "node:fs/promises";
import { homedir } from "node:os";
import path from "node:path";
import type { BrowserWindow } from "electron";
import { dialog } from "electron";
import { publicProcedure, router } from "..";
Expand Down Expand Up @@ -72,9 +74,6 @@ export const createWindowRouter = (getWindow: () => BrowserWindow | null) => {
return { canceled: true, dataUrl: null };
}

// Read the file and convert to base64 data URL
const fs = await import("node:fs/promises");
const path = await import("node:path");
const filePath = result.filePaths[0];
const buffer = await fs.readFile(filePath);
const ext = path.extname(filePath).slice(1).toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { toast } from "@superset/ui/sonner";
import { ClipboardAddon } from "@xterm/addon-clipboard";
import { FitAddon } from "@xterm/addon-fit";
import { ImageAddon } from "@xterm/addon-image";
import { LigaturesAddon } from "@xterm/addon-ligatures";
import { Unicode11Addon } from "@xterm/addon-unicode11";
import { WebglAddon } from "@xterm/addon-webgl";
import type { ITheme } from "@xterm/xterm";
Expand Down Expand Up @@ -221,16 +222,13 @@ export function createTerminalInstance(
rendererRef.current = loadRenderer(xterm);
});

import("@xterm/addon-ligatures")
.then(({ LigaturesAddon }) => {
if (isDisposed) return;
try {
xterm.loadAddon(new LigaturesAddon());
} catch {
// Ligatures not supported by current font
}
})
.catch(() => {});
try {
if (!isDisposed) {
xterm.loadAddon(new LigaturesAddon());
}
} catch {
// Ligatures not supported by current font
}

const cleanupQuerySuppression = suppressQueryResponses(xterm);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FitAddon } from "@xterm/addon-fit";
import type { SearchAddon } from "@xterm/addon-search";
import { SearchAddon } from "@xterm/addon-search";
import type { IDisposable, ITheme, Terminal as XTerm } from "@xterm/xterm";
import type { MutableRefObject, RefObject } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -239,12 +239,11 @@ export function useTerminalLifecycle({
xterm.focus();
}

import("@xterm/addon-search").then(({ SearchAddon }) => {
if (isUnmounted) return;
if (!isUnmounted) {
const searchAddon = new SearchAddon();
xterm.loadAddon(searchAddon);
searchAddonRef.current = searchAddon;
});
}

// Wait for first render before applying restoration
let renderDisposable: IDisposable | null = null;
Expand Down
Loading