prosekit/extensions/image
Interfaces
Section titled “Interfaces”ImageAttrs
Section titled “ImageAttrs”Properties
Section titled “Properties”-
src?:
null
|string
-
width?:
null
|number
-
height?:
null
|number
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.
ImageUploadHandlerOptions
Section titled “ImageUploadHandlerOptions”Options for defineImageUploadHandler.
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”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.
ImageUploadErrorHandler()
Section titled “ImageUploadErrorHandler()”-
type ImageUploadErrorHandler = (
options
:ImageUploadErrorHandlerOptions
) =>void
-
A handler to be called when an error occurs during the upload.
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.
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