ui/client/features/pages-editor/hooks/usePagesEditorTabs
Cockpit client (features), next. Source: ui/client/features/pages-editor/hooks/usePagesEditorTabs.tsx.
Functions#
usePagesEditorTabs()#
usePagesEditorTabs(
e,onImpactPreview):object
Defined in: ui/client/features/pages-editor/hooks/usePagesEditorTabs.tsx:32
Puts the Pages Editor's panels into the shell (slot registry): the page/feature
tree in the Browser pane and Inspector / Scope / Source / Change / Palette / Diff as Tools tabs.
Each tab is memoised on the data it shows so the registry only updates when that changes.
onImpactPreview lets the Change tab draw its dashed-box preview on the live app;
it lives one level up (PagesEditorController) since the preview and the Change tab are siblings.
Returns the Findings pins + click handler so the caller can hand them to LivePreviewPanel
(the shared panel's own pins/onPinClick, lives one level up next to the preview itself).
Parameters#
e
allPages
{ error: string; pages: object[]; reload: () => void; status: "loading" | "ready" | "error"; }
allPages.error
string
allPages.pages
object[]
allPages.reload
() => void = load
allPages.status
"loading" | "ready" | "error"
dismissExternalChange
() => void = external.dismiss
error
string | null
externalChange
PageChange | null = external.change
feature
string
features
string[]
file
string
files
string[]
filesLoading
boolean
livePreview
{ connect: () => void; connectTo: (target) => void; disconnect: () => void; draft: string; frameRef: RefObject<HTMLIFrameElement | null>; fullScreen: boolean; message: string | null; release: (target) => void; requestRects: (queries) => Promise<Record<string, PreviewRect | null>>; setDraft: Dispatch<SetStateAction<string>>; url: string | null; view: LivePreviewView; }
livePreview.connect
() => void
livePreview.connectTo
(target) => void
Point the frame at an address the Cockpit itself was given (the dev server it started, ).
livePreview.disconnect
() => void
livePreview.draft
string
livePreview.frameRef
RefObject<HTMLIFrameElement | null>
livePreview.fullScreen
boolean = full.fullScreen
livePreview.message
string | null
livePreview.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.
livePreview.requestRects
(queries) => Promise<Record<string, PreviewRect | null>>
livePreview.setDraft
Dispatch<SetStateAction<string>>
livePreview.url
string | null
livePreview.view
onTreeSaved
(tree) => void
openFile
(f) => void
openPageOf
(pageFeature, pageFile) => void
previewTitle
(node) => string
reloadFromDisk
() => void = external.reload
selectedNode
PagesEditorNode | null
selectedNodeId
string | null
selectNode
(nodeId) => void
setFeature
(f) => void
showAllPages
() => void
tree
PageTree | null
onImpactPreview
(v) => void
Returns#
object
onPinClick
onPinClick: (
id) =>void
Parameters
id
string
Returns
void
pins
pins:
LivePreviewPin[]