Host

Editor host container, iframe, and editable root.

Access:

app.host
app.getModule('host')
app.invoke('host.method', …)

setBlurClass#

Adds rx-blur class to main container.

app.host.setBlurClass();

setFocusClass#

Adds rx-focused class to main container.

app.host.setFocusClass();

hasBlurClass#

Returns whether main container has rx-blur class.

Returns: boolean

app.host.hasBlurClass();

hasFocusClass#

Returns whether main container has rx-focused class.

Returns: boolean

app.host.hasFocusClass();

setSelectAllClass#

Adds rx-select-all class to main container.

app.host.setSelectAllClass();

clearSelectAllClass#

Removes rx-select-all class from main container.

app.host.clearSelectAllClass();

syncEditorInteractionVisual#

Toggles disabled/readonly classes and overlay on editor surface.

Parameters:

  • disabled (boolean) — whether to disable interaction
  • readonly (boolean) — whether to enable read-only mode
app.host.syncEditorInteractionVisual({ readonly: true });

hasSelectAllClass#

Returns whether rx-select-all is active.

Returns: boolean

app.host.hasSelectAllClass();

getEditorRoot#

Returns iframe element in iframe mode or editable root in div mode.

Returns: HTMLElement

app.host.getEditorRoot();

getEditor#

Returns the contenteditable root element.

Returns: HTMLElement

app.host.getEditor();

ensureVisualCaretEl#

Creates or returns the visual caret overlay element.

Returns: HTMLElement|null

app.host.ensureVisualCaretEl();

removeVisualCaretEl#

Removes visual caret element from DOM.

app.host.removeVisualCaretEl();

getIframe#

Returns iframe element or false in div mode.

Returns: HTMLIFrameElement|false

app.host.getIframe();

syncIframeHeight#

Recalculates iframe height from document content (iframe mode only; no-op in div mode).

Call this after the editor becomes visible if it was started inside a hidden container (tab, accordion, display: none). While hidden, scrollHeight is often 0, so the frame keeps a collapsed height until the next resize.

// e.g. on tab show
requestAnimationFrame(() => {
  app.host.syncIframeHeight();
});

getDocument#

Returns host document (iframe doc or page document).

Returns: Document

app.host.getDocument();

getWindow#

Returns host window.

Returns: Window

app.host.getWindow();

getBody#

Returns host document body.

Returns: HTMLElement

app.host.getBody();

getHead#

Returns host document head (iframe mode).

Returns: HTMLHeadElement|undefined

app.host.getHead();

getMainContainer#

Returns main editor wrapper container.

Returns: HTMLElement

app.host.getMainContainer();

getEditorContainer#

Returns inner editor container element.

Returns: HTMLElement

app.host.getEditorContainer();

getToolboxContainer#

Returns toolbox wrapper element.

Returns: HTMLElement

app.host.getToolboxContainer();

getPathbar#

Returns pathbar element reference.

Returns: HTMLElement

app.host.getPathbar();

getToolbar#

Returns toolbar element reference.

Returns: HTMLElement

app.host.getToolbar();

getExtrabar#

Returns extrabar element reference.

Returns: HTMLElement

app.host.getExtrabar();

getStatusbarContainer#

Returns statusbar container element.

Returns: HTMLElement

app.host.getStatusbarContainer();

getSourceContainer#

Returns source panel container element.

Returns: HTMLElement

app.host.getSourceContainer();

getPreviewContainer#

Returns preview panel container element.

Returns: HTMLElement

app.host.getPreviewContainer();

showToolbox#

Shows the toolbox UI.

app.host.showToolbox();

hideToolbox#

Hides the toolbox UI.

app.host.hideToolbox();