Skip to main content
openEditor opens the editor as a modal over the page.
Available in both entries: @embededitor/full/react and @embededitor/full/standalone.

Parameters

Omit<EmbedEditorProps, 'layout'>
default:"{}"
Every prop EmbedEditor takes except layout: the modal is its own layout. See Props.

Returns

The editor’s handle, EmbedEditorHandle: its commands, reads and events. See Commands. Beside them:
() => void
Closes the modal from code. onClose is called once it has gone.

Behavior

  • The modal opens in its own host on document.body, as a dialog on a desktop and as a bottom sheet on a phone.
  • Save closes it once onProcess returns. If onProcess throws, the modal stays open, so the user can save again.
  • closeOnEscape decides whether Escape closes it. Close and Save always do.
  • However it closes (close, its Close button, Escape, a Save that went through, the commands editor.close and output.save), its handle takes no more commands: every command waiting, and every one called after, rejects with NOT_AVAILABLE.
  • openEditor touches the DOM, so call it from an event handler or an effect, never during a server render.

Example

edit-photo.ts