Interface RpEditorConfig

Configuration for the image editor

interface RpEditorConfig {
    calloutDefaults?: {
        color?: string;
        fontSize?: number;
        lineBreakAt?: number;
        maxChars?: number;
        text?: string;
        textColor?: string;
    };
    colorPalette?: string[];
    cropAspectRatios?: CropAspectRatio[];
    currentImageIndex?: number;
    defaultBrushColor?: string;
    defaultBrushWidth?: number;
    defaultShapeColor?: string;
    defaultShapeStrokeWidth?: number;
    defaultTextColor?: string;
    defaultTextFontSize?: number;
    disableKeyboardShortcuts?: boolean;
    disabledFeatures?: string[];
    exportAtNativeResolution?: boolean;
    exportFormat?: "png" | "jpeg";
    exportPixelRatio?: number;
    exportQuality?: number;
    filterPresetLabels?: Partial<Record<ImageFilterPreset, string>>;
    filterPresets?: ImageFilterPreset[];
    keyboardShortcutsScope?: "global" | "editor";
    labels?: LocalePackOverrides;
    language?: LanguageCode;
    locale?: string;
    maxResolution?: null | number;
    maxUndoSteps?: number;
    onApply?: (() => void);
    onClose?: (() => void);
    onError?: ((error) => void);
    onImageLoaded?: ((info) => void);
    onModeChanged?: ((mode) => void);
    showToolbar?: boolean;
    strings?: {
        emptyStateSubtitle?: string;
        emptyStateTitle?: string;
    };
    theme?: RpEditorTheme;
    totalImages?: number;
}

Properties

calloutDefaults?: {
    color?: string;
    fontSize?: number;
    lineBreakAt?: number;
    maxChars?: number;
    text?: string;
    textColor?: string;
}

Defaults applied to newly-placed callouts. All keys are optional; omitted keys fall back to the current built-in defaults.

  • text — initial label text (default 'Label').
  • color — callout box background color. Falls back to defaultBrushColor.
  • textColor — label text color (default '#ffffff').
  • fontSize — label font size in pixels (default 20).
  • maxChars — maximum characters allowed in the label (default 40).
  • lineBreakAt — character position around which to insert an automatic line break (default 15).

Type declaration

  • Optional color?: string
  • Optional fontSize?: number
  • Optional lineBreakAt?: number
  • Optional maxChars?: number
  • Optional text?: string
  • Optional textColor?: string
colorPalette?: string[]

Color palette for the color picker

cropAspectRatios?: CropAspectRatio[]

Default crop aspect ratios available to user

currentImageIndex?: number

Current image position in a multi-image editing flow. 1-based index (for example: 1, 2, 3...).

When used together with totalImages, the editor header shows a compact current/total indicator (e.g. 2/5).

defaultBrushColor?: string

Default brush color. Default: '#ff0000'

defaultBrushWidth?: number

Default brush width in pixels. Default: 3

defaultShapeColor?: string

Default stroke color for shapes (circle/ellipse/square/rectangle/arrow). Default: matches defaultBrushColor

defaultShapeStrokeWidth?: number

Default stroke width for shapes. Default: 3

defaultTextColor?: string

Default text color. Default: '#ff0000'

defaultTextFontSize?: number

Default text font size. Default: 24

disableKeyboardShortcuts?: boolean

When true, the editor will NOT install keyboard shortcuts (V/C/B/E/T/S, ⌘Z/⌘⇧Z, +/-/0/1, ⌘⏎/Esc, R/⇧R, H/⇧H). Additive; default false.

disabledFeatures?: string[]

Features to hide from the toolbar. Accepts individual tool names: 'move','crop','zoomIn','zoomOut','rotateLeft','rotateRight', 'draw','text','eraser','callout','undo','redo','reset','filters','adjust','fullscreen' Or group names: 'zoom' (zoomIn+zoomOut), 'transform' (rotateLeft+rotateRight+reset), 'annotate' (draw+text+callout+eraser) Default: [] (all features visible)

exportAtNativeResolution?: boolean

When true (default), the exported image is rendered at the native (intrinsic) resolution of the loaded image — so the on-screen scaling that the editor applies to fit the canvas does NOT reduce the resolution of the output. Annotations are upscaled to match.

Set to false to revert to the legacy behaviour where the export size matches the on-screen canvas size. Default: true

exportFormat?: "png" | "jpeg"

Default export format

exportPixelRatio?: number

Export pixel ratio. 1 = standard, 2 = retina. Default: 1

exportQuality?: number

JPEG export quality (0.0 - 1.0). Default: 0.92

filterPresetLabels?: Partial<Record<ImageFilterPreset, string>>

Rename individual filter preset tiles without changing behaviour. Keys not present here fall back to the built-in English label.

Example:

filterPresetLabels: { grayscale: 'Mono', sepia: 'Warm Vintage' }
filterPresets?: ImageFilterPreset[]

Whitelist and ordering of built-in one-click filter presets shown in the Filters tool's tile grid. When set, only listed presets render, in the given order. When unset (default), all seven built-in presets render in their canonical order.

Note: this only picks from the built-in set (see ImageFilterPreset); it does not let you define new filter algorithms.

keyboardShortcutsScope?: "global" | "editor"

Which key presses the shortcuts react to.

  • 'global' (default): any key press on the page that isn't typed into an input. When several editors are mounted, only the most recently created or clicked/focused one responds, and a key press inside one editor never reaches another.
  • 'editor': only key presses while focus is inside this editor. Use for inline editors so page-level keys (c, +, Escape, …) aren't captured.

Additive; default 'global'.

Per-key overrides for the resolved locale pack. Deep-partial: pass any subset of LocalePack keys and only those strings are replaced.

Precedence (lowest → highest):

  1. English pack (built-in fallback)
  2. Language pack selected via language (if any)
  3. labels overrides passed here
  4. Explicit fields on theme, strings, filterPresetLabels, and calloutDefaults (highest priority)

Use cases:

  • Rebrand a single label (e.g. rename "Callout" to "Annotation").
  • Provide a full translation for a language not in the built-in LanguageCode set — pass a complete labels object with no language, and the missing keys fall back to English.
  • Mix and match: language: 'de' plus a few tweaks.

Example:

openEditorModal({
image: file,
config: {
language: 'en',
labels: {
tool: { callout: 'Annotation' },
props: { title: { callout: 'Annotation' }, deleteSelected: 'Remove' },
},
},
});
language?: LanguageCode

Two-letter language code that selects a bundled translation pack for every user-facing string in the editor shell (top bar, rails, empty state, props panel, filter tiles, callout defaults).

Supported: da, de, en, es, fr, it, ko, nl, pl, pt, sv, th, tr, vi, zh. sp is accepted as an alias for es. Regional variants such as de-DE or pt_BR are folded to their primary tag.

Any individual label you set explicitly on theme, strings, filterPresetLabels, or calloutDefaults overrides the language pack for that key. Unknown or missing codes fall back to English.

Example:

openEditorModal({
image: file,
config: {
language: 'de', // whole UI in German
theme: { headerTitle: 'Foto Studio' } // this one label stays custom
},
});
locale?: string

Locale for button text. Can override individual labels via theme

maxResolution?: null | number

Maximum resolution (longest side). null = no limit (auto-detect per platform)

maxUndoSteps?: number

Maximum undo stack depth. Default: 20

onApply?: (() => void)

Optional callback wired to the shell's primary Apply button in the top bar. When provided the button is rendered; when omitted it is hidden. Used by openEditorModal to bridge the modal's promise. Additive — inline (non-modal) consumers can ignore this.

Type declaration

    • (): void
    • Returns void

onClose?: (() => void)

Optional callback wired to the shell's Close button in the top bar. When omitted, the Close button is hidden.

Type declaration

    • (): void
    • Returns void

onError?: ((error) => void)

Fired for non-fatal editor errors (e.g. bad file, HEIC decode failure, resolution exceeded). Additive mirror of the error event on the editor instance.

Type declaration

    • (error): void
    • Parameters

      • error: Error

      Returns void

onImageLoaded?: ((info) => void)

Fired once the image has finished loading (after HEIC decode, EXIF orientation correction, and any downscaling). Additive mirror of the image:loaded event on the editor instance — use this from modal consumers who don't have a reference to the RpImageEditor instance.

Type declaration

    • (info): void
    • Parameters

      • info: {
            downscaled: boolean;
            height: number;
            width: number;
        }
        • downscaled: boolean
        • height: number
        • width: number

      Returns void

onModeChanged?: ((mode) => void)

Fired whenever the active tool changes. Additive mirror of the mode:changed event on the editor instance.

Type declaration

    • (mode): void
    • Parameters

      Returns void

showToolbar?: boolean

Whether to show the built-in toolbar. Default: true

strings?: {
    emptyStateSubtitle?: string;
    emptyStateTitle?: string;
}

User-facing strings rendered by the editor shell. All keys are optional; omitted keys fall back to the built-in English text. Pass an empty string ('') to hide the corresponding UI element entirely (currently supported for emptyStateSubtitle).

Type declaration

  • Optional emptyStateSubtitle?: string

    Default: 'Supported: PNG, JPEG, HEIC'. Pass '' to hide the row.

  • Optional emptyStateTitle?: string

    Default: 'Drop an image or click to upload'

Theme customization

totalImages?: number

Total number of images in a multi-image editing flow.

When used together with currentImageIndex, the editor header shows a compact current/total indicator.