Upload module boot-time configuration.

interface AsukaUploadModuleConfig {
    autoAddOnSingle?: boolean;
    credentials?: RequestCredentials;
    endpoint?: string;
    fieldName?: string;
    handler?: ((file: File, context: AsukaUploadHandlerContext) => AsukaUploadHandlerResult | Promise<AsukaUploadHandlerResult>);
    headers?: Record<string, string>;
    mapResponseToUrl?: ((payload: unknown) => string);
    method?: string;
    multiple?: boolean;
    picker?: "native";
    pickerButtonText?: string;
    pickerTitle?: string;
    selectHandler?: ((context: AsukaUploadSelectHandlerContext) => AsukaUploadSelectHandlerResult | Promise<AsukaUploadSelectHandlerResult>);
    strategy?: AsukaUploadStrategy;
}

Properties

autoAddOnSingle?: boolean

In single mode, add the uploaded image immediately.

credentials?: RequestCredentials

Fetch credentials mode used by the remote upload request.

endpoint?: string

Remote upload endpoint used by the remote strategy.

fieldName?: string

Multipart form field name used for the uploaded file. Defaults to file.

handler?: ((file: File, context: AsukaUploadHandlerContext) => AsukaUploadHandlerResult | Promise<AsukaUploadHandlerResult>)

Optional custom upload handler.

When provided, the handler is used before endpoint for the remote strategy and can return either a URL string or an object containing url, dataUrl, src, or value. This is useful for WordPress/Symfony/custom backends.

headers?: Record<string, string>

Optional request headers sent with the remote upload request.

mapResponseToUrl?: ((payload: unknown) => string)

Maps the remote upload response to a final image URL.

Example: (json) => json.url

method?: string

HTTP method used when endpoint is provided. Defaults to POST.

multiple?: boolean

Allow selecting multiple files in the upload dropzone.

picker

Optional media picker mode.

  • native: keep the browser file input.

Host integrations such as WordPress media library should use selectHandler. AsukaDesigner awaits the returned promise, normalizes its result, registers the upload asset, then applies it to the right target automatically.

pickerButtonText?: string

Optional button label forwarded to host-controlled pickers through selectHandler context.

pickerTitle?: string

Optional title forwarded to host-controlled pickers through selectHandler context.

Optional host-controlled media picker. It may return File objects, URL strings, media objects, arrays, or { items/data/result } containers.

File-to-image strategy used when a file is added to the canvas.

  • objectUrl: create a temporary local blob URL and add it immediately.
  • base64: convert the file to a data URL before adding it.
  • remote: upload the file to an HTTP endpoint, then add the returned URL.

Defaults to base64 when neither a strategy nor a remote target is configured.