Skip to content

Commit

Permalink
fixed dropping files into the terminal not inserting the path - fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jan 16, 2025
1 parent 92c729d commit 6ffeb61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion tabby-electron/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'
import { PlatformService, LogService, UpdaterService, DockingService, HostAppService, ThemesService, Platform, AppService, ConfigService, WIN_BUILD_FLUENT_BG_SUPPORTED, isWindowsBuild, HostWindowService, HotkeyProvider, ConfigProvider, FileProvider } from 'tabby-core'
import { TerminalColorSchemeProvider } from 'tabby-terminal'
import { TerminalColorSchemeProvider, TerminalDecorator } from 'tabby-terminal'
import { SFTPContextMenuItemProvider, SSHProfileImporter, AutoPrivateKeyLocator } from 'tabby-ssh'
import { PTYInterface, ShellProvider, UACService } from 'tabby-local'
import { auditTime } from 'rxjs'
Expand All @@ -23,6 +23,7 @@ import { ElectronConfigProvider } from './config'
import { EditSFTPContextMenu } from './sftpContextMenu'
import { OpenSSHImporter, PrivateKeyLocator, StaticFileImporter } from './sshImporters'
import { ElectronPTYInterface } from './pty'
import { PathDropDecorator } from './pathDrop'

import { CmderShellProvider } from './shells/cmder'
import { Cygwin32ShellProvider } from './shells/cygwin32'
Expand Down Expand Up @@ -73,6 +74,8 @@ import { VSDevToolsProvider } from './shells/vs'

{ provide: PTYInterface, useClass: ElectronPTYInterface },

{ provide: TerminalDecorator, useClass: PathDropDecorator, multi: true },

// For WindowsDefaultShellProvider
PowerShellCoreShellProvider,
WSLShellProvider,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import { TerminalDecorator } from '../api/decorator'
import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component'
import { TerminalDecorator, BaseTerminalTabComponent } from 'tabby-terminal'
import { webUtils } from 'electron'

/** @hidden */
@Injectable()
Expand All @@ -11,8 +11,8 @@ export class PathDropDecorator extends TerminalDecorator {
event.preventDefault()
}))
this.subscribeUntilDetached(terminal, terminal.frontend?.drop$.subscribe((event: DragEvent) => {
for (const file of event.dataTransfer!.files as any) {
this.injectPath(terminal, file.path)
for (const file of event.dataTransfer!.files as unknown as Iterable<File>) {
this.injectPath(terminal, webUtils.getPathForFile(file))
}
event.preventDefault()
}))
Expand Down
2 changes: 0 additions & 2 deletions tabby-terminal/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { TerminalContextMenuItemProvider } from './api/contextMenuProvider'
import { TerminalColorSchemeProvider } from './api/colorSchemeProvider'
import { TerminalSettingsTabProvider, AppearanceSettingsTabProvider, ColorSchemeSettingsTabProvider } from './settings'
import { DebugDecorator } from './features/debug'
import { PathDropDecorator } from './features/pathDrop'
import { ZModemDecorator } from './features/zmodem'
import { TerminalConfigProvider } from './config'
import { TerminalHotkeyProvider } from './hotkeys'
Expand Down Expand Up @@ -54,7 +53,6 @@ import { DefaultColorSchemes } from './colorSchemes'

{ provide: ConfigProvider, useClass: TerminalConfigProvider, multi: true },
{ provide: HotkeyProvider, useClass: TerminalHotkeyProvider, multi: true },
{ provide: TerminalDecorator, useClass: PathDropDecorator, multi: true },
{ provide: TerminalDecorator, useClass: ZModemDecorator, multi: true },
{ provide: TerminalDecorator, useClass: DebugDecorator, multi: true },

Expand Down

0 comments on commit 6ffeb61

Please sign in to comment.