fix: only the primary button picks a frame behind the text

A right-click over one selected it and swallowed the mousedown, where the
browser's own context-menu handling should have the point.

Claude-Session: https://claude.ai/code/session_01Wzs2qG6Y5qm7mKmJHfu44G
This commit is contained in:
Steffen Becker committed 2026-09-11 09:10:29 +02:00
1 parent 85036b9559
commit e70c1e9c6c
1 file changed
+4 -1
+4 -1
View File
@@ -329,7 +329,10 @@ function behindTextPlugin(): Plugin {
handleDOMEvents: {
mousedown(view, event) {
const at = event.target;
if (!view.editable || (at instanceof HTMLElement && at.closest('[data-wrap="through"]'))) return false;
// The primary button only: a right-click keeps whatever the browser's own
// context-menu handling does with the point.
if (!view.editable || event.button !== 0) return false;
if (at instanceof HTMLElement && at.closest('[data-wrap="through"]')) return false;
const frame = frameBehindPoint(view, event.clientX, event.clientY);
if (!frame) return false;
event.preventDefault();