prosekit/extensions/image
Interfaces
Section titled “Interfaces”UploadImageOptions
Section titled “UploadImageOptions”Options for uploadImage.
Properties
Section titled “Properties”-
The uploader used to upload the file. It should return a promise that resolves to the URL of the uploaded image.
-
pos?:
number
-
The position where the image should be inserted. If not provided, the image is inserted at the current selection.
-
A handler to be called when an error occurs during the upload.
ImageUploadErrorHandlerOptions
Section titled “ImageUploadErrorHandlerOptions”Options for the ImageUploadErrorHandler callback.
Properties
Section titled “Properties”-
error:
unknown
-
The error that occurred during the upload.
-
uploadTask:
UploadTask
<string
> -
The upload task that was used to upload the file.
ImageAttrs
Section titled “ImageAttrs”Properties
Section titled “Properties”-
src?:
null
|string
-
width?:
null
|number
-
height?:
null
|number
ImageUploadHandlerOptions
Section titled “ImageUploadHandlerOptions”A handler to be called when an error occurs during the upload.
Properties
Section titled “Properties”-
The uploader used to upload the file. It should return a promise that resolves to the URL of the uploaded image.
-
A predicate to determine if the pasted file should be uploaded and inserted as an image. If not provided, it defaults to only allowing paste of files with a content type starting with
image/
.
-
A predicate to determine if the dropped file should be uploaded and inserted as an image. If not provided, it defaults to only allowing drop of files with a content type starting with
image/
.
-
A handler to be called when an error occurs during the upload. If not provided, it defaults to logging the error to the console.
Type Aliases
Section titled “Type Aliases”ImageUploadErrorHandler()
Section titled “ImageUploadErrorHandler()”-
type ImageUploadErrorHandler = (
options
:ImageUploadErrorHandlerOptions
) =>void
-
A handler to be called when an error occurs during the upload.
ImageCanPastePredicate()
Section titled “ImageCanPastePredicate()”-
type ImageCanPastePredicate = (
options
:FilePasteHandlerOptions
) =>boolean
-
A predicate to determine if the pasted file should be uploaded and inserted as an image.
ImageCanDropPredicate()
Section titled “ImageCanDropPredicate()”-
type ImageCanDropPredicate = (
options
:FileDropHandlerOptions
) =>boolean
-
A predicate to determine if the dropped file should be uploaded and inserted as an image.
Functions
Section titled “Functions”insertImage()
Section titled “insertImage()”-
function insertImage(
attrs?
:ImageAttrs
):Command
-
Returns a command that inserts an image node with the given attributes at the current selection position.
uploadImage()
Section titled “uploadImage()”-
function uploadImage(
options
:UploadImageOptions
):Command
-
Returns a command that uploads an image file and inserts an image node with a temporary URL which is replaced once the upload completes.
defineImageUploadHandler()
Section titled “defineImageUploadHandler()”-
function defineImageUploadHandler(
options
:ImageUploadHandlerOptions
):PlainExtension
-
Returns an extension that handles image file uploads when pasting or dropping images into the editor.
defineImage()
Section titled “defineImage()”-
function defineImage():
ImageExtension