Vizel API / core/src / VizelImageUploadPluginOptions
Interface: VizelImageUploadPluginOptions
Defined in: packages/core/src/plugins/image-upload.ts:13
Image upload plugin options
Properties
allowedTypes?
optional allowedTypes?: string[];Defined in: packages/core/src/plugins/image-upload.ts:31
Allowed MIME types
Default
["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"]imageClass?
optional imageClass?: string;Defined in: packages/core/src/plugins/image-upload.ts:43
CSS class for the uploading image
Default
"vizel-image-uploading"maxFileSize?
optional maxFileSize?: number;Defined in: packages/core/src/plugins/image-upload.ts:25
Maximum file size in bytes
Default
20MB (20 * 1024 * 1024)onError?
optional onError?: (err) => void;Defined in: packages/core/src/plugins/image-upload.ts:68
Editor-level error sink.
Upload rejections route through emitVizelError(error, onError) as a VizelError with code UPLOAD_FAILED, so observability sinks (Sentry, log pipes) see the failure even when only onUploadError is wired up for feature-specific UI. The adapter threads the editor's onError here via getOnError; see createVizelUploadEventHandler.
Parameters
| Parameter | Type |
|---|---|
err | VizelError |
Returns
void
onUpload
onUpload: (file) => Promise<string>;Defined in: packages/core/src/plugins/image-upload.ts:19
Handler to upload file and return the uploaded image URL
Parameters
| Parameter | Type | Description |
|---|---|---|
file | File | The file to upload |
Returns
Promise<string>
Promise resolving to the uploaded image URL
onUploadError?
optional onUploadError?: (error, file) => void;Defined in: packages/core/src/plugins/image-upload.ts:57
Callback for upload errors.
Receives the raw rejection reason and the offending file. This is the feature-specific contract that demos and tests rely on; it fires in addition to the editor-level VizelImageUploadPluginOptions.onError.
Parameters
| Parameter | Type |
|---|---|
error | Error |
file | File |
Returns
void
onValidationError?
optional onValidationError?: (error) => void;Defined in: packages/core/src/plugins/image-upload.ts:48
Callback for validation errors
Parameters
| Parameter | Type |
|---|---|
error | VizelImageValidationError |
Returns
void
placeholderClass?
optional placeholderClass?: string;Defined in: packages/core/src/plugins/image-upload.ts:37
CSS class for the placeholder element
Default
"vizel-image-placeholder"