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

Function getSelection

packages/react-aria/src/tokenfield/useTokenField.ts:626–633  ·  view source on GitHub ↗
(container: Element)

Source from the content-addressed store, hash-verified

624}
625
626export function getSelection(container: Element): [Position, Position] | null {
627 let selection = window.getSelection();
628 if (!selection || selection.rangeCount === 0) {
629 return null;
630 }
631 let range = selection.getRangeAt(0);
632 return rangeToPositions(container, range);
633}
634
635export function getSelectedRange(container: Element) {
636 let selection = window.getSelection();

Callers 3

getFieldSelectionFunction · 0.90
writeClipboardDataFunction · 0.85
useTokenFieldFunction · 0.85

Calls 1

rangeToPositionsFunction · 0.85

Tested by

no test coverage detected