From b4636c1eb3241c0d5802f6ab9caa26ea2d802e33 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Mon, 30 Aug 2021 12:46:32 +0200 Subject: [PATCH] Restore FireFox-only caretPositionFromPoint type See https://unpkg.com/browse/@types/web@0.0.1/index.d.ts --- packages/dom/src/dom/caret-range-from-point.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/dom/src/dom/caret-range-from-point.js b/packages/dom/src/dom/caret-range-from-point.js index fb32c15f0f9759..a3f83926f083a2 100644 --- a/packages/dom/src/dom/caret-range-from-point.js +++ b/packages/dom/src/dom/caret-range-from-point.js @@ -4,7 +4,7 @@ * * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint * - * @param {Document} doc The document of the range. + * @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range. * @param {number} x Horizontal position within the current viewport. * @param {number} y Vertical position within the current viewport. * @@ -34,3 +34,8 @@ export default function caretRangeFromPoint( doc, x, y ) { return range; } + +/** + * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint + * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition + */