Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/client/features/pages-editor/hooks/useLivePreview

Cockpit client (features), next. Source: ui/client/features/pages-editor/hooks/useLivePreview.tsx.

Functions#

useLivePreview()#

useLivePreview(__namedParameters): object

Defined in: ui/client/features/pages-editor/hooks/useLivePreview.tsx:21

Pages editor's own live preview: click-to-source is resolved against the open page's tree, and "Show in source" after an app error opens the file in the (already-mounted) Navigator panel -- both pages-editor-specific, so they stay here as the two callbacks usePreview takes.

Parameters#

__namedParameters

Args

Returns#

connect

connect: () => void

Returns

void

connectTo

connectTo: (target) => void

Point the frame at an address the Cockpit itself was given (the dev server it started, ).

Parameters
target

string

Returns

void

disconnect

disconnect: () => void

Returns

void

draft

draft: string

frameRef

frameRef: RefObject<HTMLIFrameElement | null>

fullScreen

fullScreen: boolean = full.fullScreen

message

message: string | null

release

release: (target) => void

Let go of target only if that is what the frame is showing: a server stopping must not close a URL the person typed.

Parameters
target

string

Returns

void

requestRects

requestRects: (queries) => Promise<Record<string, PreviewRect | null>>

Parameters
queries

PreviewRectQuery[]

Returns

Promise<Record<string, PreviewRect | null>>

setDraft

setDraft: Dispatch<SetStateAction<string>>

url

url: string | null

view

view: LivePreviewView