ui/client/features/pages-editor/hooks/useLivePreview
Cockpit client (features), v0.8. Source: ui/client/features/pages-editor/hooks/useLivePreview.tsx.
Functions#
useLivePreview()#
useLivePreview(
__namedParameters):object
Defined in: ui/client/features/pages-editor/hooks/useLivePreview.tsx:31
Live preview state: a user-provided URL (input draft + the URL actually framed), click-to-source — a selection posted by the framed app is resolved against the open page's tree and selects the matching node — and, since #456, how big the frame is (device sizes, remembered per project), whether the dev server is actually answering, and full screen.
The URL is set once and left alone: choosing a size or going full screen only
changes the box around the iframe, never its src, so the app under
development keeps its own state and the selected node survives.
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, #378).
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
setDraft
setDraft:
Dispatch<SetStateAction<string>>
url
url:
string|null
view
view:
LivePreviewView