Skip to content

docs: document scriptUrl, the offline options, and the exported types - #54

Open
sidgaikwad wants to merge 1 commit into
unlayer:mainfrom
sidgaikwad:docs/script-url-and-options
Open

docs: document scriptUrl, the offline options, and the exported types#54
sidgaikwad wants to merge 1 commit into
unlayer:mainfrom
sidgaikwad:docs/script-url-and-options

Conversation

@sidgaikwad

Copy link
Copy Markdown
Contributor

Fixes #36.

scriptUrl (the actual bug)

scriptUrl is a fully implemented, fully tested prop — loadScript(scriptUrl), part of the remount effect's deps, covered by "forwards a custom scriptUrl to loadScript" and "remounts when scriptUrl changes". But it was absent from the props table, so the only supported way to pin an embed environment was undiscoverable short of reading the .d.ts.

Added, along with the caveat already written in its doc comment — the kind of thing people otherwise discover by breaking it:

One embed per page: the first loader to run installs window.ImageEditor and wins globally, so do not mix different scriptUrls across components.

The related gaps from the issue

Offline / self-hosted assets. offline, licenseUrl and env were named in the options row and explained nowhere — that's the entire offline and self-hosted-assets story. New section with a table and a worked example, plus a note that env is remount-tier.

TypeScript. Every example was JSX. Added a .tsx example and a table of the five exported types (ImageEditorProps, ImageEditorOptions, ImageEditorRef, ImageEditorInstance, ImageEditorSaveResult).

Verification

The TypeScript example isn't hand-waved — I extracted it from the README and compiled it against the real source types through the demo's tsconfig:

README TypeScript example COMPILES against the real source types

Prettier clean.

`scriptUrl` is fully implemented and tested but was absent from the props
table, so the only supported way to pin an embed environment was
undiscoverable outside the .d.ts. Add it, along with the doc comment's
caveat about one embed winning per page.

Also close the gaps around it:

- `offline`, `licenseUrl` and `env` were named in the options row but
  never explained anywhere. Give them a section with a worked example.
- Add a TypeScript usage example — every other example was JSX — and a
  table of the exported types.

The TypeScript example is verified to compile against the real source
types via the demo's tsconfig.
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

@sidgaikwad is attempting to deploy a commit to the Unlayer Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: scriptUrl prop is missing from the README props table

1 participant