MCPcopy Create free account
hub / github.com/adobe/react-spectrum / rangeToPositions

Function rangeToPositions

packages/@react-spectrum/ai/src/TokenField.tsx:584–591  ·  view source on GitHub ↗
(
  container: Element,
  range: Range | StaticRange
)

Source from the content-addressed store, hash-verified

582}
583
584export function rangeToPositions(
585 container: Element,
586 range: Range | StaticRange
587): [Position, Position] {
588 let start = getPosition(container, range.startContainer, range.startOffset);
589 let end = getPosition(container, range.endContainer, range.endOffset);
590 return [start, end];
591}
592
593function getPosition(container: Element, node: Node, offset: number): Position {
594 if (node === container) {

Callers 2

TokenField.tsxFile · 0.85
getSelectionFunction · 0.85

Calls 1

getPositionFunction · 0.70

Tested by

no test coverage detected