Line

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

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

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

Type Aliases#

LinkHover#

LinkHover = object

Defined in: ui/client/features/pages-editor/hooks/useLinkedCode.tsx:8

Properties#

ref

ref: NavReference

Defined in: ui/client/features/pages-editor/hooks/useLinkedCode.tsx:8

x

x: number

Defined in: ui/client/features/pages-editor/hooks/useLinkedCode.tsx:8

y

y: number

Defined in: ui/client/features/pages-editor/hooks/useLinkedCode.tsx:8

Functions#

useLinkedCode()#

useLinkedCode(source, references, onFollow): object

Defined in: ui/client/features/pages-editor/hooks/useLinkedCode.tsx:13

Link behaviour for the read-only code view: the segments (only resolved references carry a ref), whether Ctrl/Cmd is held (links draw solid), the hover label, and the open gestures. A plain click keeps its meaning (it does not navigate); Ctrl/Cmd-click and Enter on a focused link open.

Parameters#

source

string

references

NavReference[]

onFollow

(ref) => void

Returns#

object

hideTip

hideTip: () => void

Returns

void

hover

hover: LinkHover | null

modifierHeld

modifierHeld: boolean

onLinkClick

onLinkClick: (e, ref) => void

Parameters
e

MouseEvent<HTMLElement>

ref

NavReference

Returns

void

onLinkKeyDown

onLinkKeyDown: (e, ref) => void

Parameters
e

KeyboardEvent<HTMLElement>

ref

NavReference

Returns

void

segments

segments: CodeSegment[]

showTip

showTip: (ref, el) => void

Parameters
ref

NavReference

el

HTMLElement

Returns

void