Skip to content

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

Properties

allowedTypes?

ts
optional allowedTypes?: string[];

Defined in: packages/core/src/plugins/image-upload.ts:31

Allowed MIME types

Default

ts
["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"]

Inherited from

VizelImageUploadPluginOptions.allowedTypes


imageClass?

ts
optional imageClass?: string;

Defined in: packages/core/src/plugins/image-upload.ts:43

CSS class for the uploading image

Default

ts
"vizel-image-uploading"

Inherited from

VizelImageUploadPluginOptions.imageClass


maxFileSize?

ts
optional maxFileSize?: number;

Defined in: packages/core/src/plugins/image-upload.ts:25

Maximum file size in bytes

Default

ts
20MB (20 * 1024 * 1024)

Inherited from

VizelImageUploadPluginOptions.maxFileSize


onError?

ts
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

ParameterType
errVizelError

Returns

void

Inherited from

VizelImageUploadPluginOptions.onError


onUpload?

ts
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

ParameterTypeDescription
fileFileThe file to upload

Returns

Promise&lt;string&gt;

Promise resolving to the uploaded image URL

Inherited from

VizelImageUploadPluginOptions.onUpload


onUploadError?

ts
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

ParameterType
errorError
fileFile

Returns

void

Inherited from

VizelImageUploadPluginOptions.onUploadError


onValidationError?

ts
optional onValidationError?: (error) => void;

Defined in: packages/core/src/plugins/image-upload.ts:48

Callback for validation errors

Parameters

ParameterType
errorVizelImageValidationError

Returns

void

Inherited from

VizelImageUploadPluginOptions.onValidationError


placeholderClass?

ts
optional placeholderClass?: string;

Defined in: packages/core/src/plugins/image-upload.ts:37

CSS class for the placeholder element

Default

ts
"vizel-image-placeholder"

Inherited from

VizelImageUploadPluginOptions.placeholderClass


resize?

ts
optional resize?: boolean;

Defined in: packages/core/src/types.ts:56

Enable image resizing (default: true)

Released under the MIT License.