@mermaid-editor-sdk/headless


@mermaid-editor-sdk/headless / getDiagramElementIdForSelection

Function: getDiagramElementIdForSelection()

getDiagramElementIdForSelection(elements, selection): string | undefined

Defined in: core/selection-mapping.ts:8

Finds the model element identifier corresponding to a canvas selection.

Parameters

ParameterTypeDescription
elementsreadonly DiagramElement[]Diagram elements to search.
selectionEditorSelectionSelected node, edge, or flowchart subgraph.

Returns

string | undefined

The matching model element ID, if found.