Skip to content

Commit f137647

Browse files
committed
feat: add support for clipboard copying from ui RunTerminal
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 91fb871 commit f137647

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

pdl-live-react/package-lock.json

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdl-live-react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@tauri-apps/plugin-fs": "^2.2.0",
3030
"@tauri-apps/plugin-opener": "^2",
3131
"@tauri-apps/plugin-window-state": "^2.2.1",
32+
"@xterm/addon-clipboard": "^0.1.0",
3233
"@xterm/addon-fit": "^0.10.0",
3334
"@xterm/xterm": "^5.3.0",
3435
"pretty-bytes": "^6.1.1",

pdl-live-react/src/view/term/RunTerminal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createRef, useCallback, useEffect, useState } from "react"
33
import { spawn } from "tauri-pty"
44
import { Terminal } from "@xterm/xterm"
55
import { FitAddon } from "@xterm/addon-fit"
6+
import { ClipboardAddon } from "@xterm/addon-clipboard"
67

78
import "./RunTerminal.css"
89

@@ -50,6 +51,8 @@ export default function RunTerminal({ cmd, args = [], onExit }: Props) {
5051
if (term && ref.current && exitCode === -1) {
5152
const fitAddon = new FitAddon()
5253
term.loadAddon(fitAddon)
54+
const clipboardAddon = new ClipboardAddon()
55+
term.loadAddon(clipboardAddon)
5356

5457
term.open(ref.current)
5558
fitAddon.fit()

0 commit comments

Comments
 (0)