From 272f2f8de150454fca7895913bd85c60a6c3ac2e Mon Sep 17 00:00:00 2001 From: Lonny Wong Date: Fri, 10 Nov 2023 11:04:00 +0800 Subject: [PATCH] add trzszDragInitTimeout option (#1238) --- html/package.json | 2 +- html/src/components/terminal/xterm/addons/zmodem.ts | 2 ++ html/src/components/terminal/xterm/index.ts | 5 +++++ html/yarn.lock | 10 +++++----- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/html/package.json b/html/package.json index fe743e9..9b9b25d 100644 --- a/html/package.json +++ b/html/package.json @@ -55,7 +55,7 @@ "decko": "^1.2.0", "file-saver": "^2.0.5", "preact": "^10.18.1", - "trzsz": "^1.1.3", + "trzsz": "^1.1.4", "whatwg-fetch": "^3.6.19", "xterm": "^5.3.0", "xterm-addon-canvas": "^0.5.0", diff --git a/html/src/components/terminal/xterm/addons/zmodem.ts b/html/src/components/terminal/xterm/addons/zmodem.ts index 8571f68..7873836 100644 --- a/html/src/components/terminal/xterm/addons/zmodem.ts +++ b/html/src/components/terminal/xterm/addons/zmodem.ts @@ -8,6 +8,7 @@ export interface ZmodeOptions { zmodem: boolean; trzsz: boolean; windows: boolean; + trzszDragInitTimeout: number; onSend: () => void; sender: (data: string | Uint8Array) => void; writer: (data: string | Uint8Array) => void; @@ -75,6 +76,7 @@ export class ZmodemAddon implements ITerminalAddon { sendToServer: data => sender(data), terminalColumns: terminal.cols, isWindowsShell: this.options.windows, + dragInitTimeout: this.options.trzszDragInitTimeout, }); const element = terminal.element as EventTarget; this.addDisposableListener(element, 'dragover', event => event.preventDefault()); diff --git a/html/src/components/terminal/xterm/index.ts b/html/src/components/terminal/xterm/index.ts index 06d97ee..4610c37 100644 --- a/html/src/components/terminal/xterm/index.ts +++ b/html/src/components/terminal/xterm/index.ts @@ -45,6 +45,7 @@ export interface ClientOptions { enableSixel: boolean; titleFixed?: string; isWindows: boolean; + trzszDragInitTimeout: number; } export interface FlowControl { @@ -328,6 +329,7 @@ export class Xterm { zmodem: prefs.enableZmodem, trzsz: prefs.enableTrzsz, windows: prefs.isWindows, + trzszDragInitTimeout: prefs.trzszDragInitTimeout, onSend: this.sendCb, sender: this.sendData, writer: this.writeData, @@ -366,6 +368,9 @@ export class Xterm { case 'enableTrzsz': if (value) console.log('[ttyd] trzsz enabled'); break; + case 'trzszDragInitTimeout': + if (value) console.log(`[ttyd] trzsz drag init timeout: ${value}`); + break; case 'enableSixel': if (value) { terminal.loadAddon(register(new ImageAddon())); diff --git a/html/yarn.lock b/html/yarn.lock index de113b3..b8281f4 100644 --- a/html/yarn.lock +++ b/html/yarn.lock @@ -9925,13 +9925,13 @@ __metadata: languageName: node linkType: hard -"trzsz@npm:^1.1.3": - version: 1.1.3 - resolution: "trzsz@npm:1.1.3" +"trzsz@npm:^1.1.4": + version: 1.1.4 + resolution: "trzsz@npm:1.1.4" bin: trz: bin/trz.js tsz: bin/tsz.js - checksum: 6bdb718a744d6983ebbe57237e54c580cb39ecb5adcf135c65c99a9fd1a3139f52279b9992b6dc28a8d84ca569d7a01e49981d9d2080dd17867ac05c756b15dd + checksum: d84fe4f2e2784f0c3beb4063647738f6a32eb07ee0f5de0d8fe5ea9b5a5817e327454e80c2bfa9515090739a5e63e6775340d9d1b06742243e7f1a9b63449ddf languageName: node linkType: hard @@ -10021,7 +10021,7 @@ __metadata: style-loader: ^3.3.3 terser-webpack-plugin: ^5.3.9 through2: ^4.0.2 - trzsz: ^1.1.3 + trzsz: ^1.1.4 ts-loader: ^9.5.0 typescript: ^5.2.2 util: ^0.12.5 -- 2.43.4