fixed dropping files into the terminal not inserting the path - fixes #10221, fixes #10206

This commit is contained in:
Eugene 2025-01-16 22:24:24 +01:00
parent 92c729dada
commit 6ffeb61c9c
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
3 changed files with 8 additions and 7 deletions

View File

@ -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'
@ -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'
@ -73,6 +74,8 @@ import { VSDevToolsProvider } from './shells/vs'
{ provide: PTYInterface, useClass: ElectronPTYInterface },
{ provide: TerminalDecorator, useClass: PathDropDecorator, multi: true },
// For WindowsDefaultShellProvider
PowerShellCoreShellProvider,
WSLShellProvider,

View File

@ -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()
@ -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()
}))

View File

@ -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'
@ -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 },