Preview

Preview mode panel.

create#

Creates the hidden preview container element inside mainContainer.

Parameters:

  • mainContainer (HTMLElement | string) — main editor layout container element

Returns: HTMLElement

app.preview.create(mainContainer);

clear#

Clears preview content, cancels height sync, and resets the iframe reference.

app.preview.clear();

show#

Hides the editor container and displays the preview container.

app.preview.show();

hide#

Clears preview content and restores the editor container visibility.

app.preview.hide();

isVisible#

Returns whether preview mode is currently active.

Returns: boolean

app.preview.isVisible();

runIframe#

Loads HTML into a preview iframe, optionally injects CSS, and calls onReady when complete.

Parameters:

  • html (string) — HTML string
  • css (any) — CSS
  • hidden (object) — hidden
  • onReady (any) — on ready

Returns: HTMLIFrameElement|null

app.preview.runIframe({ html: '<p>Preview</p>' });

getIframe#

Returns the current preview iframe element.

Returns: HTMLIFrameElement|null

app.preview.getIframe();

syncHeight#

Schedules iframe height adjustment to fit its document content.

app.preview.syncHeight();