prosekit/extensions/file
Classes
Section titled “Classes”UploadTask<Result>
Section titled “UploadTask<Result>”A class that represents a upload task.
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
|
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new UploadTask<Result>(
options
:object
):UploadTask
<Result
> -
Creates a new upload task. You can find the upload task by its object URL later using
UploadTask.get()
.
Properties
Section titled “Properties”-
protected done:
boolean
=false
-
A boolean indicating whether the upload is complete (either successfully or with an error).
-
A promise that fulfills once the upload is complete, or rejects if an error occurs.
-
readonly objectURL:
string
-
An object URL representing the file to be uploaded. This URL will be revoked once the upload is complete successfully.
Methods
Section titled “Methods”subscribeProgress()
Section titled “subscribeProgress()”-
subscribeProgress(
callback
: (progress
:UploadProgress
) =>void
):VoidFunction
-
Subscribes to progress updates. Returns a function to unsubscribe.
delete()
Section titled “delete()”-
static delete(
objectURL
:string
):void
-
Deletes an upload task by its object URL.
-
static get<Result>(
objectURL
:string
):undefined
|UploadTask
<Result
> -
Finds an upload task by its object URL.
Interfaces
Section titled “Interfaces”FileDropHandlerOptions
Section titled “FileDropHandlerOptions”Properties
Section titled “Properties”-
pos:
number
-
The position of the document where the file was dropped.
-
The editor view.
FilePasteHandlerOptions
Section titled “FilePasteHandlerOptions”Properties
Section titled “Properties”-
The event that triggered the paste.
-
The editor view.
UploaderOptions
Section titled “UploaderOptions”Properties
Section titled “Properties”-
onProgress: (
progress
:UploadProgress
) =>void
-
A callback function that should be called with the upload progress updates.
UploadProgress
Section titled “UploadProgress”An interface representing the upload progress.
Properties
Section titled “Properties”-
loaded:
number
-
total:
number
Type Aliases
Section titled “Type Aliases”Uploader()<Result>
Section titled “Uploader()<Result>”-
type Uploader<Result> = (
options
:UploaderOptions
) =>Promise
<Result
> -
The implementation of the actual upload function. You need to implement this function to upload files to your desired destination.
Type Parameters
Section titled “Type Parameters”Type Parameter Result
Functions
Section titled “Functions”defineFileDropHandler()
Section titled “defineFileDropHandler()”-
function defineFileDropHandler(
handler
:FileDropHandler
):PlainExtension
defineFilePasteHandler()
Section titled “defineFilePasteHandler()”-
function defineFilePasteHandler(
handler
:FilePasteHandler
):PlainExtension