Vizel API / core/src / VizelImageFeatureOptions
Interface: VizelImageFeatureOptions
Defined in: packages/core/src/types.ts:54
Image feature options.
This interface extends Partial<VizelImageUploadPluginOptions>, so it inherits the plugin's onError?: (err: VizelError) => void field. That inherited onError is a per-feature override scoped to image uploads; it is distinct from the editor-level VizelEditorOptions.onError. When both are set, the editor-level sink takes precedence and the per-feature onError serves as a fallback (see createVizelUploadEventHandler and addImageExtension). The two never shadow each other because they live on different option objects (features.content.image versus the top-level editor options).
Extends
Partial<VizelImageUploadPluginOptions>
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"]Inherited from
VizelImageUploadPluginOptions.allowedTypes
imageClass?
optional imageClass?: string;Defined in: packages/core/src/plugins/image-upload.ts:43
CSS class for the uploading image
Default
"vizel-image-uploading"Inherited from
VizelImageUploadPluginOptions.imageClass
maxFileSize?
optional maxFileSize?: number;Defined in: packages/core/src/plugins/image-upload.ts:25
Maximum file size in bytes
Default
20MB (20 * 1024 * 1024)Inherited from
VizelImageUploadPluginOptions.maxFileSize
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
Inherited from
VizelImageUploadPluginOptions.onError
onUpload?
optional 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
Inherited from
VizelImageUploadPluginOptions.onUpload
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
Inherited from
VizelImageUploadPluginOptions.onUploadError
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
Inherited from
VizelImageUploadPluginOptions.onValidationError
placeholderClass?
optional placeholderClass?: string;Defined in: packages/core/src/plugins/image-upload.ts:37
CSS class for the placeholder element
Default
"vizel-image-placeholder"Inherited from
VizelImageUploadPluginOptions.placeholderClass
resize?
optional resize?: boolean;Defined in: packages/core/src/types.ts:56
Enable image resizing (default: true)