mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
download/upload implementation for the web
This commit is contained in:
@@ -10,7 +10,7 @@ export { Theme } from './theme'
|
||||
export { TabContextMenuItemProvider } from './tabContextMenuProvider'
|
||||
export { SelectorOption } from './selector'
|
||||
export { CLIHandler, CLIEvent } from './cli'
|
||||
export { PlatformService, ClipboardContent, MessageBoxResult, MessageBoxOptions, FileDownload, FileUpload, FileTransfer, FileUploadOptions } from './platform'
|
||||
export { PlatformService, ClipboardContent, MessageBoxResult, MessageBoxOptions, FileDownload, FileUpload, FileTransfer, HTMLFileUpload, FileUploadOptions } from './platform'
|
||||
export { MenuItemOptions } from './menu'
|
||||
export { BootstrapData, BOOTSTRAP_DATA } from './mainProcess'
|
||||
export { HostWindowService } from './hostWindow'
|
||||
|
@@ -88,7 +88,7 @@ export abstract class PlatformService {
|
||||
abstract startDownload (name: string, size: number): Promise<FileDownload|null>
|
||||
abstract startUpload (options?: FileUploadOptions): Promise<FileUpload[]>
|
||||
|
||||
startUploadFromDragEvent (event: DragEvent): FileUpload[] {
|
||||
startUploadFromDragEvent (event: DragEvent, multiple = false): FileUpload[] {
|
||||
const result: FileUpload[] = []
|
||||
if (!event.dataTransfer) {
|
||||
return []
|
||||
@@ -96,9 +96,12 @@ export abstract class PlatformService {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < event.dataTransfer.files.length; i++) {
|
||||
const file = event.dataTransfer.files[i]
|
||||
const transfer = new DropUpload(file)
|
||||
const transfer = new HTMLFileUpload(file)
|
||||
this.fileTransferStarted.next(transfer)
|
||||
result.push(transfer)
|
||||
if (!multiple) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -160,8 +163,7 @@ export abstract class PlatformService {
|
||||
abstract quit (): void
|
||||
}
|
||||
|
||||
|
||||
class DropUpload extends FileUpload {
|
||||
export class HTMLFileUpload extends FileUpload {
|
||||
private stream: ReadableStream
|
||||
private reader: ReadableStreamDefaultReader
|
||||
|
||||
|
Reference in New Issue
Block a user