Skip to content

Vizel API / core/src / VizelImageUploadPluginOptions

Interface: VizelImageUploadPluginOptions ​

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

Image upload plugin options

Properties ​

allowedTypes? ​

ts
optional allowedTypes?: string[];

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

Allowed MIME types

Default ​

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

imageClass? ​

ts
optional imageClass?: string;

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

CSS class for the uploading image

Default ​

ts
"vizel-image-uploading"

maxFileSize? ​

ts
optional maxFileSize?: number;

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

Maximum file size in bytes

Default ​

ts
20MB (20 * 1024 * 1024)

onError? ​

ts
optional onError?: (err) => void;

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

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


onUpload ​

ts
onUpload: (file) => Promise<string>;

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

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


onUploadError? ​

ts
optional onUploadError?: (error, file) => void;

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

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


onValidationError? ​

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

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

Callback for validation errors

Parameters ​

ParameterType
errorVizelImageValidationError

Returns ​

void


placeholderClass? ​

ts
optional placeholderClass?: string;

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

CSS class for the placeholder element

Default ​

ts
"vizel-image-placeholder"

Released under the MIT License.