MCPcopy Create free account
hub / github.com/editablejs/editable / findEventPoint

Function findEventPoint

packages/editor/src/plugin/editable.ts:671–683  ·  view source on GitHub ↗

* Get the target point from a DOM `event`.

(editor: Editor, event: any)

Source from the content-addressed store, hash-verified

669 * Get the target point from a DOM `event`.
670 */
671 findEventPoint(editor: Editor, event: any): Point | null {
672 event = getNativeEvent(event)
673 const { clientX: x, clientY: y } = event
674
675 if (x == null || y == null) {
676 throw new Error(`Cannot resolve a Editor range from a DOM event: ${event}`)
677 }
678 let target = event.target
679 if (isTouch(event)) {
680 target = document.elementFromPoint(event.clientX, event.clientY)
681 }
682 return Editable.findClosestPoint(editor, target, x, y)
683 },
684
685 findPreviousLinePoint(editor: Editor, at?: Range): Point | null {
686 const { selection } = editor

Callers

nothing calls this directly

Calls 2

getNativeEventFunction · 0.90
isTouchFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…