The link record to convert.
JointJS-compatible cell attributes.
Expand the declarative preset input into native attributes and hand them to a cell model:
import { LinkModel, linkAttributes } from '@joint/react';
const link = new LinkModel(
linkAttributes({
source: { id: 'a' },
target: { id: 'b' },
style: { color: '#333', width: 2 }, // preset shorthand
labelMap: { mid: { text: 'edge', position: 0.5 } },
})
);
Expands the declarative React link shorthand (
style,labelMap) into the native attributes JointJS understands, so you can describe a link with the friendly preset fields instead of rawattrsandlabels.style→ SVGattrsvia linkStyle.labelMap→ a nativelabelsarray via linkLabels.labels(array) → passed through unchanged.