(container: Element)
| 573 | } |
| 574 | |
| 575 | export function getSelection(container: Element): [Position, Position] | null { |
| 576 | let selection = window.getSelection(); |
| 577 | if (!selection || selection.rangeCount === 0) { |
| 578 | return null; |
| 579 | } |
| 580 | let range = selection.getRangeAt(0); |
| 581 | return rangeToPositions(container, range); |
| 582 | } |
| 583 | |
| 584 | export function rangeToPositions( |
| 585 | container: Element, |
no test coverage detected