prosekit/extensions/file
Classes
Section titled “Classes”UploadTask<Result>
Section titled “UploadTask<Result>”A class that represents a upload task.
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”-
readonly objectURL:
string
-
An object URL representing the file to be uploaded. This URL will be revoked once the upload is complete successfully.
-
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.
Methods
Section titled “Methods”-
subscribeProgress(
callback
: (progress
:UploadProgress
) =>void
):VoidFunction
-
Subscribes to progress updates. Returns a function to unsubscribe.
-
static get<Result>(
objectURL
:string
):undefined
|UploadTask
<Result
> -
Finds an upload task by its object URL.
-
static delete(
objectURL
:string
):void
-
Deletes an upload task by its object URL.
Interfaces
Section titled “Interfaces”FileDropHandlerOptions
Section titled “FileDropHandlerOptions”Properties
Section titled “Properties”-
The editor view.
-
pos:
number
-
The position of the document where the file was dropped.
FilePasteHandlerOptions
Section titled “FilePasteHandlerOptions”Properties
Section titled “Properties”-
The editor view.
-
The event that triggered the paste.
UploadProgress
Section titled “UploadProgress”An interface representing the upload progress.
Properties
Section titled “Properties”-
loaded:
number
-
total:
number
UploaderOptions
Section titled “UploaderOptions”Properties
Section titled “Properties”-
onProgress: (
progress
:UploadProgress
) =>void
-
A callback function that should be called with the upload progress updates.
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.
Functions
Section titled “Functions”defineFileDropHandler()
Section titled “defineFileDropHandler()”-
function defineFileDropHandler(
handler
:FileDropHandler
):PlainExtension
defineFilePasteHandler()
Section titled “defineFilePasteHandler()”-
function defineFilePasteHandler(
handler
:FilePasteHandler
):PlainExtension