MCPcopy
hub / github.com/Eugeny/tabby / attach

Method attach

tabby-electron/src/pathDrop.ts:9–21  ·  view source on GitHub ↗
(terminal: BaseTerminalTabComponent<BaseTerminalProfile>)

Source from the content-addressed store, hash-verified

7@Injectable()
8export class PathDropDecorator extends TerminalDecorator {
9 attach (terminal: BaseTerminalTabComponent<BaseTerminalProfile>): void {
10 setTimeout(() => {
11 this.subscribeUntilDetached(terminal, terminal.frontend?.dragOver$.subscribe(event => {
12 event.preventDefault()
13 }))
14 this.subscribeUntilDetached(terminal, terminal.frontend?.drop$.subscribe((event: DragEvent) => {
15 for (const file of event.dataTransfer!.files as unknown as Iterable<File>) {
16 this.injectPath(terminal, webUtils.getPathForFile(file))
17 }
18 event.preventDefault()
19 }))
20 })
21 }
22
23 private injectPath (terminal: BaseTerminalTabComponent<BaseTerminalProfile>, path: string) {
24 const shellType = this.getShellType(terminal)

Callers

nothing calls this directly

Calls 2

injectPathMethod · 0.95
subscribeMethod · 0.45

Tested by

no test coverage detected