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

Function handleDocumentMouseMove

packages/editor/src/components/content.tsx:305–343  ·  view source on GitHub ↗
(event: MouseEvent | TouchEvent)

Source from the content-addressed store, hash-verified

303 }
304
305 const handleDocumentMouseMove = (event: MouseEvent | TouchEvent) => {
306 const darg = getDrag()
307 const isMouseDown = IS_MOUSEDOWN.get(editor)
308 // 未长按不触发 move 事件
309 if (IS_TOUCHING.get(editor) && !IS_TOUCH_HOLD.get(editor)) {
310 clearTouchHoldTimer()
311 return
312 }
313 const isTouchMoving = isTouchEvent(event)
314 IS_TOUCHMOVING.set(editor, isTouchMoving)
315
316 if (
317 !isTouchMoving &&
318 !darg &&
319 ((isMouseEvent(event) && event.button !== 0) ||
320 !isMouseDown ||
321 event.defaultPrevented ||
322 isContextMenu.current)
323 )
324 return
325 const point = event.defaultPrevented ? null : Editable.findEventPoint(editor, event)
326 if (point && dragging && isMouseEvent(event)) {
327 setDrag({
328 to: {
329 anchor: point,
330 focus: point,
331 },
332 position: {
333 x: event.clientX,
334 y: event.clientY,
335 },
336 })
337 return
338 }
339 // 阻止 touchmove 时页面滚动
340 if (isTouchMoving) event.preventDefault()
341 const range = handleSelecting(point)
342 if (range) editor.onSelecting()
343 }
344
345 const handleRootTouchStart = (event: React.TouchEvent) => {
346 if (event.defaultPrevented) return

Callers

nothing calls this directly

Calls 5

isTouchEventFunction · 0.90
isMouseEventFunction · 0.90
clearTouchHoldTimerFunction · 0.85
handleSelectingFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…