Line

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

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

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

Functions#

useScopeBind()#

useScopeBind(feature, file, node, contentHash, onSaved): object

Defined in: ui/client/features/pages-editor/hooks/useScopeBind.tsx:15

Click-to-bind: arm exactly one target prop, then commit a chosen scope candidate's name onto it. Reuses the same rewrite PropRow/AutoMapPanel already use (saveNodeProp -> POST /api/pages/props, kind: 'identifier') — no new mechanical block, per the design doc's own "reuses pages-editor-propflow-rename/-values" instruction. index (an existing attribute's position) is looked up from the node's own props when the target already has one; omitted (the server appends a new attribute instead) for a declared-but-unpassed prop.

Parameters#

feature

string

file

string

node

PagesEditorNode | null

contentHash

string

onSaved

(tree) => void

Returns#

arm

arm: (prop) => void

Pressing a target's Bind control: arms it, or (pressed again on the same target) cancels.

Parameters
prop

string

Returns

void

armed

armed: string | null

busy

busy: boolean

cancel

cancel: () => void

Returns

void

commit

commit: (candidateName) => Promise<void>

Parameters
candidateName

string

Returns

Promise<void>

status

status: StatusMessage | null