@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
| Parameter | Type | Description |
|---|---|---|
elements | readonly DiagramElement[] | Diagram elements to search. |
selection | EditorSelection | Selected node, edge, or flowchart subgraph. |
Returns
string | undefined
The matching model element ID, if found.