Skip to content

demo: several documented options are never exercised (AI Assistant, dock, translations, custom icons) #40

Description

@sidgaikwad

The demo is the main thing people try before adopting the component, but several documented options are never exercised in it:

Option Status in demo
projectId + features.ai (AI Assistant) not wired — the README's headline feature can't be tried
translations not wired
features.imageEditor.dock ('left' | 'right') not wired
custom tool icons (tools.crop: { icon }) not wired
features.imageEditor.tools.corners not in TOOL_NAMES
offline / licenseUrl / env not wired
scriptUrl not wired

demo/src/Sidebar.tsx currently covers theme, locale (5 of the 10 bundled locales) and the 8 tool toggles.

The AI Assistant one is the notable gap — it needs a projectId, so it would have to come from a Vite env var (import.meta.env.VITE_UNLAYER_PROJECT_ID) with the panel hidden when unset, plus a .env.example. dock and the custom-icon form are cheap additions that would double as living documentation for the README's Tools section.

Unrelated small bug in the same file

snapshot() in demo/src/App.tsx#L83-L89 fabricates the blob:

setSaved({ dataUrl, blob: new Blob() });

The Download link works (it uses dataUrl), but the object is a lie about the ImageEditorSaveResult shape — anyone reading the demo to learn the API sees an empty Blob presented as a valid result. Either build a real blob from the data URL or give the snapshot path its own type that doesn't claim to be a save result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions