Skip to content

Commit

Permalink
add trzszDragInitTimeout option (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong authored Nov 10, 2023
1 parent 3b17574 commit 272f2f8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions html/src/components/terminal/xterm/addons/zmodem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions html/src/components/terminal/xterm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface ClientOptions {
enableSixel: boolean;
titleFixed?: string;
isWindows: boolean;
trzszDragInitTimeout: number;
}

export interface FlowControl {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()));
Expand Down
10 changes: 5 additions & 5 deletions html/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 272f2f8

Please sign in to comment.