UNPKG

phx-react

Version:

PHX REACT

32 lines 908 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = caretFromPoint; function caretFromPoint(x, y) { if (typeof document.caretRangeFromPoint !== 'undefined') { const range = document.caretRangeFromPoint(x, y); if (range === null) { return null; } return { node: range.startContainer, offset: range.startOffset, }; // @ts-ignore } else if (document.caretPositionFromPoint !== 'undefined') { // @ts-ignore FF - no types const range = document.caretPositionFromPoint(x, y); if (range === null) { return null; } return { node: range.offsetNode, offset: range.offset, }; } else { // Gracefully handle IE return null; } } //# sourceMappingURL=caretFromPoint.js.map