Skip to content

Commit 65198f6

Browse files
committed
fix: add clipboard addon to docker container terminal
The docker container terminal did not load xterm's ClipboardAddon, so pasting into it (e.g. a MariaDB shell) broke the cursor and left the pasted text uneditable. The web server terminal already loads this addon; this brings the container terminal in line with it. Also dispose the terminal on cleanup so its addons don't leak on remount. Fixes Dokploy#5065
1 parent 2bda2cc commit 65198f6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎apps/dokploy/components/dashboard/docker/terminal/docker-terminal.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useEffect, useRef } from "react";
33
import { FitAddon } from "xterm-addon-fit";
44
import "@xterm/xterm/css/xterm.css";
55
import { AttachAddon } from "@xterm/addon-attach";
6+
import { ClipboardAddon } from "@xterm/addon-clipboard";
67
import { useTheme } from "next-themes";
78
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
89
import { fixMacOsAltKeys } from "@/lib/terminal-keyboard";
@@ -46,6 +47,8 @@ export const DockerTerminal: React.FC<Props> = ({
4647
const ws = new WebSocket(wsUrl);
4748

4849
const addonAttach = new AttachAddon(ws);
50+
const clipboardAddon = new ClipboardAddon();
51+
term.loadAddon(clipboardAddon);
4952
fixMacOsAltKeys(term);
5053
// @ts-ignore
5154
term.open(termRef.current);
@@ -55,6 +58,7 @@ export const DockerTerminal: React.FC<Props> = ({
5558
addonFit.fit();
5659
return () => {
5760
ws.readyState === WebSocket.OPEN && ws.close();
61+
term.dispose();
5862
};
5963
}, [containerId, activeWay, id]);
6064

0 commit comments

Comments
 (0)