We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 42851d6 commit d141168Copy full SHA for d141168
1 file changed
src/input.ts
@@ -288,8 +288,11 @@ function cellUnderMouse(
288
top: event.clientY,
289
});
290
if (!mousePos) return null;
291
- // Use `inside` position when available (when pointer is inside a node),
292
- // otherwise fall back to `pos`
293
- const pos = mousePos.inside >= 0 ? mousePos.inside : mousePos.pos;
294
- return cellAround(view.state.doc.resolve(pos));
+ // Prefer `inside` position for better accuracy with merged cells (rowspan/colspan),
+ // but fall back to `pos` if `inside` doesn't resolve to a valid cell
+ let { inside, pos } = mousePos;
+ return (
295
+ (inside >= 0 && cellAround(view.state.doc.resolve(inside))) ||
296
+ cellAround(view.state.doc.resolve(pos))
297
+ );
298
}
0 commit comments