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

Function handleRootTouchStart

packages/editor/src/components/content.tsx:345–378  ·  view source on GitHub ↗
(event: React.TouchEvent)

Source from the content-addressed store, hash-verified

343 }
344
345 const handleRootTouchStart = (event: React.TouchEvent) => {
346 if (event.defaultPrevented) return
347 if (
348 !event.target ||
349 !ref.current?.contains(event.target as DOMNode) ||
350 isEditableDOMElement(event.target) ||
351 inAbsoluteDOMElement(event.target)
352 )
353 return
354
355 const { selection } = editor
356
357 IS_TOUCHING.set(editor, true)
358 IS_TOUCH_HOLD.set(editor, false)
359 clearTouchHoldTimer()
360 // touch hold
361 touchHoldTimer.current = setTimeout(() => {
362 IS_TOUCH_HOLD.set(editor, true)
363
364 if (Focused.is(editor)) {
365 handleRootMouseDown(event)
366 } else if (!selection || Range.isCollapsed(selection)) {
367 IS_TOUCHING.set(editor, false)
368 const point = Editable.findEventPoint(editor, event)
369 if (point)
370 editor.selectWord({
371 at: {
372 anchor: point,
373 focus: point,
374 },
375 })
376 }
377 }, 530)
378 }
379
380 const handleRootMouseDown = (e: React.MouseEvent | React.TouchEvent) => {
381 const event = getNativeEvent(e)

Callers

nothing calls this directly

Calls 4

isEditableDOMElementFunction · 0.90
inAbsoluteDOMElementFunction · 0.90
clearTouchHoldTimerFunction · 0.85
handleRootMouseDownFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…